/* old sidenav function
function sidenav(highlight1,subnav1) {
	var strTemp = new String();
	if ( highlight1 != '' ) {
		document.getElementById(highlight1).className = 'topicon1';	
	}
	if ( subnav1 != '' ) {
		document.getElementById(subnav1).className = 'subtopicson1';
  	}
	if (arguments.length >= 3) { 
		var subhead2 = arguments[2];
  	  	document.getElementById(subhead2).className = 'topicon2';
		if (arguments.length >= 4){
			var subcat2 = arguments[3];
			document.getElementById(subcat2).className = 'subtopicson2';
			if (arguments.length >= 5){
				var subhead3 = arguments[4];
				document.getElementById(subhead3).className = 'topicon3';
			}
		}			
	}
	document.getElementById('sidenav').style.visibility = "visible"; 
	}
		
}
*/

  /*
    Adds CSS class names to the LI elements of a nested UL list.
    leafes get the menu_leaf_class
    open nodes get the menu_open_class
    closed nodes get the menu_closed_class
    the current node gets the menu_active_class
    
    written 2004 by Ortwin Glueck
    
    mods for siemens styling by Ryan Ragle 2007.04.11
  */

  //config

  
  //the default page that is displayed if URL ends in /

 
    
  //main function
  //menu_id : id of the element containing the navigation
  var menu_url;
  function sidenav() {
	
	
	var menu_id = "sidenav";
     	var url = location.href;
     if (url.lastIndexOf("/") == (url.length-1)) {
       url = url; //+"index.shtml";
     }
     if (url.lastIndexOf("?") >= 0) {
       url = url.substring(0, url.lastIndexOf("?"));
     }
     if (url.lastIndexOf("#") >= 0) {
       url = url.substring(0, url.lastIndexOf("#"));
     }
     menu_url = url;
     
     var main = document.getElementById(menu_id);
     if (!main) alert("No element with id '"+ menu_id +"' found");
     menu_traverse(main);
     
    
     
  }
  
  /* Walks down the subtree and on the way back
     sets properties.
     returns bit set
             1: set = element is a node, unset = element is a leaf
             2: set = element contains the active node
             4: set = element is the active A node
  */
  function menu_traverse(element) {
  var menu_active_class = "active";
  var menu_leaf_class = "leaf";
  var menu_open_class = "open";
  var menu_closed_class = "closed";
    var props  = 0;
    
    // walk down
    for (var i=0; i<element.childNodes.length; i++) {
      var child = element.childNodes[i];
      props |= menu_traverse(child); // aggregate bits
    }
    
    // on the way back now
    switch (element.tagName) {
      case "UL":
        props |= 1;
        break;
        
      case "LI":
       var c1
	if (props & 1) {
		if (props & (2|4)) {
			c1 = menu_open_class;
			} else {
			c1 = menu_closed_class;
		} 
	} else {
		c1 = menu_leaf_class; 
	}
	/* shorthand version
        var c1 = (props & 1) ? 
                   ((props & (2|4)) ? menu_open_class : menu_closed_class)
                 : menu_leaf_class; 
   	*/
	
	
	 element.className = element.className ? element.className+" "+c1 : c1;
	 
	 if (c1 == menu_open_class) {
	 	if (element.childNodes.length > 0) {
			if (element.childNodes[0].tagName == "A") {
				element.childNodes[0].className += " bold normalDownArrow";
			}
		 }
	 }
	 
	 if (c1 == menu_leaf_class || c1 == menu_closed_class) {
	 	if (element.childNodes.length > 0) {
			if (element.childNodes[0].tagName == "A") {
				element.childNodes[0].className += "  normalBullet";
			}
		 }
	 }
	 
	 
	 
	 if (props & 4) {
		 if (element.childNodes.length > 0) {
			element.childNodes[0].className += " bold activeArrow highlightBackground";
		 }
		if (!(props & 2)) { 
			element.className += " "+menu_active_class;
			// cycle through and add highlightedBullet to elements below
			 for (var j=0; j<element.childNodes.length; j++) {
				 //document.write("j-loop:" + element.childNodes[j].tagName);
				 if (element.childNodes[j].tagName == "UL") {
				 	for (var x=0; x<element.childNodes[j].childNodes.length; x++) {
						if (element.childNodes[j].childNodes[x].tagName == "LI") {
							element.childNodes[j].childNodes[x].className += " highlightBackground";
							for(var z=0; z<element.childNodes[j].childNodes[x].childNodes.length; z++) {
								if (element.childNodes[j].childNodes[x].childNodes[z].tagName == "A") {
									element.childNodes[j].childNodes[x].childNodes[z].className += " highlightBullet highlightBackground";
								}
							}
						}
					}
				 }
			 }
			
			
		}
			props |= 2;
			props &= 1 | 2; // reset bit 4
	}
	
	
	
	
        break;
        
      case "A":
	
        if (props & 2) break; // once is enough
        var href = element.getAttribute("href");
        if (menu_isSameUrl(menu_url, href)) props |= 4;
        break;
    }
    
    return props;
  }
 
  //matches two URIs when href is the last part of url
  //.. and . are correctly resolved
  function menu_isSameUrl(url, href) {
    var a = url.split(/[?\/]/i);
    var b = href.split(/[?\/]/i);
    var i = a.length - 1;
    var j = b.length - 1;
    while ((i >= 0) && (j >= 0)) {
      if (b[j] == "..") { j-=2; continue; }
      if (a[i] == "..") { i-=2; continue; }
      if ((b[j] == ".") || (b[j] == "")) { j--; continue; }
      if ((a[i] == ".") || (a[i] == "")) { i--; continue; }
      if (! (a[i] == b[j])) return false;
      i--;
      j--;
    }
    return true;
  }
  
  /* End New Code */





startList = function(){
if (document.all&&document.getElementById){
  navRoot = document.getElementById("nav");
  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", "");
			}
		}
	}
  }
}
window.onload=startList;


var win = null;
function newWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function writeIndicator(expires,what) {
	var today = new Date();
	if (what == 'new' && today < expires) {
		document.write("<span class='accenttext'><strong>New!</strong></span>");
	} else if (what == 'updated' && today < expires) {
		document.write("<span class='accenttext'><strong>Updated!</strong></span>");
	} else {
		document.write("");
	}
}

function setupRollovers() {
  if (!document.getElementsByTagName)
    return;
  var all_links = document.getElementsByTagName('a');
  for (var i = 0; i < all_links.length; i++) {
    var link = all_links[i]; 
    if (link.className &&
        (' ' + link.className + ' ').indexOf(' rollover ') != -1) {
      if (link.childNodes &&
          link.childNodes.length == 1 &&
          link.childNodes[0].nodeName.toLowerCase() == 'img') {
        link.onmouseover = mouseover;
        link.onmouseout = mouseout;
      }
    }
  }
}

function find_target(e)
{

	var target; 
	
	if (window.event && window.event.srcElement) 
		target = window.event.srcElement;
	else if (e && e.target)
		target = e.target;
	if (!target)
		return null;
	
	while (target != document.body && target.nodeName.toLowerCase() != 'a')
		target = target.parentNode;
	
	if (target.nodeName.toLowerCase() != 'a')
		return null;
	
	return target;
}

function mouseover(e) {
	var target = find_target(e);
	if (!target) return;
	var img_tag = target.childNodes[0];
	img_tag.src = img_tag.src.replace(/(\.[^.]+)$/, '_over$1');
}

function mouseout(e) {
	var target = find_target(e);
	if (!target) return;
	var img_tag = target.childNodes[0];
	img_tag.src = img_tag.src.replace(/_over(\.[^.]+)$/, '$1');
}

// When the page loads, set up the rollovers
window.onload = setupRollovers;

function toggleLayer(whichLayer)
{
	if (document.getElementById)	{
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all) {
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers) {
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}
