var menuids=["navigation_list"]

function buildsubmenus(){
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 ul_width = 0;
            var lis = ultags[t].getElementsByTagName("li");
            for (var tmp=0; tmp<lis.length; tmp++){
               // ul_width += lis[tmp].getElementWidth()
            }
            ul_width = 300;
            ultags[t].style.width = ul_width+'px'
            
            ultags[t].parentNode.onmouseover=function(){
                this.getElementsByTagName("ul")[0].style.display="block"
                this.getElementsByTagName("ul")[0].style.visibility="visible"
                this.getElementsByTagName("a")[0].className = this.getElementsByTagName("a")[0].className + " selected" //add .hover class too keep the menu item with hover state
            }
            ultags[t].parentNode.onmouseout=function(){
                this.getElementsByTagName("ul")[0].style.display="none"
                this.getElementsByTagName("ul")[0].style.visibility="hidden"
                this.getElementsByTagName("a")[0].className = this.getElementsByTagName("a")[0].className.replace(" selected", "") //remove .hover
            }
        }
        for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
            ultags[t].style.visibility="hidden"
        }
    }
}

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

Object.prototype.getElementWidth = function() {
   if (typeof this.clip !== "undefined") {
      return this.clip.width;
   } else {
      if (this.style.pixelWidth) {
         return this.style.pixelWidth;
      } else {
         return this.offsetWidth;
      }
   }
}
