
//$sx = jQuery.noConflict();

$(document).ready(function(){
	
	$(".navLeft a").click(
		function(){

			if($(this).attr("rel")=="niv2"){	
			
				if($(this).hasClass("actived")){
					//alert('JE SUIS DANS UN ON');
					$(this).removeClass("actived");
					$(this).next().removeClass("deployed");
				}else{
					//alert('JE SUIS DANS UN OFF');
					$(".niv1 a").removeClass("actived")
					$(".niv2 a").removeClass("actived")
					$(".niv3").removeClass("deployed");
					$(".niv2").removeClass("deployed");
					$(this).addClass("actived");
					$(this).next().addClass("deployed");
				}
				
			}
			
			if($(this).attr("rel")=="niv3"){	
			
				if($(this).hasClass("actived")){
					//alert('JE SUIS DANS UN ON');
					$(this).removeClass("actived");
					$(this).next().removeClass("deployed");
				}else{
					//alert('JE SUIS DANS UN OFF');
					$(".niv2 a").removeClass("actived")
					$(".niv3").removeClass("deployed");
					$(this).addClass("actived");
					$(this).next().addClass("deployed");
				}
				
			}

		}
	);

	//********************************
	// HOME REFERENCES
	//********************************
	$(".puce2 .bt").click( function() { 
									
		var btNum = $(this).attr("title");
		if (btNum==0)
		{
			$(".jFlowPrev").fadeOut("slow");
			$(".jFlowNext").fadeIn("slow");
		}
		else if (btNum==3)
		{
			$(".jFlowPrev").fadeIn("slow");
			$(".jFlowNext").fadeOut("slow");
		}
		else
		{
			$(".jFlowPrev").fadeIn("slow");
			$(".jFlowNext").fadeIn("slow");
		}
									
		$(".puce2 .bt").removeClass("active");
		$(".puce2 .bt").removeClass("prev");
		$(this).addClass("active");
		$(this).prev().addClass("prev");
		
		var decalBloc = (-(btNum * 633)) +"px";
		
		$("#mySlidesPush").animate({
			marginLeft: decalBloc
		}, 400 );		
		
	});
	
	
	$(".jFlowPrev").click( function() {  
		$(".jFlowNext").fadeIn("slow");
		
		var btNum = $(".puce2 .active").attr("title");
		
		if (btNum==1){
			$(this).css("display", "none");
		}
		
		$(".puce2 .bt").removeClass("active");
		$(".puce2 .prev").addClass("active");
		$(".puce2 .prev").removeClass("prev");
		
		for (i=0; i<4; i++){
			if (btNum==i){
				$("#bt"+(i-1)).addClass("prev");
			}
		}
		
		
		var blocActive = $("#mySlidesPush").css("margin-left");
		var blocActive2 = Number(blocActive.replace("px", ""));
		
		var operation =  -((Number(btNum)-1) * 633) +"px";
		
		$("#mySlidesPush").animate({
			marginLeft: operation
		}, 400 );
		
		
	});
	
	$(".jFlowNext").click( function() { 
		$(".jFlowPrev").fadeIn("slow");
									
		var btNum = $(".puce2 .active").attr("title");
		
		if (btNum==2){
			$(this).css("display", "none");
		}
		
		$(".puce2 .bt").removeClass("prev");
		$(".puce2 .active").addClass("prev");
		$(".puce2 .active").removeClass("active");
		
		for (i=0; i<4; i++){
			if (btNum==i){
				$("#bt"+(i+2)).addClass("active");
			}
		}

		var blocActive = $("#mySlidesPush").css("margin-left");
		var blocActive2 = Number(blocActive.replace("px", ""));
	
		var operation =  -((Number(btNum)+1) * 633) +"px";
		
		
		$("#mySlidesPush").animate({
			marginLeft: operation
		}, 400 );
		
		
	});
	
	
	
	
	
	

	$(".divClick").click(function () {
	
		if($(this).next().css("display")=="none"){
			$(".reponse").css("display", "none");
			$(this).next().show("fast");
		}
		$(".divClick .arrow").attr("src", "/images/bg/arrow-faq-off.gif");
		$(this).children().attr("src", "/images/bg/arrow-faq-on.gif");
		
	});
	
	$("#selectProduct").change( function() { 
		//alert($(this).attr("value"));
		var target = '#'+$(this).attr("value");
		$.scrollTo(target, 500);
	} );
	
	$(".loginError").fadeOut(2500);

	
	
});
