function addLoadEvent(func) {
/* This handy function from Simon Willison allows you to stack up 'window.onload' events without them stepping on each other's toes. */
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function openAWindow( pageToLoad, winName, width, height, center, resize, scroll) {
/* Old pop-up */
	xposition=0; yposition=0;

	if (resize==null) { resize=1; }
	if (scroll==null) { scroll=1; }

	if ((parseInt(navigator.appVersion) >= 4 ) && (center)) {
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;
	}

	args = "width=" + width + ","
	+ "height=" + height + ","
	+ "location=0,"
	+ "menubar=0,"
	+ "resizable=" + resize + ","
	+ "scrollbars=" + scroll + ","
	+ "status=0,"
	+ "titlebar=0,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + ","  //NN Only
	+ "screeny=" + yposition + ","  //NN Only
	+ "left=" + xposition + ","     //IE Only
	+ "top=" + yposition;           //IE Only

	window.open( pageToLoad,winName,args );
}

function windowLinks() {
/* Accessible, unobtrusive popup code */
/* From the technique explained in the March 2006 edition of the SitePoint Design View. */
	if(!document.getElementsByTagName) {
		return;
	}
	var anchors = document.getElementsByTagName("a");
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		var relIndex = anchor.rel;
		if (relIndex){
			var relSplit = relIndex.split("|");
/* XHTML compliant target attribute */
		if (relSplit[0] == "external") {
			anchor.target = "_blank";
			anchor.className = "external";
			anchor.title = "Load in new window: "+ anchor.href;
/* XHTML compliant popup attribute */
		} else if (relSplit[0] == "pdf") {
			anchor.target = "_blank";
			anchor.className = "external";
			anchor.title = "Load in new window: "+ anchor.href;
		} else if (relSplit[0] == "popup") {
			anchor.className = "popup";
			anchor.title = "Link loads in Popup Window";
			anchor.popupName = relSplit[1];
			anchor.popupWidth = relSplit[2];
			anchor.popupHeight = relSplit[3];
			anchor.popupPos = relSplit[4];
			anchor.onclick = function() {openAWindow(this.href,this.popupName,this.popupWidth,this.popupHeight,this.popupPos);return false;};
			}
		}
	}
}

function startList() {
/* Kleenex flyout nav */
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("mainnav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

addLoadEvent(function() {
	windowLinks();
	startList();
// otherFunctions();
// goHere();
});
