// Standardize DOM method
if(document.all && !document.getElementById) {
    document.getElementById = function(id) {
         return document.all[id];
    }
}

// Setup the dynamic JS for the page
setupMenu = function() {

	// Use mouseOver and mouseOut to dynamically add and remove the 'visible' class on the drop down menu
	navNode = document.getElementById("nav").getElementsByTagName("LI");
	for (i = 0; i < navNode.length; i++) {
		navNode.onmouseover=function() {
			this.className += " over";
		}
		
		navNode.onmouseout=function() {
			this.className = this.replace(new RegExp(" over\\b", ""));
		}
	}

	// Cycle through all of the links on the page
	var links = document.links, link, k=0;
	while(link=links[k++]) {

		// Add '(External Link)' to all links specified with the seperateWindow class name.
		// 	(All external links use the onclick function to open in a new window due to the deprication of the target property.)
		if (link.className.match("seperateWindow")) {
			link.onclick = function() {
				window.open(this.href);
				return false;
			}
			extraInfo = " (External Link)";
			link.title = link.title + extraInfo;
		}

		// Set the status bar of the browser to display the links tooltip on mouseover
		link.onmouseover = function() {window.status = this.title; this.onclick; return true;}
		link.onmouseout = function() {window.status = ""; return true;}
	}
}

// Initialize the drop down menu
window.onload = setupMenu;
