$(function(){
	
	if($.browser.msie)
{
   
	   $("#footer").hide();
   
}
		   
/*--------------------------------------//

MASQUE EN JAVASCRIPT LE MENU DE GAUCHE -> Qu'il reste accessible en cas de désactivation javascript;
---------------------------------------*/

	$("#menu_navigation_gauche .sous_menu ul").hide();



/*-------------------------------------//

FONCTION : Affichage dynamique du menu lors de modification de la liste

//-------------------------------------*/

/* Masque dynamiquement le bouton du formulaire*/
	$("#formChoixGamme > input").hide();

	$("#menuChoixGamme").change(afficheGamme);
								
								
								
				function afficheGamme() {
				var gamme = $(this).attr("value");
					
				$.ajax({ 
					type: "GET", 
					url: "conf/affichemenugauche.php?gamme="+gamme, 
					success: function(retour){ 
						$("#menu_navigation_gauche").empty().append(retour); 
						$("#menu_navigation_gauche .sous_menu ul").hide();
						$(".sous_menu > a").click(afficheElements);
						$(".sous_menu .sous_menu_produit > a").click(function(){affichProduits($(this).attr("href"));return false; });
						
					},
					error: function(){
						$("#menu_navigation_gauche").empty().text("Il y a un probleme");
					}
				
				});
				
				$.ajax({ 
					type: "GET", 
					url: "conf/afficheproduits.php?gamme="+gamme+"&ssgamme=0&produit=0", 
					success: function(retour){ 
						$("#divProduits").empty().append(retour);
					},
					error: function(){
						$("#divProduits").empty().text("Il ya un probleme");
					}
				
				});	
				
				
				
									   
				return false; 									  					
														
	}
	 
/*---------------------------------------//

FONCTION : Dérouler le menu de gauche

//--------------------------------------*/


	function afficheElements(){
		
		$("#menu_navigation_gauche .sous_menu ul").hide();
		
		$(this).next().show();
			
		return false; 
		}
		
		
	$(".sous_menu > a").click(afficheElements);

/*-------------------------------------//

FONCTION : Affichage produit dans le div CONTENU

//-------------------------------------*/



	function affichProduits(hrefElement){
		//console.log(hrefElement);	
		$.ajax({ 
				type: "GET", 
				url: hrefElement, 
				success: function(retour){ 
					$("#divProduits").empty().append(retour);  
				} ,
				
				error: function(retour){ 
					$("#divProduits").empty().append("Photos indisponibles pour le moment. Veuillez-nous en excuser.");  
				} 
		});
			
		return false; 
	};
		
	$(".sous_menu .sous_menu_produit > a").click(affichProduits);
	$("a.affichProd").click(afficheGamme);


   
/*-------------------------------------//

AU DEMARRAGE : Afficher Produits

//-------------------------------------*/   
   

//affichProduits("conf/afficheproduits.php?gamme=4&ssgamme=0&produit=0");	


});
