//AJAX library v1.0
function createREQ()
{
	try
	{
		req = new XMLHttpRequest();
	}
	catch (err1)
	{
		try
		{
			req = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (err2)
		{
			try
			{
				req = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (err3)
			{
				req = false;
			}
		}
	}
	return req;
}
function requestGET(url, query, req)
{
	myrand = parseInt(Math.random()*9999999999);
	req.open("GET", url+'?'+query+'&rand='+myrand, true);
	req.send(null);
}
function requestPOST(url, query, req)
{
	req.open("POST", url, true);
	req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	req.send(query);
}
function doAJAX(url, query, callback, reqtype, getxml)
{
	var myreq = createREQ();
	
	myreq.onreadystatechange = function()
	{
		if(myreq.readyState == 4)
		{
			if(myreq.status == 200)
			{
				if(callback != null)
				{
					var myitem = myreq.responseText;
					if(getxml == 1)
						myitem = myreq.responseXML;
					callback(myitem);
				}
			}
		}
	}
	if(reqtype == 'post')
		requestPOST(url, query, myreq);
	else
		requestGET(url, query, myreq);
}