<{import file="index/header.html" title="电话修改"}>
<div class="tab"><a href="?m=user&a=safe" class="ch">电话修改</a></div>
<div class="lbox">
	<form action="#" method="post">
		<table width="100%" class="etable">
			<tr>
				<td width="120">已验证手机： </td>
				<td><{$smarty.session.user.mobile}></td>
			</tr> 
			<tr>
				<td>验证码：</td>
				<td>
					<input type="text" name="vcode" id="vcode" class="reg_input2" size="10"/>
					<img id="vcode_img" src="index.php?m=ajax&a=vcode"/></a>
					<a href="javascript:;" class="refreshImg" onClick="freshVcode()">
				</td>
			</tr> 
			<tr>
				<td>短信验证码：</td>
				<td>
					<input type="text" name="smscode" class="reg_input2" id="sms_code" placeholder="手机验证码"/>
					<input id="zphone" type="button" value="获取手机验证码">
				</td>
			</tr> 
			<tr>
				<td>&nbsp; </td>
				<td><input type="submit" name="submit" class="submit" value="下一步"/></td>
			</tr>
		</table>  
	</form> 	
</div> 
<{include file="index/footer.html"}>
<script type="text/javascript">
$(function(){
	$('form').submit(function(){ 
		var sms_code = $("#sms_code").val();
		if(sms_code){
			$.post('?m=user&a=mobile_cknext',{sms_code:sms_code},function(data){ 
				if(data.error == '0'){
					location.href="?m=user&a=mobile_update&ck="+data.code;
				}else{
					alert(data.msg);
				}
			},'json');
			return false;
		}else{
			alert('短信验证码不能为空');
		}
	});
	
	// 获得验证码 
	$("#zphone").click(function(){
		var mobile = '<{$row.mobile}>';
		var vcode = $('input[name=vcode]').val(); 
		send_sms(mobile, vcode, '#zphone', '1');
	});
});
</script>