var nbItemsSH;var oldItemSH=0;var currentSH=0;var intervalSH;var itemWidthSH;var withControlBts=-1;var withNavBts=-1;var isStop=-1;var initSliderHome=function(b,c){itemWidthSH=$(".sliderHome .SH_item").eq(0).width();nbItemsSH=$(".sliderHome .SH_item").size();currentSH=parseInt(Math.random()*nbItemsSH);oldItemSH=currentSH;$(".sliderHome .SH_item").eq(oldItemSH).css("left",0);withControlBts=b;withNavBts=c;if(nbItemsSH>1){intervalSH=setInterval(sliderHomeRotate,5000);if(withControlBts){$(".SH_play").addClass("SH_playOn");$(".SH_pause").click(function(){if(!$(this).hasClass("SH_pauseOn")){clearInterval(intervalSH);$(".SH_playOn").removeClass("SH_playOn");$(this).addClass("SH_pauseOn")}return false});$(".SH_play").click(function(){if(!$(this).hasClass("SH_playOn")){sliderHomeRotate();intervalSH=setInterval(sliderHomeRotate,5000);$(".SH_pauseOn").removeClass("SH_pauseOn");$(this).addClass("SH_playOn")}return false})}if(withNavBts){if($("#SH_Nav").is("p")){for(i=0;i<nbItemsSH;i++){var a=$(document.createElement("span"));a.text(i+1);$("#SH_Nav").append(a)}$(".SH_Nav span").eq(currentSH).addClass("offerActive");$(".SH_Nav span").click(function(){if(intervalSH){clearInterval(intervalSH)}var d=$(".SH_Nav span").index(this);if(d!=currentSH){currentSH=d;if(currentSH>=oldItemSH){$(".sliderHome .SH_item:eq("+oldItemSH+")").animate({left:-itemWidthSH},"slow");$(".sliderHome .SH_item:eq("+currentSH+")").css("left",itemWidthSH+"px")}else{$(".sliderHome .SH_item:eq("+oldItemSH+")").animate({left:itemWidthSH},"slow");$(".sliderHome .SH_item:eq("+currentSH+")").css("left",-itemWidthSH+"px")}$(".sliderHome .SH_item:eq("+currentSH+")").animate({left:0},"slow");$(".offerActive").removeClass("offerActive");$(this).addClass("offerActive");oldItemSH=currentSH}return false})}else{if($("#SH_tabs").is("p")){$("#SH_tabs span").eq(oldItemSH).addClass("SH_tabActive");$("#SH_tabs span").click(function(){if(intervalSH){clearInterval(intervalSH)}var d=$("#SH_tabs span").index(this);if(d!=currentSH){currentSH=d;if(currentSH>=oldItemSH){$(".sliderHome .SH_item:eq("+oldItemSH+")").animate({left:-itemWidthSH},"slow");$(".sliderHome .SH_item:eq("+currentSH+")").css("left",itemWidthSH+"px")}else{$(".sliderHome .SH_item:eq("+oldItemSH+")").animate({left:itemWidthSH},"slow");$(".sliderHome .SH_item:eq("+currentSH+")").css("left",-itemWidthSH+"px")}$(".sliderHome .SH_item:eq("+currentSH+")").animate({left:0},"slow");$(".SH_tabActive").removeClass("SH_tabActive");$(this).addClass("SH_tabActive");oldItemSH=currentSH}return false})}}$(".sliderHomeContainer").mouseenter(function(){if(isStop==-1){setTimeout(function(){if(intervalSH){clearInterval(intervalSH)}isStop=1},1000)}}).mouseleave(function(){if(isStop==1){setTimeout(function(){if(intervalSH){clearInterval(intervalSH)}intervalSH=setInterval(sliderHomeRotate,5000);isStop=-1},2000)}})}}else{$(".SH_control").hide()}};var sliderHomeRotate=function(){currentSH=(oldItemSH+1)%nbItemsSH;$(".sliderHome .SH_item:eq("+oldItemSH+")").stop().animate({left:-itemWidthSH},"slow",function(){$(this).css("left",itemWidthSH+"px")});$(".sliderHome .SH_item:eq("+currentSH+")").css("opacity","0.2");$(".sliderHome .SH_item:eq("+currentSH+")").css("left",itemWidthSH+"px");$(".sliderHome .SH_item:eq("+currentSH+")").stop().animate({left:0},"slow");if(withNavBts){if($("#SH_Nav").is("p")){$(".offerActive").removeClass("offerActive");$(".SH_Nav span").eq(currentSH).addClass("offerActive")}else{if($("#SH_tabs").is("p")){$(".SH_tabActive").removeClass("SH_tabActive");$("#SH_tabs span").eq(currentSH).addClass("SH_tabActive")}}}$(".sliderHome .SH_item:eq("+currentSH+")").animate({opacity:1},"slow");oldItemSH=currentSH};$(document).ready(function(){var a=20000;$(document).bind("idle.idleTimer",function(){if(intervalSH){clearInterval(intervalSH)}});$(document).bind("active.idleTimer",function(){if(nbItemsSH>1){if(intervalSH){clearInterval(intervalSH)}intervalSH=setInterval(sliderHomeRotate,5000)}});$.idleTimer(a)});
