<!--{include file=elements/header.js.html type=valid}-->
<script>
$(document).ready(function(){
	$("#loginForm").validate({
		rules: {
			"login_name":{
				required : true
			},
			"password":{
				required : true
			}
		},
		messages:{
			"login_name":{
				required : "账户名不能为空"
			},
			"password":{
				required : "密码不能为空"
			}
		},
		errorPlacement: function(error, element){
			$("#span_" + element.attr("id")).html(error).attr("class", "error");
		},
		submitHandler: function(form){
			setDisabled(":submit",window.document);
			login();
		},
		errorClass: "invalid",
		success: function(label){
			label.parent().html("&nbsp;&nbsp;&nbsp;").attr("class", "valid");
		},
		onkeyup:false
	});
});
function login(){
	$.ajax({
		type: "post",
		url: "index.php?r=Uuadv.login",
		data: "action=do&login_name="+$("#login_name").val()+"&password="+$("#password").val(),
		cache: false,
		dataType: "json",
		success: function(result){
			if (result.flag == 0) {
				var str = "<div style=\"background:#e2f0fd; margin:10px 0px; border:#aedcfe 1px solid;\">";
					str += "<div style=\"background:url(images/key.gif) 80px 20px no-repeat ; height:80px; padding-left:180px; padding-top:40px;\">";
					str += "<span style=\"color:#985919;\">用户名或密码输入错误!</span><br>请重新输入正确的用户登录名和密码.</div></div>";
				$.popbox({
					title: "超级管理员身份验证",
					content: str
				});
			}
			else {

				$.ajax({
					type: "get",
					url: "index.php?r=Uuadv.binduser",
					cache: false,
					success: function(data){
						$.popbox.setcontent({
							title: "绑定优告账户",
							content: data
						});
					}
				});
			}
		}
	});
}
</script>
<form id="loginForm" action="index.php?r=Uuadv.login" 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><button type="submit" class="butsubmit">下一步</button></td>
		</tr>
	</table>
</form>