var menuids=new Array("verticalmenu") //Enter id(s) of UL menus, separated by commas
var submenuoffset=-6 //Offset of submenus from main menu. Default is -2 pixels.

 function is_numeric( strString )
 // check for valid numeric strings
 {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;
  
   if (strString.length == 0) return false;
  
   // test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
   {
     strChar = strString.charAt(i);
    
     if (strValidChars.indexOf(strChar) == -1)
     {
     blnResult = false;
     }
   }
  
   return blnResult;                                    
 }

 function DateInt()
 {
   var now = new Date();
  
   var h = now.getHours();
   var m = now.getMinutes();
   var s = now.getSeconds();
  
   return ( h * 60 * 60 ) + ( m * 60 ) + s;
 }

 function sleep( intTime )
 {
   if( !is_numeric( intTime ) )
   {
   return; // Arret de l'éxecution
   }
  
   intTime = ( intTime / 1000 );
   var Exp = DateInt() + intTime; // TimeOut
  
   while( Exp > DateInt() )
   {
   ;
   }
 }

function createcssmenu(){
for (var i=0; i<menuids.length; i++){
    var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
      var spanref=document.createElement("span")
  		spanref.className="arrowdiv"
  		spanref.innerHTML="&nbsp;&nbsp;"
  		ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref)
      ultags[t].parentNode.onmouseover=function(){
        this.getElementsByTagName("ul")[0].style.left=this.parentNode.offsetWidth+submenuoffset+"px"
        this.getElementsByTagName("ul")[0].style.display="block"
        this.getElementsByTagName("ul")[0].onmouseover=function(){ //FFX2 sous Mac
          this.style.display="block"
        }
        /*this.getElementsByTagName("ul")[0].onmouseout=function(){
          this.style.display="none"
        }*/
        //alert('block');
      }
      ultags[t].parentNode.onmouseout=function(){ 
        //sleep(200);
        //alert('none');
        this.getElementsByTagName("ul")[0].style.display="none";
        //setTimeout(function() {this.getElementsByTagName("ul")[0].style.display="none"}, 2); 
      }
    }
  }
}


if (window.addEventListener)
window.addEventListener("load", createcssmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", createcssmenu)
