<{import file="common.html" title="账户注册"}>
<link rel="stylesheet" type="text/css" href="<{$__APP__}>public/css/login.css"/>  
<div class="cnav">
	<a class="back"></a>账户注册<a href="javascript:;" class="thome">主页</a>
</div>
<div class="main">
	<div class="loginBox">
		<form action="#" method="post"> 
			<div id="error_msg" style="display:none;"></div> 
			<div class="emailBox">
				<div class="tbtr"><i>电话号码</i><p><input type="text" name="username" id="username" placeholder="请输入电话号码"/></p></div>
				<div class="tbtr"><i>密码</i><p><input type="password" name="password" id="password" placeholder="请输入密码"/></p></div>
				<div class="tbtr"><i>重复密码</i><p><input type="password" name="repasswd" id="repasswd" placeholder="确认新密码"/></p></div>
				<div class="tbtr">
					<i>验证码</i><p><input type="text" name="vcode" id="vcode" class="input_vcode" placeholder="图形验证码"/>
					<a href="javascript:;"><img id="vcode" src="index.php?m=ajax&a=vcode"></a>
				</div>
				<div class="tbtr">
					<i>手机验证码</i><p><input type="text" name="smscode" class="input_vcode" id="smscode" placeholder="手机验证码"/>
					<input id="zphone" type="button" value="获取手机验证码"></p> 
				</div>
			</div>
			<div class="tbtr" style="border-bottom:none; margin-top:6px;"><input type="submit" name="submit" class="login_submit" value="注册"/></div>
		</form>
		<div class="find_pass">
			<a href="?m=member&a=forget" class="l">找回密码</a>
			<a href="?m=member&a=login" class="r">立即登陆</a>
		</div> 
	</div>
</div>	
<{import file="footer.html"}>
<script type="text/javascript">
$(function(){ 
	$('form').submit(function(){
		var smscode = $('input[name=smscode]').val(); 
		if(smscode == ''){ 
			$.alert('手机验证码不能为空');
			return false;
		}
		var username = $('input[name=username]').val();
		if(username == ''){
			$.alert('电话号码不能为空'); 
			return false;
		}
		var password = $('input[name=password]').val(); 
		var repasswd = $('input[name=repasswd]').val(); 
		if(password == ''){ 
			$.alert('密码不能为空');
			return false;
		} 
		if(repasswd == ''){ 
			$.alert('重复密码不能为空');
			return false;
		}
		if(password != repasswd){ 
			$.alert('两次密码输入不一致');
			return false; 
		}
		$.ajax({
			type:'POST',
			url:'member.php?a=do_register',
			data:{username:username, password:password, repasswd:repasswd, smscode:smscode}, 
			success:function(result){
				var data = jQuery.parseJSON(result); 
				if(data.error == '0'){
					window.location.href="wap.php?m=member"; 
				}else{ 
					$.alert(data.msg);
					freshVcode();
					return false;
				}
			},error:function(){
				alert('错误');
			}
		}); 
		return false; 
	}); 
	// 获得验证码 
	$("#zphone").click(function(){
		var mobile = $('input[name=username]').val();  
		var vcode = $('input[name=vcode]').val(); 
		send_sms(mobile, vcode, '#zphone', '2');
	}); 
	
}); 
</script>
