var on = false;
prep = function() {
	// IE menu
	var mainList = document.getElementById("nav");
	for (var i = 0; i < mainList.childNodes.length; i++) {
		if (mainList.childNodes[i].nodeName == "LI") {
			var mainListItem = mainList.childNodes[i];
			mainListItem.onmouseover = function() {
				var menu = this.getElementsByTagName("UL");
				if (menu.length > 0) {
					menu[0].style.display = "block";
				}
				on = true;
			}
			mainListItem.firstChild.onfocus = function() {
				var menu = this.parentElement.getElementsByTagName("UL");
				if (menu.length > 0) {
					menu[0].style.display = "block";
				}
				on = true;
			}
			mainListItem.onmouseout = function() {
				var menu = this.getElementsByTagName("UL");
				if (menu.length > 0) {
					menu[0].style.display = "none";
				}
				
			}
			mainListItem.firstChild.onblur = function() {
				if (!on) {
					var menu = this.parentElement.getElementsByTagName("UL");
					if (menu.length > 0) {
						menu[0].style.display = "none";
					}
				}
			}
		}
	}
}
window.onload = prep;

// Sets a class to all external links
function StyleExternalLinks()
{
 var divs = document.getElementsByTagName("div");
 for (i = 0; i < divs.length; i++)
 {
  var anchors = divs[i].getElementsByTagName("a");

  for (a = 0; a < anchors.length; a++)
  {
   if (anchors[a].href.substring(0,13) != location.href.substring(0,13))
    anchors[a].className += "external";
  }
 }
}