/* 	nav.js - Gives a specified nav item the class name "current".

------------------------------------------------------------------------

	Usage

------------------------------------------------------------------------

   	

   	Each nav item must have the prefix "nav_" followed by a unique name:



		<li id="nav_home">

			<a href="#">home</a>

		</li>

   	

   	Add the onload function to the body element and reference the unique part of the nav id.

   	

		<body onload="highlight('home')">

   	

------------------------------------------------------------------------*/







function highlight(navid,subnavid) {

	if(document.getElementById){

		// Highlight the nav item for this page

		if (navid) {

			document.getElementById( 'nav_' + navid ).className = 'OnMenu';

		}

		if(subnavid){

			//highlight subnav if applicable

			document.getElementById( 'subnav_' + subnavid ).className = 'current';

		}

		return;

	}

}







// replaces A element with id "navID" with a strong tag

// improves accessibility and ensures that current page nav link

// isn't clickable

function unclick(navId)

{	



  	if (!document.getElementById(navId)) return false;



	var link = document.getElementById(navId);

	

	if (!link.getElementsByTagName("A")) return false;

	

	//get the first anchor element

	aTag = link.getElementsByTagName("A")[0];

	aTagText = aTag.childNodes[0].nodeValue;

	

	

	var replacementTag = document.createElement("strong");

	

	var replacementTagText = document.createTextNode(aTagText);

	

	

	replacementTag.appendChild(replacementTagText);

	//swaps the A tag with a strong tag but maintains the a tag text

	link.replaceChild(replacementTag,aTag);

}







function highlight_subnav() {

	// Highlight the right subnav item by comparing the URL with

	// the href of each <a> elt in the <div id="subnav">, or by

	// using the hint if supplied as arguments[0]. The hint

	// specifies a part of the URL, useful for actions with

	// lots of paramters

	

	var this_page = document.location.href;

	

	// Remove anchor if there is one -- anything following #, including #

	this_page = this_page.replace( /\#.*/, '' );

	

	var hint = "";

	if (arguments[0]) {

		hint = arguments[0];

	}

	

	

	// Try both subnav and subnavIndent for our item to highlight

	

	var divs = [ "secondary-content" ];

	for (var d = 0; d < divs.length; d++) {

	

		if (document.getElementById(divs[d])) {

			var subnav_elts = document.getElementById(divs[d]);

			var aTags = subnav_elts.getElementsByTagName("A");

 			var i = 0;

			for (i = 0; i < aTags.length; i++) {

				// Is this a link?

				var elt = aTags[i]

 					if (elt.href == this_page || (hint && elt.href.indexOf(hint) != -1) ) {

						elt.className = elt.className + " currentsection";

					 

						

						

					}

 			}

		}

	}

		



} 



//addLoadEvent(highlight_subnav);





// Use javascript to hide news archive sub navigation links, so that they will be visible by 
// default to users with Javascript disabled.
function hideArchive(currcat) {
	alert(currcat);
	var container = document.getElementById('archiveLinks');
	var elements = container.getElementsByTagName('div');
	for ( var i = 0; i < elements.length ; i++) {
		if (elements[i].getAttribute('id') != currcat) {
			elements[i].style.display = 'none';
		}
	}
}	


















 
