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

?>
<!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>



<script>
$( document ).ready(function() {
    <? if($type=='find_password') {?>
    mobile_auth_password_find_fin('<?=$CI?>');
    <? } else if($type=='find_id') {?>
    mobile_auth_id_find_fin('<?=$CI?>');
    <? } else if($type=='email_check') {?>
    mobile_auth_email_check_fin();
    <? } else if($type=='member_edit') {?>
    mobile_auth_member_edit_fin('<?=$phone?>');
    alert("번호 수정 완료");
    <? } else {?>
    mobile_auth_fin('<?=$CI?>', '<?=$name?>');
    <?  }?>
   self.close();
});

function mobile_auth_fin(key, name){
	$("#is_mobile_auth", opener.document).val("Y");
	$("#mobile_CI", opener.document).val(key);
	$("#member_name", opener.document).val(name);
	$('.mobile_auth_btn', opener.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', opener.document).hide();
				$('#find_pwd_fin_layer', opener.document).show();
				$('#find_pwd_email_text', opener.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', opener.document).hide();
				$('#find_id_fin_layer', opener.document).show();
				$('#find_id_text', opener.document).html(rtnJson.data);

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

	});
}

function mobile_auth_email_check_fin(){
	$("#is_mobile_auth_email", opener.document).val("Y");
	$('#email_change_layer2', opener.document).show();
	$('#email_change_layer1', opener.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", opener.document).val("");
				$('#mobile_edit_layer', opener.document).hide();
				$('#member_edit_text', opener.document).html('+82 '+rtnJson.data);
			}
		},
		error: function (rtnHtml) {
			alert('모바일폰 변경에 실패했습니다.');
			return_state = false;
		}

	});


}




</script>

</body>
</html>

