var g_currSubMenu = "";
var g_currSubItem = "";


function toggleSubMenu(subMenu)
{
    if (document.getElementById(subMenu) && subMenu != g_currSubMenu)
    {
        //Expand new current sub menu
        Effect.BlindDown(subMenu, {
              duration: 0.3,
              fps: 30,
              queue:'end'
            });
        
        if (document.getElementById(g_currSubMenu))
        {
            //Collapse current sub menu
            Effect.BlindUp(g_currSubMenu, {duration:0.3});
        }
        
        g_currSubMenu = subMenu;
    }
    else
    {
        //Collapse current sub menu
        Effect.BlindUp(g_currSubMenu, {duration:0.3});
        
        g_currSubMenu = "";
    }
}


function gotoUrl(url)
{
    window.location = url;
}


function overBackground(divId)
{
    if (document.getElementById(divId))
    {
        //document.getElementById(divId).style.backgroundColor = "#18798b";
        document.getElementById(divId).style.backgroundImage = "url(/images/bkgr_sub_menu_item_hover.gif)";
    }
}


function outBackground(divId)
{
    if (document.getElementById(divId))
    {
        if (g_currSubItem != divId)
        {
            //document.getElementById(divId).style.backgroundColor = "transparent";
            document.getElementById(divId).style.backgroundImage = "url(/images/bkgr_sub_menu_item.gif)";
        }
    }
}


function updateMenuSelection(subMenu, subItem, subItemTextPar)
{
    toggleSubMenu(subMenu);
    selectSubItem(subItem, subItemTextPar);
}


function selectSubItem(subItem, subItemTextPar)
{
    if (document.getElementById(subItem))
    {
        //document.getElementById(subItem).style.backgroundColor = "#18798b";
        document.getElementById(subItem).style.backgroundImage = "url(/images/bkgr_sub_menu_item_hover.gif)";
        g_currSubItem = subItem;
    }
    
    if (document.getElementById(subItemTextPar))
    {
        document.getElementById(subItemTextPar).style.color = "#155b6b";
    }
}
