function addLoadEvent(func)
{
    var oldonload=window.onload;
    if(typeof window.onload!='function')
    {
        window.onload=func;
    }
    else
    {
        window.onload=function()
        {
            oldonload();func();
        }
    }
}

function preparaSubmenu()
{
    //var li = document.getElementsBy("li_menu");
    var li = document.getElementsByTagName("li");
    
    for(i=0; i<li.length; i++)
    {
        
        if(li[i].getElementsByTagName("div")[0] != undefined)
        {
            li[i].onmouseover = function()
            {
                this.getElementsByTagName("div").item(0).style.display = "block";
                this.getElementsByTagName("a").item(0).style.background = "#5179a3";
                this.getElementsByTagName("a").item(0).style.color = "#fff";
            }
            li[i].onmouseout = function()
            {
                this.getElementsByTagName("div").item(0).style.display = "none";
                this.getElementsByTagName("a").item(0).style.background = "#fff";
                this.getElementsByTagName("a").item(0).style.color = "#3e3e3e";
            }
            li[i].onclick = function()
            {
                this.getElementsByTagName("div").item(0).style.display = "none";
                this.getElementsByTagName("a").item(0).style.background = "#fff";
                this.getElementsByTagName("a").item(0).style.color = "#3e3e3e";
            }
        }
    }
}
addLoadEvent(preparaSubmenu);
