
<!--{include file=elements/header.js.html type=valid}-->
<script>
$(document).ready(function(){
	$("#BindUserForm").validate({
		rules: {
			"login_name":{
				required : true
			},
			"password":{
				required : true
			},
   			"repassword":{
    			required:true,   
    			equalTo:"#password"   
  			}							
		},
		messages:{
			"login_name":{
				required : "优告账户名不能为空"
			},
			"password":{
				required : "密码不能为空"
			},
   			"repassword":{
    			required: "确认密码不能为空",
    			equalTo:"两次密码输入不一致"   
  			}									
		},
		errorPlacement: function(error, element){
			$("#span_" + element.attr("id")).html(error).attr("class", "error");
		},
		submitHandler: function(form){
			setDisabled(":submit",window.document);
			bindingUser();
		},
		errorClass: "invalid",
		success: function(label){
			label.parent().html("&nbsp;&nbsp;&nbsp;").attr("class", "valid");
		},
		onkeyup:false
	});
});
function bindingUser(){
	var str = "<table width=\"100%\"><tr><td height=\"50px\" align=\"center\">";
	str += "<img src=\"images/ajax.gif\"/>绑定中，请稍候......";
	str += "</td></tr></table>";
	$.popbox.setcontent({title:"优告用户绑定", content:str});
	$.ajax({
		type: "post",
		url: "index.php?r=Uuadv.binduser",
		data: "action=do&login_name="+$("#login_name").val()+"&password="+$("#password").val(),
		cache: false,
		timeout:10000,
		dataType: "json",
		error : function() {
			var str = "<div style=\"margin:10px 0px;\">";
				str += '<div style="height:90px; padding-left:120px; padding-top:50px;">';
				str += "<span style=\"color:red;font-size:12px;font-weight:800;\">网络通讯异常，请稍后再试！</span>";
				str += '</div></div>';
			$.popbox.setcontent({title:"优告用户绑定", content:str});
  		},
		success: function(result){
			var str = '<div style="background:#e2f0fd; margin:10px 0px; border:#aedcfe 1px solid;">';
				if(result.flag==1){
					str += '<div style="background:url(images/key_open.gif) 25px 15px no-repeat #e2f0fd; height:120px; padding-left:120px; padding-top:15px;">';
				}else{
					str += '<div style="background:url(images/key.gif) 25px 15px no-repeat #e2f0fd; height:120px; padding-left:120px; padding-top:15px;">';
				}
				str += '<span style="color:#985919;">'+result.msg+'</span><br>';
				str += '<br/>客服QQ:<a href="tencent://message/?uin='+result.qq+'&Site=http://www.taogao.net&Menu=yes">'+result.qq+'</a>';
				str += '<img border="0" src="http://wpa.qq.com/pa?p=1:'+result.qq+':4">';
				str += '</div></div>';
			$.popbox.setcontent({title:"优告用户绑定", content:str});
			$("#firesbox_close").bind("click",function(){
				window.location.reload();
			});
		}
	});
}
</script>
<form id="BindUserForm" action="index.php?r=Uuadv.binduser" method="post">
	<input type="hidden" name="action" value="do"/>
	<table class="tbl_edit" width="100%">
		<tr>
			<td width="20%">优告账户名</td>
			<td><input type="text" class="text" id="login_name" name="login_name"/><span id="span_login_name"></span></td>
		</tr>
		<tr>
			<td>优告账户密码</td>
			<td><input type="password" class="text" id="password" name="password"/><span id="span_password"></span></td>
		</tr>
		<tr>
			<td>确认密码</td>
			<td><input type="password" class="text" id="repassword" name="repassword"/><span id="span_repassword"></span></td>
		</tr>								
		<tr>
			<td></td>
			<td><button type="submit" class="butsubmit">提交</button></td>
		</tr>
	</table>
</form>
