$(document).ready(function(){
	
	var value = 0;
	var nbrActu = 2;
	
	var timer = setInterval(function(){animateSlide(value,'1')},8000);
	
	$("#actuSlider li").click(function(){animateSlide($(this).attr('id'),'2'); clearInterval(timer)}) 

	function animateSlide($value,type){
		
		if(type=='1')
		{
			
			if(value==nbrActu)
			{
				value = 0;
			}
			else
			{
				value++;
			}
		}
		else
		{
			value = $value-1;
		}
		
		var heightmodif=463*value;
		
				
		$('#actuDisplay').animate({left:-heightmodif}, 'slow', 'easeOutBounce');
		$("#actuSlider").animate({backgroundPosition:value*20+'px 0' }, 'fast', 'easeOutBounce');

	}
	
	function onBlur() {
		clearInterval(timer);
	};
	function onFocus(){
		animateSlide(1);
	};
	
	
	
	if (/*@cc_on!@*/false) { 
		document.onfocusin = onFocus;
		document.onfocusout = onBlur;
	} else {
		window.onfocus = onFocus;
		window.onblur = onBlur;
	}

	
});
