function doMouseover(menunode,evt) {
  menunode.className="mainitemover";
}

function doMouseout(menunode,evt) {
  var tg = (window.event) ? evt.srcElement : evt.target;
  var msg1 = tg.nodeName;
  while (tg && tg != menunode) {
    tg = tg.parentNode;
    if (tg) msg1 = msg1 + "/" + tg.nodeName;
  }

  msg1 = msg1 + "(" + evt.x + "," + evt.y + ")";

  var reltg = (evt.relatedTarget) ? evt.relatedTarget : evt.toElement;
  var msg = reltg.nodeName;
//  alert("going to a "+reltg.nodeName+"."+reltg.className+"#"+reltg.id+" node");
  while (reltg && reltg != menunode) {
    reltg = reltg.parentNode;
    if (reltg) msg = msg + "/" + reltg.nodeName;
  }
//  window.status=msg1 + "->" + msg;
  if (reltg==menunode) return;
  menunode.className="mainitem";
}

function walkOneMenu(menunode) {
  var basicWidth = menunode.rwidth;
  for (var x=0; x<menunode.childNodes.length; x++) {
        var node = menunode.childNodes[x];
      if (node.nodeName=="LI") {
         basicWidth = Math.max(basicWidth,node.offsetWidth - 2);
         //node.style.backgroundColor="green";
      }
  }
  for (x=0; x<menunode.childNodes.length; x++) {
    node = menunode.childNodes[x];
    if (node.nodeName=="LI") {
      for (var y=0;y<node.childNodes.length; y++) {
	var subnode = node.childNodes[y];
	if (subnode.nodeName=="A") {
	  if (basicWidth > 0) {
	    //alert("found it! (" + basicWidth + ")");
	    subnode.style.width=basicWidth;
	    //subnode.style.backgroundColor="red";
	  } else {
	    //subnode.style.backgroundColor="red";
          }
	}
      }
    }
  }
}

function walkSubMenus(root,i) {
  if (root.nodeName != "#text") {
    if (root.className == "mainitem" 
	 || root.className == "mainitemover") {
      root.onmouseover=function(e) {if (!e) e=window.event;doMouseover(this,e)};
      root.onmouseout=function(e) {if (!e) e=window.event;doMouseout(this,e)};
    }
    for (var x=0; x<root.childNodes.length; x++) {
    var node = root.childNodes[x];
      if (node.className == "horz_submenu") {
        walkOneMenu(node);
      } else {
        if (node.nodeName != "#text") {
           walkSubMenus(node,i+1);
	}
      }
    }
  }  
}
doJump = function() {
////  rjaparent = document.getElementById("robparent1");
////  rjatest = document.getElementById("robtest1");
////  rjatest.style.left = rjaparent.offsetWidth;
////  rjatest.style.top = -rjaparent.offsetHeight;
  rjaouter = document.getElementById("horiz_menu");
  walkSubMenus(rjaouter,1);
}
if (window.attachEvent)
  window.attachEvent("onload", doJump)
else
  window.onload=doJump;
