function onload_primaryNav(){

	/*
	 *	This function combined with "setHAlignOffset()" are used to evenly distribute the primary 
	 *		navigation "li" elements across their parent element, which is the "ul" element. The 
	 *		margin values could be set in the style sheet, but depending on the browser vendor and 
	 *		platform that is being used, the widths of the "li" elements vary to much. The reason 
	 *		they vary is related to whether the text is aliased or not. Mac aliased fonts are 
	 *		different than Windows aliased fonts and Mac anti-aliased fonts are different than Windows 
	 *		anti-aliased fonts.
	 *		
	 *		1. Running IE6 or IE7 on windows with "clear-type" turned off
	 *		2. Running IE6 or IE7 on windows with "clear-type" turned on
	 *		3. Firefox and Opera on windows do not alias text
	 *		4. Firefox, Safari and Opera on Mac, alias text by default
	 *		
	 *		How this function works. This function subtracts the width of the parent element(ul)
	 *		from the combined width of the "li" elements. The left over value is then divided by the
	 *		total number of "li" elements. This new value is then divided by 2, which yields the 
	 *		left and right margin value for the "li" elements.
	 *		
	 */
	
	function getHAlignOffset(){
		var parent = document.getElementById(arguments[0]);
		var parentNodeWidth = parent.offsetWidth;
		var childNodesWidth = 0;
		var childNodesLength = 0;
		
		for(var i=0; i<parent.childNodes.length; i++){
			if(parent.childNodes[i].nodeType != 3){
				childNodesLength += 1;
				childNodesWidth += parent.childNodes[i].offsetWidth;
																				
			}
			
		}
		return Math.floor(((parentNodeWidth - childNodesWidth) / childNodesLength) / 2);
		
	}
	
	
	
	
	
	/*
	 *	This function is used to set the left and right margin values that are returned by the 
	 *		"getHAlignOffset()" function.
	 *
	 */
	 
	function setHAlignOffset(){
		var parent = document.getElementById(arguments[0]);
			
		for(var i=0; i<parent.childNodes.length; i++){
			if(parent.childNodes[i].nodeType != 3){
				parent.childNodes[i].style.marginLeft = arguments[1] + "px";
				parent.childNodes[i].style.marginRight = arguments[1] + "px";
				parent.childNodes[i].style.visibility = "visible";
																										
			}
						
		}
			
	}
	setHAlignOffset("primary-nav", getHAlignOffset("primary-nav"));
	setHAlignOffset("footer-nav", getHAlignOffset("footer-nav"));
	
	
	
	
	
	/*
	 *	This loop registers mouseover and mouseout events for primary navigation li elements. These
	 *		events are are used to show and hide secondary navigation menus if they exist. The event
	 *		logic is nested inside a "try-catch" statement because not all primary navigation links
	 *		have a secondary navigation menu, so this will trap any errors that occur. The "finally"
	 *		statement always executes and every primary navigation elements text turns black on
	 *		mouseover whether a secondary navigation menu exists or not. The secondary navigation 
	 *		menus use "visibility:visible and hidden" instead of "display:block and none" so that css
	 *		properties can be applied while the element is not visible.
	 *			
	 */
	
	var nav = document.getElementById("primary-nav");
	for(var i=0; i<nav.childNodes.length; i++){
		if(nav.childNodes[i].nodeName.toLowerCase() == "li"){
			nav.childNodes[i].onmouseover = function(){
				try{
					this.getElementsByTagName("div")[0].style.visibility = "visible";
					
				}catch(e){}finally{
					this.getElementsByTagName("a")[0].style.color = "#999";
												
				}
			
			}
			nav.childNodes[i].onmouseout = function(){
				try{
					this.getElementsByTagName("div")[0].style.visibility = "hidden";
					
				}catch(e){}finally{
					this.getElementsByTagName("a")[0].style.color = "#fff";
					
				}
			
			}
											
		}
				
	}

}