<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<link rel="stylesheet" type="text/css" href="/resources/css/common.css" />
<link rel="stylesheet" type="text/css" href="/resources/css/sub.css" />
<title>SIMS</title>
<link rel="shortcut icon" type="image/png" href="/resources/images/ui/CI_logo.ico"/>
<link rel="icon" type="image/ico" href="/resources/images/ui/CI_logo.ico"/>
</head>
<body>
<script type="text/javascript" src="/resources/js/jquery-3.6.1.min.js"></script>
<script>
    $(document).ready(function(){
        var userInputId = getCookie("userInputId");
        $("input[name='id']").val(userInputId); 
         
        if($("input[name='id']").val() != "")
            $("#idSaveCheck").attr("checked", true);
         
        $("#idSaveCheck").change(function(){
            if($("#idSaveCheck").is(":checked")){
                var userInputId = $("input[name='id']").val();
                setCookie("userInputId", userInputId, 7);
            }else
                deleteCookie("userInputId");            
        });
         
        $("input[name='id']").keyup(function(){
            if($("#idSaveCheck").is(":checked")){
                var userInputId = $("input[name='id']").val();
                setCookie("userInputId", userInputId, 7);
            }
        });
        
        var input = document.getElementById("TA_Id");
        var input2 = document.getElementById("TA_passwd");
        input.addEventListener("keypress", function (event) {
            if (event.keyCode === 13) {
                event.preventDefault();
                input2.focus();
            }
          });
        
        input2.addEventListener("keypress", function (event) {
            if (event.keyCode === 13) {
                event.preventDefault();
                if($("#TA_Id").val().replace(' ','')==''){
                	alert("아이디를 입력해주세요.");
                	return;
                }
                if($("#TA_passwd").val().replace(' ','')==''){
                    alert("비밀먼호를 입력해주세요.");
                    return;
                }
                $("#frmLogin").submit();
            }
          });
        //refreshData();
    });
    $(function(){
        $('#infoSend').click(function(){
            if($("#TA_Id").val().replace(' ','')==''){
                alert("아이디를 입력해주세요.");
                return;
            }
            if($("#TA_passwd").val().replace(' ','')==''){
                alert("비밀먼호를 입력해주세요.");
                return;
            }
        	$("#frmLogin").submit();
        });
    });
    function setCookie(cookieName, value, exdays){
        var exdate = new Date();
        exdate.setDate(exdate.getDate() + exdays);
        var cookieValue = escape(value) + ((exdays==null) ? "" : "; expires=" + exdate.toGMTString());
        document.cookie = cookieName + "=" + cookieValue;
    }
     
    function deleteCookie(cookieName){
        var expireDate = new Date();
        expireDate.setDate(expireDate.getDate() - 1);
        document.cookie = cookieName + "= " + "; expires=" + expireDate.toGMTString();
    }
     
    function getCookie(cookieName) {
        cookieName = cookieName + '=';
        var cookieData = document.cookie;
        var start = cookieData.indexOf(cookieName);
        var cookieValue = '';
        if(start != -1){
            start += cookieName.length;
            var end = cookieData.indexOf(';', start);
            if(end == -1)end = cookieData.length;
            cookieValue = cookieData.substring(start, end);
        }
        return unescape(cookieValue);
    } 
    
</script>
    
    <div id="container"> 
        <div id="contents_container" style="padding:0px;width:1080px">  
            <div class="loginCenter" style="margin:180px 300px;">
              <div class="intro">
                <div class="inner"> 
                  <!-- <strong>SIMS</strong>
                  <p style="color: black;font-size: 20px;width: 600px;">(The System for Integrated mental health care and social services)</p>
                  <strong style="padding: 0;padding-left: 260px;">에 오신 것을 환영합니다.</strong> -->
                  <strong style="padding-top: 50px;width: 600px;font-size: 40px; letter-spacing: 0.7px;">SIMS에 오신 것을 환영합니다.</strong>
                  <p style="color: black;font-size: 20px;width: 600px;letter-spacing: -1.5px;">(The System for Integrated mental health care and social services)</p>
                  <p style="padding-top: 15px;">관리자 계정으로 로그인 할 수 있습니다.</p>
                </div>
              </div>
              <div class="loginForm">
                <form id="frmLogin" action="/login" method='POST'>
                  <table>
                    <caption>아이디, 비밀번호를 입력하는 로그인 서식 </caption>
                    <tbody>
                      <tr>
                        <th scope="row"><label for="TA_Id">아이디</label></th>
                        <td><input type="text" id="TA_Id" name="id" placeholder="아이디를 입력해 주세요." class="large" style="width:322px;" autocomplete="off"/></td>
                      </tr>
                      <tr>
                        <th scope="row"><label for="TA_passwd">비밀번호</label></th>
                        <td><input type="password" id="TA_passwd" name="pw" placeholder="비밀번호를 입력해 주세요." class="large" style="width:322px;"/></td>
                      </tr>
                      <tr>
                        <td colspan="2">
                            <span class="formElement" style="position:relative">
                                <input type="checkbox" id="idSaveCheck" name="idSaveCheck"/>
                                <em style="display:inline-block; position:absolute; top:-8px; width:200px;font-family:Noto Regular">
                                    <label for="idSaveCheck">아이디 기억하기</label>
                                </em> 
                            </span>
                         </td>
                      </tr>
                      
                    </tbody>
                  </table>
                  <button type="button" id="infoSend" value="Login" >로그인</button>
                </form>
              </div>
            </div>
        </div>
    </div>
        <!-- footer  -->
        <div id="footer" style="margin-top:-150px;">
            <div class="line01">
                <span><a href="http://www.chmhc.or.kr/">센터소개</a></span>
                <span>이용약관</span>
                <span><a href="/privacyPolicy2">개인정보취급방침</a></span></div>
            <div class="line02">(32256) 충청남도 홍성군 홍북읍 의향로 273 펠리피아 504-506호<br/>
              <span style="background:none !important">Tel : 041-633-9183~5</span> <span>Fax : 041-633-9187</span></div>
            <div class="line03">Copyright © CHUNGCHEONGNAM-DO MENTAL HEALTH WELFARE CENTER. All rights reserved.</div>
            <p id="_version" style="margin-left:50%;font-family: 'Noto Regular';font-size: 10px;color: #969696;">260211_W1</p>
        </div><!--footer-->
</body>
</html>