var bodyLoadFunctions = new Array();
//bodyLoadFunctions.push("initEventHandlers");

var documentClickFunctions = new Array();

function handleBodyLoad() {
  document.onclick = handleDocumentClick;

  for (var i=0; i<bodyLoadFunctions.length; i++) {
    var name = bodyLoadFunctions[i];
    var funct = window[name];
    if (funct) {
      funct();
    }
  }
}
function handleDocumentClick() {
  for (var i=0; i<documentClickFunctions.length; i++) {
    var name = documentClickFunctions[i];
    var funct = window[name];
    if (funct) {
      funct();
    }
  }
}

/* doesn't work in ie */
function initEventHandlers() {
  var els = document.getElementsByTagName("*");
  for (var i=0; i<els.length; i++) {
    var e = els[i];
    var click = e.getAttribute("click");
    if ((click != null) && (click != "")) {
      e.onclick = window[click];
    }
    var mouseOver = e.getAttribute("mouseOver");
    if ((mouseOver != null) && (mouseOver != "")) {
      e.onmouseover = window[mouseOver];
    }
    var mouseOut = e.getAttribute("mouseOut");
    if ((mouseOut != null) && (mouseOut != "")) {
      e.mouseout = window[mouseOut];
    }
  }
}

function show(menu, event) {
  menu.style.display="";
  menu.style.left=(event.clientX+document.documentElement.scrollLeft)+"px";
  menu.style.top=(event.clientY+document.documentElement.scrollTop)+"px";
}


/* menuLinks */

  bodyLoadFunctions.push("initMenuLinks");
  function initMenuLinks() {
    var lis = getElementsByClass("menuLink", this.document, "*");
    for (var i=0; i<lis.length; i++) {
      var li = lis[i];
      li.onmouseover = hoverOver;
      li.onmouseout = hoverOut;
      var click = li.getAttribute("click");
      if ((click != null) && (click != "")) {
        li.onclick = window[click];
      }
    }
  }


  function hoverOver(event) {
    if (!getEvent) return;
    event = getEvent(event);
    var li = event.target;
    addClass(li, "hover");
  }
  function hoverOut(event) {
    if (!getEvent) return;
    event = getEvent(event);
    var li = event.target;
    removeClass(li, "hover");
  }

