var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('dl{display: none;}\n')
document.write('</style>\n')
}
/*
function Allumer(node)
{

	if(node.nodeName == 'DT')
	{
		monhref = node.firstChild.getAttribute('href');
	}
	else 
	{
		monhref = node.getAttribute('href');
		
	}
	
	
	if(this.lien != monhref)
	{
		this.lien = monhref;
	if(monhref=='donnees-financieres.php')
	{			
			myMenu.expandMenu(myMenu.submenus[0],0);
		//	myMenu.collapseMenu(myMenu.submenus[1]);
		//	myMenu.collapseMenu(myMenu.submenus[2]);
	}
	if(monhref=='backoffice.php')
	{
			myMenu.expandMenu(myMenu.submenus[1],1);	
		//	myMenu.collapseMenu(myMenu.submenus[0]);
		//	myMenu.collapseMenu(myMenu.submenus[2]);			
	}
	if(monhref=='audit-opcvm.php')
	{
			myMenu.expandMenu(myMenu.submenus[2],2);	
		//	myMenu.collapseMenu(myMenu.submenus[0]);
		//	myMenu.collapseMenu(myMenu.submenus[1]);
	}
	}
	var tableau = document.getElementsByTagName("a");
	for(i=0;i<tableau.length;i++)
	{
		href = tableau[i].getAttribute('href');
		if(href==monhref)
		{
			
			tableau[i].style.color = '#999';
			if(tableau[i].parentNode.nodeName == 'DT')
			{
				 tableau[i].style.color = "#E1680F";
			}
			
		
		}
		else
		{
			if(!(tableau[i].parentNode.parentNode.parentNode.getAttribute('id')=='menu' || tableau[i].parentNode.parentNode.parentNode.getAttribute('id')=='mfixe' || tableau[i].parentNode.parentNode.getAttribute('id')=='menu')) tableau[i].style.color = '#E1680F';
		}
		
	}
	

}

function Eteindre(node)
{
	if(node.nodeName == 'DT')
	{
		monhref = node.firstChild.getAttribute('href');
	}
	else 
	{
		monhref = node.getAttribute('href');
	}
	
	var tableau = document.getElementsByTagName("a");
	for(i=0;i<tableau.length;i++)
	{
		href = tableau[i].getAttribute('href');
		if(href==monhref)
		{
	
			tableau[i].style.color = '#E1680F';
			tableau[i].onmouseover = function()
			{
				this.style.color = '#999';
				Allumer(this);
			}
			tableau[i].onmouseout = function()
			{
				this.style.color = '#E1680F';
				Eteindre(this);
			}
			

			
		
		}
		else
		{
			if(!(tableau[i].parentNode.parentNode.parentNode.getAttribute('id')=='menu' || tableau[i].parentNode.parentNode.parentNode.getAttribute('id')=='mfixe' || tableau[i].parentNode.parentNode.getAttribute('id')=='menu')) tableau[i].style.color = '#E1680F';
		}
		
	}
	if(node.nodeName == 'DT')
	{
		node.firstChild.style.color = "#E1680F";
	}



}
*/
function Allumer(node)
{

      if(node.nodeName == 'DT')
      {
            monhref = node.firstChild.getAttribute('href');
      }
      else 
      {
            monhref = node.getAttribute('href');
            
      }
      var tableau = document.getElementsByTagName("a");
      for(i=0;i<tableau.length;i++)
      {
            href = tableau[i].getAttribute('href');
            if(href==monhref)
            {
                  
                  tableau[i].style.color = '#E1680F';
                  if(tableau[i].parentNode.nodeName == 'DT')
                  {
                         tableau[i].style.color = "#000";
                  }
                  
            
            }
            else
            {
                  if(!(tableau[i].parentNode.parentNode.parentNode.getAttribute('id')=='menu' || tableau[i].parentNode.parentNode.parentNode.getAttribute('id')=='mfixe' || tableau[i].parentNode.parentNode.getAttribute('id')=='menu')) tableau[i].style.color = '#000';
            }
            
      }
      

}

function Eteindre(node)
{
      if(node.nodeName == 'DT')
      {
            monhref = node.firstChild.getAttribute('href');
      }
      else 
      {
            monhref = node.getAttribute('href');
      }
      
      var tableau = document.getElementsByTagName("a");
      for(i=0;i<tableau.length;i++)
      {
            href = tableau[i].getAttribute('href');
            if(href==monhref)
            {
            
                  tableau[i].style.color = '#000';
                  tableau[i].onmouseover = function()
                  {
                        this.style.color = '#E1680F';
                        Allumer(this);
                  }
                  tableau[i].onmouseout = function()
                  {
                        this.style.color = '#E1680F';
                        Eteindre(this);
                  }
                  
            
            }
            else
            {
                  if(!(tableau[i].parentNode.parentNode.parentNode.getAttribute('id')=='menu' || tableau[i].parentNode.parentNode.parentNode.getAttribute('id')=='mfixe' || tableau[i].parentNode.parentNode.getAttribute('id')=='menu')) tableau[i].style.color = '#000';
            }
            
      }
      if(node.nodeName == 'DT')
      {
            node.firstChild.style.color = "#E1680F";
			
      }
      


}


function SwitchMenu(obj){  
	for(i=0;i<document.getElementsByTagName("dl").length;i++)
	{
		document.getElementsByTagName("dl")[i].style.display = 'none';
	}
	
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("menu").getElementsByTagName("dl"); //DynamicDrive.com change
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="dl") 
				ar[i].style.display = "none";
			}
			el.style.display = "block";
			document.getElementById('titre1').firstChild.style.color = "white";
			document.getElementById('titre1').firstChild.style.background= "url(images/backsite/collapsed.gif) no-repeat";
			document.getElementById('titre2').firstChild.style.color = "white";
			document.getElementById('titre2').firstChild.style.background= "url(images/backsite/collapsed.gif) no-repeat";
			document.getElementById('titre3').firstChild.style.color = "white";
			document.getElementById('titre3').firstChild.style.background= "url(images/backsite/collapsed.gif) no-repeat";
			if(obj=='sub1') document.getElementById('titre1').firstChild.style.color = "#E1680F";
			if(obj=='sub1') document.getElementById('titre1').firstChild.style.background= "url(images/backsite/expanded.gif) no-repeat";
			if(obj=='sub2') document.getElementById('titre2').firstChild.style.color = "#E1680F";
			if(obj=='sub2') document.getElementById('titre2').firstChild.style.background= "url(images/backsite/expanded.gif) no-repeat";
			if(obj=='sub3') document.getElementById('titre3').firstChild.style.color = "#E1680F";
			if(obj=='sub3') document.getElementById('titre3').firstChild.style.background= "url(images/backsite/expanded.gif) no-repeat";
		}else{
			el.style.display = "none";
		}
	}
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
