var timer;
var timer2;
var def_col = '#2C261E';

function richmenu_off(){
	hz_bg();
	$('#richmenu').hide('slow');
}

function richmenu_on(id, survol){
	clearTimeout(timer); 
	hz_bg();
	$("#" + id).css("background-color", survol);
	
	$('#richmenu').show('slow');
	$("#richmenu").css("border-color", survol);
	
	//Chargement Ajax du menu
	$.get(id + '.html', function(data) {
	  $('#richmenu').html(data);
	});
}

function hz_bg(){
	$("#menu1").css("background-color", def_col);
	$("#menu2").css("background-color", def_col);
	$("#menu3").css("background-color", def_col);
	$("#menu4").css("background-color", def_col);
	$("#menu5").css("background-color", def_col);
	$("#menu6").css("background-color", def_col);
}

function actions(id, couleur, survol){
	$("#" + id).mouseover(function () {
		timer2 = setTimeout ("richmenu_on('" + id + "', '" + survol + "')", 300);
	}).mouseout(function() {
		clearTimeout(timer2);
	});
}

$(document).ready(function() {
	
	$('#content-richmenu').mouseout(function() {
		timer = setTimeout ("richmenu_off()", 450);
	}).mouseover(function () {
		clearTimeout(timer);
	});
	
	// A paramétrer avec id du DOM et couleurs par défaut et au survol
	actions("menu1", def_col, '#1c9cff');
	actions("menu2", def_col, '#6BC07F');
	actions("menu3", def_col, '#f7914d');
	actions("menu4", def_col, '#4061A4');
	actions("menu5", def_col, '#e97285');
	actions("menu6", def_col, '#d7284d');


});
