menuYPos=80;
currentY=moveY=menuYPos;
scrolltimer=null;
function setMenuBar()
{
  docheight=600;
  if (window.innerHeight)docheight = window.innerHeight;
  else if (document.body.clientHeight)docheight = document.body.clientHeight;
  if (docheight < 600)docheight=600;
  if (document.getElementById('menubar'))document.getElementById('menubar').height=docheight;
  else if(menubar)menubar.height=docheight;
}
function updateMenuPosition()
{
 var pY=0;
 if (window.pageYOffset)pY=window.pageYOffset;
 if (document.body.scrollTop)pY=document.body.scrollTop;
 targetY=pY+menuYPos;
 moveY=moveY+(targetY-currentY)/20;
 showPermPanel('menu0', 10, moveY);
 currentY=moveY;

 if (document.getElementById('menuimage'))document.getElementById('menuimage').style.top=moveY-menuYPos;
 else if(menuimage)menuimage.style.pixelTop=100;
 if (scrolltimer)clearTimeout(scrolltimer);
 if (Math.abs(currentY-targetY) > 0.5)scrolltimer = setTimeout("updateMenuPosition()", 10);
 else scrolltimer = scrolltimer = setTimeout("updateMenuPosition()", 2000);
}
function menuInit()
{
  menusGo();
  window.onscroll = updateMenuPosition;
  window.onresize = setMenuBar;
  setMenuBar()
  updateMenuPosition();
}
