function pop_user_auth(auth_type , type, device) {
    var auth_url = '/shop/user_auth_request.html';

    if (auth_type == 'SKIP') {
        if (document.form1 && document.form1.auth_select_type && document.form1.auth_select_type.type == 'hidden') {
            document.form1.auth_select_type.value = 'N';
        } else if (device == 'MOBILE') {
            document.ipinOutForm.submit();
        }
        return;
    } else if (document.form1 && document.form1.auth_select_type && document.form1.auth_select_type.type == 'hidden') {
        document.form1.auth_select_type.value = '';
    } else {
        if (document.getElementsByName('ipin_type').length > 0) { 
            obj = document.getElementsByName('ipin_type');
        } else if (document.getElementsByName('auth_select_type').length > 0) {
            obj = document.getElementsByName('auth_select_type');
        }

        if (typeof obj != 'undefined' && obj.length > 0) {
            for (var i = 0; i < obj.length; i++) {
                if (obj[i].checked === true) {
                    chk_auth = obj[i].value;
                }
            }

            if (auth_type == 'MOBILE' && chk_auth != 'M') {
                alert('휴대폰 인증을 선택하셔야 인증이 가능합니다.');
                return;
            } else if (auth_type == 'NHAUTH' && chk_auth != 'NA') {
                alert('네이버인증서를 선택하셔야 인증이 가능합니다.');
                return;
            } else if (auth_type == 'IPIN' && chk_auth != 'Y') {
                alert('아이핀 인증을 선택하셔야 인증이 가능합니다.');
                return;
            }
        }
    }
    if (device == 'MOBILE') {
        // 모바일에서 회원정보 수정시 페이지 이동으로 인한 경고문구
        if (auth_type == 'MOBILE' && type == 'change') {
            if (!confirm("입력중이던 정보가 초기화 됩니다.\n계속 진행하시겠습니까?")) {
                return false;
            }
        }
        var add_string = '';
        // 회원가입일 경우 post데이터를 넘겨줘야 한다.
        if (type == 'join') {
            var ipinOutForm = document.getElementById('ipinOutForm');
            if (ipinOutForm != 'undefined') {
                add_string = 'data_third_party_agree='+ ipinOutForm.data_third_party_agree.value;
                add_string += '&data_trust_agree='+ ipinOutForm.data_trust_agree.value;
                add_string += '&mem_type='+ ipinOutForm.mem_type.value;
                add_string += '&cur_page='+ ipinOutForm.cur_page.value;
                add_string += '&join_type='+ ipinOutForm.join_type.value;
                add_string += '&data_privacy_agree='+ ipinOutForm.data_privacy_agree.value;
                if (typeof ipinOutForm.b_store !== 'undefined') {
                    add_string += '&b_store='+ ipinOutForm.b_store.value;
                }
                if (typeof ipinOutForm.is_modern_member != 'undefined') {
                    add_string += '&is_modern_member=' + ipinOutForm.is_modern_member.value;
                }
                if (typeof ipinOutForm.mh_join_type != 'undefined') {
                    add_string += '&mh_join_type=' + ipinOutForm.mh_join_type.value;
                }
                if (typeof ipinOutForm.mem_simple_type != 'undefined') {
                    add_string += '&mem_simple_type=' + ipinOutForm.mem_simple_type.value;
                }
                if (typeof ipinOutForm.id != 'undefined') {
                    add_string += '&id=' + ipinOutForm.id.value;
                }
                add_string += '&';
            }
        } else if (type == 'find') {
            if (document.form1 && document.form1.checktype) {
                for (var i = 0 ; i < document.form1.checktype.length; i++) {
                    if (document.form1.checktype[i].checked) {
                        add_string = 'checktype=' + document.form1.checktype[i].value;
                    }
                }
            }
            if (document.form1 && document.form1.find_type && document.form1.find_type.value.length > 0) {
                add_string += '&find_type=' + document.form1.find_type.value;
            }
            if (document.form1 && document.form1.mh_find_pw && document.form1.mh_find_pw.value.length > 0) {
                add_string += '&mh_find_pw=' + document.form1.mh_find_pw.value;
            }
        } else if (type == 'auth') {
            if (document.ipinOutForm != 'undefined' && document.ipinOutForm.returnurl) {
                add_string += 'returnurl='+ document.ipinOutForm.returnurl.value;
                add_string += '&';
            }
        }

        document.location.href = auth_url + "?" + add_string + "&type=" + type + '&auth_type=' + auth_type;
    } else {
        var _height = (auth_type == 'NHAUTH' ? 720 : 560);
        var auth = window.open(auth_url + "?type=" + type + '&auth_type=' + auth_type, "auth_popup", "width=432,height=" + _height+ ",scrollbars=yes"); 
        auth.focus();
    }
}

function mobile_service() {
    window.open('http://www.mobile-ok.com/service_intro.html');
}

function naver_auth_info() {
    window.open('https://nid.naver.com/user2/eSign/v1/intro/simpleCertify', 'auth_info_pop');
}
