


$(document).ready(function() {

	/*-- MENU DEROULANT --*/
    function ShowMenu() {
 		$("#menu-deroulant").stop().animate(
			{height: 310, opacity: 1}, 
			400, "easeOutQuint"	
		);
    };

	function HideMenu() {
 		$("#menu-deroulant").stop().animate(
			{height: 0, opacity: 0 }, 
			300, "easeOutQuint", 
			function () { $(this).hide(); }	
		);
    };


	$("#btn_catalogue, #menu-deroulant").bind("mouseenter", function() {
		ShowMenu();
	});

	$("#btn_catalogue, #menu-deroulant").bind("mouseleave", function() {	
		HideMenu();
		//$("#menu-deroulant").unbind();
	});	
	
	//$('#menu-deroulant').appendTo('#btn_catalogue');
	

	/*
	$("#btn_catalogue, #menu-deroulant").mouseover(function() {
		$("#menu-deroulant").show();
	});
	
	
	$("#btn_catalogue, #menu-deroulant").mouseout(function() {
		$("#menu-deroulant").hide();
		
	});
	*/

	/*-- IMAGE AMBIANCE UNIVERS --*/
	
	// Initialisation 
	$(".ambiance p").hide(); 	// on cache toutes les images univers
	$(".amb_ugap").show();		// on affiche l'image par dafaut

	// Affichage de l'image correspondant à l'univers au rollover
	$("#menu-deroulant a").bind("mouseover", function(event){
		event.stopPropagation();
		showAmbiance(this);
	}); 
	
	// On cache l'image de l'univers pour remettre celle par défaut au rollout
	$("#menu-deroulant a").bind("mouseout", function(event){
		event.stopPropagation();
		hideAmbiance(this);
	}); 
	
});

/* Fonction permettant d'afficher l'image univers */
function showAmbiance(param){
	
	classLien = $(param).attr("class");			// on récupère la class du lien <a href class="">Univers</a>
	var classAmbiance = classLien.substr(3);	// on tronque les 3 premiers caractères pour enlever "md_"
		
	$(".amb_ugap").hide();
	$(".ambiance p").hide();
	$(".amb_" + classAmbiance + " ").fadeIn(400);
	
}

/* Fonction permettant de cacher l'image univers */
function hideAmbiance(param){
	
	classLien = $(param).attr("class");			// on récupère le class du lien 
	var classAmbiance = classLien.substr(3);	// on tronque les 3 premiers caractères pour enlever "md_"
	
	//$(".amb_" + classAmbiance + " ").hide();
	$(".ambiance p").css('opacity', '1');
	$(".ambiance p").stop().hide();
	$(".amb_ugap").fadeIn(2000);
	
}


