//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuidsGauche=["menuGauche"]; //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_vertical(){
for (var iGauche=0; iGauche<menuidsGauche.length; iGauche++){
  var ultagsGauche=document.getElementById(menuidsGauche[iGauche]).getElementsByTagName("ul");
    for (var tGauche=0; tGauche<ultagsGauche.length; tGauche++){
		if (ultagsGauche[tGauche].parentNode.id==menuidsGauche[iGauche]){ //if this is a first level submenu
			//ultagsGauche[tGauche].style.left=ultagsGauche[tGauche].parentNode.offsetWidth+"px"; //dynamically position first level submenus to be width of main menu item
// Pas besoin changer la classe pour les flèches pour là...
//			ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon";
		}
		else{ //else if this is a sub level menu (ul)
          var niveauMenuGauche = ultagsGauche[tGauche].className;
          var positionAUtiliserGauche = 0;
          // We gotta check not only the previous ul, but the previous UL that's a level under it;
          for (var zGauche=tGauche-1; zGauche >= 0; zGauche--)
             {
             if (ultagsGauche[zGauche].className < niveauMenuGauche)
                {
                positionAUtiliserGauche = zGauche;
                break;
                }
             }
        if (ultagsGauche[tGauche].className.indexOf('expandMenu') == -1)
           {
			 //ultagsGauche[tGauche].style.left=ultagsGauche[positionAUtiliserGauche].getElementsByTagName("a")[0].offsetWidth+"px"; //position menu to the right of menu item that activated it
   			 // Pas besoin changer la classe pour les flèches pour là...
			 ultagsGauche[tGauche].parentNode.getElementsByTagName("a")[0].className=ultagsGauche[tGauche].parentNode.getElementsByTagName("a")[0].className + " menuGaucheAvecSousMenu";
           }
        else if (ultagsGauche[tGauche].className.indexOf('niveau2') == -1)
           {
         	ultagsGauche[tGauche].parentNode.getElementsByTagName("a")[0].className=ultagsGauche[tGauche].parentNode.getElementsByTagName("a")[0].className + " menuGaucheAvecSousMenuBas";
           }
		}
    if (ultagsGauche[tGauche].className.indexOf('expandMenu') == -1)
       {
       ultagsGauche[tGauche].parentNode.onmouseover=function(){
          this.getElementsByTagName("ul")[0].style.visibility="visible";
          }
       ultagsGauche[tGauche].parentNode.onmouseout=function(){
          this.getElementsByTagName("ul")[0].style.visibility="hidden";
          }
       }
    }
  }
}

if (window.addEventListener)
   window.addEventListener("load", buildsubmenus_vertical, false);
else if (window.attachEvent)
   window.attachEvent("onload", buildsubmenus_vertical);

