/* Create a new XMLHttpRequest object to talk to the Web server */

/*

function myxmlhttpreq(id, url, update_func) {
	var xmlHttp = false;
	try {
		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e2) {
			xmlHttp = false;
		}
	}

	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
		xmlHttp = new XMLHttpRequest();
	}


	if (!xmlHttp)
	{
		alert("Your browser does not support XMLHTTP. That is bad. You should upgrade.");
	} else {
		this.url = url;
		this.xmlHttp=xmlHttp
		this.id = id;
		this.ajax_do = ajax_do;
		this.update = update_func;
	}
}

var cont2 = new myxmlhttpreq('contentdiv2','/radio/radio_stats4.php',update_cont2);

function update_cont2() {
        //document.getElementById('secs_left').innerHTML = "server status will refresh in "+sec_count+" seconds";
	
	if ((cont2) && (cont2.xmlHttp.readyState == 4 )) {
		document.getElementById(cont2.id).innerHTML = cont2.xmlHttp.responseText;
	}
}


function ajax_do() {
	var mytime= new Date().getTime();
	var url=this.url + "?ms=" + mytime ;

	this.xmlHttp.open("GET", url, true);
	this.xmlHttp.onreadystatechange=this.update;
	this.xmlHttp.send(null);
}



// this is a looper
var sec_count = 0;
function update_ajax() {
        //document.getElementById('secs_left').innerHTML = "server status will refresh in "+sec_count+" seconds";
        if ( sec_count == 0 ) {
		cont2.ajax_do();
                sec_count = 30 ;
        } else {
                sec_count-- ;
        }
}

window.onload="update_ajax()";
setInterval("update_ajax()",1000);

*/

