var inmenu   = false;
var lastmenu = 0;

function Menu(current) {
    if (!document.getElementById(current)) { 
        return;
    }
   
    inmenu    = true;
    oldmenu   = lastmenu;
    lastmenu  = current;
   
    if (oldmenu) {
        Erase(oldmenu);
    }
   
    m   = document.getElementById("menu-" + current);
    box = document.getElementById(current);
   
    box.style.left       = m.offsetLeft + m.offsetWidth +1;
    box.style.top        = m.offsetTop;
    box.style.visibility = 'visible';
    box.style.width      = '200px';
}

function Erase(current) {
    if (!document.getElementById(current)) { 
        return;
    }
   
    if (inmenu && lastmenu == current) { 
        return;
    }

    document.getElementById(current).style.visibility = 'hidden';
}

function Timeout(current) {
   inmenu = false;
   window.setTimeout("Erase('" + current + "');",500);
}

function Highlight(menu,item) {
    if (!document.getElementById) {
       return;
    }
       
    inmenu   = true;
    lastmenu = menu;
}

function UnHighlight(menu,item) {
    if (!document.getElementById) {
       return;
    }

    Timeout(menu);
}