
function nav_rollover() {

	var navlinks = document.getElementById("primary-nav").getElementsByTagName("LI");

	var secondary_nav = document.getElementById("secondary-nav");
	var orig = secondary_nav.className;

	for (var i=0; i < navlinks.length; i++) { 
		navlinks[i].onmouseover=function() {
			var id = this.id;
			secondary_nav.className = id;
		}

		navlinks[i].onmouseout=function() {
			secondary_nav.className = orig;
		}
	}
}

function replace_email() { // un-hides e-mail addresses with appropriate classname

	var links = document.getElementsByTagName( "A" );

	for ( var i = 0; i < links.length; i++ ) {
		if ( links[i].className.match( /email-link/ ) ) {
			var address_to_replace = links[i].firstChild;
			var real_address = address_to_replace.nodeValue.replace( "[at]", "@" );

			if ( links[i].getAttribute( "name" ) ) {
				address_to_replace.nodeValue = links[i].getAttribute( "name" );
			} else {
				address_to_replace.nodeValue = real_address; 
			}
			address_to_replace.parentNode.setAttribute( "href", "mailto:" + real_address );
		}
	}	
}

window.onload = function() { 
	if ( document.getElementsByTagName ) {
		nav_rollover();
		replace_email();
	}
};



