var menu = 0;
var menuTimer = 0;

function center()
{
  var page = document.getElementById('page');
  var bottom = document.getElementById('bottom');
  var w = document.all ? document.body.clientWidth : window.innerWidth;
  page.style.left = bottom.style.left = ((w > page.clientWidth?((w - page.clientWidth) / 2):0) + (page.clientWidth / 2)) + 'px';
  page.parentNode.style.overflowX = 'auto';
}

window.onload = window.onresize = center;

function showMenu(m)
{
  if(menuTimer)
    clearTimeout(menuTimer);
  if(menu && menu != m)
    menu.style.display = 'none';
  menu = m;
  if(menu)
    menu.style.display = 'block';
}

function hideMenu()
{
  menuTimer = setTimeout(function()
  {
    if(menu)
      menu.style.display = 'none';
  }, 500);
}
