//this is derived from a proof of concept by Stoyan Stefanov, phpied.comfunction makeHttpRequest(url, callback_function, return_xml){   var http_request = false;   if (window.XMLHttpRequest) { // Mozilla/Firefox, Safari, Gecko       http_request = new XMLHttpRequest();       if (http_request.overrideMimeType) {           http_request.overrideMimeType('text/xml');       }   } else if (window.ActiveXObject) { // IE       try {           http_request = new ActiveXObject("Msxml2.XMLHTTP");       } catch (e) {           try {               http_request = new ActiveXObject("Microsoft.XMLHTTP");           } catch (e) {}       }   }  //we don't want to display an error message; just a static ad  if (!http_request) {      //alert('Sorry, your browser doesn\'t support this feature.');       return false;   }   http_request.onreadystatechange = function() { //if request is complete if (http_request.readyState == 4) {  //if status is OK  if (http_request.status == 200) {               if (return_xml) {                   eval(callback_function + '(http_request.responseXML)');               } else {                   eval(callback_function + '(http_request.responseText)');               }           } else {  //again, use a static ad  alert('There was a problem with the request.(Code: ' + http_request.status + ')');           }       }   }   http_request.open('GET', url, true);   http_request.send(null);}function loadContent(xml){ 	var current_ad = xml.getElementsByTagName('content').item(0).firstChild.nodeValue;    var reload_after = xml.getElementsByTagName('reload').item(0).firstChild.nodeValue;//this identities id/class name in HTML file	document.getElementById('adrotate').innerHTML = current_ad;//if reload value in XML file > 0, we're using a timer to rotateif (reload_after > 0) {    try {        clearTimeout(to);    } catch (e) {}    to = setTimeout("nextAd()", parseInt(reload_after));}}function nextAd(){    var now = new Date();    var url = 'rotatecontent.php?ts=' + now.getTime();    makeHttpRequest(url, 'loadContent', true);}//let's load next ad in rotation when page refreshedwindow.onload = nextAd;