var ver = navigator.appVersion;
var dom = document.getElementById ? 1 : 0;
var ie5 = (this.ver.indexOf("MSIE 5") > - 1 && this.dom) ? 1 : 0;
var ie4 = (document.all && !this.dom) ? 1 : 0;
var ns5 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0;
var ns4 = (document.layers && !this.dom) ? 1 : 0;
var dhtmlShowPrefix;
var dhtmlShowPostfix;
var visibility = "visible";
var i;
var menuTimer = 0;
var menus = new Array();
var menuObjs = new Array();
var menuX = new Array();
var inited = 0;

if(ns5) {
  dhtmlShowPrefix = "document.getElementById('";
  dhtmlShowPostfix = "').style";
} else if(ns4) {
  dhtmlShowPrefix = "document.";
  dhtmlShowPostfix = "";
  visible = "show";
} else {
  dhtmlShowPrefix = "document.all.";
  dhtmlShowPostfix = ".style";
}

function lgifch(lname, iname, nimage, wstat) {
  if(document.images) {
    if(ns4) {
      eval("document." + lname + ".document." + iname + 
           ".src=\"/img/" + nimage + "\";");
    } else {
      eval("document." + iname + ".src=\"/img/" + nimage + "\";");
    }
    eval("window.status=\"" + wstat + "\";");
  }
}

function gifch(iname, nimage, wstat) {
  if(document.images) {
    eval("document." + iname + ".src=\"/img/" + nimage + "\";");
    eval("window.status=\"" + wstat + "\";");
  }
}

function linkch(wstat) {
  eval("window.status=\"" + wstat + "\";");
}

function loadHidden(name) {
  hiddenImage = new Image();
  eval("hiddenImage.src=\"/img/" + name + "\";");
}

function embedMenu(menu) {
  this.css = dom ? document.getElementById(menu).style :
             ie4 ? document.all[menu].style :
             ns4 ? document.layers[menu] : 0;
  this.mover = mover;
  return this;
}

function mover(x, y) {
  this.x = x;
  this.y = y;
  if(!ie4) { 
    this.css.left = this.x;
    this.css.top = this.y;
  } else {
    this.css.pixelLeft = this.x;
    this.css.pixelTop = this.y;
  }
}

function showMenu(menuNo, imageName, id) {
  if(inited != 0) {
    hideAllMenus();
    var x;
    var y;
    if(dom) {
      x = document.getElementById(id).offsetLeft + menuX[menuNo];
      y = document.getElementById(id).offsetTop +
          document.getElementById(imageName).offsetHeight - 9;
    } else if(ie4) {
      eval("x = " + id + ".offsetLeft + menuX[menuNo]");
      eval("y = " + id + ".offsetTop + " + imageName + ".offsetHeight - 9");
    } else {
      eval("x = document." + imageName + ".x");
      eval("y = document." + imageName + ".y + document." + imageName + 
           ".height - 9");
    }
    menuObjs[menuNo].mover(x, y);
    eval(dhtmlShowPrefix + menus[menuNo] + dhtmlShowPostfix + 
         ".visibility = '" + visibility + "'");
    resetTimer();
  }
}

function hideMenu(menuId) {
  if(inited != 0) {
    eval(dhtmlShowPrefix + menuId + dhtmlShowPostfix + 
         ".visibility = 'hidden'");
  }
}

function hideAllMenus() {
  if(inited != 0) {
    for(i = 0; i < menus.length; i++) {
      hideMenu(menus[i]);
    }
    resetTimer();
  }
}

function resetTimer() {
  clearTimeout(menuTimer);
}

function setTimer() {
  menuTimer = setTimeout('hideAllMenus()', 3000)
}
