/////////////////////////////////////////////////////////////////////////////////////////////////
//Add all document funcitonality when page is finished loading (jquery's version of window.onload)
 $(document).ready(function(){


	////////////////////////////////////////////////////////////////////////////
	//IE6 hover bug fix
	//allow function to only add mouse events if browser is IE
	if (document.all&&document.getElementById) {
		//get navigation menu parent
		navRoot = document.getElementById("nav");
		//get all list items
		if (navRoot != null) {
			liList = navRoot.getElementsByTagName("li");
			//add onmounseover and onmouseout events to each <li>
			//that change the class of the element top .over
			for (i = 0; i < liList.length; i++) {
				node = liList[i];
				if (node.nodeName == "LI") {
					node.onmouseover = function(){
						this.className += " over";
					}
					node.onmouseout = function(){
						this.className = this.className.replace(" over", "");
		}	}	}	}

		navRoot = document.getElementById("sec-nav");
		if (navRoot != null) {
			liList = navRoot.getElementsByTagName("li");
			for (i = 0; i < liList.length; i++) {
				node = liList[i];
				if (node.nodeName == "LI") {
					node.onmouseover = function(){
						this.className += " over";
					}
					node.onmouseout = function(){
						this.className = this.className.replace(" over", "");
		}}}}
	}



      /////////////////////////////////////////////////////////////////////////////////////////////
   //collapse all expandable areas in secondary nav
   //$('div#secondary_nav ul ul').show();
   //alert('Testing');

   //add img link and image for expanding
   $('div#sec-nav ul li.has_children > a').after("<img src='/images/nav-expand.png' alt='nav-expand.png' />");

   //add functionality to expand and collapse hidden sub nav ul
   $('div#sec-nav ul li.has_children img').toggle(function(){
   		$(this).parent().children( 'ul' ).show('slow');
   		$(this).attr({
          src: "/images/nav-contract.png",
          alt: "nav-contract.png"
        });

   },function(){
		$(this).parent().children( 'ul' ).hide('slow');
		$(this).attr({
          src: "/images/nav-expand.png",
          alt: "nav-expand.png"
        });
   });

   //show current subnav ul
   $('div#sec-nav ul li.current img').click();

 });  //End of $(document).ready
