(function(){
	HttpRequest={
		ReadHttp:connectionHttp,
		ReadXML:connectionXML
	};
	function createHttpRequest(){
		if(window.ActiveXObject)
		{
			var msxmlhttp = [
				'Msxml2.XMLHTTP.5.0',
				'Msxml2.XMLHTTP.4.0',
				'Msxml2.XMLHTTP.3.0',
				'Msxml2.XMLHTTP',
				'Microsoft.XMLHTTP'];
			for (var i = 0; i < msxmlhttp.length; i++) {
				try {
					var dom = new ActiveXObject(msxmlhttp[i]);
					return dom;
				} catch (e) {
					continue;
				}
			}
		}
		else if(window.XMLHttpRequest)
		{
			return new window.XMLHttpRequest();
		}
	}
	function createXmlHttp(){
		if(window.ActiveXObject){
			var arrSignatures = ["MSXML2.DOMDocument.5.0","MSXML2.DOMDocument.4.0",
							"MSXML2.DOMDocument.3.0","MSXML2.DOMDocument",
							"Micosoft.XmlDom"
			];
			for(var i=0;i<arrSignatures.length;i++){
				try{
					var dom = new ActiveXObject(arrSignatures[i]);
					return dom;
				}catch(e){
					continue;
				}
			}
		}
	}
	function connectionHttp(url,para,closure){
		var httpRequest = createHttpRequest();
		url = window.location.href.substr(0,window.location.href.lastIndexOf("/")+1)+url;
		httpRequest.open("POST",url,true);
		httpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		httpRequest.onreadystatechange=function(){closure(httpRequest);};
		httpRequest.send(para);
	}
	function connectionXML(filePath){
		var xmlDom = createXmlHttp();
		if(xmlDom){
			xmlDom.async = false;
			xmlDom.load(filePath);
			return xmlDom;
		}
	}
})()
