//
//   rebrandNavigationStuff()
//
//   Sets up the navigation menus to work the way they are supposed to,
//   given the rebranded templates - but fixes it so things still work
//   in IE when we are loading other stuff at startup as well.
//

function rebrandNavigationStuff()
   {

   //   *** NAVIGATION FLYOUTS AND MENU EXPANSION ***
   var this_path= new Array(" "," "," ");
   this_path = document.URL.split(/\/+/);
	var current_server = this_path[1];
   var current_section = this_path[2];
   var current_subsection = this_path[3];
	if (current_section == "cgi-bin") {
		current_section = this_path[3];
		current_subsection = this_path[4];
	}
   
   if (current_section == "ABET") {
      current_section = "academic";
      }
   else if (current_section == "Calcium38") {
      current_section = "operations";
      }
   else if (current_section == "circuit_archive") {
      current_section = "resources";
      }
   else if (current_section == "intranet") {
      current_section = "operations";
      }
   else if (current_section == "class") {
      current_section = "academic";
      }
   else if (current_section == "gradapps") {
      current_section = "operations";
      }
   else if (current_section == "graduate") {
      current_section = "academic";
      }
   else if (current_section == "jobs") {
      current_section = "careers";
      }
   else if (current_section == "news") {
      current_section = "about";
      }
   else if (current_section == "newsletter") {
      current_section = "about";
      }
   else if (current_section == "undergrad") {
      current_section = "academic";
      }
	else if (current_server == "mail.ee.washington.edu") {
		current_section = "computing";
		}
	else if (current_server == "user.ee.washington.edu") {
		current_section = "computing";
		}
   else if (! document.getElementById(current_section)) {
      current_section = "home";
      }
   var this_parent = document.getElementById(current_section);
   this_parent.style.background = "#fbfbfb";
   this_parent.style.color = "#333";
   this_parent.style.fontWeight = "bold";
   if (this_parent.hasChildNodes()) {
      for (cnloop = 0 ; cnloop < this_parent.childNodes.length; cnloop++)
         {
         this_child = this_parent.childNodes[cnloop];
         if ((this_child.nodeName == "ul") || (this_child.nodeName == "UL")) {
            this_child.style.position = "static";
            this_child.style.display = "block";
            this_child.style.border = "none";
            this_child.style.background = "#fbfbfb";
            this_child.style.paddingLeft = "15px";
            this_child.style.width = "130px";
            this_child.style.fontWeight = "normal";
            }
         }
      }   
   // IE hack for navigation flyouts - compensates for IE's CSS shortcomings
   if (document.all&&document.getElementById) {
      navRoot = document.getElementById("navlist");
      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", "");
               }
            }
         }
      }

   }
