function vertical() { 

   var navItems = document.getElementById("nav").getElementsByTagName("li"); 
        
   for (var i=0; i< navItems.length; i++) { 
          if(navItems[i].className == "submenu") { 
                 navItems[i].onmouseover=function() {this.getElementsByTagName('ul')[0].style.display="block";this.style.
backgroundColor = "#f9f9f9";} 
                 navItems[i].onmouseout=function() {this.getElementsByTagName('ul')[0].style.display="none";this.style.
backgroundColor = "#FFFFFF";} 
          } 
   } 

} 

function horizontal() { 

   var navItems = document.getElementById("barra").getElementsByTagName("li"); 
        
   for (var i=0; i< navItems.length; i++) { 
          if((navItems[i].className == "menuvertical") || (navItems[i].className == "submenu")) 
          { 
                 if(navItems[i].getElementsByTagName('ul')[0] != null) 
                 { 
                        navItems[i].onmouseover=function() {this.getElementsByTagName('ul')[0].style.display="block";this.style.
backgroundColor = "#f9f9f9";} 
                        navItems[i].onmouseout=function() {this.getElementsByTagName('ul')[0].style.display="none";this.style.
backgroundColor = "#FFFFFF";} 
                 } 
          } 
   } 

}
function bodyOnReady(func){
 //call the function 'func' when DOM loaded
 //Version 3.0 - 15/10/2008 - based on Jquery bindReady
 //by Micox - www.elmicox.com - elmicox.blogspot.com - webly.com.br
 //http://www.elmicox.com/2007/evento-body-onready-sem-o-uso-de-libs/

    //flag global para indicar que já rodou e function que roda realmente
    done = false
    init = function(){ if(!done) { done=true; func() } }
    var d=document; //apelido para o document
    //pra quem tem o DOMContent (FF)
    if(document.addEventListener){ d.addEventListener("DOMContentLoaded", init, false );}
    
    if( /msie/i.test( navigator.userAgent ) ){ //IE
        (function () {
            try { // throws errors until after ondocumentready                
                d.documentElement.doScroll("left");
            } catch (e) {
                setTimeout(arguments.callee, 10); return;
            }
            // no errors, fire
            init();
        })();
    }
    if ( window.opera ){
        d.addEventListener( "DOMContentLoaded", function () {
            if (done) return;
            //no opera, os estilos só são habilitados no fim do DOMready
            for (var i = 0; i < d.styleSheets.length; i++){
                if (d.styleSheets[i].disabled)
                    setTimeout( arguments.callee, 10 ); return;
            }
            // fire
            init();
        }, false);
    }
    if (/webkit/i.test( navigator.userAgent )){ //safari's
        if(done) return;
        //testando o readyState igual a loaded ou complete
        if ( /loaded|complete/i.test(d.readyState)===false ) {
            setTimeout( arguments.callee, 10 );    return;
        }
        init();
    }
    //se nada funfou eu mando a velha window.onload lenta mesmo
    if(!done) window.onload = init
} 

bodyOnReady(horizontal);
