<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/taglib/c.tld" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网上阅卷系统-学生登录</title>
<link rel="stylesheet" type="text/css"
	href="${ctx}/static/student/style/login.css" />
	<script type="text/javascript" src="${ctx}/static/student/js/jquery-1.8.0.min.js"></script>
</head>

<body>
	<div id="login">
		<div class=" header-wrap">
			<img src="${ctx}/static/student/images/logo.png" />
		</div>
		<div class=" banner">
			<div class="grid-1000 login-bgcolor">
				<div class="banner-img"></div>
				<form id="examLoginFrm" action="${ctx }/student/login" method="post">
				<input type="hidden" id="registered" name="registered" value="0"/>
				<div id="examNoLogin" class="login-box">
					<div class="login-title">
						<h1>欢迎同学/家长登录</h1>
					</div>
					<div class="ui-tab">
						<div class="ui-tab-trigger">
							<ul>
								<li class="ui-tab-trigger-item ui-tab-trigger-item-current  examNoLogin" ><a href="javascript:void(0);" >准考证登录</a></li>
								<li class="ui-tab-trigger-item userNameLogin" ><a href="javascript:void(0);" >用户名登录</a></li>
							</ul>
						</div>
					</div>
					<div class=" field field-username">
						<input id="examId" name="examId" type="text" class="field-input" value="考试序号" />
					</div>
					<div class=" field field-password">
						<input id="examNumber" name="examNumber" type="text" class="field-input" value="准考证号" />
					</div>
					<div class=" field field-username">
						<input id="name" name="name" type="text" class="field-input" value="用户名" />
					</div>
					<div class="error-box" <c:if test="${message == null }">style="display: none;"</c:if>>
						<i class="icon-exclamation-sign icon-red" style="margin: 4px;"></i><span class="errorMessage">${message }</span>
					</div>
					<a href="javascript:void(0);"><button type="button" class="button button-font" onclick="goLogin(1)">登录</button></a>
				</div>
				</form>
				<form id="userNameLoginFrm" action="${ctx }/student/login" method="post">
				<input type="hidden" id="registered" name="registered" value="1"/>
				<div id="userNameLogin" class="login-box" style="display: none;">
					<div class="login-title">
						<h1>欢迎同学/家长登录</h1>
					</div>
					<div class="ui-tab">
						<div class="ui-tab-trigger">
							<ul>
								<li class="ui-tab-trigger-item examNoLogin" ><a href="javascript:void(0);" >准考证登录</a></li>
								<li class="ui-tab-trigger-item ui-tab-trigger-item-current userNameLogin" ><a href="javascript:void(0);" >用户名登录</a></li>
							</ul>
						</div>
					</div>
					<div class=" field field-username">
						<input id="loginName" name="loginName" type="text" class="field-input" value="用户名" />
					</div>
					<div class=" field field-password">
						<input id="password" name="password" type="password" class="field-input" value="密码" />
					</div>
					<div class="field">
						<label class="checkbox"><input type="checkbox"> 下次自动登录</label>
					</div>
					<div class="error-box" <c:if test="${message == null }">style="display: none;"</c:if>>
						<i class="icon-exclamation-sign icon-red" style="margin: 4px;"></i><span class="errorMessage">${message }</span>
					</div>
					<a href="javascript:void(0);"><button type="button" class="button button-font" onclick="goLogin(2)">登录</button></a>
				</div>
				</form>
			</div>
		</div>
		<div class="footer">
			<p class="footer-font">Copyright © 2011 启明泰和软件服务有限公司，鄂ICP备12000033号 E-mail:service@qmth.com.cn</p>
		</div>
	</div>
<script type="text/javascript">
$(".examNoLogin").click(function(){
	$("#userNameLogin").hide();
	$("#examNoLogin").show();
});
$(".userNameLogin").click(function(){
	$("#examNoLogin").hide();
	$("#userNameLogin").show();
});

$("#examId").click(function(){
	if($(this).val()=='考试序号'){
		$(this).val("");
	}
});
$("#examId").blur(function(){
	if($(this).val()==''){
		$(this).val("考试序号");
	}else{
		var reg = new RegExp("^[0-9]*$");
		 if(!reg.test($(this).val())){
		     $(".errorMessage").html("考试序号请输入数字!");
		     $(".error-box").show();
		     $(this).focus();
		     return false;
		 }else{
			 $(".error-box").hide();
		 }
	}
	 
});
$("#examNumber").click(function(){
	if($(this).val()=='准考证号'){
		$(this).val("");
	}
});
$("#examNumber").blur(function(){
	if($(this).val()==''){
		$(this).val("准考证号");
	}else{
		var reg = new RegExp("^[A-Za-z0-9]+$");
		 if(!reg.test($(this).val())){
		     $(".errorMessage").html("准考证号请输入数字或字母!");
		     $(".error-box").show();
		     $(this).focus();
		     return false;
		 }else{
			 $(".error-box").hide();
		 }
	}
});
$("#name").click(function(){
	if($(this).val()=='用户名'){
		$(this).val("");
	}
});
$("#name").blur(function(){
	if($(this).val()==''){
		$(this).val("用户名");
	}
});
$("#loginName").click(function(){
	if($(this).val()=='用户名'){
		$(this).val("");
	}
});
$("#loginName").blur(function(){
	if($(this).val()==''){
		$(this).val("用户名");
	}
});
$("#password").click(function(){
	if($(this).val()=='密码'){
		$(this).val("");
	}
});
$("#password").blur(function(){
	if($(this).val()==''){
		$(this).val("密码");
	}
});
function goLogin(obj){
	if(obj==1){
		if($("#examId").val()=='考试序号'){
			$(".errorMessage").html("请输入考试序号!");
		     $(".error-box").show();
		     return false;
		}
		if($("#examNumber").val()=='准考证号'){
			$(".errorMessage").html("请输入准考证号!");
		     $(".error-box").show();
		     return false;
		}
		if($("#name").val()=='用户名'){
			$(".errorMessage").html("请输入用户名!");
		     $(".error-box").show();
		     return false;
		}
		$("#examLoginFrm").submit();
	}else{
		if($("#loginName").val()=='用户名'){
			$(".errorMessage").html("请输入用户名!");
		     $(".error-box").show();
		     return false;
		}
		if($("#password").val()=='密码'){
			$(".errorMessage").html("请输入密码!");
		     $(".error-box").show();
		     return false;
		}
		$("#userNameLoginFrm").submit();
	}
}
</script>
</body>
</html>

