function ShowLoading(show)
  {
  var Yscroll=(document.layers)?window.pageYOffset:document.body.scrollTop;
  var Xscroll=(document.layers)?window.pageXOffset:document.body.scrollLeft;
  if (show)
    {
    document.getElementById('loading').style.top = document.body.clientHeight/2-25+Yscroll;
    document.getElementById('loading').style.left = document.body.clientWidth/2-75+Xscroll;
    document.getElementById('loading').style.display = '';
    }
  else document.getElementById('loading').style.display = 'none';
  }
  
function getAbsolutePos(el)
  {
  var r = { x: el.offsetLeft, y: el.offsetTop };
  if (el.offsetParent)
    {
    var tmp = getAbsolutePos(el.offsetParent);
    r.x += tmp.x;
    r.y += tmp.y;
    }
  return r;
  }
  
function MarkerON(param)
  { document.getElementById(param).src = 'img/mand_marker_selected.png'; }

function MarkerOFF(param)
  { document.getElementById(param).src = 'img/mand_marker.png'; }
  
function showhide(param)
  {
  if (document.getElementById(param).style.display == 'none')
    document.getElementById(param).style.display = '';
  else document.getElementById(param).style.display = 'none';
  return true;
  }
  
function startMenu() 
  {
  if (!document.getElementById) return;
  nav = document.getElementById('mmenu');
  while (nav.nodeName != 'TR') nav = nav.childNodes[0];
  for (i=0; i<nav.childNodes.length; i++)
    {
    node = nav.childNodes[i];
    if (node.nodeName == 'TD' && (node.className == 'mmenu' || node.className == 'mmenu_over'))
      {
      anode = node.childNodes[0];
      if (anode.nodeName != 'A') continue;
      if (node.className == 'mmenu_over') continue;
      anode.onmouseover = function() { this.parentNode.className = 'mmenu_over'; } 
      anode.onmouseout = function() { this.parentNode.className = 'mmenu'; }
      }
    }
  if (nav = document.getElementById('smenu'))
    {
    for (i=0; i<nav.childNodes.length; i++) 
      if (nav.childNodes[i].nodeName == 'TBODY') { nav = nav.childNodes[i]; break; }
    for (i=0; i<nav.childNodes.length; i++)
      {
      node = nav.childNodes[i];
      if (node.nodeName != 'TR') continue;
      node = node.childNodes[0];
      if (node.nodeName == 'TD')
        {
        anode = node.childNodes[0];
        if (anode.nodeName != 'A') continue;
        if (node.className == 'smenu_over') continue;
        anode.onmouseover = function() 
          {
          pnode = this.parentNode;
          pnode.className = 'smenu_over'; 
          } 
        anode.onmouseout = function() 
          { 
          pnode = this.parentNode;
          pnode.className = 'smenu'; 
          }
        }
      }
    }
  }
  
function expandCategory(id) {
  if (document.getElementById('cat_list_'+id).style.display != 'none') {
    document.getElementById('cat_exp_'+id).className = '';
    document.getElementById('cat_list_'+id).style.display = 'none';
  } else {
    document.getElementById('cat_exp_'+id).className = 'selected';
    document.getElementById('cat_list_'+id).style.display = '';
  }
}