var objHTTPServiceGlobal = null
var strResponseFunctionGlobal = null

function httpServiceObject(in_strUrl, in_strResponseFunction)
{
	this.strUrl = in_strUrl;
	this.strResponseFunction = in_strResponseFunction;
	this.objRequest = null;
	this.strMethod = 'POST';
	this.strContentType = 'application/x-www-form-urlencoded';
	this.objLastResult = null;
	this.bolIsInit = false;

	this.init = function()
	{
		this.objRequest = this.createXMLHttpRequest();
		objHTTPServiceGlobal = this;
		strResponseFunctionGlobal = this.strResponseFunction;
	}

	this.createXMLHttpRequest = function()
	{
		var objRequest = null;
		try
		{
			objRequest = new ActiveXObject("MSXML2.XMLHTTP");
		}
		catch (exc)
		{
			try
			{
				objRequest = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (exc)
			{
				if (typeof XMLHttpRequest != "undefined") 
				{
					objRequest = new XMLHttpRequest;
				}
			}
		}
		return objRequest;
	}

	this.send = function(in_strData)
	{
		this.objRequest.open(this.strMethod, this.strUrl, true);
		if (in_strData)
		{
			this.objRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			this.objRequest.setRequestHeader('Content-length', in_strData.length);
		}
		this.objRequest.onreadystatechange = handleResponse;
		this.objRequest.send(in_strData);
		this.bolIsInit = false
	}

	function handleResponse()
	{
		if (objHTTPServiceGlobal.objRequest.readyState == 4)
		{
			if(objHTTPServiceGlobal.objRequest.status == 200)
			{
				//alert(objHTTPServiceGlobal.objRequest.responseText);
				var objXml = objHTTPServiceGlobal.objRequest.responseXML;
				objHTTPServiceGlobal.lastResult = objXml;
				objHTTPServiceGlobal.bolIsInit = true;
				
				eval(strResponseFunctionGlobal + '()');
			}
			else
			{
				alert("Error loading data");
			}
		}
	}
}