var http_request = false;
var callobj;
function makeRequest(url, functionName, httpType, sendData) {
	http_request = false;
	if (!httpType) httpType = "GET";
	if (window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/plain');
		}
		} else if (window.ActiveXObject) {
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		alert('Cannot send an XMLHTTP request');
		return false;
	}
	var changefunc="http_request.onreadystatechange = "+functionName;
	eval (changefunc);
	http_request.open(httpType, url, true);
	http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http_request.send(sendData);
}


// 检测版本
var http_request = false;
var callobj;
function $(objname){return document.getElementById(objname);}
function ShowObj(objname){var obj = $(objname);obj.style.display = "block";}
function HideObj(objname){var obj = $(objname);obj.style.display = "none";}
function s(o){var obj = $(o);obj.style.display = "block";}
function h(o){var obj = $(o);obj.style.display = "none";}


// 检测用户名
function ChkTitle(){
	var aTitle = $("username").value;
	if (aTitle.length>0){makeRequest("Ajax.Asp?Act=ChkTitle&Key=" + escape(aTitle) + '&Rand=' + Math.random(),"ReturnOnlyAlert","get","");}
}


// 返回操作(AJAX) ///////////////////

// 返回: 仅出错提示用
function ReturnOnlyAlert(){
	if (http_request.readyState == 4) {
		if (http_request.status == 200){
			var vback=http_request.responseText.split('|');
			if(vback[0]=='False'){alert(vback[1]);}
		}
	}
}
