function getWidth(obj) {
  return obj.offsetWidth;
}
function setWidth(obj, newWidth) {
  if (document.all&&document.getElementById) {
    newWidth -= 4;
    obj.style.width = newWidth;
  } else {
    newWidth -= 2;
    obj.style['width'] = newWidth+"px";
  }
}

// the below function successfully crawls through the menu elements
startList = function() {
    navRoot = $('nav_ul');
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        if (document.all&&document.getElementById) {
          node.onmouseover=function() { this.className+=" over"; }
          node.onmouseout=function() { this.className=this.className.replace(" over", ""); }
        }
        for (j=0; j<node.childNodes.length; j++) {
          subNode = node.childNodes[j];
          if (subNode.nodeName=="UL") {
            liWidth = getWidth(node);
            for (k=0; k<subNode.childNodes.length; k++) {
              subChild = subNode.childNodes[k];
              if (subChild.nodeName=="LI") {
                setWidth(subChild, liWidth);
              }
            }
          }
        }
      }
    }
  }


window.onload=startList;

/*
startList = function() {
  if (document.all&&document.getElementById) {
    navRoot = document.getElementById("nav_ul");
    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", "");
        }
        liWidth = node.getWidth
      }
    }
  }
}
window.onload=startList;
*/
