var xmlhttp;

var loader = new Image;
loader.src = "../img/contentLoader.gif";

function loadXMLDoc(url){
	document.getElementById("calendar").innerHTML = "<p class='center'><img src='misc/img/contentLoader.gif' alt='' /></p>" + document.getElementById("calendar").innerHTML;
	xmlhttp=GetXmlHttpObject();
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function GetXmlHttpObject(){
	if (window.XMLHttpRequest){
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject){
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

function stateChanged(){
	if (xmlhttp.readyState==4){
		if (xmlhttp.status==200){
			document.getElementById("calendar").innerHTML = xmlhttp.responseText;
		}
	}
}

function writeNP(NP){
	if(NP == "Next") {
		document.write(" <a href='#calendar' onclick='this.removeAttribute(\"href\"); loadXMLDoc(\"misc/js/calendar.php?To=Next\");'>&raquo;</a>");
	}else{
		document.write("<a href='#calendar' onclick='this.removeAttribute(\"href\"); loadXMLDoc(\"misc/js/calendar.php?To=Prev\");'>&laquo;</a> ");
	}
}