$(document).ready(function(){
	
	var autoplay = 1;

		$('li.headlink2').hover(
			function() { $('ul', this).slideDown("fast"); },
			function() { $('ul', this).slideUp("fast"); });
			
		var aktualnyObrazek = 1;
		
		
		
			$('#slider').hover(
			function() { $('#buttons').fadeIn("fast"); },
			function() { $('#buttons').fadeOut("fast"); });
			
			
	$('#next').click(
			function() {
				if (aktualnyObrazek !=  5) {
				aktualnyObrazek = aktualnyObrazek + 1;
				$('#slide_wrap').animate({
					left: '-=650'
					}, 475, function() {})

				} else {
					aktualnyObrazek = 1;
					$('#slide_wrap').animate({
					left: '0'
					}, 700, function() {})
				}
			});


	$('#prev').click(
			function() {
				if (aktualnyObrazek !=  1) {
				aktualnyObrazek = aktualnyObrazek - 1;
				$('#slide_wrap').animate({
					left: '+=650'
					}, 475, function() {})
				} else {
					aktualnyObrazek = 5;
					$('#slide_wrap').animate({
					left: '-2600'
					}, 700, function() {})
				}
			});


	$('span.headlink').click(function () {
		aktualnyObrazek = $(this).attr('id');
   		$('ul #s' + aktualnyObrazek ).slideToggle(500, "easeOutQuad", function () { });

	});		
						
	var tooger = 0;
		
	$("span.headlink").toggle(
	
      function () {
		  aktualnyObrazek = $(this).attr('id');
        $('img #o'+ aktualnyObrazek).css("margin-top","-28px");
		tooger = 1;
      },
      function () {
		  aktualnyObrazek = $(this).attr('id');
        $('img #o'+ aktualnyObrazek).css("margin-top","0px");
		tooger = 0;
      }

   );
   
   $("li.lheadlink").hover(
      function () {
		   if (tooger==0) {
        $('img', this).css("margin-top","-15px");
		}
		$('span', this).css("color", "#c1c321");
      },
      function () {
		  if (tooger==0) {
        $('img', this).css("margin-top","0px");
		}
		$('span', this).css("color", "#909118");
		  
      }

   );

});
	

	
