﻿function createXmlHttpRequest()
{
	try 
	{
		xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e) 
	{
		try 
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (e2) 
		{
			xmlHttp = false;
		}
	}
	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') 
	{
		xmlHttp = new XMLHttpRequest();
	}
	return xmlHttp;
}

function checkState(xhrObj)
{
	if(xhrObj.readyState==4)
	{
		if(xhrObj.status==200)
		{
			return true;
		}
		else
		{
			//alert('对不起,您请求的网页出现问题!错误代码为:'+xhrObj.status);
			return false;
		}
	}
	return false;
}

function getHttpResponseText(xhrObj)
{
	if(checkState(xhrObj))
	{
		return xhrObj.responseText;
	}
	return null;
}

function getHttpResponseXml(xhrObj)
{
	if(checkState(xhrObj))
	{
		return xhrObj.responseXML;
	}
	return null;
}