/* verticalmenu will be the only list used for this navigation */
var menuids=new Array("verticalmenu") //Enter id(s) of UL menus, separated by commas
var leftoffset=0 //Offset of submenus from main menu. Default is -2 pixels.
var topoffset=0 //Offset of submenus from main menu. Default is -2 pixels.

function createcssmenu(){

/* Get array mainUL of all UL items */
var mainUL=document.getElementsByTagName("ul");
/* Because verticalmenu does not exist, set the first occurence of UL to verticalmenu */
mainUL[0].setAttribute("id","verticalmenu"); 
/* Set the class of this attribute to glossymenu for CSS styling */
mainUL[0].className="glossymenu";
/* Loop through all main lists (only one declare on line 2) */
for (var i=0; i<menuids.length; i++){
/* Get all the submenus (UL) values into array ultags */
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
/* Loop through all submenu items */
    for (var t=0; t<ultags.length; t++){
		var theme=document.getElementById("main_content");
		ultags[t].className=theme.className;

/* Create a mouseover function for the parent (list item) node */
/* add listener */
    ultags[t].parentNode.onmouseover=function(){
/* getElementsByTagName will search only the this value ie the parent LI */
/* Sets the absolute left value of the menu to the width of the parent (LI) plus offset */
/* in this case it will appear to the right of the parent menu items and in line */
		this.getElementsByTagName("ul")[0].parentNode.style.position="relative";
		this.getElementsByTagName("ul")[0].parentNode.style.display="block";
    	this.getElementsByTagName("ul")[0].style.top=this.offsetHeight+"px";
    	this.getElementsByTagName("ul")[0].style.left="10px";


/* display the menu as a block item */
		    	this.getElementsByTagName("ul")[0].style.position="absolute";
		    	this.getElementsByTagName("ul")[0].style.zindex="999";
    	this.getElementsByTagName("ul")[0].style.display="block";
    }
/* define mouseout of the LI. Because UL and subsequent LI items are all within the parent LI */
/* tag, the mouseover applies even when over the submenu. The mouseout only triggers when you  */
/* are out of the list item and submenu  */
/* add listener */
    ultags[t].parentNode.onmouseout=function(){
/* hide the submenu on mouseout */
	this.getElementsByTagName("ul")[0].parentNode.style.position="";
	this.getElementsByTagName("ul")[0].parentNode.style.display="";
    this.getElementsByTagName("ul")[0].style.display="none"
    }
    }
  }
}
/* Add the listener events to the window object. Trigger onload events */
if (window.addEventListener)
window.addEventListener("load", createcssmenu, false)
else if (window.attachEvent)
window.attachEvent("onload", createcssmenu)