
var TIME = 200;
	var timer = 0 ;
	var flagClose;
	var couleur = "#2D2A2B";
	$(document).ready(function() {
	    $("#aPropos").mouseover(function() {
	        closeAll();
	        $("#menu1").slideDown(TIME);
	        shade();

	    }).mouseout(function() {
	        launchTimer();
	    });
	    $("#pourquoi").mouseover(function() {
	        closeAll();
	        $("#menu2").slideDown(TIME);
	        shade();
	    }).mouseout(function() {
	        launchTimer();
	    });
	    $("#produits").mouseover(function() {
	        closeAll();
	        $("#menu3").slideDown(TIME);
	        shade();
	    }).mouseout(function() {
	        launchTimer();
	    });
	    $("#occasions").mouseover(function() {
	        closeAll();
	        $("#menu5").slideDown(TIME);
	        shade();
	    }).mouseout(function() {
	        launchTimer();
	    });
	    $("#marches").mouseover(function() {
	        closeAll();
	    });
	    $(".menuClass").mouseover(function() {
	        flagClose = false;
	    }).mouseout(function() {
	        launchTimer();
	    });
	    $("#linkPanel").click(function() {
	        $("#panelInfo").slideDown(TIME);
	    });
	    $("#closePanel").click(function() {
	        $("#panelInfo").hide();
	    });
	}); 
 
function closeAll(){
    $(".menuClass:animated").stop(true, true);
    clearTimeout(timer);
    $(".menuClass").hide();
    $(".overEffect").attr("style", "");
    $(".overEffect h1").attr("style", "");
    $(".overEffect p").attr("style", "");
} 
function launchTimer(){
    flagClose = true;
	timer = setTimeout("onTimeOut()",2000);
}
function onTimeOut(){
    if (flagClose) {
	    closeAll(); 
	}
}

function shade() {
    $(".overEffect").css("backgroundColor", "#111");
    $(".overEffect p").css("color", "#333");
    $(".overEffect h1").css("color", "#6d4d26");
	$(".joindreReseau").css("backgroundColor", "#74460e");
	$(".joindreReseau h1").css("color", "#111");
	
}



function random_img(){
  var myimages=new Array()
  //specify random images below.
  myimages[0]="/images/img_entete_1.jpg"
  myimages[1]="/images/img_entete_2.jpg"
  myimages[2]="/images/img_entete_3.jpg"
  myimages[3]="/images/img_entete_4.jpg"

  var ry=Math.floor(Math.random()*myimages.length)

	$("#randomImg").attr("src",myimages[ry]);

}
