// JavaScript Document
<!--
//userName用户名检测
function click_userName_input(thisinput)
{
	reguserNameinfo.className = "show exactness";
	reguserNameinfo.innerHTML = "只能由中英文字母a～z(不区分大小写)、数字0～9、_(下划线)组成,长度为3～20个字符。 ";
}

function check_userName_input(thisinput)
{
	var count = thisinput.value.length;
    var words = /([a-zA-Z0-9\u4e00-\u9fa5])/;
	if (count==0) {
		reguserNameinfo.className="show null";
		reguserNameinfo.innerHTML="<font color=#FF0000>系统未检测到您的输入！</font><br><br>";
	}
	else if ((!thisinput.value.match(words)) || bytes(thisinput.value) < 3 || bytes(thisinput.value) > 20 )
	{
		reguserNameinfo.className = "show null";
		reguserNameinfo.innerHTML = "<font color=#FF0000>输入不符合规范！</font><br><br>";
	}
	
	else
	{
		GetResult(thisinput.value);
	}
}
//Email邮件检测
function click_Email_input(thisinput)
{
	regEmailinfo.className = "show exactness";
	regEmailinfo.innerHTML = "提示:一个邮件地址仅允许注册一个用户名";
}

function check_Email_input(thisinput)
{
	var count = thisinput.value.length;
    var words = /^[a-z0-9A-Z_]+$/;
	if (count==0) {
		regEmailinfo.className="show null";
		regEmailinfo.innerHTML="<font color=#FF0000>系统未检测到您的输入！</font><br><br>";
	}
	else
	{
		GetEmailResult(thisinput.value);
	}
}
//Password密码检测
function click_Password_input(thisinput)
{
	regPasswordinfo.className = "show exactness";
	regPasswordinfo.innerHTML = "1.密码只能由英文字母a～z(不区分大小写)、数字0～9、_(下划线)组成。<Br>2.密码长度为6～20个字符。 ";
}
function check_Password_input(thisinput)
{
	var count = thisinput.value.length;
    var words = /^[a-z0-9A-Z_]+$/;
	

	if (count==0) {
		regPasswordinfo.className="show null";
		regPasswordinfo.innerHTML="<font color=#FF0000>系统未检测到您的输入！</font><br><br>";
	}
	else if ((!thisinput.value.match(words)) || count < 6 || count > 20 )
	{
		regPasswordinfo.className = "show null";
		regPasswordinfo.innerHTML = "<font color=#FF0000>输入不符合规范！</font><br><br>";
	}
	else
	{
		regPasswordinfo.className = "show exactness";
		regPasswordinfo.innerHTML = "内容符合规范，可以使用！<br><br>";
	}
}

//chkPassword确认密码检测
function click_chkPassword_input(thisinput)
{
		var oPass = thisinput.value;
		if( oPass == "")
		{
			thisinput.focus();
		}else{
			regchkPasswordinfo.className="show exactness";
			regchkPasswordinfo.innerHTML="请输入确认密码";
		}
}

function check_chkPassword_input(thisinput)
{
	var oPass = $("passWord").value;
	if( thisinput.value.length==0 )
	{
		regchkPasswordinfo.className="show null";
		regchkPasswordinfo.innerHTML = "<font color=#FF0000>系统未检测到您的输入！</font>";
	}
	else if(thisinput.value != oPass)
	{
		regchkPasswordinfo.className="show null";
		regchkPasswordinfo.innerHTML = "<font color=#FF0000>确认密码与密码不一致！</font>";
	}
	else
	{
		regchkPasswordinfo.className = "show exactness";
		regchkPasswordinfo.innerHTML = "密码确认通过！";
	}
}

//cus_Question提问检测
function checkQuestion(thisInput){
	if ($("Question").value == "cus") {
		$("cus_Question_").style.display = "";
	}
	else{
		$("cus_Question_").style.display = "none";
	}
}
function click_cus_Question_input(thisinput)
{
	regcus_Questioninfo.className = "show exactness";
	regcus_Questioninfo.innerHTML = "问题长度不超过30个字符。";
}

function check_cus_Question_input(thisinput)
{
	var count = thisinput.value.length;
	if (count==0) {
		regcus_Questioninfo.className="show null";
		regcus_Questioninfo.innerHTML="<font color=#FF0000>系统未检测到您的输入！</font>";
	}
	else if ( bytes(thisinput) > 30 )
	{
		regcus_Questioninfo.className = "show null";
		regcus_Questioninfo.innerHTML = "<font color=#FF0000>输入不符合规范！</font>";
	}
	else
	{
		regcus_Questioninfo.className = "show exactness";
		regcus_Questioninfo.innerHTML = "内容符合规范，可以使用！";
	}
	
}

//Answer回答检测
function click_Answer_input(thisinput)
{
	regAnswerinfo.className = "show exactness";
	regAnswerinfo.innerHTML = "答案在30个字符之间。";
}
function check_Answer_input(thisinput)
{
	var count = thisinput.value.length;
	if (count==0) {
		regAnswerinfo.className="show null";
		regAnswerinfo.innerHTML="<font color=#FF0000>系统未检测到您的输入！</font>";
	}
	else if ( bytes(thisinput.value) > 30 )
	{
		regAnswerinfo.className = "show null";
		regAnswerinfo.innerHTML = "<font color=#FF0000>输入不符合规范！</font>";
	}
	else
	{
		regAnswerinfo.className = "show exactness";
		regAnswerinfo.innerHTML = "内容符合规范，可以使用！";
	}
	
}

//userName用户名检测与数据库
function GetResult(str)
{
	$("reguserNameinfo").innerHTML='<font color=red>检测中,请稍候...</font>';
    var xmlhttp = createxmlhttprequest();
    xmlhttp.open("get","inc/regCheck.asp?rType=1&/="+escape(str),true);
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
		
			if(xmlhttp.status==200)
			{
				if (xmlhttp.responseText==0)
				{   
					$("reguserNameinfo").innerHTML='验证通过,可以正常注册';
				}
				else if (xmlhttp.responseText==1)
				{   
					$("reguserNameinfo").className="show null";
					$("reguserNameinfo").innerHTML='<font color=#FF0000>抱歉,用户名[<b>' + str + '</b>]已被注册,请您使用其他用户名完成注册.</font>';
				}
				else
				{
					$("reguserNameinfo").className="show null";
					$("reguserNameinfo").innerHTML='格式错误,请您确认输入';
				}
			}
		}
	}
	xmlhttp.send(null);
}

//email用户名检测与数据库
function GetEmailResult(str)
{
	$("regEmailinfo").innerHTML='<font color=red>检测中,请稍候...</font>';
    var xmlhttp = createxmlhttprequest();
	//window.open("inc/regCheck.asp?rType=2&/="+escape(str))
    xmlhttp.open("get","inc/regCheck.asp?rType=2&/="+escape(str),true);
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			if(xmlhttp.status==200)
			{
				if (xmlhttp.responseText==0)
				{   
					$("regEmailinfo").innerHTML='验证通过,请继续完成注册';
				}
				else if (xmlhttp.responseText==1)
				{   
					$("regEmailinfo").className="show null";
					$("regEmailinfo").innerHTML='<font color=#FF0000>抱歉,邮件地址[<b>' + str + '</b>]已被注册,一个邮件仅可以注册一个用户名</font>';
				}
				else
				{
					$("regEmailinfo").className="show null";
					$("regEmailinfo").innerHTML='<font color=#FF0000>邮件格式错误,请您确认输入</font>';
				}
			}
		}
	}
	xmlhttp.send(null);
}

//验证码检测与数据库
function GetCodeResult(str)
{
	$("regcheckCodeinfo").innerHTML='<font color=red>检测中,请稍候...</font>';
    var xmlhttp = createxmlhttprequest();
	//window.open("inc/regCheck.asp?rType=2&/="+escape(str))
    xmlhttp.open("get","inc/regCheck.asp?rType=3&/="+escape(str),true);
	xmlhttp.onreadystatechange=function()
	{
		if(xmlhttp.readyState==4)
		{
			if(xmlhttp.status==200)
			{
				alert(xmlhttp.responseText);
				return xmlhttp.responseText;
			}
		}
	}
	xmlhttp.send(null);
}
//-->