$(document).ready(function () {
	
	var isopen	= false;

	if (navigator.appName == 'Microsoft Internet Explorer'){
		$('#flecheimageout').rotate(0);
	}
	
	$('#cachezone').mouseover(function(){
		openblocs();
	});
	
	$('#cachezone').mouseout(function(){
		closeblocs();
	});
	$('#cachezone').click(function(){
		if(isopen)
			closeblocs();
		else
			openblocs();
	});
	
	
	$('#cachezone').stop().fadeTo(0,0,function(){
		if (navigator.appName == 'Microsoft Internet Explorer')
			$('#flecheimageout').hide();
	});
	
	
	function openblocs(){
		isopen = true;
		
		$('#ie_flecheimageout').show();
		
		if (navigator.appName == 'Microsoft Internet Explorer')
		{
			$('#flecheimage').hide();
		}
		else{
			$('#flecheimage').rotateAnimation(-90);
			$('#flecheimage').stop().fadeTo(300,0);
		}
		$('#flecheimageout').rotateAnimation(-90);
		$('#blocgauche').stop().animate({left: "-380px"}, {duration: 1500, easing:"easeInOutQuad",complete:
			function(){$('#flecheimageout').show();}
		});
		$('#blocdroit').stop().animate({left: "750px"}, {duration: 1500, easing:"easeInOutQuad"});
		$('.imagetitre').stop().animate({top: "100px"}, {duration: 500, easing:"easeInOutQuad"});
		$('#bloccoulisse .mask').stop().fadeTo(1000,0);
		$('#vignettecoulisse').stop().animate({left: "0px"}, {duration: 1000, easing:"easeInOutQuad"});
		$('.coulissezonetext').stop().delay(500).animate({top: "15px"}, {duration: 1200, easing:"easeOutQuad"});
		$('#coulissezonetextmask').stop().delay(500).animate({opacity: 0}, {duration: 1200, easing:"easeOutQuad"});
		
		
	}
	
	function closeblocs(){
		isopen = false;
		
		if (navigator.appName != 'Microsoft Internet Explorer'){
			$('#flecheimage').rotateAnimation(0);
			$('#flecheimage').stop().fadeTo(300,1);
		}
		$('#flecheimageout').rotateAnimation(0);
		$('#blocgauche').stop().animate({left: "53px"}, {duration: 1500, easing:"easeInOutQuad",complete:
			function(){
				$('#flecheimage').show();	
			}
		});
		$('#blocdroit').stop().animate({left: "585px"}, {duration: 1500, easing:"easeInOutQuad"});
		$('.imagetitre').stop().animate({top: "0px"}, {duration: 1500, easing:"easeInOutQuad"});
		$('#bloccoulisse .mask').stop().delay(200).fadeTo(800,1);
		$('#vignettecoulisse').stop().animate({left: "-50px"}, {duration: 1000, easing:"easeInOutQuad"});
		$('.coulissezonetext').stop().animate({top: "50px"}, {duration: 1000, easing:"easeInOutQuad"});
		$('#coulissezonetextmask').stop().delay(500).animate({opacity: 1}, {duration: 1200, easing:"easeOutQuad"});
		
	}
	
})
