function sendRequest(url)
{	sendRequest2(url,"GET")
}
function sendRequest2(url,method)
{	sendRequest3(url,"GET","Text")
}
function sendRequest3(url,method,resonseType)
{ 
	var xmlReq = null; 
	if (window.XMLHttpRequest)
	{	xmlReq = new XMLHttpRequest();
		if (xmlReq.overrideMimeType) 
		{	xmlReq.overrideMimeType('text/xml');
		}
	} 
	else if (window.ActiveXObject) 
	{	try 
		{	xmlReq = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e)
		{	try 
			{	xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	xmlReq.onreadystatechange = function()
	{ 	if(xmlReq.readyState == 4 || xmlReq.readyState == "complete")
		{	
			if(xmlReq.status == 200)
			{	
				if (resonseType =="Text")
					onResponse(xmlReq.responseText);
				else if (resonseType =="XML")
					onResponse(xmlReq.responseXML);
				else
					onResponse(xmlReq.responseText);
			}	
			else	
			{	alert("There was a problem retrieving the data:\n" + xmlReq.status + " " + xmlReq.statusText); 
				onResponse("");
			}	
		} 
	}; 

	if (method == '')
		method = 'GET';

	if (url.length >= 2048)
		method = 'POST';


	if (method == 'GET')
	{	xmlReq.open(method, url, true); 
		xmlReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"); 
		xmlReq.send(null); 
	}
	else if (method == 'POST')
	{	
		var target = url.substring(0,url.indexOf('?'));
		var params = url.substring(url.indexOf('?') + 1);
		xmlReq.open(method, target, true); 
		xmlReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"); 
		//xmlReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
		xmlReq.setRequestHeader("Content-length", params.length);
		xmlReq.setRequestHeader("Connection", "close");
		xmlReq.send(params);


	}
} 

