/****************************************************************************
* 로그아웃
****************************************************************************/
function fn_logout(){
	window.location ='/weblogin/logout.do';
}

/****************************************************************************
* 로그아웃(session 종료)
****************************************************************************/
function fn_sessionLogout(){
	if(checkMobile()){
		getLoginInfo();
	}
	else{
		window.location ='/weblogin/logout.do';
	}
}

/****************************************************************************
* 숫자 3자리 콤마 이벤트
****************************************************************************/
function fn_numberFormat(str) {
	str = String(str);
	return str.replace(/(\d)(?=(?:\d{3})+(?!\d))/g, '$1,');
}

/****************************************************************************
* 페이지 이동
****************************************************************************/
function fn_leftFormAction(action){
	let newForm = $("<form><form/>");
	newForm.attr("name","submitForm");
	newForm.attr("method","POST");
	
	if(-1 != action.indexOf("?")) {
		let actionArr = action.split('?');
		newForm.attr("action",actionArr[0]);
		
		let paramUrlArr = actionArr[1].split('&');
		for(let i = 0; i < paramUrlArr.length; i++){
			let paramArr = paramUrlArr[i].split('=');
			newForm.append($('<input/>',{type:'hidden',name:paramArr[0],value:paramArr[1]}));
		}
	}
	else {
		newForm.attr("action",action);
	}
	
	// newForm.append($('<input/>',{type:'hidden',name:"menuCode",value:menuCode}));
	newForm.appendTo('body');
	newForm.submit();
}

/****************************************************************************
* 페이지 이동2
****************************************************************************/
function fn_leftFormAction2(menuClass, action){
	let newForm = $("<form><form/>");
	newForm.attr("name","submitForm");
	newForm.attr("method","POST");

	if(-1 != action.indexOf("?")) {
		let actionArr = action.split('?');
		newForm.attr("action",actionArr[0]);

		let paramUrlArr = actionArr[1].split('&');
		for(let i = 0; i < paramUrlArr.length; i++){
			let paramArr = paramUrlArr[i].split('=');
			newForm.append($('<input/>',{type:'hidden',name:paramArr[0],value:paramArr[1]}));
		}
	}
	else {
		newForm.attr("action",action);
	}

	newForm.append($('<input/>',{type:'hidden',name:"menuClass",value:menuClass}));
	newForm.appendTo('body');
	newForm.submit();
}

/****************************************************************************
* 새창 이동 (미리보기)
****************************************************************************/
function fn_openPopup(action){
	let newForm = $("<form><form/>");
	newForm.attr("name","submitForm");
	newForm.attr("method","POST");
	newForm.attr("target","_blank");
	
	if(-1 != action.indexOf("?")) {
		let actionArr = action.split('?');
		newForm.attr("action",actionArr[0]);
		
		let paramUrlArr = actionArr[1].split('&');
		for(let i = 0; i < paramUrlArr.length; i++){
			let paramArr = paramUrlArr[i].split('=');
			newForm.append($('<input/>',{type:'hidden',name:paramArr[0],value:paramArr[1]}));
		}
	}
	else {
		newForm.attr("action",action);
	}
	
	newForm.appendTo('body');
	newForm.submit();
}

/****************************************************************************
* 새창 이동2 (미리보기)
****************************************************************************/
function fn_openPopup2(menuClass, action){
	const newWindow = window.open("about:blank", "popup", "width=1600, height=800");

	let newForm = $("<form><form/>");
	newForm.attr("name","submitForm");
	newForm.attr("method","POST");
	newForm.attr("target","popup");

	if(-1 != action.indexOf("?")) {
		let actionArr = action.split('?');
		newForm.attr("action",actionArr[0]);

		let paramUrlArr = actionArr[1].split('&');
		for(let i = 0; i < paramUrlArr.length; i++){
			let paramArr = paramUrlArr[i].split('=');
			newForm.append($('<input/>',{type:'hidden',name:paramArr[0],value:paramArr[1]}));
		}
	}
	else {
		newForm.attr("action",action);
	}

	newForm.append($('<input/>',{type:'hidden',name:"menuClass",value:menuClass}));
	newForm.appendTo('body');
	newForm.submit();
}

/****************************************************************************
* 뒤로가기
****************************************************************************/
function fn_back(){
	history.back();
}

/****************************************************************************
* 새로고침
****************************************************************************/
function fn_reload(){
	location.reload();
}

/****************************************************************************
* 전화번호 형식 변경
* type:0이면 중간번호 가리기
****************************************************************************/
function fn_setFormatPhone(num,type){
	if (!num) return '';
    num = String(num);
	let formatNum = '';

	if(11 == num.length){
		if(0 == type){
			formatNum = num.replace(/(\d{3})(\d{4})(\d{4})/, '$1-****-$3');
		}
		else{
			formatNum = num.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3');
		}
	}
	else if(8 == num.length){
		formatNum = num.replace(/(\d{4})(\d{4})/, '$1-$2');
	}
	else{
		if(0 == num.indexOf('02')){
			if(0 == type){
				formatNum = num.replace(/(\d{2})(\d{4})(\d{4})/, '$1-****-$3');
			}
			else{
				formatNum = num.replace(/(\d{2})(\d{4})(\d{4})/, '$1-$2-$3');
			}
		}
		else{
			if(0 == type){
				formatNum = num.replace(/(\d{3})(\d{3})(\d{4})/, '$1-***-$3');
			}
			else{
				formatNum = num.replace(/(\d{3})(\d{3})(\d{4})/, '$1-$2-$3');
			}
		}
	}

	return formatNum;
}

/****************************************************************************
* 날짜 보이는 영역에 셋팅
****************************************************************************/
function fn_selectDateTime(paramId, paramValue){
	$("#"+paramId).val(paramValue);
}

/****************************************************************************
* datePicker 생성
****************************************************************************/
function fn_datePicker(id){
	$(id).datetimepicker({
		allowInputToggle: true,
		format: 'YYYY-MM-DD'
	});
	
}

/****************************************************************************
* datePicker 
****************************************************************************/
function fn_searchDatePicker(startId, endId){
	$(startId).datetimepicker({
		allowInputToggle: true,
		format: 'YYYY-MM-DD',
		defaultDate: moment()
	});
	
	$(endId).datetimepicker({
		allowInputToggle: true,
		useCurrent: false, //Important! See issue #1075
		format: 'YYYY-MM-DD',
		defaultDate: moment()
	});
	
	/*$(endId).data("DateTimePicker").minDate(fn_getToDate());*/
	
	//$(endId).data("DateTimePicker").maxDate(fn_getToDate());
	//$(startId).data("DateTimePicker").maxDate(fn_getToDate());
	
	$(startId).on("dp.change", function (e) {
		$(endId).data("DateTimePicker").minDate(e.date);
		
		if($(endId).data("DateTimePicker").date() < e.date){
			$(endId).data("DateTimePicker").date(e.date);   
		}
	});
}

/****************************************************************************
* dateTimePicker 생성
****************************************************************************/
function fn_dateTimePicker1(id, value){
	if(value){
		$(id).datetimepicker({
			allowInputToggle: true,
			format: 'HH:mm',
			defaultDate: moment().format('YYYY-MM-DD')+'T'+ value
		});
	}
	else{
		$(id).datetimepicker({
			allowInputToggle: true,
			format: 'HH:mm'
		});
	}
}

/****************************************************************************
* dateTimePicker 생성 (AM, PM 선택)
****************************************************************************/
function fn_dateTimePicker2(id){
	$(id).datetimepicker({
		allowInputToggle: true,
		format: 'LT'
	}); 
}

/****************************************************************************
* dateTimePicker 생성
****************************************************************************/
function fn_dateTimePicker3(id){
	$(id).datetimepicker({
		allowInputToggle: true,
		format: 'YYYY-MM-DD HH:mm'
	});
}

/****************************************************************************
 * dateTimePicker 생성 (AM, PM 선택)
 ****************************************************************************/
function fn_dateMonthPicker(id){
	$(id).datetimepicker({
		allowInputToggle: true,
		format: 'YYYY-MM',
		defaultDate: moment().format('YYYY-MM')
	}); 
}

/****************************************************************************
* null 확인
****************************************************************************/
function fn_emptyYn(value){
	if( value == "" || value == null || value == undefined || ( value != null && typeof value == "object" && !Object.keys(value).length ) ){ 
		return true 
	}
	else{ 
		return false 
	} 
}


/****************************************************************************
* 오늘 날짜 조회
****************************************************************************/
function fn_getToDate() {
	let toDate = new Date();
	let newToDate = fn_formatToDate(toDate.getFullYear(), 4) + '-' + fn_formatToDate(toDate.getMonth() + 1, 2) + '-' + fn_formatToDate(toDate.getDate(), 2);
	
	return newToDate;
}

/****************************************************************************
* 어제 날짜 조회
****************************************************************************/
function fn_getToYesterday() {
	let toDate = new Date();
	let newToDate = fn_formatToDate(toDate.getFullYear(), 4) + '-' + fn_formatToDate(toDate.getMonth() + 1, 2) + '-' + fn_formatToDate(toDate.getDate()-1, 2);
	
	return newToDate;
}

/****************************************************************************
* 날짜 형식 맞추기
****************************************************************************/
function fn_formatToDate(day, number) {
	let temp = '';
	day = day.toString();
	
	if (day.length < number) {
		for (i = 0; i < number - day.length; i++){
			temp += '0';
		}
	}
	
	return temp + day;
}


/****************************************************************************
* 날짜 요일 조회
****************************************************************************/
function fn_getDayName(param){
	let paramArray = param.split('-');
	let week = new Array('일', '월', '화', '수', '목', '금', '토');	
	let dt = new Date(parseInt(paramArray[0]), parseInt(paramArray[1])-1, parseInt(paramArray[2]));
	let dayName = week[dt.getDay()];
	
	return dayName;
}

/*************************************************************************
* 날짜 형식 변환
* A: 년월일
* B: 월일
* C: 년월일 시간
* D: 년.월.일
* E: 년.월.일 (년도4자리)
* F: 월/일(요일) (년도4자리)
* G: 년.월.일(요일) (년도4자리)
* H: YYMMDD (8자리)
**************************************************************************/
function setFormatDate(type, param) {
	let retureValue = param;
	
	if("A" == type){
		let dateArray = param.split("-");
		retureValue = dateArray[0]+"년 "+dateArray[1]+"월 "+dateArray[2]+"일";
	}
	else if("B" == type){
		let dateArray = param.split("-");
		retureValue = dateArray[1]+"월 "+dateArray[2]+"일";
	}
	else if("C" == type){
		let tempArray = param.split(" ");
		let dateArray1 = tempArray[0].split("-");
		let dateArray2 = tempArray[1];
		
		retureValue = dateArray1[0]+"년 "+dateArray1[1]+"월 "+dateArray1[2]+"일 "+dateArray2;
	}
	else if("D" == type){
		let dateArray = param.split("-");
		retureValue = dateArray[0].substring(2, 4)+"."+dateArray[1]+"."+dateArray[2];
	}
	else if("E" == type){
		let dateArray = param.split("-");
		retureValue = dateArray[0].substring(0, 4)+"."+dateArray[1]+"."+dateArray[2];
	}
	else if("F" == type){
		let dateArray = param.split("-");
		const week = ['일', '월', '화', '수', '목', '금', '토'];
		const dayOfWeek = week[new Date(dateArray[0], dateArray[1], dateArray[2]).getDay()];
		
		retureValue = dateArray[1]+"/"+dateArray[2]+"("+dayOfWeek+")";
	}
	else if("G" == type){
		// 년.월.일(요일)
		let dateArray = param.split("-");
		const week = ['일', '월', '화', '수', '목', '금', '토'];
		const dayOfWeek = week[new Date(dateArray[0], dateArray[1], dateArray[2]).getDay()];
		
		retureValue = dateArray[0].substring(0, 4)+"."+dateArray[1]+"."+dateArray[2]+"("+dayOfWeek+")";
	}
	else if("H" == type){
		let dateArray = param.split("-");
		retureValue = dateArray[0].substr(2, 4)+dateArray[1]+dateArray[2];
	}
	
	return retureValue;
}

/****************************************************************************
* 빈값 체크
****************************************************************************/
function fn_emptyCheck(param){
	if(param === null || param === "" || param === "null" || param === "NULL" || param === undefined || param === "undefined"){
		return false;
	}
	else{
		return true;
	}
}

/****************************************************************************
* 길이 체크
****************************************************************************/
function fn_lengthCheck(str, maxLength){
	let strLength = str.length;
	
	if(strLength > maxLength){
		return false;
	}
	else{
		return true;
	}
}

/****************************************************************************
* 날짜 체크
****************************************************************************/
function fn_dateCheck(value){
	let strLength = value.length;
	let cnt = 0;
	let searchChar = "-"; // 찾으려는 문자
	let pos = value.indexOf(searchChar); // pos는 0의 값을 가짐

	if(10 == strLength){
		while(-1 !== pos){
			cnt++;
			pos = value.indexOf(searchChar, pos + 1) // 첫 번째 - 이후의 인덱스부터 -를 찾음
		}

		if(2 == cnt){
			return true;
		}
		else{
			return false;
		}
	}
	else{
		return false;
	}
	// let date = value.split("-");
	// let y = parseInt(date[0], 10),
	// 	m = parseInt(date[1], 10),
	// 	d = parseInt(date[2], 10);
	//
	// let dateRegex = /^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-.\/])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
	// if(dateRegex.test(d+'-'+m+'-'+y)){
	// 	return true;
	// }else{
	// 	return false;
	// }
}

/****************************************************************************
* 날짜 시간 체크
****************************************************************************/
function fn_dateTimeCheck(value){
	let strLength = value.length;
	let cnt = 0;
	let searchChar = "-"; // 찾으려는 문자
	let pos = value.indexOf(searchChar); // pos는 0의 값을 가짐

	if(10 == strLength){
		while(-1 !== pos){
			cnt++;
			pos = value.indexOf(searchChar, pos + 1) // 첫 번째 - 이후의 인덱스부터 -를 찾음
		}

		if(2 == cnt){
			return true;
		}
		else{
			return false;
		}
	}
	else{
		return false;
	}

	// let date = value.split("-");
	// let y = parseInt(date[0], 10),
	// 	m = parseInt(date[1], 10),
	// 	d = parseInt(date[2], 10);
	//
	// let dateRegex = /^(?=\d)(?:(?:31(?!.(?:0?[2469]|11))|(?:30|29)(?!.0?2)|29(?=.0?2.(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00)))(?:\x20|$))|(?:2[0-8]|1\d|0?[1-9]))([-.\/])(?:1[012]|0?[1-9])\1(?:1[6-9]|[2-9]\d)?\d\d(?:(?=\x20\d)\x20|$))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}(\x20[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;
	// if(dateRegex.test(d+'-'+m+'-'+y)){
	// 	return true;
	// }else{
	// 	return false;
	// }
}

/****************************************************************************
* 첨부파일 최대 용량
****************************************************************************/
function fn_maxFileSize(){
	return 52428800;
}

/****************************************************************************
* 첨부파일 최대 갯수 : 10
****************************************************************************/
function fn_maxFileCount(){
	return 10;
}

/****************************************************************************
* 첨부파일 최대 갯수 : 5
****************************************************************************/
function fn_maxFileCount2(){
	return 5;
}

/****************************************************************************
* 약관 페이지 이동
****************************************************************************/
function fn_selectPolicyIntro(param){
	let pagingParam = '?policyType='+param;

	fn_openPopup("/webpolicy/policyDetailIntro.do"+pagingParam);
}

/****************************************************************************
* 기본 프로필 사진 처리
****************************************************************************/
function fn_setProfileUrlEmpty(param, widthParam, heightParam, index, className){
	if(fn_emptyCheck(param)){
		if(widthParam<heightParam){
			$("."+className+index).attr("src",param);
			$("."+className+index).css("width","100%");
		}
		else{
			$("."+className+index).attr("src",param);
			$("."+className+index).css("height","100%");
		}
	}
	else{
		$("."+className+index).attr("src","/image/web/profile-empty.svg");
		$("."+className+index).css("width","100%");
	}
}

/****************************************************************************
* 기본 프로필 사진 처리2
****************************************************************************/
function fn_setProfileUrlEmpty2(fileUrlParam,widthParam, heightParam){
	let object = new Object;
	if(fn_emptyCheck(fileUrlParam)){
		//파일 경로가 있지만 가로가 더 작은 경우
		if(parseInt(widthParam)<parseInt(heightParam)){
			object.styleValue = 'width:100%;';
		}
		else{
			//경로가 있지만 세로가 더 작은 경우
			object.styleValue = 'height:100%;';
		}
		
		object.urlValue = fileUrlParam;
	}
	else{
		//파일 경로가 없는경우
		object.urlValue = '/image/web/profile-empty.svg';
		object.styleValue = 'width:100%;';
	}
	
	return object;
}

/****************************************************************************
* 기본 프로필 사진 경로만 있을경우
****************************************************************************/
function fn_setProfileUrlSizeNone(fileUrlParam,profileIdParam,_callback){
	let image = new Image();
	image.src = fileUrlParam;
	
	let widthParam = 0;
	let heightParam = 0;
	
	let object = new Object;
	
	if(!fn_emptyCheck(fileUrlParam)){
		//파일 경로가 없는경우
		object.urlValue = '/image/web/profile-empty.svg';
		object.styleValue = 'width:100%;';
		
		$("#"+profileIdParam).attr('src',object.urlValue).attr('style',object.styleValue);
	}
	else{
		image.onload = function () {
			widthParam = image.width;
			heightParam = image.height;
			//_callback();
			
			//파일 경로가 있지만 가로가 더 작은 경우
			if(widthParam<heightParam){
				object.styleValue = 'width:100%;';
			}
			else{
				//경로가 있지만 세로가 더 작은 경우
				object.styleValue = 'height:100%;';
			}
			
			object.urlValue = fileUrlParam;
			
			$("#"+profileIdParam).attr('src',object.urlValue).attr('style',object.styleValue);
		}
	}
	
	return object;
}

/****************************************************************************
* 디데이 구하기
****************************************************************************/
function fn_setDday(param){
	if(fn_emptyCheck(param)){
		const today = new Date();
		
		let dateArray = param.split("-");
		const paramDay = new Date(dateArray[0], dateArray[1]-1, dateArray[2]);
		
		if(paramDay>today){
			const gapDay = paramDay.getTime() - today.getTime();
			
			const resultDate = Math.ceil(gapDay / (1000 * 60 * 60 * 24));
			
			return 'D-'+resultDate;
		}
		else{
			const gapDay = today.getTime() - paramDay.getTime();
			
			const resultDate = Math.ceil(gapDay / (1000 * 60 * 60 * 24))-1;
			
			if(0==resultDate){
				return 'D-day';
			}
			else{
				return '';
			}
		}
	}
}

/****************************************************************************
* selectBox 선택 시 색상
****************************************************************************/
function fn_selectColor(param){
	let selectValue = $(param).val();
	
	if(""!=selectValue){
		$(param).css("color","#121212");	
	}else{
		$(param).css("color","#969696");		
	}
}

/****************************************************************************
* 프로필 화면 이동
****************************************************************************/
function fn_userProfileIntro(param){
	location.href = "/webuserprofile/selectListUserProfileIntro.do?userName="+param;
	
	//fn_leftFormAction2("", "/webuserprofile/selectListUserProfileIntro.do?userName="+param+"&loginId="+param2);
}

/****************************************************************************
* 검색 화면 이동
****************************************************************************/
function fn_searchFeedIntro(param,param2){
	fn_leftFormAction2(menuClass, "/websearch/selectListSearchIntro.do?searchText=#"+param+"&searchType="+param2);
}

/****************************************************************************
* 전화번호 형식 (가운데 마스킹 처리)
****************************************************************************/
function fn_setFormatPhoneNumber(param){
	if(fn_emptyCheck(param)){
		return param
		.replace(/(\d{3})(\d{4})(\d{4})/, '$1-$2-$3')
		.split('-')
		.reduce((pre, cur, idx) => (idx === 1 ? pre + '****' : pre + cur), '');
	}
	else {
		return '';
	}
}

function modalCloseEvent(){
	$(".loading-image-layer").hide();
	
	let modalCheck = false;	
	let modalArrLength = modalArr.length;
	
	for(let i=0;i<modalArrLength;i++){
		let modalName = modalArr[i];
		if(location.hash=='#'+modalName){
			modalCheck = true;
			
			break;
		}
	}
	
	if(location.hash=='#'+modalArr[modalArr.length-1]){
		modalBackYn = 'N';
	}
	else{
		let modalName = modalArr[modalArr.length-1];
		
		modalBackYn = 'Y';
		
		
		if("commonModal"==modalName && true==modalCheck){
			modalEvent.close();
		}
		else if("jobPostingApplyPopup"==modalName && true==modalCheck){
			$("#jobPostingApplyPopup .modal-header img").click();
		}
		else if("contentPopup"==modalName && true==modalCheck){
			$("#contentPopup .modal-header img").click();
		}
		else if("areaPopup"==modalName && true==modalCheck){
			$("#areaPopup .modal-header img").click();
		}
		else if("jobPopup"==modalName && true==modalCheck){
			$("#jobPopup .modal-header img").click();
		}
		else if("userFeedTagPopup"==modalName && true==modalCheck){
			$("#userFeedTagPopup .modal-header img").click();
		}
		else if("feedCommentPopup"==modalName && true==modalCheck){
			$("#feedCommentPopup .modal-header img").click();
		}
		else if("branchPopup"==modalName && true==modalCheck){
			$("#branchPopup .modal-header img").click();
		}
		else if("userTagPopup"==modalName && true==modalCheck){
			$("#userTagPopup .modal-header img").click();
		}
		else if("feedAndCommentPopup"==modalName && true==modalCheck){
			$("#feedAndCommentPopup .modal-header img").click();
		}
		else if("branchSelectPopup"==modalName && true==modalCheck){
			$("#branchSelectPopup .modal-header img").click();
		}
		else if("interestKeywordTagPopup"==modalName && true==modalCheck){
			$("#interestKeywordTagPopup .modal-header img").click();
		}
		else{
			//hash명이 정의되지않은 이름일시 팝업 전부 닫기
			
			let modalArrLength = modalArr.length;
			
			for(let i=0;i<modalArrLength;i++){
				fn_modalBackCloseEvent(modalArr[modalArr.length-1]);
			}
			modalArr = new Array();
		}
	}
	
	const scrollPosition = pageYOffset;
	
	if(0==modalArr.length){
		//팝업이 다 닫혀있다면 새로고침 켜기
		window.scrollTo(0,scrollPosition+1);
		
		//setRefreshOn();
	}else{
		//팝업이 한개라도 열려있다면 새로고침 끄기
		//setRefreshOff();
	}
}

//모달 Array에 있는 이름으로 닫기
function fn_modalBackCloseEvent(modalNameParam){
	if("commonModal"==modalNameParam){
		modalEvent.close();
	}
	else if("jobPostingApplyPopup"==modalNameParam){
		$("#jobPostingApplyPopup .modal-header img").click();
	}
	else if("contentPopup"==modalNameParam){
		$("#contentPopup .modal-header img").click();
	}
	else if("areaPopup"==modalNameParam){
		$("#areaPopup .modal-header img").click();
	}
	else if("jobPopup"==modalNameParam){
		$("#jobPopup .modal-header img").click();
	}
	else if("userFeedTagPopup"==modalNameParam){
		$("#userFeedTagPopup .modal-header img").click();
	}
	else if("feedCommentPopup"==modalNameParam){
		$("#feedCommentPopup .modal-header img").click();
	}
	else if("branchPopup"==modalNameParam){
		$("#branchPopup .modal-header img").click();
	}
	else if("userTagPopup"==modalNameParam){
		$("#userTagPopup .modal-header img").click();
	}
	else if("feedAndCommentPopup"==modalNameParam){
		$("#feedAndCommentPopup .modal-header img").click();
	}
	else if("branchSelectPopup"==modalNameParam){
		$("#branchSelectPopup .modal-header img").click();
	}
	else if("interestKeywordTagPopup"==modalNameParam){
		$("#interestKeywordTagPopup .modal-header img").click();
	}
}

function checkMobile(){
	return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
}

// 30분단위 시간값 셋팅
function fn_setTimeValue(target, defaultTime){
	let timeHTML = '';
	
	for(let i = 0; i <= 23; i++){
		let hour = i;
		
		if(hour <10) hour = '0' + hour;
		
		if(i==0){
			timeHTML += '<li class="option_list_item first">'+hour+':00</li>';
			timeHTML += '<li class="option_list_item">'+hour+':30</li>';
		}
		else{
			timeHTML += '<li class="option_list_item">'+hour+':00</li>';
			timeHTML += '<li class="option_list_item">'+hour+':30</li>';
		}
		
	}
	$('#'+target).empty().html(timeHTML);
	
	$('#'+target).siblings("button").text(defaultTime);
	$('#'+target).siblings("input").val(defaultTime);
	
	// 옵션 선택 이벤트
	$('#'+target + '>.option_list_item').on('click', function() {
		let selectedOption = $(this).text();
		$(this).parent().siblings("button").text(selectedOption);
		$(this).parent().siblings("input").val(selectedOption);
	});
}



// 공백처리
function fn_formatNull(param){
	if(null==param){
		return '';
	}else{
		return param;
	}
}



