/*
'---
'--- MenuDyn.js - Page de menu en Javascript
'---
'--- Par Sacha Vincent
'---     CIBLE Solutions d'affaires
'---
'--- RÉVISION
'--- 2004/10/01, SJV	Programmation
'--- 2006/01/30, SJV	Ajout des liens Ungava & Insect Stop
'--- 2006/03/09, SJV	Ajout du Menu Over par ID
'---
*/


bgcolor='#EDEBF0';
bgcolor2='#EDEBF0';
LargeurMax='150';
HauteurMenu='18';
LeftMenu='143';
var MenuActif;

var LaClasse='ejsmenu';

if(OS=="Mac")
{	
	if(browser == "Netscape Navigator" || browser == "Safari")
	{
		document.write('<style type="text/css">');
		document.write('.popper { POSITION: absolute; VISIBILITY: hidden; z-index:15; left:144px; top:0px; display:1 }')
		//document.write('.SousMenu { font-style: normal; font-weight: bold; font-size: 9pt; font-family: Helvetica, Arial, Geneva, Swiss, SunSans-Regular; background-color: #edebf0; border: solid 1px #b9b5d0; width: 144px}')
		document.write('#topgauche { POSITION: absolute;  z-index:10; }')
		document.write('A:hover.ejsmenu {color:#FF400D; text-decoration:none;}')	//Le Over du texte
		document.write('.ejsmenu {color:#000000; text-decoration:none;}')			//Le texte
		document.write('</style>')
		document.write('<div style="position:absolute;">');
		document.write('<DIV class="popper" id="topdeck"></DIV>');
	}
	else
	{		
		document.write('<style type="text/css">');
		document.write('.popper { POSITION: absolute; VISIBILITY: hidden; z-index:15; left:144px; top:0px; width:144px ;display:1;font-style: normal; font-weight: bold;  font-size: 8pt; text-align:center;font-family: Helvetica, Arial, Geneva, Swiss, SunSans-Regular; background-color: #edebf0; border: solid 1px #b9b5d0; width: 144px}')
		//document.write('.SousMenu { font-style: normal; font-weight: bold; font-size: 8pt; font-family: Helvetica, Arial, Geneva, Swiss, SunSans-Regular; background-color: #edebf0; border: solid 1px #b9b5d0; width: 144px')
		document.write('#topgauche { POSITION: fixed;  z-index:10; width:144px}')
		document.write('A:hover.ejsmenu {color:#FF400D; text-decoration:none}')	//Le Over du texte
		document.write('.ejsmenu {color:#000000; text-decoration:none}')			//Le texte
		document.write('</style>')
		document.write('<div style="position:static;">');
		document.write('<DIV class="popper" id="topdeck"></DIV>');
		
		LaClasse='Mac';
	}
}
else		//autre OS
{	
	
	document.write('<style type="text/css">');
	document.write('.popper { POSITION: absolute; VISIBILITY: hidden; z-index:15; left:144px; top:0px; display:block }')
	document.write('#topgauche { POSITION: fixed;  z-index:10; }')
	document.write('A:hover.ejsmenu {color:#FF400D; text-decoration:none;}')	//Le Over du texte
	document.write('.ejsmenu {color:#000000; text-decoration:none;}')			//Le texte
	document.write('</style>')
	document.write('<div style="position:relative;">');
	document.write('<DIV class="popper" id="topdeck" ></DIV>');
}


//-------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------//

Objet = VersionJavascript("topdeck");		//détermine si c'est document.all ou getElementById etc...

skn = Objet.style;		
skn.left = LeftMenu;

var OutSideMenu;
OutSideMenu=0;

var ObjMenuParent;
var CPT;
CPT=0;

TimerID=window.setInterval("",200);

//Le popup
function pop(NoMenu,MenuParent,pos,gau)	
{
	CPT=0;
	
	ObjMenuParent=VersionJavascript(MenuParent);
	
	OutSideMenu=parseInt(NoMenu)+1;
				
	if(ListeSousMenu[NoMenu])
	{
		skn.visibility = "hidden";
		
		a=true
		skn.top = pos;
		skn.left = gau;
		
		if(OS=="Mac" && browser == "Internet Explorer")
		{			
				var content ="";
				pass = 0;
				
				while (pass < ListeSousMenu[NoMenu].length)
				{
					content += ListeSousMenu[NoMenu][pass] + "<br>";
					pass++;
				}											
				
				document.getElementById('topdeck').innerHTML = content;				
				skn.visibility = "visible";		
			
		}
		else
		{
			var content ="<TABLE BORDER=0 WIDTH="+LargeurMax+" CELLPADDING=0 CELLSPACING=0><TR><TD><TABLE WIDTH="+LargeurMax+" class='SousMenu' BORDER=0 CELLPADDING=0 CELLSPACING=2 >";
			pass = 0			
			CPT=0;
			while (pass < ListeSousMenu[NoMenu].length)
			{
				if(SectionActive==OutSideMenu)				
					content += "<TR><TD class=SousMenu onMouseOut=\"this.className='SousMenu';Depart()\" onMouseOver=\"this.className='SousMenu_Over';ObjMenuParent.className='Menu_Over';Arret()\">";
				else
					content += "<TR><TD class=SousMenu onMouseOut=\"this.className='SousMenu';Depart()\" onMouseOver=\"this.className='SousMenu_Over';ObjMenuParent.className='Menu_Over';Arret()\">";

				// S'il existe un lien dans le menu alors on le prend par défaut
				if(ListeSousMenuLien[NoMenu][pass]=="")				
					content += "<a class='S_Gauche' href='Active.php?Lang="+Langage+"&Se=" +ListeMenuSection[NoMenu]+ "&" +ListeSousMenuSection[NoMenu][pass]+ "'>";
				else
					content += "<a class='S_Gauche' target='_blank' href='" +ListeSousMenuLien[NoMenu][pass]+"&Lang="+Langage+ "'>";
					
				content += ListeSousMenu[NoMenu][pass]+"</TD></TR>";
				pass++;								
			}
			content += "</TABLE></TD></TR></TABLE>";
			
			Objet.innerHTML = content;		
		
			skn.visibility = "visible";	
		}		
		
	}
	else
	{
		skn.visibility = "hidden";
	}
}

//cache les sous-menus
function CacheMenu()
{	
	skn.visibility = "hidden";		
	DesactiveMenu();
	window.clearInterval(TimerID);		
	CPT=0;	
}

//Compte jusqu'à et cache les sous-menus et menus
//si il n'y a pas de nouveau over
function Compteur()
{		
	if(CPT==2)
		CacheMenu();
		
	CPT=CPT+1;	
}

//Démarre le compteur qui cache les sous-menus et menus
function Depart()
{
	TimerID=window.setInterval("Compteur()",200);	
}

//Arrête le compteur qui cache les sous-menus et menus
function Arret()
{
	window.clearInterval(TimerID);
	CPT=0;	
}

//Désactive le menu de gauche si la section n'est pas active
function DesactiveMenu()
{
	for(j=0;j<ListeMenu.length;j++)
	{		
		i=j+1;		
	
		if(SectionActive!=ListeMenuSection[j])
		{			
			objMenu = VersionJavascript("MenuParent"+i);				
			objMenu.className='Menu';	
		}		
	}
}

document.onclick = CacheMenu;

//-------------------------------------------------------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------------------------------------------------------//
//Le menu principal

if(document.getElementById)
	{
	
	if(OS=="Mac")
	{
		if(browser == "Netscape Navigator")
		{
			document.write('<DIV ID="topgauche" style="position:absolute"><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><TABLE CELLPADDING=0 CELLSPACING=0>')
		}
		else
		{
			document.write('<DIV ID="topgauche" style="position:absolute"><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><TABLE CELLPADDING=0 CELLSPACING=0>')
		}
		
	}
	else		//autre OS
	{
		document.write('<DIV ID="topgauche" style="position:fixed"><TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><TABLE CELLPADDING=0 CELLSPACING=0>')
	}
	
	
	//SectionActive
	
		j=0;
		for(j=0;j<ListeMenu.length;j++)
		{		
			i=j+1;
			TopMenu=(j*HauteurMenu);
	
			if(SectionActive==ListeMenuSection[j])
			{		
				MenuActif="MenuParent"+i;		
				document.write('<tr><TD class=Menu_Over name=MenuParent'+i+' id=MenuParent'+i+' onMouseOut="DesactiveMenu()" onMouseOver="Arret();pop(\''+j+'\',\'MenuParent'+i+'\',\''+TopMenu+'\',\''+LeftMenu+'\')">')
			}
			else
			{			
				document.write('<tr><TD class=Menu name=MenuParent'+i+' id=MenuParent'+i+' onMouseOut="DesactiveMenu()" onMouseOver="Arret();this.className=\'Menu_Over\';pop(\''+j+'\',\'MenuParent'+i+'\',\''+TopMenu+'\',\''+LeftMenu+'\')">')
			}
				
			document.write('<a style="width:100%" href="Active.php?Lang=' +Langage+ '&Se=' +ListeMenuSection[j]+ '" class="M_Gauche">');																		
			document.write(ListeMenu[j])
			document.write('</a></td>')
			document.write('</TD></tr>')
		}
		

	document.write('</TABLE></TD></TR></TABLE></DIV>')
	}
	
document.write('</div>');
