function getXmlHttpObject() {
	var xmlHttp = null;
	try { xmlHttp = new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari
	catch (e) {	// Internet Explorer
		try {       xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");	  }
		catch (e) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	}
	return xmlHttp;
}

function setkalenderstatus(helperid, timestamp, newstatus) {
	var element = document.getElementById("h"+helperid+"t"+timestamp);
	element.innerHTML = '<img src="img/throbber.gif" width=20 height=20>';
	var xmlHttp = getXmlHttpObject();
	xmlHttp.open("GET", "kalendersetstatus.php?helperid="+helperid+"&timestamp="+timestamp+"&newstatus="+newstatus);
	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4 && xmlHttp.status == 200) { 
			if (newstatus == 'Y') {
				element.innerHTML = '<img width=30 height=30 style="cursor:pointer;" src=img/oksmall.gif onClick="setkalenderstatus(\''+helperid+'\',\''+timestamp+'\',\'N\');">';
			}
			else {
				element.innerHTML = '<img width=30 height=30 style="cursor:pointer;" src=img/negsmall.gif onClick="setkalenderstatus(\''+helperid+'\',\''+timestamp+'\',\'Y\');">';
			}
		}
	}
	xmlHttp.send(null);
}

