<?php
header("Pragma: no-cache");
header("Cache-Control: no-cache,must-revalidate");

$tr_url     = WWW_CROSSMAP.'/web/comm/kmc_callback_proc'; // 본인인증 결과수신 POPUP URL
$tr_add     = 'Y';          // IFrame사용여부


?>

<!doctype html>
<html lang="ko">
<head>
    <meta charset="utf-8">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no" />
    <script src="/js/jquery-3.3.1.min.js"></script>
    <script src="/js/web/common.js"></script>
</head>
<body>


<form name="reqKMCISForm" method="post" action="#">
<input type="hidden" name="tr_cert" id="tr_cert">
<input type="hidden" name="tr_url"  id="tr_url" value = "<?=$tr_url?>">
<input type="hidden" name="tr_add"  id="tr_add" value = "<?=$tr_add?>">
</form>


<script>
function kmc_window_open(mobile, type){
    var form_data = {
		"mobile"			: mobile,
        "type"              : type
	};
	$.ajax({
        url: '/web/comm/kmc_encode_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
			if(rtnJson.code=='9999') {
				alert("본인인증에 실패했습니다.");
                return false;

			} else {
			    $("#tr_cert").val(rtnJson.data);
                openKMCISWindow();
            }
        },
        error: function (rtnHtml) {
            alert('본인인증에 실패했습니다.');
            return_state = false;
        }

    });
}


// kmc 본인인증
window.name = "kmcis_web";
var KMCIS_window;
function openKMCISWindow(){
    var UserAgent = navigator.userAgent;
    /* 모바일 접근 체크*/
    // 모바일일 경우 (변동사항 있을경우 추가 필요)
    if (UserAgent.match(/iPhone|iPod|Android|Windows CE|BlackBerry|Symbian|Windows Phone|webOS|Opera Mini|Opera Mobi|POLARIS|IEMobile|lgtelecom|nokia|SonyEricsson/i) != null || UserAgent.match(/LG|SAMSUNG|Samsung/) != null) {
        document.reqKMCISForm.target = '';
    } else {  // 모바일이 아닐 경우
    	KMCIS_window = window.open('', 'KMCISWindow', 'width=425, height=550, resizable=0, scrollbars=no, status=0, titlebar=0, toolbar=0, left=435, top=250' );
        if(KMCIS_window == null){
    	    alert(" ※ 윈도우 XP SP2 또는 인터넷 익스플로러 7 사용자일 경우에는 \n    화면 상단에 있는 팝업 차단 알림줄을 클릭하여 팝업을 허용해 주시기 바랍니다. \n\n※ MSN,야후,구글 팝업 차단 툴바가 설치된 경우 팝업허용을 해주시기 바랍니다.");
        }
     	document.reqKMCISForm.target = 'KMCISWindow';
    }
    document.reqKMCISForm.action = 'https://www.kmcert.com/kmcis/web/kmcisReq.jsp';
    document.reqKMCISForm.submit();
}


function mobile_auth_fin(key, name){
    $("#is_mobile_auth", parent.document).val("Y");
    $("#mobile_CI", parent.document).val(key);
    $("#member_name", parent.document).val(name);
    $('.mobile_auth_btn', parent.document).hide();

}

function mobile_auth_password_find_fin(key){
    var form_data = {
		"key"			: key,
        "type"          : 'mobile'
	};
	$.ajax({
        url: '/web/comm/find_password_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
			if(rtnJson.code=='9999') {
				alert(rtnJson.msg);
                return false;

			} else {
			    $('#find_pwd_layer', parent.document).hide();
			    $('#find_pwd_fin_layer', parent.document).show();
                $('#find_pwd_email_text', parent.document).html(rtnJson.data);

            }
        },
        error: function (rtnHtml) {
            alert('비밀번호 찾기에 실패했습니다 실패했습니다.');
            return_state = false;
        }

    });
}

function mobile_auth_id_find_fin(key){
    var form_data = {
		"key"			: key,
        "type"          : 'mobile'
	};
	$.ajax({
        url: '/web/comm/find_id_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
			if(rtnJson.code=='9999') {
				alert(rtnJson.msg);
                return false;

			} else {
			    $('#find_id_layer', parent.document).hide();
			    $('#find_id_fin_layer', parent.document).show();
                $('#find_id_text', parent.document).html(rtnJson.data);

            }
        },
        error: function (rtnHtml) {
            alert('비밀번호 찾기에 실패했습니다 실패했습니다.');
            return_state = false;
        }

    });
}

function mobile_auth_email_check_fin(){
    $("#is_mobile_auth_email", parent.document).val("Y");
    $('#email_change_layer2', parent.document).show();
    $('#email_change_layer1', parent.document).hide();

}

function mobile_auth_member_edit_fin(phone){
    var form_data = {
		"mobile"			: phone
	};
	$.ajax({
        url: '/web/member/member_mobile_change_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
			if(rtnJson.code=='9999') {
				alert(rtnJson.msg);
                return false;
			} else {
			    $("#member_edit_mobile", parent.document).val("");
			    $('#mobile_edit_layer', parent.document).hide();
                $('#member_edit_text', parent.document).html('+82 '+rtnJson.data);
            }
        },
        error: function (rtnHtml) {
            alert('모바일폰 변경에 실패했습니다.');
            return_state = false;
        }

    });


}






</script>


</body>
</html>
