//A REALLY MESSY JAVASCRIPT FILE
//LOTS OF THIS COPIED FROM http://jibbering.com/2002/4/httprequest.html

var contentDiv = document.getElementById('middle');
var contentHeader = contentDiv.getElementsByTagName('h3')[0];
var contentBody = contentHeader.nextSibling;

var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE
// versions and security blocked creation of the objects.
try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	try {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
		xmlhttp = false;
	}
}
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	xmlhttp = new XMLHttpRequest();
}

if (xmlhttp !== undefined) {
	function setText(fileName, headerText) {
		xmlhttp.open("GET", "spitter.cgi?"+fileName, true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				contentHeader.innerHTML = headerText;
				contentBody.innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(null)
	}

	var newLinks = [
//	   'news', 'bio', 'recordings', 'computers', 'miscellaneous', 'contact'
	   'news', 'computers', 'bio', 'recordings', 'miscellaneous', 'contact'
	];

	var anchors = document.getElementsByTagName('a');
	for (var a=0; a < anchors.length; a++) {
		if (newLinks[a] !== undefined) {
			anchors[a].href = "javascript:setText('"+newLinks[a]+"','"+anchors[a].childNodes[0].nodeValue+"')";
		}
	}
}

