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

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"

	     hideAllOther(this);

        if(this.toref)
        	window.clearTimeout(this.toref);

    }
    ultags[t].parentNode.onmouseout=function(){
          var saveref=this.getElementsByTagName("ul")[0];
        saveref.isMouseOver=false;
        if(this.toref)
        	window.clearTimeout(this.toref);
        
        this.toref=window.setTimeout(function(e){
          if(!saveref.isMouseOver)
          	saveref.style.display="none"
        },300);

    }
    }
  }
}
function hideAllOther(liobj){
  var p=liobj.parentNode.childNodes;
  
  //alert(liobj.parentNode.childNodes[3]);
  //alert(p);
  var i;
try{
  for (i=0; i<p.length; i++){
    if (liobj != p[i] && "LI"==p[i].tagName && p[i].getElementsByTagName("ul").length)
      p[i].getElementsByTagName("ul")[0].style.display="none";
  }
  }catch(e){
    alert(p[i].innerHTML)
  }

}


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