/********** Watson Industries, Inc. JavaScript archive ***********/


/* Change Text of Element with Id "Img_hdr" */
function changeHdr(txt){
  document.getElementById("Img_hdr").innerHTML = "Watson Industries<br />"+ txt;}

/* Change Text of Element with Id "Img_text" */
function changeTxt(txt){
  document.getElementById("Img_text").innerHTML = txt;}
  
/* Open submenu */
function menuopen(topmenu,submenu,menuimage){
	topmenu.className="open";
	submenu.className="opened";
	topmenu.src="/images/open.bmp";
	topmenu.alt="-";
}

/* Close submenu */
function menuclose(topmenu,submenu,menuimage){
	topmenu.className="close";
	submenu.className="closed";
	topmenu.src="/images/closed.bmp";
	topmenu.alt="+";
}



/* Add mouseover functions all subnavlist list items */
/* to keep the color of their parent list item at the */
/* hover color while the menu is being hovered over */

setMenu = function() {
  if (document.getElementById) {
    navRoot = document.getElementById("navlist");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
        for (j=0; j<node.childNodes.length; j++) {
          nod=node.childNodes[j];
          if (nod.nodeName=="UL") {
            for (k=0; k<nod.childNodes.length; k++) {
              no=nod.childNodes[k];
              if (no.nodeName=="LI"){
                no.onmouseover=function(){ChangeColor(this);}
                no.onmouseout=function(){ResetColor(this);}
              }
            }
          }
        }
      }
    }
  }
}

/* Place the selected class to link (A) tags of the object passed to this function */
function ChangeColor (obj) {
  a=obj.parentNode;
  b=a.parentNode;

  for (i=0; i<b.childNodes.length; i++){
    q=b.childNodes[i];
    if (q.nodeName=="A"){q.className="selected";}
  }
}

/* Remove the selected class from link (A) tags of the object passed to this function */
function ResetColor (obj){
  a=obj.parentNode;
  b=a.parentNode;

  for (i=0; i<b.childNodes.length; i++){
    q=b.childNodes[i];
    if (q.nodeName=="A"){q.className="";}
  }
}
