$(document).ready(function(){var totalImages=$(".scrollContainer").children().size();var imageSize=$(".scrollContainer").children().outerWidth();var scrollWindow=$(".slider .scroll").width();var lengthSlider=totalImages*imageSize;var windowImages=scrollWindow/imageSize;var sxImage=0;var dxImage=((sxImage+windowImages-1)>(totalImages-1))?(totalImages-1):(sxImage+windowImages-1);var current=0;var previous=totalImages-1;$(".prevButton").click(function(){change(false);});$(".nextButton").click(function(){change(true);});$(".scrollContainer").css("left",-(current*imageSize));if($(".hole").length!=0)
$(".hole").fadeOut("slow",function(){$(this).css("margin-left",((current)*13));}).fadeIn("slow");if($(".showImage").length!=0){$(".scrollContainer img").eq(current).fadeTo("fast",1);$(".showImage li").eq(current).fadeIn("slow");}
function change(direction){previous=current;if(direction)
current++;else
current--;if(current>dxImage){dxImage++;sxImage++;}
if(current<sxImage){sxImage--;dxImage--;}
if(dxImage>=totalImages){sxImage=0;current=0;dxImage=windowImages-1;}
if(sxImage<=-1){sxImage=totalImages-windowImages;current=totalImages-1;dxImage=totalImages-1;}
if($(".hole").length!=0){$(".hole").fadeOut("slow",function(){$(this).css("margin-left",((current)*13));}).fadeIn("slow");var time=1500;}
if($(".showImage").length!=0){fadeImage();var time=500;}
$(".scrollContainer").animate({"left":-((dxImage-windowImages+1)*imageSize)},time);};$("#blocks em").hover(function(){$(this).fadeTo("fast",0.6);},function(){$(this).fadeTo("fast",0);});$(".scrollContainer img").click(function(){previous=current;current=$(this).prevAll().size();fadeImage();});function fadeImage(){$(".showImage li").eq(current).fadeIn("slow");$(".showImage li").eq(previous).fadeOut("slow");$(".scrollContainer img").eq(current).fadeTo("slow",1);$(".scrollContainer img").eq(previous).fadeTo("slow",0.5);}});
