function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
		{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}


// ajaxRun
// url - server url to process
// callback - javascript function to use as the callback
// method - GET or POST
// qs - the query string for GET, the post data for POST
// noAsync - true to run non asynchronously
// passXMLObj - pass the xmlobject to the callback function
function ajaxRun(url, callback, method, qs, noAsync, passXMLObj){
	if(!noAsync){
		noAsync = false;
	}
	var xmlHttp = null;
	xmlHttp = GetXmlHttpObject();
	if(xmlHttp == null){
		alert("Your browser does not support AJAX!");
		return;
	}
	if(method=="GET"){
		url = url + "?" + qs;
	}
	// Check if we're passing the XML object to the callback function
	if(passXMLObj){
		var cb = callback;
		callback = function(){
			var xmlObj = xmlHttp;
			cb(xmlObj);
			return;
		}
	}
	// The magic happens next
	xmlHttp.open( method, url, !noAsync );
	xmlHttp.onreadystatechange = callback;
	if(method=="POST"){
		xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttp.send(qs);
	}else{
		xmlHttp.send(null);
	}
	return;
}
