var xmlHttp = null;

function getXmlHttpObject() {
	try {
		xmlHttp = new XMLHttpRequest();
	}
	catch (e) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
}

function ajaxGET(url, action) {
	getXmlHttpObject();
	if (xmlHttp == null) {
		alert('No AJAX!');
		return false;
	}
	xmlHttp.onreadystatechange = action;
	xmlHttp.open("GET", url, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.send(null);
}
function ajaxPOST(url, params, action) {
	getXmlHttpObject();
	if (xmlHttp == null) {
		alert('No AJAX!');
		return false;
	}
	xmlHttp.onreadystatechange = action;
	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(params);
}


/*
 * example
 * (.responseText, .responseXML)
 *
 *************/

/*function action() {
	if (xmlHttp) {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.responseXML) {
				}
			}
			else {
				alert("No xmlHttp.responseXML! The response is:\n" + xmlHttp.responseText);
			}
		}
	}
	else {
		alert("No xmlHttp!");
	}
}*/
