
var inmenu=false;
var lastmenu=0;
function Menu(current) {
   if (!document.getElementById) return;
   inmenu=true;
   oldmenu=lastmenu;
   lastmenu=current;
   if (oldmenu) Erase(oldmenu);
   m=document.getElementById("menu-" + current);
   box=document.getElementById(current);
r= m.offsetLeft;
d=m.offsetTop+m.offsetHeight;
   while(m=m.offsetParent)
{
r+=m.offsetLeft; }
   box.style.left= r;
   m=document.getElementById("menu-" + current);
   while(m=m.offsetParent)d+=m.offsetTop;
   box.style.top= d
   box.style.visibility="visible";
   box.style.backgroundColor="#ffd988";
   box.style.width="250px";
   document.getElementById(current).style.display='block';
}

function Erase(current) {
   if (!document.getElementById) return;
   if (inmenu && lastmenu==current) {
     return;
   }
   m=document.getElementById("menu-" + current);
   box=document.getElementById(current);
   box.style.visibility="hidden";

}


function Timeout(current) {
   inmenu=false;
   window.setTimeout("Erase('" + current + "')",600) ;
}

function Highlight(menu,item) {
   if (!document.getElementById) return;
   inmenu=true;
   lastmenu=menu;
   obj=document.getElementById(item);
 obj.style.backgroundColor="#fff8d2";
}

function UnHighlight(menu,item) {
   if (!document.getElementById) return;
   Timeout(menu);
   obj=document.getElementById(item);
   obj.style.backgroundColor="#ffd988";
}