function Ajax()
{
	var self = this;
	
	// XMLHTTP object
	var xmlHttp;
	var callbackFunction;

	// public methods
	self.execute = execute;

	// call XMLHTTP to get source data
	function execute(commandID,param,callbackFunction)
	{
		if(commandID==null || commandID=='')
			commandID = 'Unknown';
		if(callbackFunction==null)
			alert('Javascript:CallbackFunction parameter is not set.');
		self.callbackFunction = callbackFunction;
		var requestUrl = 'Ajax.aspx?CommandID=' + commandID + '&' + param;
		xmlHttp = getXMLHTTP();
		if (xmlHttp)
		{
			xmlHttp.onreadystatechange = doReadyStateChange;
			xmlHttp.open("GET", requestUrl, true);
			xmlHttp.send(null);
		}			
	}
	
	// process the response from XMLHTTP
	function doReadyStateChange()
	{
		if (xmlHttp.readyState == 4)
		{
			if (xmlHttp.status == 200)
			{
				var response = xmlHttp==null ? null : xmlHttp.responseText;
				if(self.callbackFunction)
					self.callbackFunction(response);
			}
		}			
	}	

	// get XMLHTTP object
	function getXMLHTTP()
	{
		var A = null;
		try{
			A = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			try{
				A = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(oc){
				A = null;
			}
		}
		if(!A && typeof XMLHttpRequest != "undefined") {
			A = new XMLHttpRequest();
		}
		return A;
	}
}
