<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" session="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="ko">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
<meta http-equiv="content-language" content="ko">
<title><spring:message code="sys.name" /></title>

<link type="text/css" rel="stylesheet" href="<c:url value='/css/nanumgothic.css'/>" >
<link type="text/css" rel="stylesheet" href="<c:url value='/css/common.css'/>" >
<link type="text/css" rel="stylesheet" href="<c:url value='/css/login.css'/>" >
<link type="text/css" rel="stylesheet" href="<c:url value='/css/lib/jquery-ui.css'/>" >
<style>
	.hide{display:none}
</style>
</head>
<body style="text-align: center; margin: 0 auto; display: inline; padding-top: 100px;">
	<div class="login-hedaer">
		<div class="logo">
			<h1><a href="#"><img src="/images/cmmn/mpss.png" alt="국민안전처"></a></h1>		
			<h1><a href="#"><img src="/images/cmmn/kcg.png" alt="사이버외사정보시스템 로고"></a></h1>
		</div>
	</div>
	<div class="login-bg">
	<form:form name="detailForm" action="/j_spring_security_check" onsubmit="return fn_egov_login();">
		<div class="forms">

			<div class="login-form" id="login">
			<input type=hidden name=login_error value="${login_error}" />
		      <h1><spring:message code="sys.name" /> <span>통합로그인</span></h1>
		      <p class="text-p">설정하신 아이디와 비밀번호로 로그인 하실수 있습니다.<br>외사경찰과 일반경찰의 로그인이 통합되었습니다.</p>
		      <div class="input-field">
		      	<div>
		      		<label><spring:message code="member.header.id" /></label>
		       		<input name="j_username" maxlength="16" title="id" value=""/>	
		      	</div>
		        <div>
		        	<label><spring:message code="member.header.pass" /></label> 
		        	<input type=password name="j_password" maxlength="20" title="pass" value=""/>	 
		        </div>  
		        <input type="submit" title="submit" class="login-btn" value="<spring:message code="member.login" />"/>
		      </div>
			</div>
		</div>
	</form:form>
	</div>
	<div id="footer">
		<div class="footer-bottom">
			<div class="footer-content">
				<div class="footer-logo">
					<img src="<c:url value='/images/footer/mpss-footer.png'/>"  alt="logo" title="logo"/>
				</div>
				<div class="footer-info">
					<p class="footer-copyright">(우)110-751 서울특별시 종로구 세종로55 정부중앙청사.<br> COPYRIGHT(C)2011 MINISTRY OF REPUBLIC ADMINISTRATION AND SECURITY. ALL RIGHT RESERVED </p>
				</div>
			</div>
		</div>
	</div>
	
	<div id=divBrowserSetting title="최신 브라우저 지원을 위해 호환성보기 항목을 해제하여 주십시오." class="hide">
		
		<div><img src="../../images/ieSetting.png" style="margin:10px; width:600px; border: 1px solid #444;"/></div>
		<div style="margin-left:40px; ">
			<ul style="list-style-type:decimal;">
				<li style="text-align:left;">브라우저의 도구 아이콘 클릭<br/>도구 아이콘이 보이지 않는 경우 alt 키 입력 후 도구(T) 탭 선택</li>
				<li style="text-align:left;">[호환성 보기 설정(B)] 클릭</li>
				<li style="text-align:left;">[사이버외사정보시스템 URL] 선택</li>
				<li style="text-align:left;">[제거] 버튼 클릭 후 [닫기]</li>
			</ul>
		</div>
		
		<div style="height: 30px; float:right; margin-right: 20px;">
			<input type="checkbox" id="chkOpenAnymore" style="margin-bottom:-3px;">&nbsp;<label for="chkOpenAnymore">일주일간 열지 않기</label>
		</div>
	</div>
	
	<script type="text/javascript" src="/js/lib/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="/js/lib/jquery-ui.min.js"></script>
	<script type="text/javascript">
		
		function getCookie(cname) {
		    var name = cname + "=";
		    var decodedCookie = decodeURIComponent(document.cookie);
		    var ca = decodedCookie.split(';');
		    for(var i = 0; i <ca.length; i++) {
		        var c = ca[i];
		        while (c.charAt(0) == ' ') {
		            c = c.substring(1);
		        }
		        if (c.indexOf(name) == 0) {
		            return c.substring(name.length, c.length);
		        }
		    }
		    return "";
		}
		
		$(document).ready(function(){
			if (getCookie("popupOpenAnymore") != "Y") {
				$('#divBrowserSetting').dialog({
					width: 630
				});
			}
			
			// ContextMenu 방지 코드
			$(document).contextmenu(function(){
				return false;
			});
			
			$('#divBrowserSetting').on('dialogclose', function(event) {
				if ($('#chkOpenAnymore').is(':checked'))
					var todayDate = new Date();
					todayDate.setDate(todayDate.getDate() + 7);
					document.cookie = "popupOpenAnymore=Y; path=/; expires=" + todayDate.toGMTString() + ";"
			});
			
			
			document.detailForm.j_username.focus();
			  
			$('.tab a').on('click', function(e) {
				e.preventDefault();
		
				$(this).parent().addClass('active');
				$(this).parent().siblings().removeClass('active');
		
				var href = $(this).attr('href');
				$('.forms > form').hide();
				$(href).fadeIn(500);
			});
			
		
			var error = document.detailForm.login_error.value;
			if(error == 1){
				alert('${sessionScope["SPRING_SECURITY_LAST_EXCEPTION"].message}');
			}
		});
		
		/* 로그인 function */
		function fn_egov_login() {
			mberId = document.detailForm.j_username.value;
			password = document.detailForm.j_password.value;
			
			if(mberId == "" && password == ""){
				alert("<spring:message code="member.blankBoth" />");
				return false;
			}else if(mberId != "" && password == ""){
				document.detailForm.j_password.focus();
				alert("<spring:message code="member.blankPass" />");
				return false;
			}else if(password != "" && mberId == ""){
				document.detailForm.j_username.focus();
				alert("<spring:message code="member.blankId" />");
				return false;
			}
			
			return true;
		}
	</script>
</body>
</html>