// Ajax functions
// (c) joe marini 2005

var xmlhttp = null; // the XMLHttpRequest object

function createRequest()
{
	var reqObj = null;
	try {
		reqObj = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (err)	{
		try {
			reqObj = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (err2) {
			try {
				reqObj = new XMLHttpRequest();
			}
			catch (err3) {
				reqObj = null;
			}
		}
	}
	return reqObj;
}


function getURL(url, callback, isAsync)
{
	// if the request is already executing then stop it (executing means in  a state
	// other than 0 (uninitialized) or 4 (completed).
	if (xmlhttp != null) {
		if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0)
			xmlhttp.abort();
	}
	
	xmlhttp = createRequest();
	if (xmlhttp != null) {
		xmlhttp.open("GET", url, isAsync);
		
		
		
		xmlhttp.onreadystatechange=callback;
		xmlhttp.send(null);
	}
}

function postURL(url, callback, isAsync, data)
{
	// if the request is already executing then stop it (executing means in  a state
	// other than 0 (uninitialized) or 4 (completed).
	if (xmlhttp != null) {
		if (xmlhttp.readyState != 4 && xmlhttp.readyState != 0)
			xmlhttp.abort();
	}
	
	xmlhttp = createRequest();
	if (xmlhttp != null) {
		xmlhttp.open("POST", url, isAsync);
		xmlhttp.onreadystatechange=callback;
		xmlhttp.send(data);
	}
}
