var inmenu=false;
var lastmenu=0;

function Menu(current) {
 if (!document.getElementById) return;
   inmenu=true;
   oldmenu=lastmenu;
   lastmenu=current.id;
   if (oldmenu) Erase(oldmenu);
   m=current;
   
if (m.parentNode.childNodes.length > 2 ){
  if ( m.parentNode.childNodes[2].nodeName == 'UL' )
   {
   box=m.parentNode.childNodes[2];
    if ( box.parentNode.firstChild.id =='news_tab' || box.parentNode.firstChild.id =='contact_tab' ) 
   {
   box.style.left= $(m).offset().left - 50 + 'px';
   }   else  { 
	box.style.left= $(m).offset().left + 'px';
   }
   
   
   box.style.top= $(m).offset().top + $(m).outerHeight() - 1 + 'px';
   box.style.display="block"; 
   }
	}
}

function Erase(current) {
//   if (!document.getElementById) return;
m=document.getElementById(current)
if (inmenu && lastmenu==m.id) {
	return;
  }

  if (m.parentNode.childNodes.length > 2 ){
  if (m.parentNode.childNodes[2].nodeName == 'UL')
   {
   box=m.parentNode.childNodes[2];
   box.style.top="0";
   box.style.left="-999px";
   }
   }
}

function Timeout(current) {
   inmenu=false;
   window.setTimeout("Erase('"+current.id+"')",500) ;
}

function Highlight(menu) {
   inmenu=true;
   lastmenu=menu.parentNode.firstChild.id
   
}

function UnHighlight (menu) {
   Timeout(menu.parentNode.firstChild)
}



