//Replace the 'body' part of the page with the contents of the next page
function renderPage(data) {
	var data = data.replace(/\n/g,"");//Or replace '\n' with a space
	var body = data.replace(/^.*<body[^>]*>/,"");
	body = body.replace(/<\/body><\/html>/,"");
	document.getElementsByTagName('body')[0].innerHTML = body;
	toggle($("loading"),"none");
	if(data) init();//Re-run the init function for the new page.
}
function init() {
	var anchs = getElementsByClassName("hyperlink2","a");
	for(var i=0; lnk=anchs[i],i<anchs.length; i++) {
		lnk.onclick=function(e) {
			var page=this.href;
			toggle($("loading"),"inline");
			jx.load(page,renderPage,"html");

			if(!e) var e = window.event;
			//e.cancelBubble is supported by IE - this will kill the bubbling process.
			e.cancelBubble = true;
			e.returnValue = false;
		
			//e.stopPropagation works only in Firefox.
			if (e.stopPropagation) {
				e.stopPropagation();
				e.preventDefault();
			}
		}
	}
}
addEvent(window,'load',init);