<!doctype html>
<html lang="ko">
<head>
    <meta charset="utf-8">
    <meta name="naver-site-verification" content="894ba0807460988349b1e131377b26966e347fc1"/>
    <meta name="google-site-verification" content="CitaOJM4btglyBtNxZFYymBBzh3g7Pb9PxKl9YF8jDg" />
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta property="fb:app_id" content="961578337335000" />
    <meta property="og:type" content="website" />
    <meta property="og:url" content="https://crossmap.co.kr/web/register" />
    <meta property="og:title" content="크로스맵 (회원가입) - 기독교 종합 포털" />
    <meta property="og:description" content="크로스맵은 일상 속에서 은혜를 구하는 크리스천을 위한 기독교 종합 포털사이트입니다." />
    <meta property="og:image" content="https://crossmap.co.kr" />
    <meta name="description" content="크로스맵은 일상 속에서 은혜를 구하는 크리스천을 위한 기독교 종합 포털사이트입니다.">
    <meta name="keywords" content="크로스맵 회원가입">
    <title>크로스맵 (로그인) - 기독교 종합 포털</title>
    <link rel="shortcut icon" href="<?php echo THEME_FOLDER; ?>/img/shortcut_icon.png">
    <link rel="apple-touch-icon" href="<?php echo THEME_FOLDER; ?>/img/shortcut_icon.png">
    <link rel="apple-touch-startup-image" href="<?php echo THEME_FOLDER; ?>/img/shortcut_icon.png">
    <link rel="shortcut icon" href="<?php echo THEME_FOLDER; ?>/img/favicon.ico" type="image/x-icon" />

    <!-- css -->
    <link rel="stylesheet" href="<?php echo THEME_FOLDER; ?>/css/main.css">
    <link rel="stylesheet" href="<?php echo THEME_FOLDER; ?>/css/popup.css">
    <!-- Font -->
    <link href="https://fonts.googleapis.com/css?family=Nanum+Gothic" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Nanum+Myeongjo" rel="stylesheet"> 
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">

    <script src="<?php echo THEME_FOLDER; ?>/js/jquery-3.3.1.min.js"></script>
    <script src="<?php echo THEME_FOLDER; ?>/js/common.js"></script>
    <script src="<?php echo THEME_FOLDER; ?>/js/jquery.vticker.min.js"></script>
    <script src="//developers.kakao.com/sdk/js/kakao.min.js"></script>    
</head>

<body>

<script>
var press_curr_page = 1;
function change_press_page(page){
    var total_page = "0";
    var move_page = press_curr_page + page;
    if(move_page > 0 && total_page >= move_page) {
        $("#company_page"+move_page).show();
        $("#company_page"+press_curr_page).hide();
        press_curr_page = move_page;
    }
}
var company_curr_page = 1;
function change_company_page(page){
    var total_page = "1";
    var move_page = company_curr_page + page;
    if(move_page > 0 && total_page >= move_page) {
        $("#company_page"+move_page).show();
        $("#company_page"+company_curr_page).hide();
        company_curr_page = move_page;
    }
}

function change_is_direct_type(id) {
    $("#press").hide();
    $("#category").hide();
    $("#"+id).show();
}

// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
    if (response.status === 'connected') {
        FB.api('/me', function(response) {
            if(response.id!='') {
                var form_data = {
                    "id"            : response.id,
                    "name"          : response.name
                };
                $.ajax({
                    url: '/web/share/facebook_login_proc',
                    async: false,
                    type: 'POST',
                    dataType: 'JSON',
                    data: form_data,
                    success: function (rtnJson) {
                        if (rtnJson.code == "0000") {
                            window.location.reload();
                        } else {
                            alert("페이스북 로그인에 실패했습니다.");
                            return false;
                        }

                    },
                    error: function (rtnJson) {
                        return false;
                    }
                });
            }
        });
    }
}

function checkLoginState() {
    window.FB.login(function(response) {
        console.log(response);
        if (response.status === 'connected') {
            statusChangeCallback(response);
        }
    });
}

window.fbAsyncInit = function() {
    FB.init({
        appId      : '961578337335000',
        cookie     : true,  // enable cookies to allow the server to access
        xfbml      : true,  // parse social plugins on this page
        version    : 'v2.8' // use graph api version 2.8
    });
};
// Load the SDK asynchronously
(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "https://connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

</script>    <iframe id="kmc_mobile_auth" src="/web/comm/kmc_mobile_auth" style="width:0px;height:0px;position:absolute; top:0; left:-9999px;" ></iframe>


<!-- Default Statcounter code for Crossmap.co.kr
http://crossmap.co.kr -->
<script type="text/javascript">
var sc_project=10767957; 
var sc_invisible=1; 
var sc_security="0cf2c0fe"; 
</script>
<script type="text/javascript" src="https://www.statcounter.com/counter/counter.js" async></script>
<noscript><div class="statcounter"><a title="Web Analytics" href="http://statcounter.com/" target="_blank"><img class="statcounter" src="//c.statcounter.com/10767957/0/0cf2c0fe/1/" alt="Web Analytics"></a></div></noscript>
<!-- End of Statcounter Code -->

<script language='javascript'>
var _AceGID=(function(){var Inf=['gtp13.acecounter.com','8080','AH5A41707571392','AW','0','NaPm,Ncisy','ALL','0']; var _CI=(!_AceGID)?[]:_AceGID.val;var _N=0;var _T=new Image(0,0);if(_CI.join('.').indexOf(Inf[3])<0){ _T.src =( location.protocol=="https:"?"https://"+Inf[0]:"http://"+Inf[0]+":"+Inf[1]) +'/?cookie'; _CI.push(Inf);  _N=_CI.length; } return {o: _N,val:_CI}; })();
var _AceCounter=(function(){var G=_AceGID;var _sc=document.createElement('script');var _sm=document.getElementsByTagName('script')[0];if(G.o!=0){var _A=G.val[G.o-1];var _G=(_A[0]).substr(0,_A[0].indexOf('.'));var _C=(_A[7]!='0')?(_A[2]):_A[3];var _U=(_A[5]).replace(/\,/g,'_');_sc.src=(location.protocol.indexOf('http')==0?location.protocol:'http:')+'//cr.acecounter.com/Web/AceCounter_'+_C+'.js?gc='+_A[2]+'&py='+_A[4]+'&gd='+_G+'&gp='+_A[1]+'&up='+_U+'&rd='+(new Date().getTime());_sm.parentNode.insertBefore(_sc,_sm);return _sc.src;}})();
</script>
<noscript><img src='http://gtp13.acecounter.com:8080/?uid=AH5A41707571392&je=n&' border='0' width='0' height='0' alt=''></noscript> 
<!-- AceCounter Log Gathering Script End -->

<div id="pw_3month_auto_change_fin" style="display:none;">
    <div class="popup_wrap">
        <div class="popupbox">
            <div class="popuptop  trc">
                <h3 class="p_title">비밀번호 변경 완료</h3>
                <span class="btn-close"><a href="/"><img src="/renew/img/btn-close.png"></a></span>
            </div>
            <div class="popupbody">
                <div class="bgb trc" style="padding:30px 0 20px;">
                    <span class="ft24" style="margin-top: 5px;color: #606060;display: inline-block;">비밀번호가 변경되었습니다.</span>
                </div>
                <div class="ft18 trc" style="padding: 20px 0; width: 90%; margin: 0 auto;">
                    <span class="beachblue">비밀번호 변경</span>에 따른 안내
                </div>
                <dl class="pw_table">
                    <dt>아이디</dt>
                    <dd><div id="cp_member_id"></div></dd>
                    <dt>이메일</dt>
                    <dd><div id="cp_member_email"></div></dd>
                    <dt>변경일시</dt>
                    <dd><div id="cp_now_date"></div></dd>
                    <dt>다음 변경 권고일</dt>
                    <dd><div id="cp_next_change_date"></div></dd>
                </dl>
                <div class="trc f14" style="padding-top:30px;">
                    비밀번호를 다시 변경하시려면 로그인 후 <span class="beachblue" style="text-decoration:underline">내정보관리</span><br>
메뉴를 이용해주세요.
                </div>
                <div class="form-group bgt" style="margin:30px 0 40px 0; display:block; text-align:center; padding-top:30px;">
                    <button type="button" class="btn btn-success br20" style="padding:7px 40px; font-size:16px" onclick="location.href='/'">로그인하기</button>
                </div>
            </div>
        </div>
    </div>
</div>


<!-- 비밀번호 찾기 -->
<div id="find_pwd_layer" style="display:block;">
    <div class="popup_wrap">
        <div class="popupbox trc">
            <div class="popuptop">
                <h3 class="p_title">비밀번호 찾기 </h3>
                 
                <!-- <span class="btn-close"><a href="javascript:commonLayerClose('find_pwd_layer')"><img src="/renew/img/btn-close.png"></a></span> -->
                <span class="btn-close"><a href="javascript:goMain()"><img src="/renew/img/btn-close.png"></a></span>
            </div>
            <div class="popupbody">
                <div class="ft18 pd30 beachblue">원하시는 방식을 선택해 주세요.</div>
                <dl class="bgb notice_list ft16">
                    <dt>모바일폰 인증으로 찾기</dt>
                    <dd><input type="radio" name="find_password_type" id="find_password_type1" value="1"></dd>
                    <dt>이메일 인증으로 찾기</dt>
                    <dd><input type="radio" name="find_password_type" id="find_password_type2" value="2" checked></dd>
                </dl>
                <div class="form-group" style="margin:30px 0; display:block; text-align:center">
                    <button type="button" class="btn btn-success br20" style="padding:10px 50px; font-size:16px" onclick="find_password_type_select();">확인</button>
                     
                    <!-- <button type="button" class="btn btn-default_bb br20" style="padding:10px 50px; font-size:16px " onclick="commonLayerClose('find_pwd_layer')">취소</button> -->
                    <button type="button" class="btn btn-default_bb br20" style="padding:10px 50px; font-size:16px " onclick="goMain()">취소</button>
                </div>
            </div>
        </div>
    </div>
</div>
<!--// 비밀번호 찾기 -->


<div id="find_pwd_fin_layer" style="display:none;">
    <div class="popup_wrap">
        <div class="popupbox trc">
            <div class="popuptop">
                <h3 class="p_title">비밀번호 찾기 </h3>
                                <!-- <span class="btn-close"><a href="javascript:commonLayerClose('find_pwd_fin_layer');"><img src="/renew/img/btn-close.png"></a></span> -->
                <span class="btn-close"><a href="javascript:goMain();"><img src="/renew/img/btn-close.png"></a></span>
            </div>
            <div class="popupbody">
                <div class="ft16" style="padding-top:48px;font-size:20px;">인증된 메일  </div>
                <div class="ft16" style="padding: 15px 0; font-size:20px;"><span class="beachblue" id="find_pwd_email_text"></span></div>
                <div class="ft16" style="padding: 15px 0; font-size:20px;"><br>로 변경된 임시비밀번호 정보를 <br>발신하였습니다.<br><br>회원님의 소중한 개인정보 보호를 위해</div>
                <div class="ft16" style="padding: 15px 0; font-size:20px;">지금 꼭! 비밀번호를 변경하신 후,<br>로그인 하시기 바랍니다. </div>
                <div class="form-group" style="margin:30px 0 60px; display:block; text-align:center">
                    <button type="button" class="btn btn-success br20" style="padding:7px 40px; font-size:16px" onclick="document.location.href='/web/user/login';"><span class="current">로그인하기</span></button>
                </div>
            </div>
        </div>
    </div>
</div>      


<div id="find_pwd_email_layer" style="display:none;">
    <div class="popup_wrap">
        <div class="popupbox">
            <div class="popuptop  trc">
                <h3 class="p_title">비밀번호 찾기</h3>
                                <!-- <span class="btn-close"><a href="javascript:commonLayerClose('find_pwd_email_layer');"><img src="/renew/img/btn-close.png"></a></span> -->
                <span class="btn-close"><a href="javascript:goMain();"><img src="/renew/img/btn-close.png"></a></span>
            </div>
            <div class="popupbody">
                <div class="ft16 bgb trc" style="padding:30px 0 20px;">본인확인 이메일로 인증</div>
                <div style="padding:20px 0">가입시 입력한 이메일 주소와 해당 이메일에 맞는 본인 이름을 작성해주시기 바랍니다.</div>
                <div class="info_forms">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="아이디" name="find_pwd_id" id="find_pwd_id" style="width:97%;">
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="이메일 주소 " name="find_pwd_email" id="find_pwd_email" style="margin-top:10px; width:97%;">
                    </div>
                    <div style=" border: 1px solid #ccc; border-radius:5px; padding:10px; margin-top:10px; font-size:12px;">
                        메일이 스팸 메일로 분류된 것은 아닌지 확인해 주세요.
                    </div>
                </div>
                <div class="form-group bgt" style="margin:30px 0 30px 0; display:block; text-align:center; padding-top:30px;">
                    <button type="button" class="btn btn-success br20" style="padding:7px 40px; font-size:16px;" onclick="find_pwd_email_proc();">확인 </button>
                </div>
            </div>
        </div>
    </div>
</div>





<script>
$(document).ready(function() {

});

$(".mask").on('click', function(event){
    $(event.target).parent().hide();

});

function check_password(){
    if($("#profile_password").val()==""){
        alert("비밀번호를 입력해주세요.");
        return false;
    }

    var form_data = {
        "member_id"     : "",
        "member_pwd"    : $("#profile_password").val()
    };
    $.ajax({
        url: '/web/member/password_check_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            console.log(rtnJson);
            console.log(rtnJson.code);
            if (rtnJson.code == "0000") {
                location.href="/web/mypage/member_edit";
            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('비밀번호 확인에 실패했습니다.');
            return false;
        }
    });
}

// 비밀번호 찾기
function find_password_type_select(){
    $("input[name=find_password_type]:checked").each(function() {
        var find_password_type = $(this).val();
        if(find_password_type == '1') {
            $('#kmc_mobile_auth')[0].contentWindow.kmc_window_open('', 'find_password');
        } else {
            commonLayerClose('find_pwd_layer');
            commonLayerOpen('find_pwd_email_layer');
        }
    });
}

// 아이디 찾기
function find_id_type_select(){

    $("input[name=find_id_type]:checked").each(function() {
        var find_id_type = $(this).val();
        if(find_id_type == '1') {
            $('#kmc_mobile_auth')[0].contentWindow.kmc_window_open('', 'find_id');
        } else {
            commonLayerClose('find_id_layer');
            commonLayerOpen('find_id_email_layer');
        }
    });
}
// 아이디 찾기 메일 보내기
function find_id_email_proc(){
    if($("#find_id_name").val()==true){
        alert("이름을 입력해주세요.");
        return false;
    }
    if($("#find_id_email").val()==true){
        alert("이메일주소를 입력해주세요.");
        return false;
    }
    if(checkEmail($("#find_id_email").val())==false) {
        alert("이메일을 확인해주세요.");
        return false;
    }
    var form_data = {
        "content"   : $("#find_id_name").val(),
        "email"     : $("#find_id_email").val(),
        "type"      : 'id',
    };
    $.ajax({
        url: '/web/comm/find_by_email_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
                alert("인증번호를 메일로 발송했습니다.");
                return false;
            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('인증번호 발송에 실패했습니다.');
            return false;
        }
    });
}

// 아이디찾기 인증 확인
function find_id_email_auth_proc(){
    if($("#find_id_name").val()==true){
        alert("이름을 입력해주세요.");
        return false;
    }
    if($("#find_id_email").val()==true){
        alert("이메일주소를 입력해주세요.");
        return false;
    }
    if(checkEmail($("#find_id_email").val())==false) {
        alert("이메일을 확인해주세요.");
        return false;
    }
    if($("#find_id_auth_key").val()==true){
        alert("인증번호를 입력해주세요.");
        return false;
    }

    var form_data = {
        "content"   : $("#find_id_name").val(),
        "email"     : $("#find_id_email").val(),
        "type"      : 'id',
        "auth_key"  : $("#find_id_auth_key").val()
    };
    $.ajax({
        url: '/web/comm/find_by_email_auth_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
                commonLayerClose('find_id_email_layer');
                commonLayerOpen('find_id_fin_layer');
                $("#find_id_text").html(rtnJson.data);
                return false;


            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('인증번호 발송에 실패했습니다.');
            return false;
        }
    });

}

// 비밀번호 이메일로 찾기
function find_pwd_email_proc(){
    if($("#find_pwd_id").val()==true){
        alert("아이디를 입력해주세요.");
        return false;
    }
    if($("#find_pwd_email").val()==true){
        alert("이메일주소를 입력해주세요.");
        return false;
    }
    if(checkEmail($("#find_pwd_email").val())==false) {
        alert("이메일을 확인해주세요.");
        return false;
    }

    var form_data = {
        "type"      : "email",
        "id"        : $("#find_pwd_id").val(),
        "key"       : $("#find_pwd_email").val()
    };
    $.ajax({
        url: '/web/comm/find_password_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
                commonLayerClose('find_pwd_layer');
                commonLayerClose('find_pwd_email_layer');
                commonLayerOpen('find_pwd_fin_layer');
                $("#find_pwd_email_text").html(rtnJson.data);
                return false;

            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('비밀번호 찾기에 실패했습니다.');
            return false;
        }
    });



}



// 비밀번호 변경
function change_password(){
    if($("#now_pwd").val()==""){
        alert("현재 비밀번호를 입력해주세요.");
        return false;
    }

    if($("#new_member_pwd").val()=="") {
        alert("비밀번호를 입력해주세요.");
        return false;
    }

    if(member_pwd_valid_check($("#new_member_pwd").val())==false) {
        alert("비밀번호는 6~16 영문 대·소문자,숫자,특수문자로 입력해주세요.");
        return false;
    }

    if($("#new_re_member_pwd").val()=="") {
        alert("비밀번호를 확인을 입력해주세요.");
        return false;
    }

    if($("#new_member_pwd").val() != $("#new_re_member_pwd").val()) {
        alert("비밀번호를 확인을 입력해주세요.");
        return false;
    }

    if($("#now_pwd").val() == $("#new_member_pwd").val()) {
        alert("변경할 비밀번호와 현재 비밀번호는 다르게 입력해주세요.");
        return false;
    }

    var form_data = {
        "now_pwd"           : $("#now_pwd").val(),
        "new_member_pwd"    : $("#new_member_pwd").val()
    };
    $.ajax({
        url: '/web/member/password_change_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {

                $("#cp_next_change_date").html(rtnJson.data.next_change_data);
                $("#cp_now_date").html(rtnJson.data.now_date);
                $("#cp_member_id").html(rtnJson.data.member_id);
                $("#cp_member_email").html(rtnJson.data.member_email);

                commonLayerClose('pw_3month_auto_change');
                commonLayerOpen('pw_3month_auto_change_fin');
            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('비밀번호 변경에 실패했습니다.');
            return false;
        }
    });
}






// 로그인
function login_proc(){
    if($("#login_member_id").val()=="") {
        alert("아이디를 입력해주세요.");
        return false;
    }
    if($("#login_member_pwd").val()=="") {
        alert("아이디를 입력해주세요.");
        return false;
    }

    var save_login = 'N';
    if($('input:checkbox[id="save_login"]').is(":checked") == true){
        save_login = $('input:checkbox[id="save_login"]').val()
    }

    var form_data = {
        "member_id"     : $("#login_member_id").val(),
        "member_pwd"    : $("#login_member_pwd").val(),
        "save_login"    : save_login
    };
    $.ajax({
        url: '/web/member/login_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
                if(rtnJson.msg!=''){
                    alert(rtnJson.msg);
                }
                location.href="https://crossmap.co.kr/";
                
            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('로그인에 실패했습니다.');
            return false;
        }
    });
}



function join_reset(){
    if($("#login_layer").css("display") == "block") {
        $("#login_layer").hide();
    }

    $('#join_form')[0].reset();
    $("#member_pwd").removeClass('mybutton_on');
    $("#member_pwd").removeClass('mybutton_off');
    $("#member_pwd").addClass('mybutton_off');
    $("#re_member_pwd").removeClass('mybutton_on');
    $("#re_member_pwd").removeClass('mybutton_off');
    $("#re_member_pwd").addClass('mybutton_off');

    $("#gender_btn1").removeClass('btn-default_bb');
    $("#gender_btn1").removeClass('btn-default');
    $("#gender_btn1").addClass('btn-default');

    $("#gender_btn2").removeClass('btn-default_bb');
    $("#gender_btn2").removeClass('btn-default');
    $("#gender_btn2").addClass('btn-default');


    $(".profile_add_photo label").css("background","url('img/img_photo.png') no-repeat center");
    $(".profile_add_photo label").css("background-size","cover");
}


// 크로스맵으로 가입
function crossmap_join(){
    join_reset();
    commonLayerClose('member_join1_layer');
    commonLayerOpen('member_join2_layer');
}

// 트위터로 가입
function twitter_join(val){
   join_reset();
    var form_data = {
        "type"          : val
    };
    $.ajax({
        url: '/web/comm/twitter_request_token',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.result_code == "0000") {
                var url = rtnJson.result_data.url;
                console.log(url);
                window.open(url, "", "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes");

            } else {
                alert("트위터 계정인증에 실패했습니다.");
                return false;
            }
        },
        error: function (rtnJson) {
            alert('트위터 계정인증에 실패했습니다.');
            return false;
        }
    });
}

//  카카오로 가입
function kakako_login(){
    join_reset();

    var state = "61e0276330e9f515a169ca77dda4a833";
    var url = "https://kauth.kakao.com/oauth/authorize?client_id=d9d530edc95295682137fdd37dddc55f&redirect_uri=https://crossmap.co.kr/web/share/kakao_callback_proc&response_type=code&state="+state;
    window.open(url, "", "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes");
}

// 네이버로 가입
function naver_login(){
    join_reset();

    var state = "61e0276330e9f515a169ca77dda4a833";
    var url = "https://nid.naver.com/oauth2.0/authorize?response_type=code&client_id=cNiinVHYsygxVKF4FOtw&redirect_uri=https://crossmap.co.kr/web/share/naver_callback_proc&state="+state;
    window.open(url, "", "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes");
}





// 이용약관동의
function policy_agreement(){
    if($("#agree1").is(":checked")==false){
        alert("서비스 이용약관 동의를 해주세요.");
        return false;
    }

    if($("#agree2").is(":checked")==false){
        alert("개인정보 취급방침 동의를 해주세요.");
        return false;
    }

    if($("#agree3").is(":checked")==false){
        alert("개인정보 수집 및 이용 동의를 해주세요.");
        return false;
    }

    if($("#social_id").val()!='') {
        $("#crossmap_join").hide();

        var form_data = {
            "social_id" : $("#social_id").val()
        };
        $.ajax({
            url: '/web/comm/social_member_info',
            sync: false,
            type: 'POST',
            dataType: 'json',
            data: form_data,
            success: function (rtn_json) {
                if(rtn_json.result_code!='0000') {
                    alert("sns 계정연동에 실패했습니다.");
                    $("#social_id").val('');
                    return false;
                } else {
                    $("#member_name").val(rtn_json.result_data.name);
                    if(rtn_json.result_data.profile_img!='') {
                        $(".profile_add_photo label").css("background","url('"+rtn_json.result_data.profile_img+"') no-repeat center");
                        $(".profile_add_photo label").css("background-size","cover");
                        $("#sns_profile_img").val(rtn_json.result_data.profile_img);
                    }
                }
            },
            error: function (rtnHtml) {
                return false;
            }
        });

    }
    commonLayerClose('member_join2_layer');
    commonLayerOpen('member_join3_layer');

}


// 아이디 중복체크
function member_overlap_check(){
    var member_id  = $("#member_id").val();
    if(member_id=="") {
        alert("아이디를 입력해주세요.");
        return false;
    }
    if(member_id_valid_check(member_id)==false) {
        alert("아이디는 5~20자의 영문 대 소문자, 숫자와 (_),(-)만 사용 가능합니다.");
        return false;
    }

    var form_data = {
        "member_id" : member_id
    };
    $.ajax({
        url: '/web/member/member_id_check_proc',
        sync: false,
        type: 'POST',
        dataType: 'json',
        data: form_data,
        success: function (rtn_json) {
            if(rtn_json.result_code!='0000') {
                alert("사용할수없는 아이디입니다.");
                $("#member_id").val('');
                $("#is_use_id").val('N');

                return false;
            } else {
                alert("사용가능한 아이디입니다.");
                $("#is_use_id").val('Y');
                return false;
            }
        },
        error: function (rtnHtml) {
            $("#is_use_id").val('N');
            return false;

        }
    });
}

// 비밀번호 체크
function member_pwd_check(t){
    var id  = t.id;
    var val = t.value;

    $("#"+id).removeClass('mybutton_off');
    if(member_pwd_valid_check(val)==false) {
        $("#"+id).addClass('mybutton_off');
    } else {
        $("#"+id).addClass('mybutton_on');
    }
}

// 성별체크
function member_gender_select(val){
    var member_gender = $("#member_gender").val();

    $("#gender_btn"+member_gender).removeClass('btn-default_bb');
    $("#gender_btn"+member_gender).addClass('btn-default');

    $("#member_gender").val(val);
    $("#gender_btn"+val).addClass('btn-default_bb');
}

// 만14세 체크
function birth_change(){
    var birth_year  = $("#birth_year").val();
    var birth_month = $("#birth_month").val();
    var birth_day   = $("#birth_day").val();

    if(birth_year!='' && birth_month!='' && birth_day!='') {
        var date = new Date();
        var year = date.getFullYear();
        var month = (date.getMonth() + 1);
        var day = date.getDate();
        if (month < 10) month = '0' + month;
        if (day < 10) day = '0' + day;
        var today = year+month+day;
        var birth = birth_year+birth_month+birth_day;

        var result  = parseInt(today) - parseInt(birth) - 150000;
         if(parseInt(result) < 0) { // 14세미만
             $("#under14_form").show();
             $("#more14_form").hide();
             $("#is_under14").val('Y');
         } else {
             $("#under14_form").hide();
             $("#more14_form").show();
             $("#is_under14").val('N');
         }
    }
}

// 프로필이미지 등록
function readURL(input) {
    if (input.files && input.files[0]) {
        var reader = new FileReader();
        reader.onload = function (e) {
            $(".profile_add_photo label").css("background","url('"+e.target.result+"') no-repeat center");
            $(".profile_add_photo label").css("background-size","cover");
            $("#sns_profile_img").val('');
        }
        reader.readAsDataURL(input.files[0]);
    }
}

// 이메일선택
function email_change(val){
    $("#email2").val(val);
}

// 14세 미만
// 이메일 중복체크
function under14_email_overlap_check(){
    $("#email_check").val('N');
    var email = $("#under14_member_email").val();
    if(checkEmail(email)==false) {
        alert("이메일을 확인해주세요.");
        return false;
    }

    var form_data = {
        "email"     : email
    };
    $.ajax({
        url: '/web/member/member_email_check_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.result_code != "0000") {
                alert("사용할수 없는 이메일입니다.");
                return false;
            } else {
                alert("사용가능한 이메일입니다.");
                $("#email_check").val('Y');
                return false;
            }
        },
        error: function (rtnJson) {
            alert('이메일 중복확인을 실패했습니다.');
            return false;
        }
    });

}





// 이메일 중복체크
function email_overlap_check(){
    $("#email_check").val('N');
    var email = $("#email1").val()+'@'+$("#email2").val();
    if(checkEmail(email)==false) {
        alert("이메일을 확인해주세요.");
        return false;
    }

    var form_data = {
        "email"     : email
    };
    $.ajax({
        url: '/web/member/member_email_check_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.result_code != "0000") {
                alert("사용할수 없는 이메일입니다.");
                return false;
            } else {
                alert("사용가능한 이메일입니다.");
                $("#email_check").val('Y');
                return false;


            }
        },
        error: function (rtnJson) {
            alert('이메일 중복확인을 실패했습니다.');
            return false;
        }
    });

}

// 휴대폰 인증
function mobile_auth(){
    var mobile = $("#mobile1").val()+$("#mobile2").val()+$("#mobile3").val();
    if(checkMobile(mobile)==false){
        alert("휴대폰번호를 확인해주세요.");
        return false;
    }
    $('#kmc_mobile_auth')[0].contentWindow.kmc_window_open(mobile, 'member_join1');
}

// 보호자 모바일 인증
function parent_mobile_auth(){
    if($("#parent_mobile_company").val()=="") {
        alert("통신사를 선택해주세요. 입력해주세요.");
        return false;
    }

    var mobile = $("#parent_mobile").val();
    if(checkMobile(mobile)==false){
        alert("휴대폰번호를 확인해주세요.");
        return false;
    }

    $('#kmc_mobile_auth')[0].contentWindow.kmc_window_open(mobile, 'member_join2');

}


function member_join_next(){
    if($("#social_id").val()==""){
        if($("#member_id").val()=="") {
            alert("아이디를 입력해주세요.");
            return false;
        }

        if($("#is_use_id").val()!="Y") {
            alert("아이디 중복확인을 해주세요.");
            return false;
        }


        if($("#member_pwd").val()=="") {
            alert("비밀번호를 입력해주세요.");
            return false;
        }

        if($("#re_member_pwd").val()=="") {
            alert("비밀번호를 확인을 입력해주세요.");
            return false;
        }

        if($("#member_pwd").val() != $("#re_member_pwd").val()) {
            alert("비밀번호를 확인을 입력해주세요.");
            return false;
        }
    }

    if($("#member_gender").val()=="") {
        alert("성별을 선택해주세요.");
        return false;
    }

    if($("#birth_year").val()=="") {
        alert("출생연도를 선택해주세요.");
        return false;
    }

    if($("#birth_month").val()=="") {
        alert("출생월을 선택해주세요.");
        return false;
    }

    if($("#birth_day").val()=="") {
        alert("출생일을 선택해주세요.");
        return false;
    }

    if($("#member_calendar").val()=="") {
        alert("양력/음력을 선택해주세요.");
        return false;
    }


    commonLayerClose('member_join3_layer');
    commonLayerOpen('member_join4_layer');
}


// 회원체크
function member_join(){
    if($("#social_id").val()==""){
        if($("#member_id").val()=="") {
            alert("아이디를 입력해주세요.");
            commonLayerClose('member_join4_layer');
            commonLayerOpen('member_join3_layer');
            return false;
        }

        if($("#is_use_id").val()!="Y") {
            alert("아이디 중복확인을 해주세요.");
            commonLayerClose('member_join4_layer');
            commonLayerOpen('member_join3_layer');
            return false;
        }

        if($("#member_pwd").val()=="") {
            alert("비밀번호를 입력해주세요.");
            commonLayerClose('member_join4_layer');
            commonLayerOpen('member_join3_layer');
            return false;
        }

        if($("#re_member_pwd").val()=="") {
            alert("비밀번호를 확인을 입력해주세요.");
            commonLayerClose('member_join4_layer');
            commonLayerOpen('member_join3_layer');
            return false;
        }

        if($("#member_pwd").val() != $("#re_member_pwd").val()) {
            alert("비밀번호를 확인을 입력해주세요.");
            commonLayerClose('member_join4_layer');
            commonLayerOpen('member_join3_layer');
            return false;
        }
    }

    if($("#member_name").val()=="") {
        alert("이름을 입력해주세요.");
        commonLayerClose('member_join4_layer');
        commonLayerOpen('member_join3_layer');
        return false;
    }

    if($("#member_gender").val()=="") {
        alert("성별을 선택해주세요.");
        commonLayerClose('member_join4_layer');
        commonLayerOpen('member_join3_layer');
        return false;
    }

    if($("#birth_year").val()=="") {
        alert("출생연도를 선택해주세요.");
        commonLayerClose('member_join4_layer');
        commonLayerOpen('member_join3_layer');
        return false;
    }

    if($("#birth_month").val()=="") {
        alert("출생월을 선택해주세요.");
        commonLayerClose('member_join4_layer');
        commonLayerOpen('member_join3_layer');
        return false;
    }

    if($("#birth_day").val()=="") {
        alert("출생일을 선택해주세요.");
        commonLayerClose('member_join4_layer');
        commonLayerOpen('member_join3_layer');
        return false;
    }

    if($("#member_calendar").val()=="") {
        alert("양력/음력을 선택해주세요.");
        commonLayerClose('member_join4_layer');
        commonLayerOpen('member_join3_layer');
        return false;
    }

    var email = $("#email1").val()+'@'+$("#email2").val();
    if(checkEmail(email)==false) {
        alert("이메일을 확인해주세요.");
        return false;
    }

    if($("#email_check").val()!='Y'){
        alert("이메일 중복확인해주세요.");
        return false;
    }


    var mobile = $("#mobile1").val()+$("#mobile2").val()+$("#mobile3").val();
    if(checkMobile(mobile)==false){
        alert("휴대폰번호를 확인해주세요.");
        return false;
    }

    if($("#is_mobile_auth").val()!="Y") {
        alert("휴대폰 본인인증을 해주세요.");
        return false;
    }

    if($("#mobile_CI").val()=="") {
        alert("휴대폰 본인인증을 해주세요.");
        return false;
    }

    if($("#member_name").val()=="") {
        alert("휴대폰 본인인증한 이름이 없습니다.");
        return false;
    }


    $('#join_form').submit();

}


// 14세 미만 회원가입
function under14_member_join(){
    if($("#is_under14").val()=='N') {
        alert("잘못된 경로로 가입을 하셨습니다.");
        join_reset();

        commonLayerClose('member_join3_layer');
        commonLayerOpen('member_join2_layer');
        return false;
    }
    if($("#social_id").val()==""){
        if($("#member_id").val()=="") {
            alert("아이디를 입력해주세요.");
            return false;
        }

        if($("#is_use_id").val()!="Y") {
            alert("아이디 중복확인을 해주세요.");
            return false;
        }

        if($("#member_pwd").val()=="") {
            alert("비밀번호를 입력해주세요.");
            return false;
        }

        if($("#re_member_pwd").val()=="") {
            alert("비밀번호를 확인을 입력해주세요.");
            return false;
        }

        if($("#member_pwd").val() != $("#re_member_pwd").val()) {
            alert("비밀번호를 확인을 입력해주세요.");
            return false;
        }
    }


    if($("#member_gender").val()=="") {
        alert("성별을 선택해주세요.");
        return false;
    }

    if($("#birth_year").val()=="") {
        alert("출생연도를 선택해주세요.");
        return false;
    }

    if($("#birth_month").val()=="") {
        alert("출생월을 선택해주세요.");
        return false;
    }

    if($("#birth_day").val()=="") {
        alert("출생일을 선택해주세요.");
        return false;
    }

    if($("#member_calendar").val()=="") {
        alert("양력/음력을 선택해주세요.");
        return false;
    }

    if($("#parent_name").val()=="") {
        alert("보호자 이름을 입력해주세요.");
        return false;
    }

    if($("#parent_mobile_company").val()=="") {
        alert("통신사를 선택해주세요. 입력해주세요.");
        return false;
    }

    var mobile = $("#parent_mobile").val();
    if(checkMobile(mobile)==false){
        alert("휴대폰번호를 확인해주세요.");
        return false;
    }

    if($("#is_mobile_auth").val()!="Y") {
        alert("휴대폰 본인인증을 해주세요.");
        return false;
    }

    if($("#mobile_CI").val()=="") {
        alert("휴대폰 본인인증을 해주세요.");
        return false;
    }

    if($("#under14_member_name").val()=="") {
        alert("이름을 입력해주세요.");
        return false;
    }

    var under14_member_email = $("#under14_member_email").val();
    if(checkEmail(under14_member_email)==false) {
        alert("이메일을 확인해주세요.");
        return false;
    }

    if($("#email_check").val()!='Y'){
        alert("이메일 중복확인해주세요.");
        return false;
    }

    $('#join_form').submit();

}


// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
    if (response.status === 'connected') {
        FB.api('/me', function(response) {
            if(response.id!='') {
                var form_data = {
                    "id"            : response.id,
                    "name"          : response.name
                };
                $.ajax({
                    url: '/web/share/facebook_login_proc',
                    async: false,
                    type: 'POST',
                    dataType: 'JSON',
                    data: form_data,
                    success: function (rtnJson) {
                        if (rtnJson.code == "0000") {
                            window.location.reload();
                        } else {
                            alert("페이스북 로그인에 실패했습니다.");
                            return false;
                        }

                    },
                    error: function (rtnJson) {
                        return false;
                    }
                });
            }


        });
    }
}

function checkLoginState() {
    window.FB.login(function(response) {
        console.log(response);
        if (response.status === 'connected') {
            statusChangeCallback(response);
        }
    });
}


window.fbAsyncInit = function() {
    FB.init({
        appId      : '961578337335000',
        cookie     : true,  // enable cookies to allow the server to access
        xfbml      : true,  // parse social plugins on this page
        version    : 'v2.8' // use graph api version 2.8
    });
};
// Load the SDK asynchronously
(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "https://connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));


</script>
    <script>
function getCookie( name ) {
   var nameOfCookie = name + "=";
   var x = 0;
   while ( x <= document.cookie.length )
   {
       var y = (x+nameOfCookie.length);
       if ( document.cookie.substring( x, y ) == nameOfCookie ) {
           if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
               endOfCookie = document.cookie.length;
           return unescape( document.cookie.substring( y, endOfCookie ) );
       }
       x = document.cookie.indexOf( " ", x ) + 1;
       if ( x == 0 )
           break;
   }
   return "";
}
</script>


</body>
</html>
