function AjaxRequest(url, postInfo, fnSuccess, fnFail)
{
	var xmlHttp = GetXMLHttpRequest();
	xmlHttp.onreadystatechange=function()
	{
 		if(xmlHttp.readyState == 4 && xmlHttp.status == 200 )
 		{
			fnSuccess(xmlHttp.responseText);
 		}
		else if( xmlHttp.readyState == 4 && xmlHttp.status != 200)
		{
			if(fnFail != null)
			{
				fnFail();
			}
		}
	}

	xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", postInfo.length);
	xmlHttp.setRequestHeader("Connection", "close");

    xmlHttp.send(postInfo);
}

function GetXMLHttpRequest()
{
	var xmlHttp;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer pre IE7
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}

	return xmlHttp;
}
