// Create the XMLHttpRequest
	var xHRObject = false;
	
	if (window.XMLHttpRequest) {
		xHRObject = new XMLHttpRequest();
	} else if (window.ActiveXObject){
		xHRObject = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	function getData(){
		// Check to see whether the XMLHttpRequest Object is ready and whether it has returned a valid response 
		if(xHRObject.readyState == 4 && xHRObject.status == 200) {
			var responseTextHTML = xHRObject.responseText;
			var HTML_arr = responseTextHTML.split("=ID;",2);
			var adId = parseInt(HTML_arr[0]);
			var DivInnerHTML = HTML_arr[1];
			var rotator = document.getElementById("ad_rotator");
			rotator.innerHTML = DivInnerHTML;
			setTimeout("getDocument("+ adId +")", 12000);
		}		
	}
	
	function getDocument(adId) {
		// Reset the function
		xHRObject.onreadystatechange = getData;
		
		// IE will cache the GET request, the only way around this is to append a different query string. We add a new date and append it to the query string
		xHRObject.open("GET", "responsexmlforads.php?id=" + adId + "&random=" +Number(new Date), true);
		xHRObject.send(null);
	}
	
	window.onload = function() {
		getDocument('0');
	}