<!--{template 'default/head'}-->
<style type="text/css">
.mail-verify{margin:25px;padding:40px;background-color:#FFF9D7;border:1px solid #E2C822}
.mail-verify p{padding:8px}
p.loading{background-position:0 10px;padding-left:25px;}
</style>
<div class="cbody">   
      <div class="mail-verify">
			<p>您需要通过邮件审核后才能登录</p>
			<p>
				<input type="text" class="f-text" value="{$user_temp_info['email']}" size="40" id="mail-modify" />
				<input id="mail-send" type="button" value=" 邮件发送中... " class="f-button" onclick="mailVerify();" />
			</p>
			<p class="loading hidden" id="send_loading"></p>
      </div>
</div>
<script type="text/javascript">
var auto = '{$auto}';
var uid = '{$uid}';
var session = '{$session}';
var xp = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
function mailVerify(){
	var email = $('mail-modify').value.trim();
	if(!xp.test(email)) return alert("请输入正确的Email");
	$('mail-send').value = " 邮件发送中... ";
	$('mail-send').disabled = true;
	$('send_loading').innerHTML = "邮件发送中，请等待...";
	removeClassName($('send_loading'), 'hidden');
	addClassName($('send_loading'), 'loading');
	AJAX.request( 'user.php?ac=mail_verify&uid='+uid+'&session='+session+'&email='+encodeURIComponent(email),{
		method	: 'get',
		onComplete	: function(resp){
			var json = evaljson(resp);
			$('mail-send').value = " 重新发送邮件 ";
			$('mail-send').disabled = false;
			if(json == null){
				alert("系统出了点问题，请重试");
				return false;
			}
			if(json.status == 404){
				$('mail-send').disabled = true;
				$('send_loading').innerHTML = "您已经通过验证，请登录";
				window.location.href = "user.php?ac=login";
			}else if(json.status == 200){
				$('send_loading').innerHTML = "邮件已经发送到<font color='blue'>&lt;"+email+"&gt;</font>，请查收";
			}else{
				alert(json['message']);
				$('send_loading').innerHTML = json['message'];
			}
			removeClassName($('send_loading'), 'loading');
		}
	});
};
if(auto == 1) mailVerify();
</script>
<!--{template 'default/foot'}-->