//animation pour le sub_menu

$(document).ready(function() {
	var nb_vign=12;	var count=0;
	var flagUp=1;
	var flagDown=0;
	if(count==0) {
		$("#arrow_up").css({backgroundImage:"url(img/sub_menu_blank.gif)",cursor:"default"});
	}
	$("#arrow_up").click(function() {
	    // flèche gauche pour revenir dans les photos
			if(count>0){
				var move = $("#slider_move").css("left");
				move=move.substring(0,move.length-2);
				move=parseInt(move)+72; // longueur du pas pour revenir
				$("#slider_move").animate({left: move+"px"},500);
				count=count-1;
				if(flagDown==1){
					$("#arrow_down").css({backgroundImage:"url(img/arrow-right.gif)",cursor:"pointer"});
				}
				flagDown=0;
			}
			// désaffichage de la flèche gauche quand début de l'album
			if(count==0) {
				$("#arrow_up").css({backgroundImage:"url(img/sub_menu_blank.gif)",cursor:"default"});
				flagUp=1;
			}
	});
	
	$("#arrow_down").click(function() {
			// flèche droite pour avancer dans les photos
      if(count<nb_vign-5){
				var move = $("#slider_move").css("left");
				move=move.substring(0,move.length-2);
				move-=72; // longueur du pas pour avancer
				$("#slider_move").animate({left: move+"px"},500);
				count++;
				if(flagUp==1){
					$("#arrow_up").css({backgroundImage:"url(img/arrow-left.gif)",cursor:"pointer"});
				}
				flagUp=0;
			}
			// désaffichage de la flèche droite quand fin de l'album
			if(count==nb_vign-5) {
				$("#arrow_down").css({backgroundImage:"url(img/sub_menu_blank.gif)",cursor:"default"});
				flagDown=1;
			}
	});

});


$(document).ready(function() {
	
	// A chaque clic...
	$(".vign").click( function(){
		id=this.id;	
		$("#vign_oui_1").show();
		$("#vign_oui_2").show(); 
		$("#vign_oui_3").show(); 
		$("#vign_oui_4").show(); 
		$("#vign_oui_5").show(); 
		$("#vign_oui_6").show();
    $("#vign_oui_7").show(); 
		$("#vign_oui_8").show(); 
		$("#vign_oui_9").show(); 
		$("#vign_oui_10").show(); 
		$("#vign_oui_11").show(); 
		$("#vign_oui_12").show();
		
		$("#"+id).hide(); $("#vign_oui_"+id.substring(9,id.length)).show();  
    
    $("#p_1,#p_2,#p_3,#p_4,#p_5,#p_6,#p_7,#p_8,#p_9,#p_10,#p_11,#p_12").hide();	
    $("#p_"+id.substring(9,id.length)).fadeIn(500);
	});	
});