﻿//定义要创建的xmlhttp对象
var xmlhttp = null;

//创建xmlhttp对象
function createXmlHttp() {
	
	if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	}
	else if (!xmlhttp&&window.ActiveXObject) {
		var IEXMLHttpVersion = [
			"Msxml2.XMLHttp.5.0",
			"Msxml2.XMLHttp.4.0",
			"Msxml2.XMLHttp.3.0",
			"Msxml2.XMLHttp",
			"Microsoft.XMLHttp"
		];
		for (var i = 0 ; i < IEXMLHttpVersion.length; i++) {
			try {
				xmlhttp = new ActiveXObject(IEXMLHttpVersion[i]);
				} catch(e) {
				}
		}
	}
	if (!xmlhttp) {
		location="index.htm";
	} else {
		//document.write("XMLHttpRequest对象创建成功!")
	}
}

function getXmlhttp(getUrl) {
	createXmlHttp();
	//xmlhttp.onreadystatechange = null;
	xmlhttp.open("GET", getUrl, false);
	xmlhttp.send(null);
	try
	{
		if (xmlhttp.status == 200)
		{
			return xmlhttp.responseText;
		}
		throw '';
	}
	catch (e)
	{
		return '';
	}
}