


function getHTTPObject()
{
	var xmlhttp= null;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = null;
		}
	}
	if (xmlhttp == null && typeof XMLHttpRequest != 'undefined')
	{
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = null;
		}
	}
	return xmlhttp;
}



function httpRequest(parameters, uri, method, isAsinchRequest, httpResponceDataHandler, isJsonResponse)
{
	var http = getHTTPObject();
	if(http == null)
		return;
	http.open(method, uri, isAsinchRequest);
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.onreadystatechange = 
		function()
		{
			if(http.readyState == 4 && http.status == 200 && http.responseText.length > 0)
			{
				if (isJsonResponse)
				{
					var jsonData = http.responseText;
					var jsonObject = eval('('+jsonData+')');
					httpResponceDataHandler(jsonObject);
				}
				else
					httpResponceDataHandler(http.responseText);
			}
		}
	http.send(parameters);
}


function doRequest(url, parameters, responceHandler, isJsonResponse) {
	httpRequest(parameters, url, "post", true, responceHandler, isJsonResponse);
}

