function getXMLHTTP()
{
	try
	{
		//request_o = new ActiveXObject("Microsoft.XMLHTTP");
		request_o = new ActiveXObject("MSXML2.ServerXMLHTTP.4.0");
	}
	catch(ex)
	{
		//either this is not IE, or it is a version of IE which does not support XMLHTTP
		var notIECompatibleXMLHTTP=true;
	}
	if(notIECompatibleXMLHTTP==true)
	{
		try
		{
			request_o = new XMLHttpRequest();
		}
		catch(ex)
		{
			//we can't use AJAX because this browser is not compatible.
			request_o = false;
		}
	}
	return request_o;
}

function Request()
{
	this.request = getXMLHTTP();
	this.requestName = "test1";
	
	/** send a post request
			- urlString : the url to post to
			- handlerFunction : the function which will handle the response (function must have argument as response string)
			- errorFunction : the function which will handle an error response (function must have argument as error string)
	*/
	this.sendPostRequest = function(urlString,handlerFunction,errorFunction)
	{
		if(this.request)
		{
			this.request.open("post", urlString);
		 	this.request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			this.request.onreadystatechange = this.BindResponseFunction(this);
			this.handlerFunction = handlerFunction;
			this.errorFunction = errorFunction;
			this.request.send(null);
			this.requestName = "sentRequest"; 
		}
	}
	
	this.BindResponseFunction = function(obj)
	{
  		return function () { obj.handleResponse(obj); };
	}
	
	this.handleResponse = function(reqObj)
	{
		if(this.request && this.request.readyState == 4)
		{
			var response = this.request.responseText;
			if(response.match(/^Error/))
				this.errorFunction(response);
			else
				this.handlerFunction(response);
		}
	}
}