﻿// ------------------------- //



$(document).ready(function(){	

		

		var imgHeight = 246;

		var imgWidth2 = 951;

	//	var imagesCount2 = $("#slider2 img").length;
	   
	   var imagesCount2 = 10 ;
        
		var autoTime = 5000;

		var correntImg22 = 0;

				

		var vv = setTimeout("$('#sliderNextImg2').trigger('click');",autoTime);

				

		function showDescription() {

			$("#desContent").html($("#slider2 ul li").slice(correntImg22, correntImg22+1).html());

			var descriptionHeight = $("#description").height();

			$('#description').animate({opacity: 0.0, height: '0px'}, 1);

			$('#description').delay(1000).animate({opacity: 0.5, height: '60px'}, 500);

		}

				

		showDescription();

				

		$("#slider2").hover(function() {

			$("#sliderNextImg2, #sliderPreviousImg2").css("visibility","visible");

		}, function() {

			$("#sliderNextImg2, #sliderPreviousImg2").css("visibility","hidden");

		})

						
$("#sliderNextImg2").click(function() {	
			clearTimeout(vv)		
			if (correntImg22 != imagesCount2-1) {
				correntImg22 += 1;
				$('#scroll2').animate({marginTop: (-(correntImg22) * imgHeight) + "px"}, 1000);
				vv = setTimeout("$('#sliderNextImg2').trigger('click');",autoTime);
			} else {
				correntImg22 = 0;
				$('#scroll2').animate({marginTop: "0px"}, 2000);
				vv =setTimeout("$('#sliderNextImg2').trigger('click');",1000+autoTime);
			}	
			showDescription()	
		});
				
		$("#sliderPreviousImg2").click(function() {	
			clearTimeout(t)	
			if (correntImg22 != 0) {
				correntImg22 -= 1;
				$('#scroll2').animate({marginTop: (-(correntImg22) * imgHeight) + "px"}, 1000);
			} else {
				correntImg22 = imagesCount2 - 1;
				$('#scroll2').animate({marginTop: (-(correntImg22) * imgHeight) + "px"}, 2000);
			}
			vv = setTimeout("$('#sliderNextImg2').trigger('click');",autoTime);
			showDescription()
		});		

			

});








