/* javascript for bemil.chosun.com renewal GNB package */
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-58940796-10', 'auto');
ga('require', 'displayfeatures');
ga('require', 'linkid', 'linkid.js');
ga('send', 'pageview');
ga('create', 'UA-58940796-24', 'auto',{'name':'chosun_web_total'});
ga('require', 'displayfeatures');
ga('require', 'linkid', 'linkid.js');
ga('chosun_web_total.send', 'pageview');
// for PC GNB
document.write('\
\
\
');
// for Mobile GNB
document.write('\
\
');
/* current menu on */
var TEMP_ID = CatID.substring(0, 1);
var TEMP_ID2 = CatID.substring(0, 2);
if (TEMP_ID =="9") {
if (TEMP_ID2 =="92") {
document.getElementById("mm9").className = "current";
}
else if (TEMP_ID2 =="91") {
document.getElementById("mmA").className = "current";
}
else {}
} else if (TEMP_ID =="4") {
document.getElementById("mmb10158").className = "current";
if (TEMP_ID2 =="42") {
document.getElementById("mmb10158").className = "current";
}
else if (TEMP_ID2 =="45") {
document.getElementById("mmb10158").className = "current";
}
else if (TEMP_ID2 =="41") {
document.getElementById("mmb10158").className = "current";
}
else if (TEMP_ID2 =="44") {
document.getElementById("mmb10158").className = "current";
}
else if (TEMP_ID2 =="46") {
document.getElementById("mmb10158").className = "current";
}
else if (TEMP_ID2 =="47") {
document.getElementById("mmb10158").className = "current";
}
else if (TEMP_ID2 =="48") {
document.getElementById("mmb10158").className = "current";
}
else if (TEMP_ID2 =="49") {
document.getElementById("mmb10158").className = "current";
}
else {}
} else if (TEMP_ID =="3") {
document.getElementById("mmA").className = "current";
if (TEMP_ID2 =="31") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="32") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="33") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="34") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="35") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="36") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="37") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="38") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="39") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="3A") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="3B") {
document.getElementById("mmA").className = "current";
}
else if (TEMP_ID2 =="91") {
document.getElementById("mmA").className = "current";
}
else {}
} else if (TEMP_ID =="5") {
document.getElementById("mmb10159").className = "current";
if (TEMP_ID2 =="51") {
document.getElementById("mmb10159").className = "current";
}
else if (TEMP_ID2 =="52") {
document.getElementById("mmb10159").className = "current";
}
else if (TEMP_ID2 =="53") {
document.getElementById("mmb10159").className = "current";
}
else if (TEMP_ID2 =="54") {
document.getElementById("mmb10159").className = "current";
}
else if (TEMP_ID2 =="55") {
document.getElementById("mmb10159").className = "current";
}
else if (TEMP_ID2 =="56") {
document.getElementById("mmb10159").className = "current";
}
else {}
} else if (TEMP_ID =="6") {
document.getElementById("mmb10040").className = "current";
if (TEMP_ID2 =="61") {
document.getElementById("mmb10040").className = "current";
}
else if (TEMP_ID2 =="60") {
document.getElementById("mmb10040").className = "current";
}
else if (TEMP_ID2 =="62") {
document.getElementById("mmb10040").className = "current";
}
else if (TEMP_ID2 =="63") {
document.getElementById("mmb10040").className = "current";
}
else if (TEMP_ID2 =="64") {
document.getElementById("mmb10040").className = "current";
}
else {}
} else if (TEMP_ID =="7") {
document.getElementById("mmb10129").className = "current";
if (TEMP_ID2 =="71") {
document.getElementById("mmb10129").className = "current";
}
else if (TEMP_ID2 =="72") {
document.getElementById("mmb10129").className = "current";
}
else if (TEMP_ID2 =="73") {
document.getElementById("mmb10129").className = "current";
}
else if (TEMP_ID2 =="74") {
document.getElementById("mmb10129").className = "current";
}
else if (TEMP_ID2 =="75") {
document.getElementById("mmb10129").className = "current";
}
else {}
} else {
}
/* javscript include from ui.js start */
var adaptivePage; //pc Àü¿ë üÀÌÁö üũ
var winWidth = $(window).width();
var winHeight = $(window).height();
var scrollTop;
function getWinPosition(){
scrollTop = $(window).scrollTop();
}
function setWinPosition(){
$(window).scrollTop(scrollTop);
}
//À©µµ¿ì »çÀÌÁî
$(function(){
if (adaptivePage){}
else {
winWidthChk();
$(window).bind('resize', function(){
winWidthChk();
});
}
});
//À©µµ¿ìüũ
function winWidthChk() {
var winWidthChk = $(window).width();
if (768 < winWidthChk) {
$('body').removeClass('mobile');
$('body').addClass('web');
}
else if (winWidthChk <= 768) {
$('body').removeClass('web');
$('body').addClass('mobile');
}
}
//¸®¼Â ó¸®
$(function(){
if ($('body').hasClass('bodyWeb') || $('body').hasClass('bodyM')) {}
else{
$(window).resize(function(){
if (winWidth >= 768) {
closeSchBox(); //¸ð¹ÙÀÏ ¼Ä¡¹Ú½º
w_closeSchBox();
winWidthChk();
//location.reload();
//$('.gnbMenu ul').mCustomScrollbar("disable",true);
}
});
}
});
//Åõµ¥ÀÌ ·Ñ¸µ
$(function(){
$('.todayBox').cycle({
fx: 'scrollVert',
speed: 'slow',
timeout: 4000,
});
});
//ÄÁÅÙÃ÷ ¿µ¿ª ³ôÀÌ
$(function(){
if ($('body').hasClass('web')) {
var conH = $('.content .conSection').height();
if ($('.conSection').hasClass('boardView')) {
// $('.conSection').css({'height':conH-21});
$('.conSection').css({'height':conH });
} else{
// $('.conSection').css({'height':conH-41});
$('.conSection').css({'height':conH });
}
}
else if ($('body').hasClass('mobile')) {
$('.conSection').css({'height':'auto'});
}
$(window).resize(function(){
var conH = $('.content .conSection').height();
if (winWidth <= 768 && $('body').hasClass('mobile')) {
$('.conSection').css({'height':'auto'});
}
else if (winWidth > 768 && $('body').hasClass('web')) {
if ($('.conSection').hasClass('boardView')) {
// $('.conSection').css({'height':conH-21});
$('.conSection').css({'height':conH});
} else {
// $('.leftSectionWarp').css({'height':conH-41});
$('.conSection').css({'height':conH});
}
}
});
});
// textarea
$(function(){
var comment_box = '';
$(".comment_box textarea").on("click, focusin", function() {
if($(this).val() == "[¾Ë¸²] ·Î±×ÀÎ ÈÄ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù." || $(this).val() == "[¾Ë¸²] ¿å¼³, Áö¿ª°¨Á¤ Á¶Àå, À¯¾ðºñ¾î, ±¤°í, µ¿ÀÏÇÑ ±Û ¹Ýº¹ °ÔÀç µîÀº »çÀüÅ뺸 ¾øÀÌ »èÁ¦µË´Ï´Ù."){
comment_box = $(this).val();
$(this).val('');
}
});
$(".comment_box textarea").on("focusout", function() {
if($(this).val().length == 0){
$(this).val(comment_box);
}
});
});
//ul ¼Ä¡¹Ú½º
$(function(){
$(document).on('click', '.select-ul .title', function (){
var target = $(this).parent();
if(target.hasClass('open')){
$(this).siblings('.selList').stop().animate({'maxHeight' : 0+'px'}, 250, 'easeOutCubic');
setTimeout(function(){
target.find('.selList').hide();
target.removeClass('open');
},250);
} else {
$(this).parent('.select-ul').addClass('open');
$(this).siblings('.selList').show();
$(this).siblings('.selList').stop().animate({'maxHeight' : 250+'px'}, 500, 'easeOutCubic');
}
});
$(document).on('click', '.select-ul .selList label', function (){
var txt_value = $(this).text();
var target = $(this).parents('.select-ul');
target.find('.title').text(txt_value);
target.find('input').removeAttr('checked');
$(this).find('input').attr('checked','checked');
$(this).parents('.selList').stop(true, false).animate({'maxHeight' : 0+'px'}, 250, 'easeOutCubic');
setTimeout(function(){
target.removeClass('open');
target.find('.selList').hide();
},250);
});
});
// ÅÇ ÀÚµ¿ ³ÐÀÌ - tabType1
$(function(){
$(".tabType1, .tabType2, .tabType3, .tabType4").each(function(){
var size = $(this).find("li").size();
$(this).find("li").css({
'width': 100/size + '%'
});
if ($(this).hasClass('profile')) {
$(this).find("li").css({'width' : 'auto'});
}
});
});
// ÅÇ È°¼ºÈ
$(function(){
$(".js-tab li").click(function(){
$(this).siblings('li').removeClass('on');
$(this).addClass('on');
});
});
// ÅÇ ÄÁÅÙÃ÷ º¸±â
function showTab(i,ele){
$(i).parents('.js-tab').next(".js-con").children('.boardCon, .profileCon').hide();
$("#" + ele).show();
}
//¼Ä¡¹Ú½º ÅؽºÆ® »èÁ¦
$(function(){
$('.js-label').each(function(){
$(this).next('input, textarea').on({
focusin : function(){
$(this).prev('label').addClass('hide');
},
focusout : function(){
if(!$(this).val()){
$(this).prev('label').removeClass('hide');
}
}
})
});
});
//ÆäÀÌÁö»ó´Ü
function pageTop() {
wScrollTop = $(window).scrollTop();
$('html, body').stop().animate({scrollTop : 0}, 500, 'easeOutCubic');
}
function pageBottom() {
var f_pos = $('#footer').offset().top;
$('html, body').stop().animate({scrollTop : f_pos}, 800, 'easeOutCubic');
}
//ÀÎDz ÅؽºÆ® »èÁ¦
$(function(){
$('.js-label').each(function(){
$(this).next('input, textarea').on({
focusin : function(){
$(this).prev('label').addClass('hide');
},
focusout : function(){
if(!$(this).val()){
$(this).prev('label').removeClass('hide');
}
}
})
});
});
/* layer */
var open_pos;
function showLayer(e){
$('#overlay').remove();
$('#'+e).show();
var layerH = $('#'+e).height();
open_pos = $(window).scrollTop();
if (layerH > $(window).height()){
//$('#'+e).addClass('layerScale');
$('html, body').stop().animate({scrollTop : 0});
$('#wrap').css({'height' : layerH + 150, 'overflow' : 'hidden'});
} else {
$('#'+e).css({'top' : '50%', 'margin-top' : -layerH/2});
$('#wrap').css({'height' : '100%', 'overflow' : 'hidden'});
}
// if(layerH > $('#wrap').height()){
// $('#wrap').css({'min-height' : layerH + 100});
// }
$('#'+e).addClass('on').stop().fadeIn(200);
$('#wrap').append('');
// layerScale();
// });
}
function hideLayer(e){
$('#'+e).removeClass('on, layerScale').hide();
$('#overlay').remove();
$('#wrap').css({'height' : 'auto', 'overflow' : 'visible'});
$('html, body').stop().animate({scrollTop : open_pos}, 50);
}
// $(window).bind('resize', function(){
// layerScale();
// });
// function layerScale(){
// if ($('.layerPopup.on').height() > ($(window).height() - 60) ){
// $('.layerPopup.on').addClass('layerScale');
// $('html, body').stop().animate({scrollTop : 0});
// } else {
// $('.layerPopup.on').removeClass('layerScale');
// };
// }
// $(function(){
// //¶óµð¿À¹öÆ°
// $(document).on('click', '.radioForm', function (){
// var grpNm = $(this).find("input:radio").attr("name");
// $("input:radio[name=" + grpNm + "]").each(function() {
// $(this).closest(".radioForm").removeClass("checked");
// });
// $(this).addClass("checked");
// });
// });
//À¥ Çì´õ °Ë»öâ
function w_openSchBox() {
$('.w_btn_search .btnOpen').hide();
$('.w_btn_search .btnClose').show();
$('.m_head_search').addClass('open');
// $('.headerMenu').css('position','fixed');
$('.m_head_search').stop().animate({'top':106}, 150, 'easeOutCubic');
$('').clone().appendTo('#wrap');
}
function w_closeSchBox() {
$('.w_btn_search .btnOpen').show();
$('.w_btn_search .btnClose').hide();
$('.m_head_search').removeClass('open');
// $('.headerMenu').css('position','relative');
$('.m_head_search').stop().animate({'top':0}, 0, 'easeOutCubic');
$("#overlay1").remove();
}
//¸ð¹ÙÀÏ Çì´õ °Ë»öâ
function openSchBox() {
$('.btn_headSearch .btnOpen').hide();
$('.btn_headSearch .btnClose').show();
$('.m_head_search').addClass('open');
$('.headerMenu').css('position','fixed');
$('.m_head_search').stop().animate({'top':58}, 150, 'easeOutCubic');
$('').clone().appendTo('#wrap');
}
function closeSchBox() {
$('.btn_headSearch .btnOpen').show();
$('.btn_headSearch .btnClose').hide();
$('.m_head_search').removeClass('open');
$('.headerMenu').css('position','relative');
$('.m_head_search').stop().animate({'top':0}, 150, 'easeOutCubic');
$("#overlay1").remove();
}
//gnb ½ºÅ©·Ñ¹Ù
$(function(){
$('.gnbMenu ul').mCustomScrollbar({
theme:"minimal-dark",
axis:"x",
autoDraggerLength: true,
// setHeight: 42,
autoHideScrollbar: true,
scrollInertia: 800,
});
});
//gnb ¼ºê¸Þ´º ¿±â ´Ý±â
$(function(){
$(document).on('click', '.mobile .gnbMenu li.current a', function(){
$('.subMebu').stop().animate({'top' : '105px'}, 300, 'easeOutCubic');
if($(this).parent().attr('class')=='current')
return false;
});
$(document).on('click', '.mobile .subMebu button', function(){
$('.subMebu').stop().animate({'top' : '-290px'}, 300, 'easeOutCubic');
});
});
//¸®¼Â
function reSet_gnb(){
winWidth = $(window).width();
if (winWidth <= 768 && $('body').hasClass('mobile')) {
$('.subMebu').css({'top' : '-290px'});
}
else if (winWidth > 768 && $('body').hasClass('web')) {
$('.subMebu').css({'top' : '215px'});
}
}
$(function(){
//»çÀ̵å¸Þ´º º¸±â
$('.btn_sideNavi .openMenu_m').on('click focusin', function(){
$('body').addClass('openSide');
$('#wrap').css({'height' : winHeight, 'overflow' : 'hidden' });
$('.sideContainer').stop().animate({'left' : 0+'px'}, 700, 'easeOutCubic');
$(".closeSidebar").show();
$('#sideNaviWrap').append('');
$("#overlay2").stop().animate({'opacity':0.75},700);
});
$(window).resize(function(){
winWidth = $(window).width();
if (winWidth > 768 && $('body').hasClass('openSide')) {
$('#wrap').css({'height' : 'auto', 'overflow' : 'visible' });
$('.sideContainer').stop().animate({'left' : -100 +'%'}, 400, 'easeOutCubic');
$(".closeSidebar").hide();
$("#overlay2").stop().animate({'opacity':0},600);
setTimeout(function(){
$('body').removeClass('openSide');
$("#overlay2").remove();
},650);
}
});
//»çÀÌµå ¸Þ´º ´Ý±â
$('.closeSidebar').on('click', function(){
$('#wrap').css({'height' : 'auto', 'overflow' : 'visible' });
$('.sideContainer').stop().animate({'left' : -100 +'%'}, 400, 'easeOutCubic');
$(".closeSidebar").hide();
$("#overlay2").stop().animate({'opacity':0},600);
setTimeout(function(){
$('body').removeClass('openSide');
$("#overlay2").remove();
},650);
});
//À¥»çÀÌÆ®¸Ê ¿±â
$('.btn_sitemap button').on('click', function(){
if ($(this).parent().hasClass('open')) {
$('.btn_sitemap').removeClass('open');
$('.btn_sitemap .btn_close').hide();
$('.btn_sitemap .btn_open').show();
$('.siteMapArea').css({'z-index' : 500});
$('.siteMapArea').stop().animate({'top' : '-190px'}, 250, 'easeOutCubic');
setTimeout(function(){
$('.siteMapArea').removeClass('open');
},300);
}
else{
$('.btn_sitemap').addClass('open');
$('.siteMapArea').addClass('open');
$('.btn_sitemap .btn_open').hide();
$('.btn_sitemap .btn_close').show();
$('.siteMapArea').stop().animate({'top' : '215px'}, 250, 'easeOutCubic');
setTimeout(function(){
$('.siteMapArea').css({'z-index' : 501});
},250);
}
});
});
// ¸ð¹ÙÀÏ »çÀ̵å¸Þ´º È°¼ºÈ
$(function(){
$('.side_menuArea .depth1_list .depth1_title').click(function(){
if ($(this).parent().hasClass('on')) {
$('.side_menuArea .depth1_list > li').removeClass('on');
$('.side_menuArea .depth2_group').slideUp(300);
}
else{
$('.side_menuArea .depth1_list > li').removeClass('on');
$('.side_menuArea .depth1_list .depth2_group').hide();
$(this).parent().addClass('on');
$(this).siblings('.depth2_group').slideDown(300);
}
});
});
//Àüü üũ
function chkAll(e){
var thisChk = $(e).is(":checked");
if (thisChk == true){
$(e).closest(".chkAll").find('.checkForm input:checkbox').prop("checked", "checked");
if ($('body').hasClass('web')) {
$(e).closest(".chkAll").find('.checkForm input:checked + label i').css({'background-positon': '0 -258px'});
}else{
$(e).closest(".chkAll").find('.checkForm input:checked + label i').css({'background-positon': '0 -129px'});
}
}
else {
$(e).closest(".chkAll").find('.checkForm input:checkbox').prop('checked', '');
$(e).closest(".chkAll").find('.checkForm input:checked + label i').css({'background-positon': '0 0'});
}
}
/* javscript include from ui.js end */
/* javascript chosun.com custom start */
function BeforeSearch(form_name) {
if (eval("document." + form_name + ".searchTerm.value") == "") {
eval("document." + form_name + ".action") = "//bemil.chosun.com/nbemil_search.html";
return true;
}
return true;
}
function BeforeSearch_M(form_name) {
if (eval("document." + form_name + ".searchTerm.value") == "") {
eval("document." + form_name + ".action") = "//bemil.chosun.com/nbemil_search.html";
return true;
}
return true;
}
function Temp_menu() {
alert("Áغñ ÁßÀÔ´Ï´Ù.");
}
//¹æ¹®ÀÚ Áý°è
$.ajax({
url : "//bemil.chosun.com/nbrd/visit/count.html",
type : "post",
dataType : "text",
beforeSend:function(x){
if(x && x.overrideMimeType) {
//x.overrideMimeType("application/x-www-form-urlencoded;charset=EUC-KR");
x.overrideMimeType("text/html; charset=EUC-KR");
}
},
success : function(data) {
//html Å×±× Á¦°Å
var tmpStr = new RegExp();
tmpStr = /[<][^>]*[>]/gi;
data = data.replace(tmpStr , "");
data = data.replace(/[^0-9]/gi, " ");
data = data.replace(/\s+/gi, "-");
data = data.split("-");
// $("#today_box").html("¿À´Ã "+addcomma(data[4])+" ¸í
´©Àû "+addcomma(data[6])+" ¸í
");
$("#count_today_id").html('TODAY '+addcomma(data[4])+'¸í')
$("#count_total_id").html('TOTAL '+addcomma(data[6])+'¸í')
}
});
function addcomma(data){
if(data==0) return 0;
var reg = /(^[+-]?\d+)(\d{3})/;
var n = (data + '');
while (reg.test(n)) n = n.replace(reg, '$1' + ',' + '$2');
return n;
};
/* javascript chosun.com custom end */
/* end */