// JavaScript Document

//==============================================================//
//========== Fonction pour le rollover des sous menu ==========//
//============================================================//
var timer
var menuOuvert = ""

function td_out(pQuel)
{
	window.clearTimeout(timer)
	pQuel.style.backgroundColor = '#18365B';

}
function td_over(pQuel)
{
	window.clearTimeout(timer)
	pQuel.style.backgroundColor = '#c07a07';

}

//==========================================================//
//========== Fonction pour ouvrir les sous-menus ==========//
//========================================================//
function openSous(pQuel)
{		
	window.clearTimeout(timer)

	if (menuOuvert)
		document.getElementById(menuOuvert).style.visibility = 'hidden'
	
	if (pQuel)
	{
		document.getElementById(pQuel).style.visibility = 'visible'
		menuOuvert = pQuel
	}
}
function fermeSous()
{
	if (sous_c0)
	document.getElementById('sous_c0').style.visibility = 'hidden'
	if (sous_c1)
	document.getElementById('sous_c1').style.visibility = 'hidden'
	if (sous_c2)
	document.getElementById('sous_c2').style.visibility = 'hidden'
	if (sous_c3)
	document.getElementById('sous_c3').style.visibility = 'hidden'
	if (sous_c4)
	document.getElementById('sous_c4').style.visibility = 'hidden'
	if (sous_c5)	
	document.getElementById('sous_c5').style.visibility = 'hidden'
	if (sous_c6)
	document.getElementById('sous_c6').style.visibility = 'hidden'
	if (sous_c7)
	document.getElementById('sous_c7').style.visibility = 'hidden'
	
	window.clearTimeout(timer)
}
function timerSousMenu(statut)
{
	switch(statut)
	{
	case 1:
	case "1":
		timer = window.setTimeout('fermeSous();',200)
		break;
	case 0:
	case "0":
		window.clearTimeout(timer)
		break;
	}
}



//==========================================//
//========== Creer les sous menu ==========//
//========================================//

for(IndSous in menus_deroulants)
{	
		document.write("<div id='sous_" + IndSous + "' class='g_sous sous_menu_" + IndSous + "' >")	
		document.write("<div onmouseover='timerSousMenu(0)' onmouseout='timerSousMenu(1)'>")	
			document.write("<table cellpadding='0' cellspacing='0' class='tb_menu_top_deroulant' > ");
				document.write("<tr><td style='height:1px; background-color:#546070;'></td></tr>")
				for(Ind in menus_deroulants[IndSous])
				{
						var texte = menus_deroulants[IndSous][Ind]['texte'];
						var lien = menus_deroulants[IndSous][Ind]['lien'];
						var est_page_courante = menus_deroulants[IndSous][Ind]['est_page_courante'];
						
						if(est_page_courante)
							document.write("<tr onmouseover='timerSousMenu(0)'><td onmouseover='td_over(this)' onmouseout='td_out(this)'><a class='section_courante_niveau_2' href='" + lien + "'>" + texte + "</a></td></tr>");
						else
							document.write("<tr onmouseover='timerSousMenu(0)'><td onmouseover='td_over(this)' onmouseout='td_out(this)'><a class='active' href='" + lien + "'>" + texte + "</a></td></tr>");
						
						document.write("<tr><td style='height:1px; background-color:#546070;'></td></tr>")
				}
				document.write("</table>");
		document.write("</div>")
		document.write("</div>")
}