
<div class="footer">
	<div class="wrap">
		<ul class="foot_link">
			<li><a href="https://hwttjung.wixsite.com/mysite-1" target="https://hwttjung.wixsite.com/mysite-1">회사소개</a></li>
			<li><a href="/rules/privacy">개인정보 취급방침</a></li>
			<li><a href="/rules/service">이용약관</a></li>
			<li><a href="/cs/notice">고객센터</a></li>
		</ul>
		<span class="copyright">© 2016 The CrossMap. All Rights Reserved</span>
		<div class="f_social">
			<a href="/"><img src="<?php echo THEME_FOLDER; ?>/img/f_icon1.png" alt="" title=""></a>
			<a href="https://www.instagram.com/crossmapkr/"  target="_blank"><img src="<?php echo THEME_FOLDER; ?>/img/f_icon2.png" alt="" title=""></a>
			<a href="https://www.facebook.com/crossmapkr/" target="_blank"><img src="<?php echo THEME_FOLDER; ?>/img/f_icon3.png" alt="" title=""></a>
			<a href="#"><img src="<?php echo THEME_FOLDER; ?>/img/f_icon5.png" alt="" title=""></a>
		</div>
	</div>
</div>
<!-- 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="delivery_layer" style="display:none;">
    <div class="popup_wrap2_d" style="z-index:9998;">
		<div class="popupbox2" style="width:810px;">
			<div class="popuptop3_d">
				<h3 class="p_title2"><strong>홍길동</strong> 님의 배달함 <a href="javascript:change_delivery_type('3')"><span style="padding-left:40px;" class="current" id="delivery_menu3">채널</span></a>  | <a href="javascript:change_delivery_type('2')"><span id="delivery_menu2">칼럼</span></a>  | <a href="javascript:change_delivery_type('9')"><span id="delivery_menu9">태그</span></a></h3>
				<span class="btn-info"><a href="javascript:change_help()"><img src="<?php echo THEME_FOLDER; ?>/img/btn-info.png"></a></span>
				<span class="btn-close"><a href="javascript:change_toggle('delivery_layer')"><img src="<?php echo THEME_FOLDER; ?>/img/btn-close2.png"></a></span>
			</div>
		</div>

		<div class="popupbody3_d">
            <div class="pop_tit">
				<span id="delivery_text">배달받는 채널 수</span> <span class="beachblue" id="delivery_count">0</span>
				<span class="fr pop_box_d"><a href="javascript:delivery_arr_del()">전체삭제</a></span>
			</div>
            <div id="delivery_list">
                    </div>

        <div style="height:50px"></div>            <div class="btn btn-default btn_life" id="delivery_more_btn" style="display:none">
                <a href="javascript:delivery_list('');">더보기 </a><img src="<?php echo THEME_FOLDER; ?>/img/img_replyopen.gif">
            </div>
        </div>
	</div>
    <div class="mask" style="z-index: 9997"></div>
</div>


<div class="delivery_info3" id="delivery_help" style="z-index:9999;top:195px;left:895px;width:200px;display:none">
	<p class="d_info_tit" style="text-align:center; margin:10px 0">배달함 도움말</p>
	<p class="d_info_txt" style="margin-bottom: 15px;display: inline-block;"> 채널 배달받기를 하고 있는 나만의배달리스트를 관리 할수 있습니다. </p>
</div>




<script>
// 레이어 이외의 공간 클릭시 close
$(document).mouseup(function (e){
    var container = $("#delivery_help");
    if( container.has(e.target).length === 0)   container.hide();
});

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

});

var help_type = 1;
function change_help(){

    if(help_type ==1) {
        $("#delivery_help").css("display","block");
        help_type = 2;
    } else {
        $("#delivery_help").css("display","none");
        help_type = 1;
    }


}


var delivery_content_type = '3';
function change_delivery_type(content_type) {
    $('#delivery_menu3').removeClass('current');
    $('#delivery_menu2').removeClass('current');
    $('#delivery_menu9').removeClass('current');
    $('#delivery_menu'+content_type).addClass('current');

    delivery_page = 1;
    delivery_content_type = content_type;
    delivery_list(content_type);

    var text = '배달받는 채널 수';
    if(content_type == '2') {
        text = '배달받는 칼럼 수';
    } else if(content_type == '3') {
        text = '배달받는 채널 수';
    } else if(content_type == '9') {
        text = '배달받는 태그 수';
    }
    $("#delivery_text").html(text);

}


var delivery_page = 2;
function delivery_list(content_type){
    if(content_type == '') content_type = delivery_content_type;

    console.log(content_type);
    var form_data = {
		"page"          : delivery_page,
		"content_type"  : content_type
	};
	$.ajax({
        url: '/web/comm/delivery_list',
        async: false,
        type: 'POST',
        dataType: 'HTML',
        data: form_data,
        success: function (rtnHtml) {
        	if(rtnHtml=='') return false;
			var arrHtml = rtnHtml.split("|||||");
			if(arrHtml[0].trim()=='0000') {
			    if(delivery_page == 1) {
			        $("#delivery_list").html(arrHtml[1]);
                } else {
                    $("#delivery_list").append(arrHtml[1]);
                }
                var total_count = setComma(arrHtml[2]);
                $("#delivery_count").html(total_count);
                
				if (arrHtml[3] == "N") {
					$("#delivery_more_btn").hide();
				} else {
					$("#delivery_more_btn").show();
				}
				delivery_page++;

			} else {
				alert(arrHtml[1]);
               	return false;
			}
        },
        error: function (rtnHtml) {
            alert('데이터 가져오기에 실패했습니다.');
            return false;
        }
    });
}

function delivery_del(idx){
    var form_data = {
        "idx"			: idx
    };
    $.ajax({
        url: '/web/comm/delivery_del_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
                delivery_page = 1;
                delivery_list(delivery_content_type);
            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('삭제에 실패했습니다.');
            return false;
        }
    });

}



function delivery_arr_del(){
	if(confirm("배달함이 삭제됩니다. 삭제하시겠습니까?") == true) {    //확인
        var checkbox_del = [];
         $("input[name='is_del[]']").each(function(idx){
            checkbox_del.push($(this).val());
        });
        var form_data = {
            "idxs"			: checkbox_del
        };
        $.ajax({
            url: '/web/comm/delivery_arr_del_proc',
            async: false,
            type: 'POST',
            dataType: 'JSON',
            data: form_data,
            success: function (rtnJson) {
                if (rtnJson.code == "0000") {
                    delivery_page = 1;
                    delivery_list(delivery_content_type);
                } else {
                    alert(rtnJson.msg);
                    return false;
                }
            },
            error: function (rtnJson) {
                alert('삭제에 실패했습니다.');
                return false;
            }
        });



	} else {   //취소
		return false;
	}


}



function copy_delivery_url(idx){
    $('#copy_delivery_url'+idx).select();
    try {
        document.execCommand('copy');
        alert("주소가 복사되었습니다.")
    } catch (err) {
        alert('이 브라우저는 지원하지 않습니다.')
    }
}



</script>
    

<div id="user_comment_layer" style="display:none;">
	<div class="popup_wrap2_d" style=" z-index: 9998;">
		<div class="popupbox2_d" style=" width:810px;">
			<div class="popuptop3_d">
				<h3 class="p_title2"><strong><span id="user_comment_nicname">홍길동</span></strong> 님의 댓글
					<span style="padding-left:40px;"><a href="javascript:change_user_comment_content_type(3)" class="current" id="user_comment_menu3">라이프</a> | <a href="javascript:change_user_comment_content_type(1)" id="user_comment_menu1">뉴스</a> | <a href="javascript:change_user_comment_content_type(2)" id="user_comment_menu2">칼럼</a></span>
				</h3>
				<a href="javascript:change_toggle('my_comment_policy')"><span class="btn-tit">댓글운영정책</span></a>
				<span class="btn-info"><a href="javascript:change_toggle('my_comment_policy')"><img src="<?php echo THEME_FOLDER; ?>/img/btn-info.png"></a></span>
				<span class="btn-close"><a href="javascript:commonLayerClose('user_comment_layer')"><img src="<?php echo THEME_FOLDER; ?>/img/btn-close2.png"></a></span>

				<div class="delivery_info3" id="my_comment_policy" style="display:none;">
					<p class="d_info_tit" style="text-align:center; margin:10px 0">댓글운영정책</p>
					<p class="d_info_txt">크로스맵 댓글은 게시물에 대하여 자신의 생각을 말하고 남의 생각을 들으며 서로 다양한 의견을 나누는 공간입니다. 그러나 간혹 불건전한 내용을 올리시는 분들이 계셔서 건전한 인터넷문화 정착을 위해 아래와 같은 운영원칙을 적용합니다.<br><br><span style="text-decoration:underline; margin-bottom: 15px;display: inline-block;">1. 댓글의 삭제 및 제한 조치</span><br>네티즌들의 신고 또는 자제 모니터링을 통해 아래에 해당하는 내용이 포함된 댓글이 발견되면 예고없이 삭제 또는 제한 조치를 하겠습니다. <br></p>
					<table style="font-size:13px;">
					<tr>
						<td>1) 타인에 대한 욕설 또는 비방 </td>
						<td>2) 인신공격 또는 명예훼손 </td>
					</tr>
					<tr>
						<td>3) 개인정보 유출 또는 사생활 침해</td>
						<td>4) 음란성 내용 또는 음란물 링크 </td>
					</tr>
					<tr>
						<td>5) 상업적 광고 또는 사이트/홈피 홍보&nbsp;&nbsp;&nbsp;</td>
						<td>6) 불법정보 유출</td>
					</tr>
					<tr>
						delivery_info3	<td>7) 같은 내용의 반복(도배) </td>
						<td>8) 폭력 또는 사행심 조장 </td>
					</tr>
					<tr>
						<td>9) 기타 게시물 내용과 관계없는 내용</td>
						<td></td>
					</tr>
					</table>
					<br><br>
					<p class="d_info_txt"><span style="text-decoration:underline; margin-bottom: 15px;display: inline-block;">2. 댓글 작성에 대한 제한</span><br>불건전한 댓글은 발견시 별도의 통보없이 즉시 삭제 또는 제한 조치 하며 상습적 또는 위반 정도가 심한 댓글을 올리시는 분에 대해서는 일정 기간 댓글 작성에 대한 권한을 제한할 수 있습니다.<br>또한 비정상적인 패턴으로 조회, 추천, 반대 등이 발생하는 것으로 관리자 또는 시스템이 판단하는 경우 부정 클릭여부를 확인하여 해당 IP나 ID를 제재할 수 있습니다.<br>명예훼손, 개인정보유츨, 욕설 등 법률에 위반되는 댓글은 관계 법령에 의거 민형사상 처벌을 받을 수 있으니 이용에 주의를 부탁 드립니다.<br><br><span style="text-decoration:underline; margin-bottom: 15px;display: inline-block;">3. 뉴스, 칼럼 댓글함 전체공개</span><br>건전한 댓글 문화를 위하여 뉴스 및 칼럼 댓글에 한해서만 댓글모음이 전체공개됩니다. 제공되는 목록에 삭제한 댓글이나 답글은 포함되지 않습니다. <br></p>
					<div class="form-group" style="margin:20px 0; display:block; text-align:center">
						<button type="button" class="btn btn-success" style="padding:5px 20px; font-size:14px" onclick="change_toggle('my_comment_policy')"">확인</button>
					</div>
				</div>
			</div>
			<div class="popupbody3_d" >
				<div class="pop_tit">
					댓글/답글 <span class="beachblue" id="user_comment_count"></span>
					<div class="reply_sort_d">
						<span><a href="javascript:change_user_comment_sort(1)" id="user_comment_sort1">호감순</a></span>
						<span><a href="javascript:change_user_comment_sort(2)" id="user_comment_sort2" class="current">최신순</a></span>
						<span><a href="javascript:change_user_comment_sort(3)" id="user_comment_sort3">과거순</a></span>
						<span><a href="javascript:change_user_comment_sort(4)" id="user_comment_sort4">답글순</a></span>
					</div>
				</div>

				<div id="user_comment_list"></div>
				<div style="height:30px;display:none" id="user_comment_bottom"></div>
				<div class="btn btn-default btn_life" id="user_comment_more_btn">
					<a href="javascript:user_comment_list();">더보기 </a><img src="<?php echo THEME_FOLDER; ?>/img/img_replyopen.gif">
				</div>
			</div>
		</div>
	</div>
	<div class="mask" style="z-index: 9997"></div>
</div>






<!-- 댓글 신고 -->
<div id="comment_spam_layer" style="display:none;">
	<input type="hidden" name="comment_spam_idx" id="comment_spam_idx">
 	<div class="popup_wrap" style="position: fixed">
		<div class="popupbox trc" style=" width:445px; ">
			<div class="popuptop">
				<h3 class="p_title">신고하기 </h3>
				<span class="btn-close"><a href="javascript:commonLayerClose('comment_spam_layer')"><img src="<?php echo THEME_FOLDER; ?>/img/btn-close.png"></a></span>
			</div>
			<div class="popupbody">
				<dl class="bgb notice2 pd30 ft16">
					<dt>신고대상</dt>
					<dd id="comment_write_name_txt"></dd>
					<dt style="padding-top:6px;">내용</dt>
					<dd class="info_forms">
						<div class="form-group">
							<input type="text" name="spam_reason_content" id="spam_reason_content" class="form-control" placeholder="간략 내용이 들어갑니다." style="width:97%;">
						</div>
					</dd>
				</dl>
				<div class="ft18 pd30 beachblue">신고를 원하시는 이유를 선택해 주세요.</div>
				<dl class="bgb notice_list ft16">
					<dt>부적절한 홍보 게시물</dt>
					<dd><input type="radio" name="spam_reason_type" id="spam_reason_type1" value="1" checked=""></dd>
					<dt>음란성 혹은 청소년에게 유해</dt>
					<dd><input type="radio" name="spam_reason_type" id="spam_reason_type2" value="2" ></dd>
					<dt>명예훼손 혹은 저작권 침해</dt>
					<dd><input type="radio" name="spam_reason_type" id="spam_reason_type3" value="3" ></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="comment_spam_proc();">확인</button>
					<button type="button" class="btn btn-default_bb br20" style="padding:10px 50px; font-size:16px " onclick="commonLayerClose('comment_spam_layer')">취소</button>
				</div>
			</div>
		</div>
	</div>
	<div class="mask"></div>
</div>



<script>
// 댓글 신고
function comment_spam(idx, write_name){
	if("alexkoo"=="") {
        alert("로그인 후에 이용가능합니다.");
        return;
    }

    //$("html, body").scrollTop(0);

	$("#comment_spam_layer").toggle();
	$("#comment_write_name_txt").html(write_name);
	$("#comment_spam_idx").val(idx);
	$("#spam_reason_content").val('');
	$('input:radio[name="spam_reason_type"][value="1"]').prop('checked', true);

}


function comment_spam_proc(){
	var idx = $("#comment_spam_idx").val();
	if(idx == '') {
		alert("신고하기에 실패되었습니다.");
		$("#comment_spam_layer").toggle();
		return false;
	}

	if($("#spam_reason_content").val()== '') {
		alert("신고내용을 입력해주세요.");
		return false;
	}

	var form_data = {
		"comment_idx"			: idx,
		"spam_reason_content"	: $("#spam_reason_content").val(),
		"spam_reason_type"		: $(":input:radio[name=spam_reason_type]:checked").val()

	};
	$.ajax({
        url: '/web/comm/comment_spam_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
            	alert("신고되었습니다.");
				$("#comment_spam_layer").toggle();
				return false;
            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('저장에 실패했습니다.');
            return false;
        }
    });




}




</script>


<script>


var user_comment_page = 1;
var user_comment_content_type = '3';
var user_comment_write_id = 'alexkoo';
var user_comment_sort = '2';



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

});

$('.user_replay_text').click(function(e) {
	$("#social_login").toggle();

    $(".popup_wrap").css('left','50%');
	$(".popup_wrap").css('top',popH+'px');

});

$('.user_comment_text').on('keyup', function(event) {
	var key = $(this).attr('strA');
	var len = $(this).val().length;
   	if (len >= 300) {
      	$(this).val($(this).val().substring(0, 300));
		len = 300;
   	}
   	$("#user_reply_text_count"+key).html(len+'/300');
});





// sort
function change_user_comment_sort(type){
	user_comment_sort = type;
	user_comment_page = 1;
	user_comment_list();

	$('#user_comment_sort1').toggleClass('current');
    $('#user_comment_sort2').toggleClass('current');
    $('#user_comment_sort3').toggleClass('current');
    $('#user_comment_sort4').toggleClass('current');
}


// content_type
function change_user_comment_content_type(type){
	user_comment_content_type = type;
	user_comment_page = 1;
	user_comment_list();

	$('#user_comment_menu1').removeClass('current');
    $('#user_comment_menu2').removeClass('current');
    $('#user_comment_menu3').removeClass('current');

    $('#user_comment_menu'+type).addClass('current');



}


function user_comment_list() {

	var form_data = {
		"page"          : user_comment_page,
		"content_type"  : user_comment_content_type,
		"write_id"  	: user_comment_write_id,
		"sort"  		: user_comment_sort
	};
	$.ajax({
        url: '/web/comm/user_comment_list',
        async: false,
        type: 'POST',
        dataType: 'HTML',
        data: form_data,
        success: function (rtnHtml) {
        	if(rtnHtml=='') return false;
			var arrHtml = rtnHtml.split("|||||");
			if(arrHtml[0].trim()=='0000') {
			    if(user_comment_page == 1) {
			        $("#user_comment_list").html(arrHtml[1]);
                } else {
                    $("#user_comment_list").append(arrHtml[1]);
                }
                var total_count = setComma(arrHtml[2]);
                $("#user_comment_count").html(total_count);

				if (arrHtml[3] == "N") {
					$("#user_comment_more_btn").hide();
					$("#user_comment_bottom").show();
				} else {
					$("#user_comment_more_btn").show();
					$("#user_comment_bottom").hide();
				}
				user_comment_page++;

			} else {
				alert(arrHtml[1]);
               	return false;
			}
        },
        error: function (rtnHtml) {
            alert('데이터 가져오기에 실패했습니다.');
            return false;
        }
    });
}

// 대댓글 더보기
function user_comment_reply_more(idx){
	var page = $("#user_comment_reply_page"+idx).val();
	page = parseInt(page) + 1;
	$("#user_comment_reply_page"+idx).val(page);
	user_comment_reply_list(idx, page);

}


var user_comment_reply_open_type = 1;
function user_comment_reply_open(idx){

	if(user_comment_reply_open_type ==1) {
        $("#user_comment_reply_box"+idx).css("display","block");
		user_comment_reply_list(idx, 1);

        user_comment_reply_open_type = 2;
    } else {
        $("#user_comment_reply_box"+idx).css("display","none");
        user_comment_reply_open_type = 1;
    }


}


function user_comment_reply_list(idx, page) {
	var form_data = {
		"page"      	: page,
		"sort"      	: user_comment_sort,
		"comment_idx"	: idx,
		"type"			: "user_comment"
	};
	$.ajax({
        url: '/web/comm/comment_reply_list',
        async: false,
        type: 'POST',
        dataType: 'HTML',
        data: form_data,
        success: function (rtnHtml) {
        	if(rtnHtml=='') return false;
			var arrHtml = rtnHtml.split("|||||");
			if(arrHtml[0].trim()=='0000') {
			    if(page == 1) {
			        $("#user_comment_reply_list"+idx).html(arrHtml[1]);
                } else {
                    $("#user_comment_reply_list"+idx).append(arrHtml[1]);
                }
                var total_count = setComma(arrHtml[2]);
                $("#user_comment_reply_count").html(total_count);
				console.log(arrHtml[3]);
				if (arrHtml[3] == "N") {
					$("#user_comment_reply_more_btn"+idx).hide();
				} else {
					$("#user_comment_reply_more_btn"+idx).show();
				}
			} else {
				alert(arrHtml[1]);
               	return false;
			}
        },
        error: function (rtnHtml) {
            alert('데이터 가져오기에 실패했습니다.');
            return false;
        }
    });
	$("#user_comment_reply_box"+idx).show();



}




// 대대글 달기
function user_comment_reply_add_proc(p_idx, content_idx){
	if("alexkoo"=="") {
		alert("로그인 후에 이용가능합니다.");
		return;
	}

	if($("#user_comment"+p_idx).val()=="") {
		alert("댓글을 입력해주세요.");
		return;
	}

	var form_data = {
		"p_idx"					: p_idx,
		"content_idx"			: content_idx,
		"content_type"			: user_comment_content_type,
		"comment"				: $("#user_comment"+p_idx).val()
	};
	$.ajax({
        url: '/web/comm/comment_add_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
		success: function (rtnJson) {
        	if (rtnJson.code == "0000") {
				$("#user_comment"+p_idx).val('');
				$("#user_reply_text_count"+p_idx).html('0/300');
				$("#user_comment_reply_page"+p_idx).val(1);

				user_comment_reply_list(p_idx, 1);

            } else {
                alert(rtnJson.msg);
                return false;
            }

        },
        error: function (rtnJson) {
            alert('저장에 실패했습니다.');
            return false;
        }


    });

}


function user_comment_del(idx){
	if(confirm("댓글이 삭제됩니다. 삭제하시겠습니까?") == false) {
		return false;
	}


    var form_data = {
        "idx"			: idx
    };
    $.ajax({
        url: '/web/comm/user_comment_del_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
            	user_comment_page = 1;
                user_comment_list();

            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('삭제에 실패했습니다.');
            return false;
        }
    });

}


function user_reply_comment_del(idx, p_idx){
	if(confirm("댓글이 삭제됩니다. 삭제하시겠습니까?") == false) {
		return false;
	}


    var form_data = {
        "idx"			: idx
    };
    $.ajax({
        url: '/web/comm/user_comment_del_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
            	user_comment_reply_list(p_idx, 1);
            } else {
                alert(rtnJson.msg);
                return false;
            }
        },
        error: function (rtnJson) {
            alert('삭제에 실패했습니다.');
            return false;
        }
    });

}



function user_comment(write_id, write_name){
	user_comment_page = 1;
	user_comment_write_id = write_id;
	user_comment_list();
	$("#user_comment_layer").show();
	$("html, body").scrollTop(0);
	if(write_name!='') {
		$("#user_comment_nicname").html(write_name);
	}
}




function copy_user_comment_url(idx){
    $('#copy_user_comment_url'+idx).select();
    try {
        document.execCommand('copy');
        alert("주소가 복사되었습니다.")
    } catch (err) {
        alert('이 브라우저는 지원하지 않습니다.')
    }
}



// 댓글 좋아요
function user_comment_like_select(type, idx){
	if("alexkoo"=="") {
        alert("로그인 후에 이용가능합니다.");
        return;
    }
	var form_data = {
		"comment_idx"			: idx,
		"type"					: type
	};
	$.ajax({
        url: '/web/comm/comment_like_proc',
        async: false,
        type: 'POST',
        dataType: 'JSON',
        data: form_data,
        success: function (rtnJson) {
            if (rtnJson.code == "0000") {
            	var like_count 	= setComma(rtnJson.data.like_count);
            	var bad_count 	= setComma(rtnJson.data.bad_count);
				$("#comment_like1_"+idx).html(like_count);
				$("#comment_like2_"+idx).html(bad_count);

            } else {
                alert("저장에 실패했습니다.");
                return false;
            }
        },
        error: function (rtnJson) {
            alert('저장에 실패했습니다.');
            return false;
        }
    });

}




function logout_advice(){
	alert("로그아웃 후에 이용해주세요.");
	return false;
}






</script>
    

<div id="passwd_check_layer" style="display:none;">
    <div class="popup_wrap">
		<div class="popupbox" style=" width:445px; ">
			<div class="popuptop trc">
				<h3 class="p_title">비밀번호 확인 </h3>
				<span class="btn-close"><a href="javascript:commonLayerClose('passwd_check_layer')"><img src="<?php echo THEME_FOLDER; ?>/img/btn-close.png"></a></span>
			</div>
			<div class="popupbody">
				<div class="info_forms">
					<div class="form-group">
						<label for="exampleInputEmail1">비밀번호</label>
						<p>설정하신 비밀번호를 입력해주세요.</p>
						<input type="password" class="form-control" id="profile_password" name="profile_password" style="width:97%; margin:10px 0;" onkeypress="if( event.keyCode==13 ){check_password();}">
					</div>
					<div class="form-group">
						<label for="exampleInputEmail1">아이디/비밀번호 찾기</label>
						<p style="margin-bottom:10px;">설정하신 비번이 기억 안나시나요?</p>
						<p>
							<button type="button" class="btn btn-default br5" style="padding:7px 20px; font-size:16px; margin-right:10px;" onclick="commonLayerClose('passwd_check_layer');commonLayerOpen('find_id_layer');" >아이디찾기 </button>
							<button type="button" class="btn btn-default br5" style="padding:7px 20px; font-size:16px;" onclick="commonLayerClose('passwd_check_layer');commonLayerOpen('find_pwd_layer')">비밀번호 찾기 </button>
						</p>
					</div>
					<div class="form-group bgt" style="margin:40px 0 20px 0; display:block; text-align:center;padding-top: 20px;">
						<button type="button" class="btn btn-success br20" style="padding:7px 40px; font-size:16px; margin-right:10px" onclick="check_password();">확인 </button>
						<button type="button" class="btn btn-default br20" style="padding:7px 40px; font-size:16px;" onclick="commonLayerClose('passwd_check_layer')">취소 </button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="mask"></div>
</div>









<div id="pw_3month_auto_change_fin" style="display:none;">
    <div class="popup_wrap">
		<div class="popupbox" style=" width:445px; ">
			<div class="popuptop  trc">
				<h3 class="p_title">비밀번호 변경 완료</h3>
				<span class="btn-close"><a href="/"><img src="<?php echo THEME_FOLDER; ?>/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 class="mask1"></div>
</div>


<!-- 아이디 찾기 -->
<div id="find_id_layer" style="display:none;">
    <div class="popup_wrap">
		<div class="popupbox trc" style=" width:445px; ">
			<div class="popuptop">
				<h3 class="p_title">아이디 찾기 </h3>
				<span class="btn-close"><a href="javascript:commonLayerClose('find_id_layer');"><img src="<?php echo THEME_FOLDER; ?>/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_id_type" id="find_id_type2" value="2" checked></dd>
					<dt>본인명의 휴대전화로 인증</dt>
					<dd><input type="radio" name="find_id_type" id="find_id_type3" value="1"></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_id_type_select();">확인</button>
					<button type="button" onclick="commonLayerClose('find_id_layer');" class="btn btn-default_bb br20" style="padding:10px 50px; font-size:16px">취소</button>
				</div>
			</div>
		</div>
	</div>
	<div class="mask">
	</div>
</div>
<!--// 아이디 찾기 -->



<div id="find_id_email_layer" style="display:none;">
    <div class="popup_wrap">
		<div class="popupbox" style=" width:445px; ">
			<div class="popuptop  trc">
				<h3 class="p_title">아이디 찾기</h3>
				<span class="btn-close"><a href="javascript:commonLayerClose('find_id_email_layer');"><img src="<?php echo THEME_FOLDER; ?>/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_id_name" id="find_id_name" style="width:97%;">
					</div>
					<div class="form-group">
						<input type="text" class="form-control" placeholder="이메일 주소 " name="find_id_email" id="find_id_email" style="margin-top:10px; width:270px;">
						<button type="button" class="btn btn-default br5" style="padding:9px 0; font-size:16px;margin-top:10px;width:80px;" onclick="find_id_email_proc();">인증 </button>
					</div>
					<div class="form-group">
						<input type="text" name="find_id_auth_key" id="find_id_auth_key" class="form-control" placeholder="인증번호 숫자 6자리" style="margin-top:10px; width:97%;">

					</div>
					<div style="padding:10px 0 10px 15px; text-decoration:underline;"><a href="javascript:find_id_email_proc();" style="color:#898989">인증번호가 오지 않나요?</a></div>
					<div style=" border: 1px solid #ccc; border-radius:5px; padding: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_id_email_auth_proc();">확인 </button>
				</div>
			</div>
		</div>
	</div>
	<div class="mask">
	</div>
</div>




<!-- 비밀번호 찾기 -->
<div id="find_pwd_layer" style="display:none;">
    <div class="popup_wrap">
		<div class="popupbox trc" style=" width:445px; ">
			<div class="popuptop">
				<h3 class="p_title">비밀번호 찾기 </h3>
				<span class="btn-close"><a href="javascript:commonLayerClose('find_pwd_layer')"><img src="<?php echo THEME_FOLDER; ?>/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>
				</div>
			</div>
		</div>
	</div>
	<div class="mask">
	</div>
</div>
<!--// 비밀번호 찾기 -->


<div id="find_pwd_fin_layer" style="display:none;">
    <div class="popup_wrap">
		<div class="popupbox trc" style=" width:445px; ">
			<div class="popuptop">
				<h3 class="p_title">비밀번호 찾기 </h3>
				<span class="btn-close"><a href="javascript:commonLayerClose('find_pwd_fin_layer');"><img src="<?php echo THEME_FOLDER; ?>/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="commonLayerClose('find_pwd_fin_layer');commonLayerOpen('login_layer');"><span class="current">로그인하기</span></button>
				</div>
			</div>
		</div>
	</div>
	<div class="mask"></div>
</div>      


<div id="find_pwd_email_layer" style="display:none;">
    <div class="popup_wrap">
		<div class="popupbox" style=" width:445px; ">
			<div class="popuptop  trc">
				<h3 class="p_title">비밀번호 찾기</h3>
				<span class="btn-close"><a href="javascript:commonLayerClose('find_pwd_email_layer');"><img src="<?php echo THEME_FOLDER; ?>/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 class="mask">
	</div>
</div>


<div id="find_id_fin_layer" style="display:none;">
    <div class="popup_wrap">
		<div class="popupbox trc" style=" width:445px; ">
			<div class="popuptop">
				<h3 class="p_title">아이디 찾기 </h3>
				<span class="btn-close"><a href="javascript:commonLayerClose('find_id_fin_layer');"><img src="<?php echo THEME_FOLDER; ?>/img/btn-close.png"></a></span>
			</div>
			<div class="popupbody">
				<div class="ft16" style="padding-top:48px; font-size:20px;">회원님의 아이디는</div>
				<div class="ft20  beachblue" style="font-size:25px; padding: 15px 0;" id="find_id_text">abcd</div>
				<div class="ft16" style="font-size:20px;">입니다. </div>
				<div class="form-group" style="margin:30px 0 50px; display:block; text-align:center">
					<button type="button" class="btn btn-success br20" style="padding:7px 40px; font-size:16px" onclick="commonLayerClose('find_id_fin_layer');commonLayerOpen('login_layer');"><span class="current">로그인 하기</span></button>
				</div>
			</div>
		</div>
	</div>
	<div class="mask"></div>
</div>


<!-- 카카오톡 공유하기 -->
<script src="//developers.kakao.com/sdk/js/kakao.min.js"></script>
        <script type='text/javascript'>
        // 레이어 이외의 공간 클릭시 close
        $(document).mouseup(function(e) {
            var container = $("#share_box");
            if (container.has(e.target).length === 0) container.hide();

        });

        Kakao.init('6ff83d5220e4182ba5f996b2cf6dd52c');

        function share_kakao() {
            Kakao.Link.sendDefault({
                objectType: 'feed',
                content: {
                    title: $("#share_title").val(),
                    imageUrl: $("#share_img_url").val(),
                    link: {
                        mobileWebUrl: $("#share_copy_url").val(),
                        webUrl: $("#share_copy_url").val()
                    }
                },
                buttons: [{
                    title: '웹으로 보기',
                    link: {
                        mobileWebUrl: $("#share_copy_url").val(),
                        webUrl: $("#share_copy_url").val()
                    }
                }]
            });
        }

        function share_facebook() {
            var share_url = $("#share_copy_url").val();
            var url = encodeURI(share_url);
            window.open("http://www.facebook.com/sharer/sharer.php?u=" + url, "",
                "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes"
                );
        }



        function share_band() {
            var share_title = $("#share_title").val() + '\n' + $("#share_copy_url").val();
            var url = encodeURIComponent($("#share_copy_url").val());
            var text = encodeURI(share_title);
            window.open("http://band.us/plugin/share?body=" + text + "&route=" + url, "",
                "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes"
                );

        }


        // 카카오톡 스토리 공유하기
        function share_kakaostory() {
            var share_url = $("#share_copy_url").val();
            var share_title = $("#share_title").val() + '\n' + $("#share_copy_url").val();
            Kakao.Story.share({
                url: share_url,
                text: share_title,
            });
        }

        // 네이버공유하기
        function share_naver() {
            var share_url = $("#share_copy_url").val();
            var share_title = $("#share_title").val();
            var url = encodeURI(encodeURIComponent(share_url));
            var title = encodeURI(share_title);
            var shareURL = "http://share.naver.com/web/shareView.nhn?url=" + url + "&title=" + title;
            window.open(shareURL, "",
                "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes"
                );
        }

        // 트위터 공유하기
        function share_twitter() {
            var share_url = $("#share_copy_url").val();
            var share_title = $("#share_title").val();

            var url = share_url;
            var text = encodeURI(share_title);
            window.open("https://twitter.com/intent/tweet?text=" + text + "&url=" + url, "",
                "height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes"
                );
        }
        </script>


        <script>
        // 주소복사
        function copy_url() {
            var copyText = document.getElementById("copy_url");
            copyText.select();
            document.execCommand("Copy");
            alert("주소가 복사되었습니다.");
        }



        $(".share_btn").unbind("click");
        $('.share_btn').click(function(e) {
            $("#share_box").toggle();
            var popH = $(this).offset().top;
            $('.popup_share').css('left', '55%');
            $('.popup_share').css('top', popH + 'px');

        });
        </script>


        <script>
        // 공유하기
        var share_key = '';

        function share_box(e) {
            var id = e.id;
            $("#share_box").toggle();
            var key = $("#" + id).attr('strA');

            $("#share_content").val($("#content_" + key).val());
            $("#share_title").val($("#title_" + key).val());
            $("#share_copy_url").val($("#copy_url_" + key).val());
            $("#share_img_url").val($("#img_url_" + key).val());
            $("#copy_url").val($("#copy_url_" + key).val());

            var popH = $("#" + id).offset().top;
            var popL = $("#" + id).offset().left;

            $('.popup_share').css('left', (popL - 100) + 'px');
            $('.popup_share').css('top', popH + 'px');

            share_key = key;
        }


        // 공유하기 - 북마크
        function bookmark() {
            alert("이미 북마크되었습니다.");
            return false;
        }



        // 스크롤
        var more_yn = 'N';
        $(document).ready(function() {
            $(document).scroll(function() {
                var maxHeight = $(document).height();
                var currentScroll = $(window).scrollTop() + $(window).height();
                if (maxHeight <= currentScroll + 100) {
                    if (more_yn == 'Y') {
                        bookmark_list_more();
                    }
                }
            })
        });

        var bookmark_list_page = 2;

        function bookmark_list_more() {
            var form_data = {
                "page": bookmark_list_page,
                "search_keyword": ""
            };
            $.ajax({
                url: '/web/mypage/bookmark_list_more',
                async: false,
                type: 'POST',
                dataType: 'HTML',
                data: form_data,
                success: function(rtnHtml) {
                    var arrHtml = rtnHtml.split("|||||");
                    if (arrHtml[0].trim() == '0000') {
                        more_yn = arrHtml[2];
                        if (arrHtml[1] != "") {
                            $("#bookmark_list").append(arrHtml[1]);
                            bookmark_list_page++;
                        }
                    }
                },
                error: function(rtnHtml) {
                    alert('데이터 로드에 실패했습니다.');
                    return false;
                }
            });
        }


        // 검색
        function list_search(e) {
            if (e.keyCode == 13) {
                list_search_proc();
            }
        }

        function list_search_proc() {
            $("#input_form").submit();
        }

        // 북마크
        function bookmark_add() {
            if ($("#bookmark_url").val() == '') {
                alert("url을 입력해주세요.");
                return false;
            }

            var form_data = {
                "bookmark_url": $("#bookmark_url").val()
            };
            $.ajax({
                url: '/web/comm/bookmark_url_add_proc',
                async: false,
                type: 'POST',
                dataType: 'JSON',
                data: form_data,
                success: function(rtnJson) {
                    if (rtnJson.code == "0000") {
                        location.href = '/web/mypage/bookmark';
                    } else {
                        alert(rtnJson.msg);
                        return false;
                    }
                },
                error: function(rtnJson) {
                    alert('북마크에 실패했습니다.');
                    return false;
                }
            });
        }

        // 북마크 삭제
        function bookmark_del(idx) {
            if (confirm("북마크가 삭제됩니다. 삭제하시겠습니까?") == true) { //확인
                var form_data = {
                    "idx": idx
                };
                $.ajax({
                    url: '/web/comm/bookmark_del_proc',
                    async: false,
                    type: 'POST',
                    dataType: 'JSON',
                    data: form_data,
                    success: function(rtnJson) {
                        if (rtnJson.code == "0000") {
                            location.href = '/web/mypage/bookmark';
                        } else {
                            alert(rtnJson.msg);
                            return false;
                        }
                    },
                    error: function(rtnJson) {
                        alert('북마크 삭제에 실패했습니다.');
                        return false;
                    }
                });
            } else { //취소
                return;
            }
        }

        // 복수 삭제
        function bookmark_arr_del() {
            if ($("input:checkbox[name='is_del[]']").is(":checked") == false) {
                alert("삭제할 내용이 없습니다.");
                return false;
            }
            if (confirm("북마크가 삭제됩니다. 삭제하시겠습니까?") == true) { //확인
                $("#input_form").attr("action", "/comm/bookmark_arr_del_proc");
                $("#input_form").submit();
            } else { //취소
                return;
            }
        }

        // 편집 - 클릭시
        function bookmark_edit() {
            $("#bookmark_edit_header").toggle();
            $("#bookmark_edit_btn").toggleClass('arrow_down');
            $("#bookmark_edit_btn").toggleClass('arrow_up');
            $(".bookmark_checkbox").toggle();

            var class_name = $("#bookmark_edit_btn").attr("class");
            if (class_name == 'btn btn-default br5 fr arrow_down') {
                $(".mypage_list_cont").css('padding-left', '20px');
            } else {
                $(".mypage_list_cont").css('padding-left', '0px');
            }
        }

        // 내용 펼치기
        function content_more(key) {
            $("#content_" + key).toggle();
            $("#arrow_img_" + key).toggleClass('arrow_down');
            $("#arrow_img_" + key).toggleClass('arrow_up');

            var class_name = $("#arrow_img_" + key).attr("class");
            if (class_name == 'btn btn-default br5 fr arrow_down') {
                $("#arrow_img_" + key).html('자세히');
            } else {
                $("#arrow_img_" + key).html('접기');
            }
        }

        // checkbox click
        function bookmark_del_count() {
            var cnt = $("input[name='is_del[]']:checkbox:checked").length;
            $("#bookmark_del_count").html(cnt);
        }

        // checkbox all checked/unchecked
        $(function() {
            $("#allcheck").click(function() {
                if ($("#allcheck").prop("checked")) {
                    $("input:checkbox[name='is_del[]']").prop('checked', true); // 전체선택하기
                } else {
                    $("input:checkbox[name='is_del[]']").prop("checked", false);
                }
                bookmark_del_count();

            })
        })
        </script>

<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"     : "alexkoo",
        "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="/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/web/mypage/bookmark";
                
            } 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 = "8c6b2c883b37fbd69b04cfdb05d7ec2d";
    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 = "8c6b2c883b37fbd69b04cfdb05d7ec2d";
    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>



