/**
 * HoverMenuEvents prototype Class
 *
 * FUNCTIONS:
 *     .initialize(ids)                           // ands function to all mouse events in given ids
 *
 * USAGE:
 *     In <head> tag:
 *         <script type="text/javascript" src="/javascripts/hover_menu.js"></script>
 *         <script type="text/javascript">window.onload = function() { new HoverMenuEvents('menu'); };</script>
 *     In <body> tag:
 *         <ul id="menu">
 *
 */

function HoverMenuEvents(ids) {
  ids = ids.split(',');
  while (id = ids.pop()) {
    startList(id);
  }
}

function startList(id) {
  navRoot = document.getElementById(id);
  for (i=0; i<navRoot.childNodes.length; i++) {
    node = navRoot.childNodes[i];
    if (node.nodeName=="LI") {
      node.onmouseover=function() {
        this.className+=" over";
      }
      node.onmouseout=function() {
        this.className=this.className.replace(" over", "");
      }
    }
  }
}