function ajaxSend(serverPage, onCompletion, args, xml) {
	
	function getXMLobj() {
		var xmlhttp;
		if (window.XMLHttpRequest) {	// code for IE7+, Firefox, Chrome, Opera, Safari
		  xmlhttp = new XMLHttpRequest();
		} else if (window.ActiveXObject) {	// code for IE6, IE5
		  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} else return false;
		return xmlhttp;
	}
		
	var xmlhttp = getXMLobj();
	if (!xmlhttp) return false;
	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState == 4)
			if (xml) onCompletion(xmlhttp.responseXML.documentElement);
			else onCompletion(xmlhttp.responseText);
	}

	if (serverPage.substring(serverPage.lastIndexOf(".")) != ".php") {
		xmlhttp.open("GET", serverPage, true);
		xmlhttp.send(null);
	} else {
		xmlhttp.open("POST", serverPage, true);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlhttp.send(args);
	}
	return true;
}

function ajaxText(serverPage, onCompletion, args) {
	return ajaxSend(serverPage, onCompletion, args, false);
}

function ajaxXML(serverPage, onCompletion, args) {
	return ajaxSend(serverPage, onCompletion, args, true);
}