/* dropnav.js version 1.13*/
/***************************************************
This file should not need modification.
****************************************************/


var myrules = {
	'#topNav li' : function(el){	
		el.onmouseover = function(){			
			if(this.getElementsByTagName("UL").item(0)) {
				//alert(this.getElementsByTagName("A").item(0).className)
				this.getElementsByTagName("UL").item(0).className = "IEshow";

				var changeBorder = !sideNavHasChild(this.getElementsByTagName("UL").item(0));	
				
				//for when there is no side nav but there are drop-down menus
				if(changeBorder){
					changeBorder = !currentNavHasChild(this.getElementsByTagName("UL"));
				}			

				if(changeBorder && !this.getElementsByTagName("A").item(0).className.match(/currentPage/)){
					this.getElementsByTagName("A").item(0).style.borderBottom = "6px solid #009dd9";
				}
			}
		},
		el.onmouseout = function(){			
			if(this.getElementsByTagName("UL").item(0)) {
				this.getElementsByTagName("UL").item(0).className = "";				
				
				var changeBorder = !sideNavHasChild(this.getElementsByTagName("UL").item(0));		

				//for when there is no side nav but there are drop-down menus
				if(changeBorder){
					changeBorder = !currentNavHasChild(this.getElementsByTagName("UL"));
				}			

				if(changeBorder && !this.getElementsByTagName("A").item(0).className.match(/currentPage/)){
					this.getElementsByTagName("A").item(0).style.borderBottom = "6px solid #ddd";
				}
			}
		}
	},	
	'#topNav li a' : function(el){
		var root = document.getElementById("topNav");
		var ulList = root.getElementsByTagName("UL");
		el.onfocus = function(){			
			if(this.parentNode.parentNode.id == "topNav") {
				for(var i = 0; i < ulList.length; i++) {		
					ulList.item(i).className = "";
				}
			}

			if(this.parentNode.getElementsByTagName("UL").item(0)) {
				this.parentNode.getElementsByTagName("UL").item(0).className = "show";
			}
		},
		el.onblur = function(){	
			var parentUlLinks = this.parentNode.parentNode.getElementsByTagName("A");
			
			//alert(this.parentNode.parentNode.parentNode.id);		
			if(parentUlLinks.item(parentUlLinks.length -1).href == this.href ) {		
				for(var i = 0; i < ulList.length; i++) {		
					ulList.item(i).className = "";
				}
			}
		}
	},	
	'#siteSpecific li a' : function(el){
		el.onfocus = function(){
			hideMenu("topNav", "UL");
			hideMenu("sideNav", "OL");
		}
	},	
	'#globalLinks li a' : function(el){
		el.onfocus = function(){		
			hideMenu("topNav", "UL");
			hideMenu("sideNav", "OL");
		}
	},
  '#sideNav li' : function(el){	
		el.onmouseover = function(){			
			//alert("hello");
			if(this.getElementsByTagName("OL").item(0)) {
				this.getElementsByTagName("OL").item(0).className = "IEshow";

				var changeBorder = !currentNavHasChild(this.getElementsByTagName("OL"));

				if(changeBorder && !this.getElementsByTagName("A").item(0).className.match(/currentPage/)){
					this.getElementsByTagName("A").item(0).style.borderLeft = "6px solid #009dd9";
				}
			}
		},
		el.onmouseout = function(){			
			if(this.getElementsByTagName("OL").item(0)) {
				this.getElementsByTagName("OL").item(0).className = "";	

				var changeBorder = !currentNavHasChild(this.getElementsByTagName("OL"));

				if(changeBorder && !this.getElementsByTagName("A").item(0).className.match(/currentPage/)){
					this.getElementsByTagName("A").item(0).style.borderLeft = "6px solid #ddd";
				}			
			}
		}
	},	
	'#sideNav li a' : function(el){
		var root = document.getElementById("sideNav");
		var ulList = root.getElementsByTagName("OL");

		el.onfocus = function(){			
			if(this.parentNode.parentNode.id == "sideNav") {
				for(var i = 0; i < ulList.length; i++) {		
					ulList.item(i).className = "";
				}
			}

			if(this.parentNode.getElementsByTagName("OL").item(0)) {
				this.parentNode.getElementsByTagName("OL").item(0).className = "show";
			}
		},
		el.onblur = function(){	
			var parentUlLinks = this.parentNode.parentNode.getElementsByTagName("A");
					
			if(parentUlLinks.item(parentUlLinks.length -1).href == this.href ) {		
				for(var i = 0; i < ulList.length; i++) {		
					ulList.item(i).className = "";
				}
			}
		}
	},
  '#tabNav li' : function(el){	
		el.onmouseover = function(){			
			
			//alert("Mouseover");
			if(this.getElementsByTagName("DIV").item(0)) {
				this.getElementsByTagName("DIV").item(0).className = "IEshow";
			}
		},
		el.onmouseout = function(){			
			if(this.getElementsByTagName("DIV").item(0)) {
				this.getElementsByTagName("DIV").item(0).className = "";					
			}
		}
	},	
	'#tabNav li a' : function(el){
		var root = document.getElementById("tabNav");
		var ulList = root.getElementsByTagName("DIV");

		el.onfocus = function(){			
			if(this.parentNode.parentNode.id == "tabNav") {
				for(var i = 0; i < ulList.length; i++) {		
					ulList.item(i).className = "";
				}
			}

			if(this.parentNode.getElementsByTagName("DIV").item(0)) {
				this.parentNode.getElementsByTagName("DIV").item(0).className = "show";
			}
		},
		el.onblur = function(){	
			var parentUlLinks = this.parentNode.parentNode.getElementsByTagName("A");
					
			if(parentUlLinks.item(parentUlLinks.length -1).href == this.href ) {		
				for(var i = 0; i < ulList.length; i++) {		
					ulList.item(i).className = "";
				}
			}
		}
	},
  '#tabNav li div' : function(el){	
		el.onmouseover = function(){			
			
			//alert("Mouseover");
			if(this.parentNode.getElementsByTagName("A").item(0)) {
				this.parentNode.getElementsByTagName("A").item(0).className += " parentHighlight";
			}
		},
		el.onmouseout = function(){			
			if(this.parentNode.getElementsByTagName("A").item(0)) {
				var tempClassName = this.parentNode.getElementsByTagName("A").item(0).className.replace(/parentHighlight/, "")
				this.parentNode.getElementsByTagName("A").item(0).className = tempClassName;					
			}
		}
	},
  '#tabNavMB li' : function(el){	
		el.onmouseover = function(){			
			
			//alert("Mouseover");
			if(this.getElementsByTagName("DIV").item(0)) {
				this.getElementsByTagName("DIV").item(0).className = "IEshow";
			}
		},
		el.onmouseout = function(){			
			if(this.getElementsByTagName("DIV").item(0)) {
				this.getElementsByTagName("DIV").item(0).className = "";					
			}
		}
	},	
	'#tabNavMB li a' : function(el){
		var root = document.getElementById("tabNavMB");
		var ulList = root.getElementsByTagName("DIV");

		el.onfocus = function(){			
			if(this.parentNode.parentNode.id == "tabNav2") {
				for(var i = 0; i < ulList.length; i++) {		
					ulList.item(i).className = "";
				}
			}

			if(this.parentNode.getElementsByTagName("DIV").item(0)) {
				this.parentNode.getElementsByTagName("DIV").item(0).className = "show";
			}
		},
		el.onblur = function(){	
			var parentUlLinks = this.parentNode.parentNode.getElementsByTagName("A");
					
			if(parentUlLinks.item(parentUlLinks.length -1).href == this.href ) {		
				for(var i = 0; i < ulList.length; i++) {		
					ulList.item(i).className = "";
				}
			}
		}
	},
  '#tabNavMB li div' : function(el){	
		el.onmouseover = function(){			
			
			//alert("Mouseover");
			if(this.parentNode.getElementsByTagName("A").item(0)) {
				this.parentNode.getElementsByTagName("A").item(0).className += " parentHighlight";
			}
		},
		el.onmouseout = function(){			
			if(this.parentNode.getElementsByTagName("A").item(0)) {
				var tempClassName = this.parentNode.getElementsByTagName("A").item(0).className.replace(/parentHighlight/, "")
				this.parentNode.getElementsByTagName("A").item(0).className = tempClassName;					
			}
		}
	}

};

Behaviour.register(myrules);



