// source --> https://www.galee.co.kr/wp-content/plugins/mangboard/assets/js/common.js?ver=192 
function sendFormDataRequest(form, action, successCallback, errorCallback, type, dataType){
	if(typeof(action)==='undefined' || action=='') action = 'mb_board';
	if(typeof(type)==='undefined') type = "POST";
	if(typeof(dataType)==='undefined') dataType = "json";
	if(typeof(successCallback)==='undefined') successCallback	= function s(a,b){};
	if(typeof(errorCallback)==='undefined') errorCallback	= function e(a){};

	if(String(action).indexOf('http')!==0){
		action	= mb_ajax_object.ajax_url+"?action="+action+"&admin_page="+mb_ajax_object.admin_page+"&hybrid_app="+mb_hybrid_app;
	}
	form.attr("action", action);
	form.ajaxForm({
		type: type,
		async: true,
		crossDomain: true,
		dataType : dataType,
		xhrFields:{withCredentials:true},
		success:function(data, state){
			hideLoadingBox();
			successCallback(data, state);
		},error:function(e){
			//console.log(JSON.stringify(e));
			hideLoadingBox();
			if(e.responseJSON && e.responseJSON.state=="success"){
				successCallback(e.responseJSON, e.responseJSON.state);
			}else{
				errorCallback(e);
			}
		}
	});
	form.submit();
	showLoadingBox();
}

function sendDataRequest(action, param, successCallback, errorCallback, type, dataType){
	if(typeof(action)==='undefined' || action=='') action = 'mb_template';
	if(typeof(type)==='undefined') type = "POST";
	if(typeof(dataType)==='undefined') dataType = "json";
	if(typeof(successCallback)==='undefined') successCallback	= function s(a,b){};
	if(typeof(errorCallback)==='undefined') errorCallback	= function e(a){};

	if(param.indexOf('mb_nonce_value=')==-1){
		if(param=="") param	= mb_options["nonce2"];
		else param	= param+"&"+mb_options["nonce2"];
	}

	if(String(action).indexOf('http')!==0){
		param	= param+"&action="+action+"&admin_page="+mb_ajax_object.admin_page+"&hybrid_app="+mb_hybrid_app;
		action	= mb_ajax_object.ajax_url;
	}
	if(param.indexOf('board_action=board_hit')==-1) showLoadingBox();

	jQuery.ajax({
		url: action,
		type: type,
		data: param,
		success:function(data,state){
			hideLoadingBox();
			successCallback(data, state);
		},error:function(e){			
			//console.log(JSON.stringify(e));
			hideLoadingBox();			
			if(e.responseJSON && e.responseJSON.state=="success"){
				successCallback(e.responseJSON, e.responseJSON.state);
			}else{
				errorCallback(e);
			}
		},timeout: 15000,
		cache: false,
		dataType: dataType
	});
}

function sendDataRequest2(action, param, successCallback, errorCallback, type, dataType){
	if(typeof(action)==='undefined' || action=='') action = 'mb_template';
	if(typeof(type)==='undefined') type = "POST";
	if(typeof(dataType)==='undefined') dataType = "json";
	if(typeof(successCallback)==='undefined') successCallback	= function s(a,b){};
	if(typeof(errorCallback)==='undefined') errorCallback	= function e(a){};

	if(param.indexOf('mb_nonce_value=')==-1){
		if(param=="") param	= mb_options["nonce2"];
		else param	= param+"&"+mb_options["nonce2"];
	}

	if(String(action).indexOf('http')!==0){
		param	= param+"&action="+action+"&admin_page="+mb_ajax_object.admin_page+"&hybrid_app="+mb_hybrid_app;
		action	= mb_ajax_object.ajax_url;
	}
	jQuery.ajax({
		url: action,
		type: type,
		data: param,
		success:function(data,state){
			successCallback(data, state);
		},error:function(e){			
			//console.log(JSON.stringify(e));
			hideLoadingBox();			
			errorCallback(e);
		},timeout: 15000,
		cache: false,
		dataType: dataType
	});
}

function mb_insertHtml(name,message){
	jQuery(name).html(message);	
}
function mb_appendHtml(name,message){
	jQuery(name).append(message);	
}

function checkCSSDisplay(name,time){
	if(typeof(time)==='undefined') time = 0;
	var objTarget		= jQuery(name);
	if(objTarget.css("display")=="none"){
		if(time==0) objTarget.show();
		else objTarget.slideDown( time );
	}else{		
		if(time==0) objTarget.hide();
		else objTarget.slideUp( time );
	}
}

function checkCSSDisplayID(id,time){
	if(typeof(time)==='undefined') time = 0;
	var objTarget		= jQuery("#"+id);
	if(objTarget.css("display")=="none"){
		if(time==0) objTarget.show();
		else objTarget.slideDown( time );
	}else{		
		if(time==0) objTarget.hide();
		else objTarget.slideUp( time );
	}
}

function checkBoxDisplayID(obj, id){
	if(jQuery(obj).prop('checked')){		
		jQuery("#"+id).show();
	}else{		
		jQuery("#"+id+" input").val("");
		jQuery("#"+id).hide();
	}
}
function replaceCategoryText(value){
  	return value.replace(/&#038;/g, "&").replace(/&/g, "&amp;").replace(/[=<>`'"]/g, '');
}
function set_category_data(data, id,value){
	if(typeof(data)!=='undefined'){
		jQuery("#"+id+" option").remove();
		var index		= id.substr(-1);
		if(typeof(mb_languages["selectbox"+index])!='undefined' && mb_languages["selectbox"+index]!=""){
			jQuery("#"+id).append('<option value="">'+mb_languages["selectbox"+index]+'</option>');
		}
		if(typeof(data)==='object'){
			var add_html			= "";
			var category_text	= "";
			jQuery.each(data, function(key, entry){
				category_text	= replaceCategoryText(key);
				if(value!="" && (key==value || category_text==value)){
					add_html	+= '<option value="'+category_text+'" selected>'+category_text+'</option>';
				}else{
					add_html	+= '<option value="'+category_text+'">'+category_text+'</option>';
				}
			});
			if(add_html!=""){
				jQuery("#"+id).append(add_html);
			}
			jQuery("#"+id).css("display","inline-block");
		}else{
			jQuery("#"+id).html('<option value=""></option>');
			jQuery("#"+id).hide();
		}
	}else{
		jQuery("#"+id).html('<option value=""></option>');
		jQuery("#"+id).hide();
	}
}


function category_select(index){
	var value1			= "";
	var value2			= "";
	var theme_type		= "type1";

	if(typeof(category_text)!=='undefined' && category_text!="" && category_text.indexOf('&#038;')!=-1){
		theme_type	= "type2";
	}
	if(index==0){
		set_category_data(category_data,mb_options["board_name"]+"_category1",mb_categorys["value1"]);
		value1		= jQuery("#"+mb_options["board_name"]+"_category1 option").filter(":selected").val();
		if(theme_type=="type2" && value1.indexOf('&')!=-1){
			value1		= value1.replace(/&/g, "&#038;");
		}		
		if(mb_categorys["value1"]!=undefined && mb_categorys["value1"]!="" && value1!=''){
			set_category_data(category_data[value1],mb_options["board_name"]+"_category2",mb_categorys["value2"]);
		}else{
			jQuery("#"+mb_options["board_name"]+"_category2").hide();
		}

		value2		= jQuery("#"+mb_options["board_name"]+"_category2 option").filter(":selected").val();
		if(theme_type=="type2" && value2!="" && value2.indexOf('&')!=-1){
			value2		= value2.replace(/&/g, "&#038;");
		}
		if(mb_categorys["value2"]!=undefined && mb_categorys["value2"]!="" && value2!=''){
			set_category_data(category_data[value1][value2],mb_options["board_name"]+"_category3",mb_categorys["value3"]);
		}else{
			jQuery("#"+mb_options["board_name"]+"_category3").hide();
		}
	}else{
		value1		= jQuery("#"+mb_options["board_name"]+"_category1 option").filter(":selected").val();
		value2		= jQuery("#"+mb_options["board_name"]+"_category2 option").filter(":selected").val();
		if(theme_type=="type2"){
			if(value1!="" && value1.indexOf('&')!=-1){
				value1		= value1.replace(/&/g, "&#038;");
			}
			if(value2!="" && value2.indexOf('&')!=-1){
				value2		= value2.replace(/&/g, "&#038;");
			}
		}
		if(index==1){
			if(value1!=""){
				set_category_data(category_data[value1],mb_options["board_name"]+"_category2","");
			}else{
				set_category_data("",mb_options["board_name"]+"_category2","");
			}
			set_category_data("",mb_options["board_name"]+"_category3","");
		}else if(index==2){
			if(value1!=""){				
				if(value2!=""){					
					set_category_data(category_data[value1][value2],mb_options["board_name"]+"_category3","");
				}else{
					set_category_data("",mb_options["board_name"]+"_category3","");
				}
			}else{
				set_category_data("",mb_options["board_name"]+"_category3","");
			}
		}
	}
}

function movePage(url, param){	
	moveURL(url, param)
}
function moveViewPage(pid,board_name,page){
	var param		= "vid="+pid;
	if(typeof(board_name)!=='undefined'&& board_name!="") param		= param+"&board_name="+board_name;
	if(typeof(page)!=='undefined' && page!="") param			= param+"&page="+page;
	moveURL("", param)
}
function moveURL(url, param, loading){
	var isLoading		= false;
	if(typeof(loading)!=='undefined') isLoading = loading;
	if(isLoading) showLoadingBox();

	if(typeof(param)!=='undefined' && param!=""){
		if(url.indexOf('?')==-1){
			url		= url+'?';
		}else{
			url		= url+'&';
		}
		url		= url+param;
	}
	if(url.indexOf('category1=')!=-1){
		if(url.indexOf('category1=&')!=-1){
			url		= url.replace('category2=&','');
			url		= url.replace('category3=&','');
		}else{
			url		= url.replace(/(category)(\d{1})=&/g,'');
		}
	}
	if(url.indexOf('&#038;')!=-1){
		url		= url.replace(/&#038;/g,'&');
	}
	var match_count = (url.match(/page_id=/g) || []).length;
	if(match_count>0) {
		url		= url.replace(/page_id=&/g,'');
		if(match_count>1) {
			var index1		= url.lastIndexOf('page_id=');
			var index2		= url.indexOf('&',index1);
			if(index2==-1){
				url					= url.slice(0,index1-1);
			}else{
				url					= url.slice(0,index1-1)+url.slice(index2);
			}
		}
	}
	if(url=="reload"){
		window.location.reload();
	}else if(url=="back"){
		window.history.back();
	}else if(url=="forward"){
		window.history.forward();
	}else if(url=="referer" || url=="referrer"){
		url		= document.referrer;
		if(url.indexOf('%26')==-1){
			url		= decodeURIComponent(url);
		}else{
			url		= url.replace(/%26/g,"##26##");
			url		= decodeURIComponent(url);
			url		= url.replace(/##26##/g,"%26");
		}
		window.location.href		= url;
	}else{
		if(url.indexOf('%26')==-1){
			url		= decodeURIComponent(url);
		}else{
			url		= url.replace(/%26/g,"##26##");
			url		= decodeURIComponent(url);
			url		= url.replace(/##26##/g,"%26");
		}
		window.location.href		= url;
	}
}
function openWindow(url,name,option){
	var objPopup;
	if(url.indexOf('&#038;')!=-1){
		url		= url.replace(/&#038;/g,'&');
	}
	if(typeof(mb_hybrid_app)==='undefined' || mb_hybrid_app==""){
		if(typeof(option)==='undefined') option	= "width=600,height=640,toolbar=no,location=no,status=no,menubar=no,top=200,left=300,scrollbars=no,resizable=no";
		if(typeof(mb_options)!=='undefined' && typeof(mb_options["device_type"])!=='undefined' && mb_options["device_type"]=="mobile"){
			objPopup		= window.open(url,name);
		}else{
			objPopup		= window.open(url,name,option);
		}
	}else{
		 objPopup		= openMobileWindow(url,name,option);
	}
	return objPopup;
}

var mb_selectFileName		= "";
function sendBoardFileData(file_pid,file_name){
	var data				= "mode=file&board_action=file_download&board_name="+mb_options["board_name"]+"&file_pid="+file_pid+"&file_name="+encodeURIComponent(file_name);
	mb_selectFileName		= file_name;
	sendDataRequest2(mb_urls["board_api"], data, sendBoardFileDataHandler);
}
function sendBoardFileDataHandler(response, state)
{
	if(response.state == "success"){
		if(typeof(response.data)!=='undefined' && typeof(response.data.file_path)!=='undefined'){
			if(mb_hybrid_app=="ios" && typeof(response.data.file_path2)!=='undefined'){
				var file_url	= mb_urls["base"];
				file_url			= file_url.replace('/wp-content/plugins','/wp-content/uploads');
				homeSendMessage({"mode":"FILE_DOWNLOAD","value": file_url+response.data.file_path2,"name": mb_selectFileName});
			}else{
				downloadFile(mb_urls["file"],"path="+encodeURIComponent(response.data.file_path));
			}			
		}
	}else{
		showAlertPopup(response);
	}
}
function downloadFile(url, param){
	if(typeof(param)!=='undefined' && param!=""){
		if(url.indexOf('?')==-1){
			url		= url+'?';
		}else{
			url		= url+'&';
		}
		url		= url+param;
	}
	if(typeof(mb_hybrid_app)==='undefined' || mb_hybrid_app==""){
		window.location.href		= decodeURIComponent(url+"&file_name="+mb_selectFileName+"&type=download");
	}else{
		window.location.href		= decodeURIComponent(url+"&type=download&file_name="+mb_selectFileName);
	}
}

var listTemplateMode		= "";
var listTemplateBoard		= "";
var listTemplateCheck		= true;
var listTemplateAction		= "";


function sendTabReload(data,idx){
	if(typeof(idx)==='undefined') idx	= "1";
	if(jQuery("input[name=category"+idx+"]")) jQuery("input[name=category"+idx+"]").val(data);
	if(idx==1 && data==''){
		if(jQuery("input[name=category2]")) jQuery("input[name=category2]").val(data);
		if(jQuery("input[name=category3]")) jQuery("input[name=category3]").val(data);
	}else if(idx==2 && data==''){
		if(jQuery("input[name=category3]")) jQuery("input[name=category3]").val(data);
	}
	if(jQuery('.mb-board.mb-commerce').length>0){
		sendSearchData();
	}else{
		sendSearchData("#mb_top");
	}
}

function setEditorType(type){
	if(document.getElementById("editor_type")){
		document.getElementById("editor_type").value	= type;
	}
}
function sendListTemplateData(data){
	listTemplateCheck	= true;
	if(typeof(data)==='undefined') data = {};
	if(typeof(data.board_name)==='undefined' || data.board_name==='undefined' || data.board_name==='') board_name = mb_options["board_name"];	
	else board_name = data.board_name;	
	if(typeof(data.mode)==='undefined' || data.mode==='undefined') mode = "";
	else mode = data.mode;
	if(typeof(data.page)==='undefined' || data.page==='undefined' || data.page==='') page = 1;
	else page = data.page;	
	
	listTemplateBoard					= board_name;
	listTemplateMode					= mode;	
	var params		= jQuery('#'+listTemplateBoard+'_form_board_search').serialize();
	if(jQuery('#'+listTemplateBoard+'_form_board_search2').length>0) params		= params+"&"+jQuery('#'+listTemplateBoard+'_form_board_search2').serialize();
	params		= params+"&"+jQuery('#'+listTemplateBoard+'_form_board_list').serialize()+"&board_action=load";

	if(typeof(data.category)!=='undefined'){
		if(typeof(data.idx)==='undefined' || data.idx==='undefined' || data.idx==='') idx = "1";
		else idx = data.idx;
		params					= params+"&category"+idx+"="+encodeURIComponent(data.category);
	}else if(typeof(data.page_type)!=='undefined' && data.page_type=="ajax"){
		if(typeof(mb_categorys["value1"])!=='undefined' && mb_categorys["value1"]!=""){		
			params					= params+"&category1="+encodeURIComponent(mb_categorys["value1"]);
			if(typeof(mb_categorys["value2"])!=='undefined' && mb_categorys["value2"]!=""){		
				params					= params+"&category2="+encodeURIComponent(mb_categorys["value2"]);
				if(typeof(mb_categorys["value3"])!=='undefined' && mb_categorys["value3"]!=""){		
					params					= params+"&category3="+encodeURIComponent(mb_categorys["value3"]);
				}
			}
		}
	}

	if(typeof(data.page_type)!=='undefined'){
		params					= params+"&page_type="+encodeURIComponent(data.page_type);
	}		
	params					= params+"&board_page="+page;	
	sendDataRequest(mb_urls["template_api"], params, sendListTemplateDataHandler);			
}

function sendListTemplateDataHandler(response, state){		
	if(listTemplateCheck){
		if(response.state == "success"){
			if(listTemplateMode!="append"){
				jQuery("#"+listTemplateBoard+"_board_body>tr").remove();
				jQuery("#"+listTemplateBoard+"_board_body>div").remove();
			}

			if(response.data["body"]){
				jQuery("#"+listTemplateBoard+"_board_body").append(response.data["body"]);
			}
			if(response.data["pagination"]!=""){
				jQuery('#'+listTemplateBoard+'_pagination_box').html(response.data["pagination"]);
			}else{
				jQuery('#'+listTemplateBoard+'_pagination_box').html("");
			}
			if(jQuery('div[id="mb_top"]').length==1 && mb_options["mode"]=="list"){
				var nTop	= jQuery('#mb_top').offset().top-80;
				if(nTop<0) nTop		= 0;
				if(Math.abs(jQuery(window).scrollTop()-nTop)>100){
					jQuery("html, body").animate({scrollTop: nTop}, 300);
				}
			}
		}else{
			showAlertPopup(response);
		}
		listTemplateCheck		= false;
	}
}


function getPostcode(type,id) {
	if(typeof(mb_hybrid_app)==='undefined' || mb_hybrid_app==""){
		new daum.Postcode({
			oncomplete: function(data) {
				var fullAddr = ""; 
				var extraAddr = "";

				if(data.userSelectedType === "R"){
					fullAddr = data.roadAddress;
				}else{
					fullAddr = data.jibunAddress;
				}

				if(data.userSelectedType === "R"){
					if(data.bname !== ""){extraAddr += data.bname;}
					if(data.buildingName !== ""){extraAddr += (extraAddr !== "" ? ", " + data.buildingName : data.buildingName);}
					fullAddr += (extraAddr !== "" ? " ("+ extraAddr +")" : "");
				}

				//document.getElementById(type+"_postcode").value = data.postcode1+"-"+data.postcode2;
				document.getElementById(type+"_postcode").value = data.zonecode;
				document.getElementById(type+"_address1").value = fullAddr;
				jQuery("#"+type+"_address2").focus();
			}
		}).open();
	}else{
		openWindow(mb_urls["home"]+"/?mb_app=postcode&type="+type);
	}
}
function getPostcodeIframe(type,id) {
	if(typeof(id)==='undefined' || id=='') id = 'mb_kakao_postcode1';
	var element_wrap	= document.getElementById(id);
	var currentScroll		= Math.max(document.body.scrollTop, document.documentElement.scrollTop);
	new daum.Postcode({
		oncomplete: function(data) {
			var fullAddr = ""; 
			var extraAddr = "";

			if(data.userSelectedType === "R"){
				fullAddr = data.roadAddress;
			}else{
				fullAddr = data.jibunAddress;
			}
			if(data.userSelectedType === "R"){
				if(data.bname !== ""){extraAddr += data.bname;}
				if(data.buildingName !== ""){extraAddr += (extraAddr !== "" ? ", " + data.buildingName : data.buildingName);}
				fullAddr += (extraAddr !== "" ? " ("+ extraAddr +")" : "");
			}
			//document.getElementById(type+"_postcode").value = data.postcode1+"-"+data.postcode2;
			document.getElementById(type+"_postcode").value = data.zonecode;
			document.getElementById(type+"_address1").value = fullAddr;
			
			element_wrap.style.display = 'none';
			jQuery("html, body").scrollTop( currentScroll );
			jQuery("#"+type+"_address2").focus();
		},
		onresize : function(size) {
			element_wrap.style.height = (size.height+30)+'px';
		},
		width : '100%',
		height : '100%'
	}).embed(element_wrap);
	element_wrap.style.display = 'block';
}
function template_match_handler(type,obj,name,match_type,match_value){
	var value		= "";
	if(type=="checkbox"){
		value		= jQuery(obj).prop('checked') ? "1":"0";
	}else if(type=="radio" || type=="select"){
		value		= jQuery(obj).val();
	}else{
		if(jQuery(obj).val()!=""){
			value		= jQuery(obj).val();
		}else{
			value		= jQuery(obj).find('input').first().val();
		}		
	}
	match_value	= ","+match_value+",";
	value				= ","+value+",";
	var target		= jQuery(".mb-combo-"+name);
	if(match_type=="show"){
		if(match_value.indexOf(value)!=-1) target.css("display","inline-block");
		else{
			target.hide();
		}
	}else if(match_type=="hide"){
		if(match_value.indexOf(value)!=-1){
			target.hide();
		}else target.css("display","inline-block");
	}
}
var template_combo_hide	= {};
function template_combo_handler(type,obj,name){
	var value		= "";
	if(type=="checkbox"){
		value		= jQuery(obj).prop('checked') ? "1":"0";
	}else{
		value		= jQuery(obj).val();
	}
	var combo_wrapper		= jQuery(obj).closest('.mb-combo-wrapper').find('.mb-combo-items');
	combo_wrapper.children().hide();
	combo_wrapper.find(":input").prop("disabled", true);
	combo_wrapper.find('.mb-combo-'+name+'-'+value).show();
	combo_wrapper.find('.mb-combo-'+name+'-'+value).find(":input").prop("disabled", false);

	if(typeof(template_combo_hide[name])!=='undefined' && template_combo_hide[name]!=''){
		template_combo_display_check('show',name,template_combo_hide[name]);
	}	
	if(combo_wrapper.find('.mb-combo-'+name+'-'+value+' .mb-combo-box-hide-element').length>0){
		var combo_hide		= combo_wrapper.find('.mb-combo-'+name+'-'+value+' .mb-combo-box-hide-element').val();
		if(combo_hide!=''){
			template_combo_display_check('hide',name,combo_hide);
		}
	}
}
function template_combo_display_check(type,name,value){
	if(typeof(mb_options["board_name"])!=='undefined' && value!=''){
		var items			= value.split(",");
		var item_name	= mb_options["board_name"];
		for(var i=0; i < items.length; i++) {
			if(type=='hide'){
				jQuery('tr#mb_'+item_name+'_tr_'+items[i]).find(":input").prop("disabled", true);
				jQuery('tr#mb_'+item_name+'_tr_'+items[i]).hide();
			}else{
				jQuery('tr#mb_'+item_name+'_tr_'+items[i]).find(":input").prop("disabled", false);
				jQuery('tr#mb_'+item_name+'_tr_'+items[i]).show();
			}
		}
		if(type=='hide'){
			template_combo_hide[name] = value;
		}else{
			template_combo_hide[name] = "";
		}
	}
}
function checkEnterKey(callback,param){
	if(event.keyCode == 13){

		if(typeof(param)==='undefined')
			callback();
		else
			callback(param);
	}
}
var openTarget;
var openPid				= "";
var openColspan		= 0;
var openColspanIndex	= 0;
function openContents(obj, name, index, action){		
	if(typeof(index)!=='undefined') openColspanIndex	= index;
	if(typeof(action)!=='undefined') open_action	= action;
	else open_action	= "content";

	openTarget		= jQuery(obj).closest("tr");	
	if(openTarget.next().hasClass("mb-open-box")){
		if(openTarget.next().css("display")=="none"){
			//openTarget.next().fadeIn('slow');
			openTarget.next().show();
			openTarget.next().find(".mb-open-slide").slideDown(300);
			openTarget.find(".mb-icon-box").addClass('mb-icon-close');
		}else{			
			//openTarget.next().fadeOut('slow');
			openTarget.next().find(".mb-open-slide").slideUp(300,function(){openTarget.next().hide();});
			openTarget.find(".mb-icon-box").removeClass('mb-icon-close');
		}
	}else{
		//콘텐츠 데이타 불러오기		
		if(typeof(name)==='undefined' || name=="") name	= mb_options["board_name"];
		var board_pid = jQuery(obj).attr("class").split("_").pop(); 		
		var data		= "board_name="+name+"&mode=list&board_action="+open_action+"&board_pid="+board_pid;
		sendDataRequest2(mb_urls["template_api"], data, sendContentDataHandler);		
	}
}

function isJsonType(data){
	if(data.indexOf("{")!==-1) return true;
	else return false;
}
function sendContentDataHandler(response, state){		
	if(response.state == "success"){
		var content_html		= '<tr class="mb-open-box">';
		var colspan				= openTarget.find("td").length;
		if(openColspanIndex>0){
			colspan		= colspan - openColspanIndex;
			for(i=0;i<openColspanIndex;i++){
				content_html		= content_html+'<td></td>';
			}
		}
		content_html		= content_html+'<td colspan="'+colspan+'"><div class="mb-open-slide" style="display:none"><div class="mb-open-content">'+response.data+'</div></div></td></tr>';
		openTarget.after(content_html);		
		//openTarget.next().hide();
		//openTarget.next().fadeIn('slow');
		openTarget.next().show();
		openTarget.next().find(".mb-open-slide").slideDown(300);
		openTarget.find(".mb-icon-box").addClass('mb-icon-close');
	}else{
		showAlertPopup(response);
	}
}
function mb_reloadImage_class(name){
	if(typeof(name)==='undefined' || name=='') name = "mb_kcaptcha";

	var img_url			= jQuery("."+name).attr("src");
	var timestamp		= new Date().getTime();

	if(img_url.indexOf('?')==-1){
		img_url		= img_url+'?time=';
	}else{
		img_url		= img_url+'&time=';
	}
	img_url		= img_url+timestamp;

	jQuery("."+name).attr("src",img_url)
}
function mb_reloadImage(id){
	if(typeof(id)==='undefined') id = "mb_kcaptcha";

	var img_url			= jQuery("#"+id).attr("src");
	var timestamp		= new Date().getTime();

	if(img_url.indexOf('?')==-1){
		img_url		= img_url+'?time=';
	}else{
		img_url		= img_url+'&time=';
	}
	img_url		= img_url+timestamp;

	jQuery("#"+id).attr("src",img_url)
}

function checkMaxNumber(obj,max){
	if(typeof(max)!=='undefined'){
		if(max<parseInt(jQuery(obj).val())){
			jQuery(obj).val(max);		
		}		
	}	
}
Number.prototype.to2 = function(){return this<10?'0'+this:this;}
function setSearchDate(type){
	var date				= new Date();
	end_date			= date.getFullYear()+"-"+(date.getMonth()+1).to2()+"-"+(date.getDate()).to2();

	if(type=="month"){
		var date2			= new Date(date.getFullYear(),date.getMonth(),0);
		start_date			= date2.getFullYear()+"-"+(date2.getMonth()+1).to2()+"-"+(date.getDate()).to2();
	}else if(type=="total" || type=="empty"){
		start_date			= ""; end_date			= "";
	}else{
		if(type=="today"){
			start_date			= end_date;
		}else if(type=="yesterday"){
			date.setTime(date.getTime() - (24 * 60 * 60 * 1000));
			end_date			= date.getFullYear()+"-"+(date.getMonth()+1).to2()+"-"+(date.getDate()).to2();
		}else if(type=="tomorrow"){
			date.setTime(date.getTime() + (24 * 60 * 60 * 1000));
			end_date			= date.getFullYear()+"-"+(date.getMonth()+1).to2()+"-"+(date.getDate()).to2();
		}else if(type=="week"){
			date.setTime(date.getTime() - (24 * 60 * 60 * 1000 * 7));
		}else if(type=="last_year"){
			date					= new Date(date.getFullYear()-1,12,0);
			end_date				= date.getFullYear()+"-"+(date.getMonth()+1).to2()+"-"+(date.getDate()).to2();
			date					= new Date(date.getFullYear(),0,1);
		}else if(type=="last_month"){
			date					= new Date(date.getFullYear(),date.getMonth(),0);
			end_date			= date.getFullYear()+"-"+(date.getMonth()+1).to2()+"-"+(date.getDate()).to2();
			date					= new Date(date.getFullYear(),date.getMonth(),1);
		}else if(type=="this_month"){
			date					= new Date(date.getFullYear(),date.getMonth(),1);
		}else if(type=="next_month"){
			date					= new Date(date.getFullYear(),(date.getMonth()+2),0);
			end_date			= date.getFullYear()+"-"+(date.getMonth()+1).to2()+"-"+(date.getDate()).to2();
			date					= new Date(date.getFullYear(),date.getMonth(),1);
		}
		start_date			= date.getFullYear()+"-"+(date.getMonth()+1).to2()+"-"+(date.getDate()).to2();
	}
	jQuery("input[name='start_date']").val(start_date);
	jQuery("input[name='end_date']").val(end_date);
}

function inputOnlyNumber(event){
	var code = event.which ? event.which : event.keyCode;
	if(code == 0 || code == 9 || code == 8 || code == 46 || code == 110 || code == 188 || code == 37 || code == 39 || code == 190 || (96<=code && code <= 105)){
		return;
	}
	if( (code < 48) || (code > 57) ){
		return false;
	}	
}

function moveBodyScrollPosition(name,top,time){
	if(typeof(top)==='undefined') top = 40;
	if(typeof(time)==='undefined') time = 0;
	jQuery("html, body").animate({scrollTop: jQuery(name).offset().top-top}, time);
}

function imgResize(objImage,nWidth,nHeight){
	if(typeof(nWidth)==='undefined') nWidth = 50;
	if(typeof(nHeight)==='undefined') nHeight = nWidth;

	nWidth		= parseInt(nWidth);
	nHeight		= parseInt(nHeight);

	var imgFile			= new Image();
	imgFile.src			= objImage.src;

	var imgWidth		= imgFile.width;
	var imgHeight		= imgFile.height;
	
	if(imgWidth>imgHeight)
	{
		imgHeight = imgHeight * nWidth/imgWidth;
		imgWidth  = nWidth;
		
		if(imgHeight>nHeight)
		{
			imgWidth  = imgWidth * nHeight/imgHeight;
			imgHeight = nHeight;			
		}
		
	} else if(imgWidth<=imgHeight)
	{
		imgWidth  = imgWidth * nHeight/imgHeight;
		imgHeight = nHeight;
		
		if(imgWidth>nWidth)
		{
			imgHeight = imgHeight * nWidth/imgWidth;
			imgWidth  = nWidth;
		}
	} else
	{
		imgWidth  = nWidth;
		imgHeight = nHeight;
	}
	objImage.width		= imgWidth;
	objImage.height		= imgHeight;
}
function checkSendApiURL(){
	if(typeof(mb_urls['board_api'])==='undefined' && typeof(mb_urls['template_api'])==='undefined') {
		mb_urls['board_api']			= "mb_board";
		mb_urls['comment_api']	= "mb_comment";
		mb_urls['user_api']			= "mb_user";
		mb_urls['heditor_api']		= "mb_heditor";
		mb_urls['template_api']		= "mb_template";
		mb_urls['custom_api']		= "mb_custom";
		mb_urls['commerce_api']	= "mb_commerce";
	}
}

jQuery(document).ready(function() {
	if(jQuery.isFunction(jQuery(".tooltip").tipTip)){
		jQuery(".tooltip").tipTip();
	}
	//숫자만 입력받기
	jQuery(".mbi-only-int").keyup (function () {
		jQuery(this).val(jQuery(this).val().replace(/[^0-9]/g,""));
    });
	jQuery(".mbi-only-num").keyup (function () {
		jQuery(this).val(jQuery(this).val().replace(/[^0-9,.]/g,""));
    });
	//숫자만 입력받고 최대 자릿수가 되면 다음 포커스로 이동
	jQuery(".mbi-next-focus-num").keyup (function () {
		var maxLength = jQuery(this).attr("maxlength");
		jQuery(this).val(jQuery(this).val().replace(/[^0-9]/g,""));
        if (this.value.length >= maxLength) {
			if(jQuery(this).next('.mbi-next-focus-num').length>0){
				jQuery(this).next('.mbi-next-focus-num').focus();
			}else if(jQuery(this).next().next('.mbi-next-focus-num').length>0){
				jQuery(this).next().next('.mbi-next-focus-num').focus();
			}
            return false;
        }
    });
	//텍스트를 입력받고 최대 자릿수가 되면 다음 포커스로 이동
	jQuery(".mbi-next-focus").keyup (function () {
		var maxLength = jQuery(this).attr("maxlength");
        if (this.value.length >= maxLength) {
			if(jQuery(this).next('.mbi-next-focus').length>0){
				jQuery(this).next('.mbi-next-focus').focus();
			}else if(jQuery(this).next().next('.mbi-next-focus').length>0){
				jQuery(this).next().next('.mbi-next-focus').focus();
			}            
            return false;
        }
    });
	jQuery(".mb-user-phone").keyup (function () {
		var key = event.charCode || event.keyCode || 0;
		var value	= jQuery(this).val();		
		value		= value.replace(/[^0-9\-\(\)\+\s]/g,"");
		if(value.length>2){
			if(value.indexOf('010')==0){
				if(key!=8 && (value.length==3 || value.length==8)) value += '-';
				if(value.indexOf('-')==-1){
					if(value.length>10){
						value		= value.substr(0, 3)+'-'+value.substr(3, 4)+'-'+value.substr(7,4);
					}
				}else{
					value	= value.replace("--", "-");
				}
			}
		}
		jQuery(this).val(value);
    });
	checkSendApiURL();
});
// source --> https://www.galee.co.kr/wp-content/plugins/mangboard/assets/js/jquery.jcarousel.min.js?ver=192 
/*! jCarousel - v0.3.9 - 2018-07-30
* http://sorgalla.com/jcarousel/
* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */
!function(t){"use strict";var i=t.jCarousel={};i.version="0.3.9";var s=/^([+\-]=)?(.+)$/;i.parseTarget=function(t){var i=!1,e="object"!=typeof t?s.exec(t):null;return e?(t=parseInt(e[2],10)||0,e[1]&&(i=!0,"-="===e[1]&&(t*=-1))):"object"!=typeof t&&(t=parseInt(t,10)||0),{target:t,relative:i}},i.detectCarousel=function(t){for(var i;t.length>0;){if((i=t.filter("[data-jcarousel]")).length>0)return i;if((i=t.find("[data-jcarousel]")).length>0)return i;t=t.parent()}return null},i.base=function(s){return{version:i.version,_options:{},_element:null,_carousel:null,_init:t.noop,_create:t.noop,_destroy:t.noop,_reload:t.noop,create:function(){return this._element.attr("data-"+s.toLowerCase(),!0).data(s,this),!1===this._trigger("create")?this:(this._create(),this._trigger("createend"),this)},destroy:function(){return!1===this._trigger("destroy")?this:(this._destroy(),this._trigger("destroyend"),this._element.removeData(s).removeAttr("data-"+s.toLowerCase()),this)},reload:function(t){return!1===this._trigger("reload")?this:(t&&this.options(t),this._reload(),this._trigger("reloadend"),this)},element:function(){return this._element},options:function(i,s){if(0===arguments.length)return t.extend({},this._options);if("string"==typeof i){if(void 0===s)return void 0===this._options[i]?null:this._options[i];this._options[i]=s}else this._options=t.extend({},this._options,i);return this},carousel:function(){return this._carousel||(this._carousel=i.detectCarousel(this.options("carousel")||this._element),this._carousel||t.error('Could not detect carousel for plugin "'+s+'"')),this._carousel},_trigger:function(i,e,r){var n,o=!1;return r=[this].concat(r||[]),(e||this._element).each(function(){n=t.Event((s+":"+i).toLowerCase()),t(this).trigger(n,r),n.isDefaultPrevented()&&(o=!0)}),!o}}},i.plugin=function(s,e){var r=t[s]=function(i,s){this._element=t(i),this.options(s),this._init(),this.create()};return r.fn=r.prototype=t.extend({},i.base(s),e),t.fn[s]=function(i){var e=Array.prototype.slice.call(arguments,1),n=this;return"string"==typeof i?this.each(function(){var r=t(this).data(s);if(!r)return t.error("Cannot call methods on "+s+' prior to initialization; attempted to call method "'+i+'"');if(!t.isFunction(r[i])||"_"===i.charAt(0))return t.error('No such method "'+i+'" for '+s+" instance");var o=r[i].apply(r,e);return o!==r&&void 0!==o?(n=o,!1):void 0}):this.each(function(){var e=t(this).data(s);e instanceof r?e.reload(i):new r(this,i)}),n},r}}(jQuery),function(t,i){"use strict";var s=t(i),e=function(t){return parseFloat(t)||0};t.jCarousel.plugin("jcarousel",{animating:!1,tail:0,inTail:!1,resizeState:null,resizeTimer:null,lt:null,vertical:!1,rtl:!1,circular:!1,underflow:!1,relative:!1,_options:{list:function(){return this.element().children().eq(0)},items:function(){return this.list().children()},animation:400,transitions:!1,wrap:null,vertical:null,rtl:null,center:!1},_list:null,_items:null,_target:t(),_first:t(),_last:t(),_visible:t(),_fullyvisible:t(),_init:function(){var t=this;return t.resizeState=s.width()+"x"+s.height(),this.onWindowResize=function(){t.resizeTimer&&clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout(function(){var i=s.width()+"x"+s.height();i!==t.resizeState&&(t.resizeState=i,t.reload())},100)},this},_create:function(){this._reload(),s.on("resize.jcarousel",this.onWindowResize)},_destroy:function(){s.off("resize.jcarousel",this.onWindowResize)},_reload:function(){this.vertical=this.options("vertical"),null==this.vertical&&(this.vertical=e(this.list().height())>e(this.list().width())),this.rtl=this.options("rtl"),null==this.rtl&&(this.rtl=function(i){if("rtl"===(""+i.attr("dir")).toLowerCase())return!0;var s=!1;return i.parents("[dir]").each(function(){if(/rtl/i.test(t(this).attr("dir")))return s=!0,!1}),s}(this._element)),this.lt=this.vertical?"top":"left",this.relative="relative"===this.list().css("position"),this._list=null,this._items=null;var i=this.index(this._target)>=0?this._target:this.closest();this.circular="circular"===this.options("wrap"),this.underflow=!1;var s={left:0,top:0};return i.length>0&&(this._prepare(i),this.list().find("[data-jcarousel-clone]").remove(),this._items=null,this.underflow=this._fullyvisible.length>=this.items().length,this.circular=this.circular&&!this.underflow,s[this.lt]=this._position(i)+"px"),this.move(s),this},list:function(){if(null===this._list){var i=this.options("list");this._list=t.isFunction(i)?i.call(this):this._element.find(i)}return this._list},items:function(){if(null===this._items){var i=this.options("items");this._items=(t.isFunction(i)?i.call(this):this.list().find(i)).not("[data-jcarousel-clone]")}return this._items},index:function(t){return this.items().index(t)},closest:function(){var i,s=this,r=this.list().position()[this.lt],n=t(),o=!1,l=this.vertical?"bottom":this.rtl&&!this.relative?"left":"right";return this.rtl&&this.relative&&!this.vertical&&(r+=e(this.list().width())-this.clipping()),this.items().each(function(){if(n=t(this),o)return!1;var a=s.dimension(n);if((r+=a)>=0){if(i=a-e(n.css("margin-"+l)),!(Math.abs(r)-a+i/2<=0))return!1;o=!0}}),n},target:function(){return this._target},first:function(){return this._first},last:function(){return this._last},visible:function(){return this._visible},fullyvisible:function(){return this._fullyvisible},hasNext:function(){if(!1===this._trigger("hasnext"))return!0;var t=this.options("wrap"),i=this.items().length-1,s=this.options("center")?this._target:this._last;return!!(i>=0&&!this.underflow&&(t&&"first"!==t||this.index(s)<i||this.tail&&!this.inTail))},hasPrev:function(){if(!1===this._trigger("hasprev"))return!0;var t=this.options("wrap");return!!(this.items().length>0&&!this.underflow&&(t&&"last"!==t||this.index(this._first)>0||this.tail&&this.inTail))},clipping:function(){return e(this._element["inner"+(this.vertical?"Height":"Width")]())},dimension:function(t){return e(t["outer"+(this.vertical?"Height":"Width")](!0))},scroll:function(i,s,e){if(this.animating)return this;if(!1===this._trigger("scroll",null,[i,s]))return this;t.isFunction(s)&&(e=s,s=!0);var r=t.jCarousel.parseTarget(i);if(r.relative){var n,o,l,a,h,u,c,f,d=this.items().length-1,_=Math.abs(r.target),p=this.options("wrap");if(r.target>0){var g=this.index(this._last);if(g>=d&&this.tail)this.inTail?"both"===p||"last"===p?this._scroll(0,s,e):t.isFunction(e)&&e.call(this,!1):this._scrollTail(s,e);else if(n=this.index(this._target),this.underflow&&n===d&&("circular"===p||"both"===p||"last"===p)||!this.underflow&&g===d&&("both"===p||"last"===p))this._scroll(0,s,e);else if(l=n+_,this.circular&&l>d){for(f=d,h=this.items().get(-1);f++<l;)h=this.items().eq(0),(u=this._visible.index(h)>=0)&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(h),u||((c={})[this.lt]=this.dimension(h),this.moveBy(c)),this._items=null;this._scroll(h,s,e)}else this._scroll(Math.min(l,d),s,e)}else if(this.inTail)this._scroll(Math.max(this.index(this._first)-_+1,0),s,e);else if(o=this.index(this._first),n=this.index(this._target),l=(a=this.underflow?n:o)-_,a<=0&&(this.underflow&&"circular"===p||"both"===p||"first"===p))this._scroll(d,s,e);else if(this.circular&&l<0){for(f=l,h=this.items().get(0);f++<0;){h=this.items().eq(-1),(u=this._visible.index(h)>=0)&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().prepend(h),this._items=null;var m=this.dimension(h);(c={})[this.lt]=-m,this.moveBy(c)}this._scroll(h,s,e)}else this._scroll(Math.max(l,0),s,e)}else this._scroll(r.target,s,e);return this._trigger("scrollend"),this},moveBy:function(t,i){var s=this.list().position(),r=1,n=0;return this.rtl&&!this.vertical&&(r=-1,this.relative&&(n=e(this.list().width())-this.clipping())),t.left&&(t.left=e(s.left)+n+e(t.left)*r+"px"),t.top&&(t.top=e(s.top)+n+e(t.top)*r+"px"),this.move(t,i)},move:function(i,s){s=s||{};var e=this.options("transitions"),r=!!e,n=!!e.transforms,o=!!e.transforms3d,l=s.duration||0,a=this.list();if(!r&&l>0)a.animate(i,s);else{var h=s.complete||t.noop,u={};if(r){var c={transitionDuration:a.css("transitionDuration"),transitionTimingFunction:a.css("transitionTimingFunction"),transitionProperty:a.css("transitionProperty")},f=h;h=function(){t(this).css(c),f.call(this)},u={transitionDuration:(l>0?l/1e3:0)+"s",transitionTimingFunction:e.easing||s.easing,transitionProperty:l>0?n||o?"all":i.left?"left":"top":"none",transform:"none"}}o?u.transform="translate3d("+(i.left||0)+","+(i.top||0)+",0)":n?u.transform="translate("+(i.left||0)+","+(i.top||0)+")":t.extend(u,i),r&&l>0&&a.one("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",h),a.css(u),l<=0&&a.each(function(){h.call(this)})}},_scroll:function(i,s,r){if(this.animating)return t.isFunction(r)&&r.call(this,!1),this;if("object"!=typeof i?i=this.items().eq(i):void 0===i.jquery&&(i=t(i)),0===i.length)return t.isFunction(r)&&r.call(this,!1),this;this.inTail=!1,this._prepare(i);var n=this._position(i);if(n===e(this.list().position()[this.lt]))return t.isFunction(r)&&r.call(this,!1),this;var o={};return o[this.lt]=n+"px",this._animate(o,s,r),this},_scrollTail:function(i,s){if(this.animating||!this.tail)return t.isFunction(s)&&s.call(this,!1),this;var r=this.list().position()[this.lt];this.rtl&&this.relative&&!this.vertical&&(r+=e(this.list().width())-this.clipping()),this.rtl&&!this.vertical?r+=this.tail:r-=this.tail,this.inTail=!0;var n={};return n[this.lt]=r+"px",this._update({target:this._target.next(),fullyvisible:this._fullyvisible.slice(1).add(this._visible.last())}),this._animate(n,i,s),this},_animate:function(i,s,e){if(e=e||t.noop,!1===this._trigger("animate"))return e.call(this,!1),this;this.animating=!0;var r=this.options("animation"),n=t.proxy(function(){this.animating=!1;var t=this.list().find("[data-jcarousel-clone]");t.length>0&&(t.remove(),this._reload()),this._trigger("animateend"),e.call(this,!0)},this),o="object"==typeof r?t.extend({},r):{duration:r},l=o.complete||t.noop;return!1===s?o.duration=0:void 0!==t.fx.speeds[o.duration]&&(o.duration=t.fx.speeds[o.duration]),o.complete=function(){n(),l.call(this)},this.move(i,o),this},_prepare:function(i){var s,r,n,o=this.index(i),l=o,a=this.dimension(i),h=this.clipping(),u=this.vertical?"bottom":this.rtl?"left":"right",c=this.options("center"),f={target:i,first:i,last:i,visible:i,fullyvisible:a<=h?i:t()};if(c&&(a/=2,h/=2),a<h)for(;;){if(0===(s=this.items().eq(++l)).length){if(!this.circular)break;if(s=this.items().eq(0),i.get(0)===s.get(0))break;if((r=this._visible.index(s)>=0)&&s.after(s.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(s),!r){var d={};d[this.lt]=this.dimension(s),this.moveBy(d)}this._items=null}if(0===(n=this.dimension(s)))break;if(a+=n,f.last=s,f.visible=f.visible.add(s),a-e(s.css("margin-"+u))<=h&&(f.fullyvisible=f.fullyvisible.add(s)),a>=h)break}if(!this.circular&&!c&&a<h)for(l=o;!(--l<0||0===(s=this.items().eq(l)).length||0===(n=this.dimension(s))||(a+=n,f.first=s,f.visible=f.visible.add(s),a-e(s.css("margin-"+u))<=h&&(f.fullyvisible=f.fullyvisible.add(s)),a>=h)););return this._update(f),this.tail=0,c||"circular"===this.options("wrap")||"custom"===this.options("wrap")||this.index(f.last)!==this.items().length-1||(a-=e(f.last.css("margin-"+u)))>h&&(this.tail=a-h),this},_position:function(t){var i=this._first,s=e(i.position()[this.lt]),r=this.options("center"),n=r?this.clipping()/2-this.dimension(i)/2:0;return this.rtl&&!this.vertical?(this.relative?s-=e(this.list().width())-this.dimension(i):s-=this.clipping()-this.dimension(i),s+=n):s-=n,!r&&(this.index(t)>this.index(i)||this.inTail)&&this.tail?(s=this.rtl&&!this.vertical?s-this.tail:s+this.tail,this.inTail=!0):this.inTail=!1,-s},_update:function(i){var s,e=this,r={target:this._target,first:this._first,last:this._last,visible:this._visible,fullyvisible:this._fullyvisible},n=this.index(i.first||r.first)<this.index(r.first),o=function(s){var o=[],l=[];i[s].each(function(){r[s].index(this)<0&&o.push(this)}),r[s].each(function(){i[s].index(this)<0&&l.push(this)}),n?o=o.reverse():l=l.reverse(),e._trigger(s+"in",t(o)),e._trigger(s+"out",t(l)),e["_"+s]=i[s]};for(s in i)o(s);return this}})}(jQuery,window),function(t){"use strict";t.jcarousel.fn.scrollIntoView=function(i,s,e){var r,n=t.jCarousel.parseTarget(i),o=this.index(this._fullyvisible.first()),l=this.index(this._fullyvisible.last());if((r=n.relative?n.target<0?Math.max(0,o+n.target):l+n.target:"object"!=typeof n.target?n.target:this.index(n.target))<o)return this.scroll(r,s,e);if(r>=o&&r<=l)return t.isFunction(e)&&e.call(this,!1),this;for(var a,h=this.items(),u=this.clipping(),c=this.vertical?"bottom":this.rtl?"left":"right",f=0;0!==(a=h.eq(r)).length;){if((f+=this.dimension(a))>=u){f-(parseFloat(a.css("margin-"+c))||0)!==u&&r++;break}if(r<=0)break;r--}return this.scroll(r,s,e)}}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselControl",{_options:{target:"+=1",event:"click",method:"scroll"},_active:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onEvent=t.proxy(function(i){i.preventDefault();var s=this.options("method");t.isFunction(s)?s.call(this):this.carousel().jcarousel(this.options("method"),this.options("target"))},this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend jcarousel:scrollend",this.onReload),this._element.on(this.options("event")+".jcarouselcontrol",this.onEvent),this._reload()},_destroy:function(){this._element.off(".jcarouselcontrol",this.onEvent),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend jcarousel:scrollend",this.onReload)},_reload:function(){var i,s=t.jCarousel.parseTarget(this.options("target")),e=this.carousel();if(s.relative)i=e.jcarousel(s.target>0?"hasNext":"hasPrev");else{var r="object"!=typeof s.target?e.jcarousel("items").eq(s.target):s.target;i=e.jcarousel("target").index(r)>=0}return this._active!==i&&(this._trigger(i?"active":"inactive"),this._active=i),this}})}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselPagination",{_options:{perPage:null,item:function(t){return'<a href="#'+t+'">'+t+"</a>"},event:"click",method:"scroll"},_carouselItems:null,_pages:{},_items:{},_currentPage:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onScroll=t.proxy(this._update,this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend",this.onReload).on("jcarousel:scrollend",this.onScroll),this._reload()},_destroy:function(){this._clear(),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend",this.onReload).off("jcarousel:scrollend",this.onScroll),this._carouselItems=null},_reload:function(){var i=this.options("perPage");if(this._pages={},this._items={},t.isFunction(i)&&(i=i.call(this)),null==i)this._pages=this._calculatePages();else for(var s,e=parseInt(i,10)||0,r=this._getCarouselItems(),n=1,o=0;0!==(s=r.eq(o++)).length;)this._pages[n]?this._pages[n]=this._pages[n].add(s):this._pages[n]=s,o%e==0&&n++;this._clear();var l=this,a=this.carousel().data("jcarousel"),h=this._element,u=this.options("item"),c=this._getCarouselItems().length;t.each(this._pages,function(i,s){var e=l._items[i]=t(u.call(l,i,s));e.on(l.options("event")+".jcarouselpagination",t.proxy(function(){var t=s.eq(0);if(a.circular){var e=a.index(a.target()),r=a.index(t);parseFloat(i)>parseFloat(l._currentPage)?r<e&&(t="+="+(c-e+r)):r>e&&(t="-="+(e+(c-r)))}a[this.options("method")](t)},l)),h.append(e)}),this._update()},_update:function(){var i,s=this.carousel().jcarousel("target");t.each(this._pages,function(t,e){if(e.each(function(){if(s.is(this))return i=t,!1}),i)return!1}),this._currentPage!==i&&(this._trigger("inactive",this._items[this._currentPage]),this._trigger("active",this._items[i])),this._currentPage=i},items:function(){return this._items},reloadCarouselItems:function(){return this._carouselItems=null,this},_clear:function(){this._element.empty(),this._currentPage=null},_calculatePages:function(){for(var t,i,s=this.carousel().data("jcarousel"),e=this._getCarouselItems(),r=s.clipping(),n=0,o=0,l=1,a={};0!==(t=e.eq(o++)).length;)n+(i=s.dimension(t))>r&&(l++,n=0),n+=i,a[l]?a[l]=a[l].add(t):a[l]=t;return a},_getCarouselItems:function(){return this._carouselItems||(this._carouselItems=this.carousel().jcarousel("items")),this._carouselItems}})}(jQuery),function(t,i){"use strict";var s,e;t.each({hidden:"visibilitychange",mozHidden:"mozvisibilitychange",msHidden:"msvisibilitychange",webkitHidden:"webkitvisibilitychange"},function(t,r){if(void 0!==i[t])return s=t,e=r,!1}),t.jCarousel.plugin("jcarouselAutoscroll",{_options:{target:"+=1",interval:3e3,autostart:!0,method:"scroll"},_timer:null,_started:!1,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onAnimateEnd=t.proxy(this._start,this),this.onVisibilityChange=t.proxy(function(){i[s]?this._stop():this._start()},this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy),t(i).on(e,this.onVisibilityChange),this.options("autostart")&&this.start()},_destroy:function(){this._stop(),this.carousel().off("jcarousel:destroy",this.onDestroy),t(i).off(e,this.onVisibilityChange)},_start:function(){if(this._stop(),this._started)return this.carousel().one("jcarousel:animateend",this.onAnimateEnd),this._timer=setTimeout(t.proxy(function(){this.carousel().jcarousel(this.options("method"),this.options("target"))},this),this.options("interval")),this},_stop:function(){return this._timer&&(this._timer=clearTimeout(this._timer)),this.carousel().off("jcarousel:animateend",this.onAnimateEnd),this},start:function(){return this._started=!0,this._start(),this},stop:function(){return this._started=!1,this._stop(),this}})}(jQuery,document);
// source --> https://www.galee.co.kr/wp-content/plugins/mangboard/assets/js/jquery.number.min.js?ver=192 
﻿/**
 * jQuery number plug-in 2.1.5
 * Copyright 2012, Digital Fusion
 * Licensed under the MIT license.
 * http://opensource.teamdf.com/license/
 *
 * A jQuery plugin which implements a permutation of phpjs.org's number_format to provide
 * simple number formatting, insertion, and as-you-type masking of a number.
 *
 * @author	Sam Sehnert
 * @docs	http://www.teamdf.com/web/jquery-number-format-redux/196/
 */
!function(e){"use strict";function t(e,t){if(this.createTextRange){var a=this.createTextRange();a.collapse(!0),a.moveStart("character",e),a.moveEnd("character",t-e),a.select()}else this.setSelectionRange&&(this.focus(),this.setSelectionRange(e,t))}function a(e){var t=this.value.length;if(e="start"==e.toLowerCase()?"Start":"End",document.selection){var a,i,n,l=document.selection.createRange();return a=l.duplicate(),a.expand("textedit"),a.setEndPoint("EndToEnd",l),i=a.text.length-l.text.length,n=i+l.text.length,"Start"==e?i:n}return"undefined"!=typeof this["selection"+e]&&(t=this["selection"+e]),t}var i={codes:{46:127,188:44,109:45,190:46,191:47,192:96,220:92,222:39,221:93,219:91,173:45,187:61,186:59,189:45,110:46},shifts:{96:"~",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",48:")",45:"_",61:"+",91:"{",93:"}",92:"|",59:":",39:'"',44:"<",46:">",47:"?"}};e.fn.number=function(n,l,s,r){r="undefined"==typeof r?",":r,s="undefined"==typeof s?".":s,l="undefined"==typeof l?0:l;var u="\\u"+("0000"+s.charCodeAt(0).toString(16)).slice(-4),h=new RegExp("[^"+u+"0-9]","g"),o=new RegExp(u,"g");return n===!0?this.is("input:text")?this.on({"keydown.format":function(n){var u=e(this),h=u.data("numFormat"),o=n.keyCode?n.keyCode:n.which,c="",v=a.apply(this,["start"]),d=a.apply(this,["end"]),p="",f=!1;if(i.codes.hasOwnProperty(o)&&(o=i.codes[o]),!n.shiftKey&&o>=65&&90>=o?o+=32:!n.shiftKey&&o>=69&&105>=o?o-=48:n.shiftKey&&i.shifts.hasOwnProperty(o)&&(c=i.shifts[o]),""==c&&(c=String.fromCharCode(o)),8!=o&&45!=o&&127!=o&&c!=s&&!c.match(/[0-9]/)){var g=n.keyCode?n.keyCode:n.which;if(46==g||8==g||127==g||9==g||27==g||13==g||(65==g||82==g||80==g||83==g||70==g||72==g||66==g||74==g||84==g||90==g||61==g||173==g||48==g)&&(n.ctrlKey||n.metaKey)===!0||(86==g||67==g||88==g)&&(n.ctrlKey||n.metaKey)===!0||g>=35&&39>=g||g>=112&&123>=g)return;return n.preventDefault(),!1}if(0==v&&d==this.value.length?8==o?(v=d=1,this.value="",h.init=l>0?-1:0,h.c=l>0?-(l+1):0,t.apply(this,[0,0])):c==s?(v=d=1,this.value="0"+s+new Array(l+1).join("0"),h.init=l>0?1:0,h.c=l>0?-(l+1):0):45==o?(v=d=2,this.value="-0"+s+new Array(l+1).join("0"),h.init=l>0?1:0,h.c=l>0?-(l+1):0,t.apply(this,[2,2])):(h.init=l>0?-1:0,h.c=l>0?-l:0):h.c=d-this.value.length,h.isPartialSelection=v==d?!1:!0,l>0&&c==s&&v==this.value.length-l-1)h.c++,h.init=Math.max(0,h.init),n.preventDefault(),f=this.value.length+h.c;else if(45!=o||0==v&&0!=this.value.indexOf("-"))if(c==s)h.init=Math.max(0,h.init),n.preventDefault();else if(l>0&&127==o&&v==this.value.length-l-1)n.preventDefault();else if(l>0&&8==o&&v==this.value.length-l)n.preventDefault(),h.c--,f=this.value.length+h.c;else if(l>0&&127==o&&v>this.value.length-l-1){if(""===this.value)return;"0"!=this.value.slice(v,v+1)&&(p=this.value.slice(0,v)+"0"+this.value.slice(v+1),u.val(p)),n.preventDefault(),f=this.value.length+h.c}else if(l>0&&8==o&&v>this.value.length-l){if(""===this.value)return;"0"!=this.value.slice(v-1,v)&&(p=this.value.slice(0,v-1)+"0"+this.value.slice(v),u.val(p)),n.preventDefault(),h.c--,f=this.value.length+h.c}else 127==o&&this.value.slice(v,v+1)==r?n.preventDefault():8==o&&this.value.slice(v-1,v)==r?(n.preventDefault(),h.c--,f=this.value.length+h.c):l>0&&v==d&&this.value.length>l+1&&v>this.value.length-l-1&&isFinite(+c)&&!n.metaKey&&!n.ctrlKey&&!n.altKey&&1===c.length&&(p=d===this.value.length?this.value.slice(0,v-1):this.value.slice(0,v)+this.value.slice(v+1),this.value=p,f=v);else n.preventDefault();f!==!1&&t.apply(this,[f,f]),u.data("numFormat",h)},"keyup.format":function(i){var n,s=e(this),r=s.data("numFormat"),u=i.keyCode?i.keyCode:i.which,h=a.apply(this,["start"]),o=a.apply(this,["end"]);0!==h||0!==o||189!==u&&109!==u||(s.val("-"+s.val()),h=1,r.c=1-this.value.length,r.init=1,s.data("numFormat",r),n=this.value.length+r.c,t.apply(this,[n,n])),""===this.value||(48>u||u>57)&&(96>u||u>105)&&8!==u&&46!==u&&110!==u||(s.val(s.val()),l>0&&(r.init<1?(h=this.value.length-l-(r.init<0?1:0),r.c=h-this.value.length,r.init=1,s.data("numFormat",r)):h>this.value.length-l&&8!=u&&(r.c++,s.data("numFormat",r))),46!=u||r.isPartialSelection||(r.c++,s.data("numFormat",r)),n=this.value.length+r.c,t.apply(this,[n,n]))},"paste.format":function(t){var a=e(this),i=t.originalEvent,n=null;return window.clipboardData&&window.clipboardData.getData?n=window.clipboardData.getData("Text"):i.clipboardData&&i.clipboardData.getData&&(n=i.clipboardData.getData("text/plain")),a.val(n),t.preventDefault(),!1}}).each(function(){var t=e(this).data("numFormat",{c:-(l+1),decimals:l,thousands_sep:r,dec_point:s,regex_dec_num:h,regex_dec:o,init:this.value.indexOf(".")?!0:!1});""!==this.value&&t.val(t.val())}):this.each(function(){var t=e(this),a=+t.text().replace(h,"").replace(o,".");t.number(isFinite(a)?+a:0,l,s,r)}):this.text(e.number.apply(window,arguments))};var n=null,l=null;e.isPlainObject(e.valHooks.text)?(e.isFunction(e.valHooks.text.get)&&(n=e.valHooks.text.get),e.isFunction(e.valHooks.text.set)&&(l=e.valHooks.text.set)):e.valHooks.text={},e.valHooks.text.get=function(t){var a,i=e(t),l=i.data("numFormat");return l?""===t.value?"":(a=+t.value.replace(l.regex_dec_num,"").replace(l.regex_dec,"."),(0===t.value.indexOf("-")?"-":"")+(isFinite(a)?a:0)):e.isFunction(n)?n(t):void 0},e.valHooks.text.set=function(t,a){var i=e(t),n=i.data("numFormat");if(n){var s=e.number(a,n.decimals,n.dec_point,n.thousands_sep);return e.isFunction(l)?l(t,s):t.value=s}return e.isFunction(l)?l(t,a):void 0},e.number=function(e,t,a,i){i="undefined"==typeof i?"1000"!==new Number(1e3).toLocaleString()?new Number(1e3).toLocaleString().charAt(1):"":i,a="undefined"==typeof a?new Number(.1).toLocaleString().charAt(1):a,t=isFinite(+t)?Math.abs(t):0;var n="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4),l="\\u"+("0000"+i.charCodeAt(0).toString(16)).slice(-4);e=(e+"").replace(".",a).replace(new RegExp(l,"g"),"").replace(new RegExp(n,"g"),".").replace(new RegExp("[^0-9+-Ee.]","g"),"");var s=isFinite(+e)?+e:0,r="",u=function(e,t){return""+ +(Math.round((""+e).indexOf("e")>0?e:e+"e+"+t)+"e-"+t)};return r=(t?u(s,t):""+Math.round(s)).split("."),r[0].length>3&&(r[0]=r[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,i)),(r[1]||"").length<t&&(r[1]=r[1]||"",r[1]+=new Array(t-r[1].length+1).join("0")),r.join(a)}}(jQuery);
// source --> https://www.galee.co.kr/wp-content/plugins/mangboard/plugins/datepicker/js/datepicker.js?ver=192 
jQuery(function($){
	if($.datepicker && $.datepicker.regional){
		$.datepicker.regional["ko"] = {
			closeText: "닫기",
			prevText: "이전달",
			nextText: "다음달",
			currentText: "오늘",
			monthNames: ["1월(JAN)","2월(FEB)","3월(MAR)","4월(APR)","5월(MAY)","6월(JUN)", "7월(JUL)","8월(AUG)","9월(SEP)","10월(OCT)","11월(NOV)","12월(DEC)"],
			monthNamesShort: ["1월","2월","3월","4월","5월","6월", "7월","8월","9월","10월","11월","12월"],
			dayNames: ["일","월","화","수","목","금","토"],
			dayNamesShort: ["일","월","화","수","목","금","토"],
			dayNamesMin: ["일","월","화","수","목","금","토"],
			weekHeader: "Week",
			dateFormat: "yymmdd",
			firstDay: 0,
			isRTL: false,
			showMonthAfterYear: true,
			yearSuffix: ""
		};
		$.datepicker.setDefaults($.datepicker.regional["ko"]);
	}
});
jQuery(document).ready(function() {
	if(jQuery(".show-datepicker").datepicker) jQuery(".show-datepicker").datepicker({ changeMonth: true, changeYear: true, firstDay:0, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-100:c+10"});
});
// source --> https://www.galee.co.kr/wp-content/plugins/mangboard/plugins/popup/js/main.js?ver=192 
jQuery( document ).ready(function() {
	//팝업 태그를 body에 추가
	var popup_html	= "";
	popup_html		= popup_html+'<div class="mb-board">';
	popup_html		= popup_html+'<div class="pop-bg" id="mb_pop_bg" onclick="hidePopupAlert()"></div>';
	popup_html		= popup_html+'<div class="pop-main mb-'+mb_options["device_type"]+'" >';
		popup_html		= popup_html+'<div class="pop-html" id="mb_pop_html">';
			popup_html		= popup_html+'<div id="mb_pop_html_head"></div>';
			popup_html		= popup_html+'<div id="mb_pop_html_body"></div>';
		popup_html		= popup_html+'</div>';
		popup_html		= popup_html+'<div class="mb-pop pop-info" id="mb_pop_info">';
			popup_html		= popup_html+'<div id="mb_pop_info_head"></div>';
			popup_html		= popup_html+'<div id="mb_pop_info_body"></div>';
		popup_html		= popup_html+'</div>';
		popup_html		= popup_html+'<div class="mb-pop pop-confirm" id="mb_pop_confirm">';
			popup_html		= popup_html+'<div class="pop-confirm-head" id="mb_pop_confirm_head"></div>';
			popup_html		= popup_html+'<div class="pop-confirm-body" id="mb_pop_confirm_body"></div>';
		popup_html		= popup_html+'</div>';
		popup_html		= popup_html+'<div class="mb-pop pop-alert" id="mb_pop_alert">';
			popup_html		= popup_html+'<div class="pop-alert-head" id="mb_pop_alert_head"></div>';
			popup_html		= popup_html+'<div class="pop-alert-body" id="mb_pop_alert_body"></div>';
		popup_html		= popup_html+'</div>';
		
	popup_html		= popup_html+'</div>';
	popup_html		= popup_html+'</div>';

     jQuery("body").append(popup_html);
});

var confirmCallbackSend;
var confirmCallbackCancel;
var alertCallbackSend;
var popupCallbackData;
var select_menu		= "";
var eventX				= 0;
var eventY				= 0;
var scrollMode			= true;
var popupMode			= "popup";

function setPopupScrollEvent(){
	jQuery(window).on({
		'mousewheel': function(e){
			if(scrollMode) setPopupPosition("scroll");
		},'scroll': function(e){
			if(scrollMode) setPopupPosition("scroll");
		},'resize': function(e){
			setPopupPosition("resize");
		}
	})
}
function setPopupPosition(mode){
	if(typeof(mode)!=='undefined'){
		if((mode=="scroll" || mode=="resize") && jQuery("#mb_pop_bg").css('display')=='none') return;
	}

	var pHeight			= 120;
	var nWidth			= jQuery(window).width();
	var nHeight			= jQuery(window).height();
	var scrollTop			= jQuery(document).scrollTop();
	
	var popupObj			= jQuery("#mb_pop_confirm");
	if(mb_options["device_type"]=="mobile") pHeight				= 50;

	popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
	if(popupObj.outerHeight()>400){ pHeight			= 30; }
	popupObj.css('top',(scrollTop-pHeight+((nHeight-popupObj.outerHeight())/2)));

	popupObj		= jQuery("#mb_pop_alert");
	popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
	if(popupObj.outerHeight()>400){ pHeight			= 30; }
	popupObj.css('top',(scrollTop-pHeight+((nHeight-popupObj.outerHeight())/2)));

	popupObj		= jQuery("#mb_pop_info");
	popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
	popupObj.css('top',((scrollTop+((nHeight-popupObj.outerHeight())/2))));

	popupObj		= jQuery("#mb_pop_html");
	if(popupObj.outerHeight()>600){ 
		pHeight			= 10;
	}else if(popupObj.outerHeight()>400){ 
		pHeight			= 20;
	}
	var nTop			= (scrollTop-pHeight+((nHeight-popupObj.outerHeight())/2));
	if(nTop<scrollTop){
		if((pHeight+nTop)<scrollTop){
			nTop	= scrollTop;
		}else{
			nTop	= parseInt((pHeight+nTop)/2);
		}
	}
	if(nTop<scrollTop){ nTop	= scrollTop; }
	if(nTop<0){ nTop = 0; }

	if(popupObj.outerHeight()>=nHeight){
		popupObj.css('position','fixed');
		if(popupObj.outerHeight()>=nHeight){
			popupObj.css('top',0);
		}else{
			popupObj.css('top',nTop);
		}
		if(mb_options["device_type"]=="mobile") popupObj.css('width',"100%");
		popupObj.css('height',"100%");
		if(popupObj.outerWidth()>=nWidth){
			popupObj.css('left',0);
		}else{
			popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
		}
		scrollMode		= false;
		jQuery('body').css('overflow-y','hidden');
	}else{
		popupObj.css('position','absolute');
		popupObj.css('top',nTop);
		if(popupObj.outerWidth()>=nWidth){
			popupObj.css('left',0);
		}else{
			popupObj.css('left',(nWidth-popupObj.outerWidth())/2);
		}
	}
}
setPopupScrollEvent();

function showConfirmPopup(message,data,send,cancel){
	popupCallbackData				= data;
	confirmCallbackSend			= send;

	if(typeof(cancel)==='undefined') confirmCallbackCancel = hidePopupBox;
	else confirmCallbackCancel		= cancel;

	//위치 설정
	var pop_head		= '';
	var pop_body		= '';
	var pop_btn_ok		= mb_languages["btn_ok"];
	var pop_btn_cancel	= mb_languages["btn_cancel"];
	if(typeof(data)!=='undefined'){
		if(typeof(data.btn_ok)!=='undefined' && data.btn_ok!=""){
			pop_btn_ok		= data.btn_ok;
		}
		if(typeof(data.btn_cancel)!=='undefined' && data.btn_cancel!=""){
			pop_btn_cancel		= data.btn_cancel;
		}
	}
	if(typeof(data)!=='undefined' && typeof(data.type)!=='undefined' && data.type=="passwd"){
		pop_head		= '<div class="pop-title pop-title-confirm" id="mb_pop_confirm_text">'+message+'</div>';
		pop_body			= pop_body+'<div id="mb_pop_form">';
			pop_body			= pop_body+'<form class="pop-form" action="javascript:sendConfirmCallbackData()" id="mb_confirm_form" method="post" name="mb_confirm_form"><div><input id="mb_confirm_passwd" name="passwd" class="pop-input-passwd" type="password" /></div></form>';

		pop_body			= pop_body+'</div>';		
	}else{
		pop_head		= '<div class="pop-title" id="mb_pop_confirm_text"><div class="pop-title-head">Message</div><div class="pop-title-message">'+message+'</div></div>';
	}
	pop_body			= pop_body+'<div class="btn-box-center">';
	pop_body			= pop_body+'<a href="javascript:;" id="mb_pop_confirm_cancel" onclick="cancelConfirmCallbackData()" class="btn btn-default btn-cancel margin-right-10"><span>'+pop_btn_cancel+'</span></a>';
	pop_body			= pop_body+'<a href="javascript:;" id="mb_pop_confirm_ok" onclick="sendConfirmCallbackData()" class="btn btn-default btn-ok"><span>'+pop_btn_ok+'</span></a>';
	pop_body			= pop_body+'</div>';

	if(typeof(data)!=='undefined'){
		if(typeof(data.head)!=='undefined')  pop_head		= data.head;
		if(typeof(data.body)!=='undefined')  pop_body		= data.body;
	}

	showPopupBox("Confirm",pop_head,pop_body);
}
function showAlertPopup(response,send){
	if(!response || typeof(response)==='undefined') return;

	var code					= "";
	var message				= "";
	var target_name			= "";
	var mode					= "";
	var board_action		= "";
	
	if(typeof(send)==='undefined') alertCallbackSend			= null;
	else alertCallbackSend			= send;
	
	if(typeof(response.code)!=='undefined') code				= response.code;
	if(typeof(response.message)!=='undefined') message		= response.message;
	if(typeof(response.target_name)!=='undefined') target_name		= response.target_name;
	if(typeof(response.mode)!=='undefined') mode				= response.mode;
	if(typeof(response.board_action)!=='undefined') board_action				= response.board_action;
	if(message=="") return;
	if(code=="1103"){
		showConfirmPopup(message, {}, function(){moveURL(mb_urls["login"]);});
		return;
	}
	var pop_head		= '<div class="pop-title" id="mb_pop_alert_text"><div class="pop-title-head">Message</div><div class="pop-title-message">'+message+'</div></div>';
	var pop_body		= '';
	pop_body			= pop_body+'<div class="btn-box-center">';
	pop_body			= pop_body+'<a href="javascript:;"  id="mb_pop_alert_ok" onclick="showAlertCallback(\''+code+'\',\''+target_name+'\',\''+mode+'\',\''+board_action+'\');" class="btn btn-default btn-ok"><span>'+mb_languages["btn_ok"]+'</span></a>';
	pop_body			= pop_body+'</div>';
	showPopupBox("Alert",pop_head,pop_body);
}
function showPopupBox(type,head,body,data,mode){
	if(typeof(mode)!=='undefined' && mode!=''){
		popupMode			= mode;
	}else{
		popupMode			= "popup";
	}

	scrollMode			= true;
	initLoadingBox();
	var popupID		= "#mb_pop_confirm";	

	if(type=="Alert"){
		popupID		= "#mb_pop_alert";
		if(jQuery("#mb_pop_bg").css('display')=='none') jQuery("#mb_pop_confirm").hide();	

		setTimeout(function(){ jQuery(popupID).addClass("mb-ani-pop-open");	 }, 1);		
	}else if(type=="Info"){
		popupID		= "#mb_pop_info";
		setTimeout(function(){ jQuery(popupID).addClass("mb-ani-pop-fadein"); }, 1);
	}else if(type=="Confirm"){
		popupID		= "#mb_pop_confirm";
		setTimeout(function(){ jQuery(popupID).addClass("mb-ani-pop-open");	 }, 1);		
	}else if(type=="Html"){
		popupID		= "#mb_pop_html";
	}else{
		popupID		= "#mb_pop_alert";
		setTimeout(function(){ jQuery(popupID).addClass("mb-ani-pop-open");	 }, 1);		
	}
	if(typeof(data)==='undefined') data		= {};
	if(typeof(data.position)==='undefined') data.position = "center";
	if(typeof(data.bg)==='undefined') data.bg = true;
	if(typeof(data.eventX)==='undefined') data.eventX = 0;
	if(typeof(data.eventY)==='undefined') data.eventY = 0;
	
	jQuery(popupID+"_head").html(head);
	jQuery(popupID+"_body").html(body);	

	if(data.position=="click"){
		jQuery(popupID).css("top",parseInt((data.eventY+jQuery(document).scrollTop())/10)*10-25);
		jQuery(popupID).css("left",parseInt(data.eventX/10)*10+28);
	}else{
		setPopupPosition();
	}
	if(data.bg) showPopupBG();
	
	jQuery(popupID).show();	

	if(type=="Alert"){
		jQuery("#mb_pop_alert_ok").focus();
	}else if(type=="Confirm"){
		jQuery("#mb_confirm_passwd").focus();
	}
	
}

function initLoadingBox(){
	jQuery("#mb_pop_html_head").html("");
	jQuery("#mb_pop_html_body").html("");
	jQuery("#mb_pop_html").css({'width':'','height':''});
	jQuery("#mb_pop_html").hide();
}

function showLoadingBox(){
	showPopupBox("Html",'<img src="'+mb_urls["plugin"]+'assets/images/loader.gif" width="50px" height="50px" style="opacity: 0.7;filter: alpha(opacity=0.7);">','<div style="color:#fff;font-size:12px;min-height:19px;">Loading</div>');
}
function hideLoadingBox(){
	initLoadingBox();
	if(jQuery("#mb_pop_alert").css('display')=='none' && jQuery("#mb_pop_confirm").css('display')=='none'){
		jQuery("#mb_pop_bg").hide();
	}
	if(!scrollMode){
		jQuery('body').css('overflow-y','auto');
		scrollMode		= true;
	}
}

function showPopupBG(){
	hideInfoBox();
	jQuery('#mb_pop_bg').height(jQuery(document).height());	
	jQuery("#mb_pop_bg").show();
}

var popup_user_name	= "";
function getUserMenu(uid,pid,name){
	if(typeof(name)!=='undefined' && name!=""){
		popup_user_name		= name;
	}else{
		popup_user_name		= "";
	}
	var menu_options		= "*";	
	if(select_menu==uid+"_"+pid){
		select_menu		= "";
		hideInfoBox();
	}else{		
		sendUserMenu(uid,pid,menu_options,event);
		select_menu		= uid+"_"+pid;
	}
}
function showUserMenu(data){		
	var menu_head		= data["head"];
	var menu_body		= "";
	var menu_foot		= data["foot"];

	var user_name		= "";
	if(typeof(data["user"]["name"])!=='undefined' && data["user"]["name"]!=""){
		user_name		= data["user"]["name"];
	}else if(popup_user_name!=""){
		user_name		= popup_user_name;
	}	
	if(user_name!="") menu_head				= menu_head+'<div class="pop-info-head">'+user_name+'</div>';

	menu_body			= '<ul class="pop-info-body list-unstyled">';	

	if(data["body"].length>0){
		jQuery.each(data["body"], function(key,value){
			menu_body		= menu_body+'<li>'+value+'</li>';
		});
		menu_body		= menu_body+'</ul>';
		showPopupBox("Info","",('<div class="pop-user-menu">'+menu_head+menu_body+menu_foot+"</div>"),{"position":"click","bg":false,"eventX":eventX,"eventY":eventY});
	}
}

function sendUserMenu(uid,board_pid,option,event){
	if(typeof(event)!=='undefined'){
		eventX	= event.clientX;
		eventY		= event.clientY - jQuery('body').offset().top;
	}
	if(option=="*") option	= "search,info,email,homepage,blog";

	var param	= "board_name="+mb_options["board_name"]+"&option="+option+"&list_type="+mb_options["list_type"]+"&page="+mb_options["page"]+"&page_id="+mb_options["page_id"];
	if(jQuery('#'+mb_options["board_name"]+'_form_board_search').length>0) param		+= "&"+jQuery('#'+mb_options["board_name"]+'_form_board_search').serialize();
	param	+= "&mode=user&board_action=menu"+"&pid="+uid+"&board_pid="+board_pid;

	sendDataRequest2(mb_urls["template_api"], param, sendUserMenuHandler);
}
function sendUserMenuHandler(response, state){		
	if(response.state == "success"){
		showUserMenu(response.data);
	}else{
		showAlertPopup(response);
	}
}
function hideInfoBox() {
	jQuery("#mb_pop_info").hide();
	jQuery("#mb_pop_info").removeClass("mb-ani-pop-fadein");
}
function hidePopupBox() {	
	confirmCallbackSend		= null;
	jQuery(".mb-input-focus").removeClass("mb-input-focus");
	jQuery("#mb_pop_info").hide();
	jQuery("#mb_pop_html").hide();	
	jQuery("#mb_pop_confirm").hide();	
	jQuery("#mb_pop_confirm").removeClass("mb-ani-pop-open");
	jQuery("#mb_pop_alert").removeClass("mb-ani-pop-open");
	jQuery("#mb_pop_info").removeClass("mb-ani-pop-fadein");
	jQuery("#mb_pop_bg").hide();
	if(!scrollMode){
		jQuery('body').css('overflow-y','auto');
		scrollMode		= true;
	}
	popupMode			= "popup";
}
function showAlertCallback(code,target_name,mode,board_action){	
	hidePopupAlert(code,target_name,mode,board_action);
	sendAlertCallbackData();	
}
function hidePopupAlert(code,target_name,mode,board_action) {
	if(popupMode=="modal") return;
	if(typeof(code)!=='undefined' && code!=='undefined' && code!=''){
		if(confirmCallbackSend) jQuery("#mb_pop_confirm").show();		

		if(code.substr(0,2)=="12"){	//입력 관련 에러일 경우 포커스 설정
			if(typeof(target_name)!=='undefined'  && target_name!=='undefined' && target_name!=''){
				var target;
				if(jQuery("#mb_pop_confirm").css('display')!='none'){
					if(target_name.indexOf(" ") !== -1){		//이름에 공백이 있을 경우
						if(jQuery("#mb_confirm_form").find(target_name).length>0){
							target		= jQuery("#mb_confirm_form").find(target_name).first();
						}
					}else{
						if(jQuery("#mb_confirm_form").find("input[name='"+target_name+"']").length>0){
							target		= jQuery("#mb_confirm_form").find("input[name='"+target_name+"']").first();
						}else if(jQuery("#mb_confirm_form").find(target_name).length>0){
							target		= jQuery("#mb_confirm_form").find(target_name).first();
						}
					}					
				}else{
					if(code=="1299"){
						if(jQuery(target_name).filter(':visible').length>0){
							target		= jQuery(target_name).filter(':visible').first();
						}
					}else{
						if(target_name.indexOf(" ") !== -1){		//이름에 공백이 있을 경우
							if(jQuery(target_name).filter(':visible').length>0){
								target		= jQuery(target_name).filter(':visible').first();
							}
						}else{
							if(jQuery("[name='"+target_name+"']").filter(':visible').length>0){
								if(typeof(mode)!=='undefined' && mode=='comment' && typeof(board_action)!=='undefined' && (board_action=='reply' || board_action=='modify')){
									target		= jQuery(".cmt-reply-box [name='"+target_name+"']").filter(':visible').first();
								}else{
									target		= jQuery("[name='"+target_name+"']").filter(':visible').first();
								}
							}else if(jQuery(target_name).filter(':visible').length>0){
								target		= jQuery(target_name).filter(':visible').first();
							}
						}						
					}
				}
				jQuery(".mb-input-focus").removeClass("mb-input-focus");
				if(typeof(target)!=='undefined'  && target!=='undefined'){
					jQuery("html, body").animate({scrollTop: target.offset().top-200}, 300, function(){
						target.focus();
						target.addClass("mb-input-focus");
					});
				}
			}
		}
	}else{
		jQuery(".mb-input-focus").focus();
	}
	
	jQuery("#mb_pop_alert").hide();
	jQuery("#mb_pop_alert").removeClass("mb-ani-pop-open");
	jQuery("#mb_pop_html").hide();
	jQuery("#mb_pop_info").hide();
	if(jQuery("#mb_pop_confirm").css('display')=='none'){
		jQuery("#mb_pop_bg").hide();
		initLoadingBox();
	}
	if(!scrollMode){
		jQuery('body').css('overflow-y','auto');
		scrollMode		= true;
	}
	popupMode			= "popup";
}
function sendAlertCallbackData() {	
	if(alertCallbackSend) alertCallbackSend();
	else alertCallbackSend		= null;
}
function sendConfirmCallbackData() {	
	showLoadingBox();
	jQuery("#mb_pop_confirm").hide();
	if(confirmCallbackSend) confirmCallbackSend(popupCallbackData);
	else confirmCallbackSend		= null;
}
function cancelConfirmCallbackData() {	
	confirmCallbackSend		= null;
	if(confirmCallbackCancel) confirmCallbackCancel();
	else confirmCallbackCancel		= null;
};
// source --> https://www.galee.co.kr/wp-content/plugins/mangboard/plugins/conversion_tracking/js/main.js?ver=192 
function sendConversionTracking(type, data){
	if(type!="" && typeof(data)!=="undefined"){
		var item_id			= "";
		var item_name		= "";
		var item_price		= "";
		var total_price		= "";
		var quantity			= "";
		var item_category	= "";
		if(typeof(data.pid)!=="undefined" && data.pid!=="") item_id = data.pid;
		if(typeof(data.name)!=="undefined" && data.name!=="") item_name = data.name;
		if(typeof(data.price)!=="undefined" && data.price!=="") item_price = data.price;
		if(typeof(data.total_price)!=="undefined" && data.total_price!=="") total_price = data.total_price;
		if(typeof(data.quantity)!=="undefined" && data.quantity!=="") quantity = data.quantity;
		if(typeof(data.category1)!=="undefined" && data.category1!=="") item_category = data.category1;

		if(item_name!="" && item_id!=""){
			if(typeof(gtag)!=="undefined"){	//google
				gtag('event', type, {'currency':'KRW','value':total_price,'items':[{'item_id':item_id,'item_name':item_name,'price':item_price,'quantity':quantity,'item_category':item_category}]});
			}
			if(typeof(wcs)!=="undefined"){		//naver
				var _conv = {};
					_conv.type = 'add_to_cart';
					_conv.items = [{'id':item_id,'name':item_name,'quantity':quantity,'payAmount':item_price,'category':item_category}];
				wcs.trans(_conv);
			}
			if(typeof(fbq)!=="undefined"){		//facebook pixel
				fbq('track', 'AddToCart',{'content_name':item_name,'content_category':item_category,'content_ids':[item_id],'content_type':'product','value':item_price,'currency':'KRW'});
			}
		}
	}
};