<?php
	session_start();
	include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';

?>
<? include("./inc/inc_top.php") ?>

<!-- <!DOCTYPE html>
<HTML lang="ko">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?=ADMIN_TITLE?></title>
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="<?=ADMIN_PATH?>/css/admin.css?version_code=<?=ADMIN_CSS_VERSION_CODE?>">
<script type="text/javascript" charset="utf-8" src="<?=ADMIN_PATH?>js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/common/js/common.js?version_code=<?=JS_VERSION_CODE?>"></script>
</head>

<body> -->

<form name="frmLogin" id="frmLogin" method="post" action="<?=ADMIN_PATH?>admin/admin_proc.php">
<input type="hidden" name="mode" value="Login"/>
<input type="hidden" name="url" value="<?=ADMIN_PATH?>admin/admin_list.php?m=1"/>
<div class="box_login">
	<p><img src="<?=ADMIN_PATH?>/img/txt_login.gif" alt="LOGIN"></p>
	<p><input type="text" name="cd_userid" id="cd_userid" class="inp_login" placeholder="아이디"></p>
	<p><input type="password" name="nm_pass" id="nm_pass" class="inp_login" placeholder="비밀번호"></p>
	<p><input type="button" id="btn_login" value="로그인" title="로그인"></p>
	<!--p class="area_link">
		<a href="#">아이디 찾기</a>
		<a href="#">비밀번호 찾기</a>
		<a href="#">회원가입</a>
	</p-->
</div>
</form>

<script language="javascript" type="text/javascript">
	function login_proc() {
		var custom_opts = {
			title : '',
			btn_close_show : false,
		}

		$("#btn_login").hide();
		var data = $("#frmLogin").serialize();
		$.ajax({
			url : '<?=ADMIN_PATH?>admin/admin_proc.php',
			type: 'POST',
			dataType : 'json',
			data: data,
			success: function(res) {
				custom_opts.title = res.MSG;

				$("#btn_login").show();

				//세션 종료시 로그인 페이지로 이동
				if(res.CODE != "0000") {
					if(res.CODE == "4444") {
						window.location.href = res.DATAS.URL;
					}
					custom_modal_alert(custom_opts);
					return false;
				}
				link(res.DATAS.URL);
			},
			error:function(request,status,error){
				$("#btn_login").show();

				alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
			}
		});
	}
	$(document).ready(function() {
		$("body").keypress(function(e){
			if(e.keyCode!=13){
				return;
			}else{
				var fieldlist = [["cd_userid","아이디"],["nm_pass","패스워드"]]
				if (!fnCheckForm(fieldlist)){
					return false;
				}else{
					login_proc();
					// $("#frmLogin").submit();
				}
			}
		});

		$("#btn_login").bind("click",function(){
			var fieldlist = [["cd_userid","아이디"],["nm_pass","패스워드"]]
			if (!fnCheckForm(fieldlist)){
				return false;
			}else{
				login_proc();
				// $("#frmLogin").submit();
			}
		});
	});
</script>

<? include("./inc/inc_bottom.php") ?>
