var xmlhttp = null;

function xRequest(method,url,asynch,x_handle){
	if(window.XMLHttpRequest){
		xmlhttp = new XMLHttpRequest();
	}
	else if(window.ActiveXObject){
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		if(!xmlhttp){xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
	}
	
	if(xmlhttp){
		if(method.toLowerCase() != "post"){
			initRequest(method,url,asynch,x_handle);
		}else{
			var args = arguments[4];
			if(args != null && args.length > 0){
				initRequest(method,url,asynch,x_handle,args);
			}
		}
	}else{
		//alert("您的浏览器不支持XMLHttpRequest组件！")
	}
}

function initRequest(method,url,asynch,x_handle){
	try{
		xmlhttp.onreadystatechange = x_handle;
		xmlhttp.open(method,url,asynch);
		if(method.toLowerCase() == "post"){
			xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			xmlhttp.send(arguments[4]);
		}else{xmlhttp.send(null);}
	}catch(e){
		//alert("连接出现异常！请重试。")
	}
}
