var ContinueMake=1;
function check_u(){
var u=document.getElementById("u").value;var u_msg_obj=document.getElementById("msg_u");
if(u.length<2){u_msg_obj.innerHTML="<span class=\"msgerr\">用户名太短！</span>";document.getElementById("u").focus();document.getElementById("ButtonReg").setAttribute("disabled","disabled");}
else{
u_msg_obj.innerHTML="";document.getElementById("ButtonReg").removeAttribute("disabled");
ContinueMake=0;ajax("get","/user/reg.aspx?act=ajax&field=u&value="+base64en(u)+"&msg="+encodeURI("该用户名已被占用，请重新输入用户名！")+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){u_msg_obj.innerHTML=xmlHttp.responseText;ContinueMake=1;}});
}
}
function check_email(){
document.getElementById("email").value=document.getElementById("email").value.replace(/＠/g,'@')
ContinueMake=0;ajax("get","/user/reg.aspx?act=ajax&field=email&value="+base64en(document.getElementById("email").value)+"&msg="+encodeURI("该邮箱已被占用，请重新输入邮箱！")+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){document.getElementById("msg_email").innerHTML=xmlHttp.responseText;ContinueMake=1;}});
}
function check_qq(){
var obj1=document.getElementById("qq");var val1=obj1.value;if(val1=="")return;
if(regNum.test(val1)||val1.length<5)alert("请输入正确的QQ号");
ContinueMake=0;ajax("get","/user/reg.aspx?act=ajax&field=qq&value="+base64en(val1)+"&msg="+encodeURI("该QQ号已被占用！")+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){document.getElementById("msg_qq").innerHTML=xmlHttp.responseText;ContinueMake=1;}});
}
function check_p(){
var p=document.getElementById("p").value;
if(p.length<=3)document.getElementById("msg_p").innerHTML="<span class=\"msgerr\">密码是否过于简单？</span>";else document.getElementById("msg_p").innerHTML="";
}
function check_pcopy(){                        
if(document.getElementById("p").value!=document.getElementById("pcopy").value)document.getElementById("msg_pcopy").innerHTML="<span class=\"msgerr\">两次密码输入不一致！</span>";else document.getElementById("msg_pcopy").innerHTML="";
}
//function check_vc(){if(document.getElementById("vc").value=="")return;
//ContinueMake=0;ajax("get","/s/tool/fun/ValidateCode.aspx?act=check&cookie=&value="+base64en(document.getElementById("vc").value)+"&msg="+encodeURI("验证码输入不正确！")+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){document.getElementById("msg_vc").innerHTML=xmlHttp.responseText;ContinueMake=1;}});
//}
function check_gjvc(){if(document.getElementById("gjvc").value=="")return;
ContinueMake=0;ajax("get","/user/reg.aspx?act=ajax&check=3&value="+base64en(document.getElementById("gjvc").value)+"&rd="+Math.random(),"",function OnHandler(){if(xmlHttp.readyState == 4){document.getElementById("msg_gjvc").innerHTML=xmlHttp.responseText;ContinueMake=1;}});
}
function check(){
if(ContinueMake!=1){setTimeout(check,1000);return false;}
var u=document.getElementById("u").value;var p=document.getElementById("p").value;var pcopy=document.getElementById("pcopy").value;var email=document.getElementById("email").value;
if(u==""){alert("用户名不能为空！");return false;}else if(email==""){alert("邮箱不能为空！");return false;}else if (!emailReg.test(email)){alert("请输入正确的邮箱！");return false;}else if(p==""){alert("密码不能为空！");return false;}else if(p!=pcopy){alert("两次密码输入不一致！");return false;}//else if(document.getElementById("vc").value==""){alert("请输入验证码！");return false;}
if(document.getElementById("msg_u").innerHTML.indexOf("名称违规")!=-1){alert("名称违规，禁止使用该名称作为用户帐号，请重新输入！ ");return false;}
var arr1="u,email".split(",");var arr2="用户名,邮箱".split(",");
for(var i=0;i<arr1.length;i++){if(document.getElementById("msg_"+arr1[i]).innerHTML!=""){alert(arr2[i]+"被占用！");return false;}}
if(document.getElementById("msg_qq").innerHTML!=""&&document.getElementById("msg_qq").innerHTML.indexOf("号码")==-1){alert("QQ号被占用，请重新输入其它QQ号！");return false;}
//if(document.getElementById("msg_vc").innerHTML!=""){alert("验证码输入不正确，请重新输入验证码！ ");document.getElementById("ValidateCodeImage").src='/s/tool/fun/ValidateCode1.aspx?type=en&len=4&height=24&str=&rd'+Math.random();return false;}
if(document.getElementById("gjvc").value==""){alert("验证码必须填写！");return false;}
if(document.getElementById("agreement").checked==false){alert("您还未同意会员注册协议！");return false;}
//document.getElementById("ButtonReg").style.display="none";document.getElementById("ButtonReg_").style.display="";
}