
function getHTTPObject(){
	var xmlhttp = false;
	if(window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest();
		if(xmlhttp.overrideMimeType){
			xmlhttp.overrideMimeType('text/xml');
		}
	}else{
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e){
				xmlhttp = false;
			}
		}
	}
	return xmlhttp;
}

var http = getHTTPObject();

// 无刷新进行远程调用
function getDateOne(pageName, id){
	var url = "/" + pageName + ".aspx?temp=" + Math.random() + "&id=" + id;
	
	var xmlHttp = getHTTPObject();
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	xmlHttp = null;
	return;
}

function getDateInfo(pageName, id){
	var url = "/" + pageName + ".aspx?id=" + id+"&temp=" + Math.random() ;
  
	http = getHTTPObject();
	http.open("GET",url,true);
	http.onreadystatechange = handleHttpResponseIndex;
	http.send(null);
	return;
}

// ajax回调函数
function handleHttpResponseIndex(){
	if(http.readyState == 4){
		if(http.status == 200){
			var xmlDocument = http.responseText.split("@#*");
			//alert(http.responseText);
			if(xmlDocument[1]!="0"){
				document.getElementById(xmlDocument[1]).innerHTML = xmlDocument[4];
			}
			if(xmlDocument[2]!="ok"){
				getDateInfo(xmlDocument[2], xmlDocument[3]);
			}
		}else{
			alert("你所请求的页面发生异常，可能会影响你浏览该页的信息！\n\n错误类型：" + http.status);
		}
	}
}
