function ajaxInit() {
	var A;
	try {
		A=new ActiveXObject("MSXML2.XMLHTTP");
	} catch (e) {
		try {
			A=new ActiveXObject("Microsoft.XMLHTTP");
		} catch (oc) {
			A=null;
		}
	}
	if(!A && typeof XMLHttpRequest != "undefined"){
		A = new XMLHttpRequest();
	}
	return A;
}

//取时区差
 function GetTimeZone()
 {
     var d;
     d = new Date();
     s = d.getTimezoneOffset();
     return(s);
 }

//登录时调用uri所指向的页面进行用户名密码验证．
function ajaxCheck(uri, a, b, c, d) {
	var x;
	var postData;
	uri += "?r=" + new Date().getTime();
	uri += "&uid=" + a;
	uri += "&pwd=" + escape(b);
	uri += "&che=" + c;
	uri += "&OffTime=" + GetTimeZone();
	uri += "&url=" + d;
	
	postData = null;

	x = ajaxInit();
	
	x.open("GET", uri, true);
	x.onreadystatechange = function() {
		if (x.readyState != 4){
			return;
		}else{
			var status;
			var data;
			status = x.responseText.charAt(0);
			data = x.responseText.substring(2);
			ifLogin(status,data);
		}
	}
	x.send(postData);
	delete x;
}


//通过ajax从后台取得对应的中文/英文字符串，并直接在页面输出。
//传放的uri参数：如“getLanguageString.aspx?uid=ZTESPT.1466322”
function ajaxGetString(elemStr,uri,strOth) {
	var x;
	var postData;

	postData = null;

	x = ajaxInit();
	
	x.open("GET", uri, true);
	x.onreadystatechange = function() {
		if (x.readyState != 4){
			return;
		}else{
		
			if (strOth != null && strOth != "undefined")
			{
				strOth = x.responseText + strOth;
			}
			else
			{
				strOth = x.responseText;
			}
			swapInnerHTML(elemStr, "<div>"+ strOth +"</div>");
		}
	}
	x.send(postData);
	delete x;
}


// 以上面这个方法的唯一区别是swapInnerHTML(elemStr, strOth ); 语句去掉了<div>标签
function ajaxGetString2(elemStr,uri,strOth) {
	var x;
	var postData;

	postData = null;

	x = ajaxInit();
	
	x.open("GET", uri, true);
	x.onreadystatechange = function() {
		if (x.readyState != 4){
			return;
		}else{
		
			if (strOth != null && strOth != "undefined")
			{
				strOth = x.responseText + strOth;
			}
			else
			{
				strOth = x.responseText;
			}
			swapInnerHTML(elemStr, strOth );
		}
	}
	x.send(postData);
	delete x;
}
