<%@ page language="C#" autoeventwireup="true" inherits="wap_reg_index, kfenlei" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Cache-control" content="no-cache" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>用户注册 - <%=sWebName %></title>
<link href="/js/css/layui.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="/wap/wap.css" type="text/css" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/js/m.js"></script>
<script type="text/javascript" language="javascript" src="/js/layui.js"></script>
</head>
<body>
<script type="text/javascript">
layui.use(['form'], function(){
var form = layui.form();
    form.render();
});
</script>
<div align="left">
<div class="wapPageTitle"><a href="javascript:history.go(-1);" class="infoback">返回</a>用户注册<a class="wapPageTitle_btn" style="background-image:url(/wap/images/png12.png);" href="/wap/login/<%=sLogin %>">登录</a></div>
<div class="clear10"></div>
<div class="infowrap">
<form action="/action/?s=reg&r=wap" method="post" name="regForm" onSubmit="return check_form()" id="regForm">
<input type="hidden" name="jump" value="<%=sJumpUrl %>" />
<div class="loginForm">
<div class="loginInputDiv">
<div class="loginInputLabelUser">用户名</div>
<div class="loginFormInput"><input type="text" class="textInput" id="qth8UserName" name="qth8UserName" onBlur="checkusername()" /></div>
<div class="exDiv" id="UserNamePs"></div>
<div class="clear"></div>
</div>
<div class="loginInputDiv">
<div class="loginInputLabelPass">密码</div>
<div class="loginFormInput"><input type="password" class="textInput" id="qth8PassWord" name="qth8PassWord" onBlur="check_password()" /></div>
<div class="exDiv" id="passWordPs"></div>
<div class="clear"></div>
</div>
<div class="loginInputDiv">
<div class="loginInputLabelPass1">确认密码</div>
<div class="loginFormInput"><input type="password" class="textInput" id="qth8PassWord1" name="qth8PassWord1" onBlur="check_password1()" /></div>
<div class="exDiv" id="passWord1Ps"></div>
<div class="clear"></div>
</div>
<%if(s10!="1"){ %>
<div class="loginInputDiv">
<div class="loginInputLabelVali">验证码</div>
<div class="loginFormInput"><input type="text" class="textInput" style="width:50%;" name="qth8Validate" /><img src="/validate/?cache=<%=sRandom %>" alt="点击更换图片" onClick="this.src='/validate/?cache='+Math.random()" border="1"  height="40" width="40%" style="cursor:pointer; float:right;" /></div>
<div class="clear"></div>
</div>
<%} %>
</div>
<div class="clear10"></div>
<div style="text-align:center"><input id="Submit1" value="注册用户" class="postSubmit1" type="submit" /></div>
</form>
<div class="clear"></div>
</div>
</div>
<%=sFoot %>
<script type="text/javascript">
var v1=1,v2=1;
function check_password(){
var password=document.regForm.qth8PassWord.value;
if(password!="")
{
if(password.length<6 || password.length>16){
    kflErr("passWordPs","请输入6-16位密码！");
	}
	else
	{
			kflRig("passWordPs");
	}
	}
}
function check_password1(){
var password=document.regForm.qth8PassWord.value;
var password1=document.regForm.qth8PassWord1.value;
if(password1!="")
{
if(password!=password1)
	{
		kflErr("passWord1Ps","两次密码不相同！");
	}
	else
	{
			kflRig("passWord1Ps");
	}
}
}
 function checkusername(){
	var user_name_value=document.regForm.qth8UserName.value;
	if(user_name_value!="")
	{
	if(!/^[a-zA-Z0-9\u4e00-\u9fa5_]{2,16}$/.test(user_name_value))
	{
		kflErr("UserNamePs","用户名请输入2-16位汉字、字母、数字、下划线！");
	}
	else
	{
		var xmlhttp;
		if (window.XMLHttpRequest)
  		{// code for IE7+, Firefox, Chrome, Opera, Safari
  			xmlhttp=new XMLHttpRequest();
  		}
		else
  		{// code for IE6, IE5
 		 	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
		xmlhttp.onreadystatechange=function()
  		{
  			if (xmlhttp.readyState==4 && xmlhttp.status==200)
    		{
				if(xmlhttp.responseText=="true")
				{
					kflRig("UserNamePs");
				}
				else
				{
					kflErr("UserNamePs","此用户已被注册！");
				}
    		}
  		}
		xmlhttp.open("GET","/services/?s=checkUserName&r=wap&v="+user_name_value,true);
		xmlhttp.send();
		}
		}
	}

function check_form()
{
	v1=0,v2=0;
	var bRe=true;
	var password=document.regForm.qth8PassWord.value;
	if(password.length<6 || password.length>16 || password.length==0)
	{
		kflErr("passWordPs","请输入6-16位密码！");
		bRe=false;
	}
	var password1=document.regForm.qth8PassWord1.value;
	if(password!=password1)
	{
		kflErr("passWord1Ps","两次密码不相同！");
		bRe=false;
	}
	var user_name_value=document.regForm.qth8UserName.value;
	if(!/^[a-zA-Z0-9\u4e00-\u9fa5_]{2,16}$/.test(user_name_value))
	{
		kflErr("UserNamePs","用户名请输入2-16位汉字、字母、数字、下划线！");
		bRe=false;
	}
	else
	{
		var xmlhttp;
		if (window.XMLHttpRequest)
  		{// code for IE7+, Firefox, Chrome, Opera, Safari
  			xmlhttp=new XMLHttpRequest();
  		}
		else
  		{// code for IE6, IE5
 		 	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
		xmlhttp.onreadystatechange=function()
  		{
  			if (xmlhttp.readyState==4 && xmlhttp.status==200)
    		{
				if(xmlhttp.responseText=="true")
				{
					kflRig("UserNamePs");
				}
				else
				{
					kflErr("UserNamePs","此用户已被注册！");
					bRe=false;
				}
    		}
  		}
		xmlhttp.open("GET","/services/?s=checkUserName&r=wap&v="+user_name_value,true);
		xmlhttp.send();
	}
		return bRe;
	}
	
if(getCookie("kfRegUserName")!="")
{
	document.regForm.qth8UserName.value=decodeURI(escape(getCookie("kfRegUserName")));
	alert(decodeURI(escape(getCookie("kfRegPs"))));
}
function kflErr(name,value)
{
	var obj=$("#"+name).parent().find("input");
	$("#"+name).attr("class", "exDiv Err");
	if(value!='')
	{
		if(v1==1)
		{
			layer.tips(value,obj,{tips:[1,'#ff6600'],time:4000});
		}
		else
		{
			if(v2==0)
			{
				v2++;
				layer.tips(value,obj,{tips: [1,'#ff6600'],time:4000});
			}
		}
	}
}
function kflRig(name)
{
	$("#"+name).attr("class", "exDiv Rig");
}
</script>
</body>
</html>

