PageSourceSearch

https://www.sealife.go.kr/common/js/2021/checkFormCom.js

js sealife.go.kr collected 2026-10-06 02:14:58 UTC 73,565 bytes, 2,241 lines download raw bytes

1/***********************************
2 SNS 외부 JS IMPORT
3***********************************/
4document.write('<script type="text/javascript" src="https://connect.facebook.net/ko_KR/all.js"></script>');
5
6/***********************************
7 jQuery로 form reset 
8 : $(obj).reset()
9***********************************/
10jQuery.fn.reset = function () {
11	$(this).each (function() { this.reset(); });
12};
13
14/******************************************
15공백 제거
16******************************************/
17String.prototype.trim = function() {
18	return this.replace(/^\s*|\s*$/g, '');
19};
20
21/******************************************
22공백 체크
23******************************************/
24function fn_checkSpace( str ) {
25	if(str.search(/\s/) != -1)
26		return true;
27	else 
28		return false;
29}
30
31/******************************************
32숫자만 입력 : style="ime-mode:disabled;" 함께 구현되어야 함
33******************************************/
34var varOnlyNumKDKeyCode = false;
35function fn_onlyNumKD(e, theObj) {
36
37	var varKeyCode = e.keyCode;
38	if(varKeyCode == 17) {
39		varOnlyNumKDKeyCode = varKeyCode;
40		return true;
41	}
42	//alert(varOnlyNumKDKeyCode +":" + varKeyCode);
43	if(varOnlyNumKDKeyCode == 17 && varKeyCode == 86) {
44		// 붙여넣기
45		varOnlyNumKDKeyCode = false;
46		return true; 
47	}
48	if (varKeyCode != 0 && varKeyCode != 8 && varKeyCode != 9 && varKeyCode != 13 && varKeyCode != 46 && (varKeyCode < 35 || varKeyCode > 40 && varKeyCode < 48 || varKeyCode > 57 && varKeyCode < 96 || varKeyCode > 105)){
49		return false;
50	}
51	
52	varOnlyNumKDKeyCode = false;
53	return true;
54}
55
56/******************************************
57숫자(소수점 포함)만 입력 : style="ime-mode:disabled;" 함께 구현되어야 함
58******************************************/
59function fn_onlyNumDotKD(e, theObj) {
60	var varKeyCode = e.keyCode;
61	var varEventElement = theObj;
62	var varVal = $(varEventElement).val();
63	if(varKeyCode == 37 || varKeyCode == 39) return true;
64	if (varVal.trim() == '' && (varKeyCode == 190 || varKeyCode == 110) || (varKeyCode != 190 && varKeyCode != 110 && varKeyCode != 0 && varKeyCode != 8 && varKeyCode != 9 && varKeyCode != 13 && 
65			(varKeyCode != 45 && varKeyCode != 46 && (varKeyCode < 48 || varKeyCode > 57 && varKeyCode < 96 || varKeyCode > 105) || 
66			((varVal == '' || varVal.indexOf('.') != -1) && varKeyCode == 46) || 
67			(varVal != '' && varKeyCode == 45) /*||
68			(varVal == '0' && varKeyCode != 46)*/))){
69		return false;
70	}
71	
72	var varDotChk = varVal.match(/[.]/g);
73	if(varDotChk && varDotChk.length >= 1 && (varKeyCode == 190 || varKeyCode == 110)) return false;
74	
75	return true;
76}
77
78function fn_preventZeroHan(e, theObj) {
79	var varRegTxt = /^0.*/g;
80	var varHanRegTxt = /[ㄱ-ㅎㅏ-ㅣ가-힣]/g;
81	var varChkVal = $(theObj).val();
82	var varHasZero = varChkVal.match(varRegTxt);
83	var varHasHan = varChkVal.match(varHanRegTxt);
84	var varVal = $(theObj).val();
85	if(varHasZero && varChkVal != '0' && varChkVal.indexOf(".") == -1) {
86		varVal = varVal.replace('0', '');
87		var varObjLen = $(theObj).attr("maxlength");
88		var varValLen = varVal.length;
89		if(varValLen > varObjLen) varVal = varVal.substring(0, varObjLen);
90		$(theObj).val(varVal);
91	}
92	if(varHasHan) {
93		varVal = varVal.replace(varRegTxt, '');
94		var varObjLen = $(theObj).attr("maxlength");
95		var varValLen = varVal.length;
96		if(varValLen > varObjLen) varVal = varVal.substring(0, varObjLen);
97		$(theObj).val(varVal);
98	}
99}
100
101/******************************************
102 * 한글입력있는 경우 한글만 지우기, 공백만 남은 경우 공백 지우기
103 * @param e
104 * @param theObj
105 * @returns {Boolean}
106 ******************************************/
107function fn_preventHan(e, theObj, thePasteVal) {
108	var varRegTxt = /[ㄱ-ㅎㅏ-ㅣ가-힣]/g;
109	var varChkVal = (typeof(thePasteVal) == "undefined")?$(theObj).val():thePasteVal;
110	var varHasHan = varChkVal.match(varRegTxt);
111	var varPasteLen = (typeof(thePasteVal) == "undefined")?0:thePasteVal.length;
112	var varVal = $(theObj).val();
113	if(varHasHan && varPasteLen == 0) {
114		varVal = varVal.replace(varRegTxt, '');
115		var varObjLen = $(theObj).attr("maxlength");
116		var varValLen = varVal.length;
117		if(varValLen > varObjLen) varVal = varVal.substring(0, varObjLen);
118		$(theObj).val(varVal);
119	} else if(!varHasHan && varPasteLen > 0) {
120		varVal = varVal + thePasteVal;
121		var varObjLen = $(theObj).attr("maxlength");
122		var varValLen = varVal.length;
123		if(varValLen > varObjLen) varVal = varVal.substring(0, varObjLen);
124		$(theObj).val(varVal);
125	}
126}
127
128
129/*******************************************
130 window resizeTo
131 *******************************************/
132var fn_window = {
133		width:950
134		, height:850
135		, resizeTo:function(theWidth, theHeight){
136			if(typeof(theWidth) == 'undefined' || theWidth == 0) theWidth = fn_window.width;
137			if(typeof(theHeight) == 'undefined' || theHeight == 0) theHeight = fn_window.height;
138			window.resizeTo(theWidth, theHeight);
139			window.focus();
140		}
141}
142
143/*
144// 페이지이동시 window.open 창 닫기 : 이미 닫힌 경우 메시지 안 띄움
145$(function(){
146	$(window).on("beforeunload", function(){
147		if(fn_dialog.openWin){
148			var varCWinLen = fn_dialog.openWin.length;
149			if(varCWinLen > 0) {
150				var varOW = false;
151				for(var i = 0 ; i < varCWinLen; i ++) {
152					try {
153						if(fn_dialog.openWin[i].document) {
154							varOW = true;
155							break;
156						}
157					} catch(e) {}
158				}
159				if(varOW) return "이 페이지에서 나가시면 새창이 닫힙니다.";
160			}
161		}
162	});
163	$(window).on("unload", function(){
164		fn_checkWinOpen(window);
165	});
166	
167	function fn_checkWinOpen(theWin) {
168		try {
169			if(theWin.fn_dialog.openWin){
170				var varCWinLen = theWin.fn_dialog.openWin.length;
171				if(varCWinLen > 0) {
172					for(var i = 0 ; i < varCWinLen; i ++) {
173						fn_checkWinOpen(theWin.fn_dialog.openWin[i]);
174						theWin.fn_dialog.openWin[i].close();
175					}
176				}
177			}
178		}catch(e){console.log('error')}
179	}
180});
181*/
182
183/***********************************
184새창 dialog 띄우기
185fn_dialog.init	: dialog setting
186fn_dialog.open  : dislog open
187***********************************/
188var fn_dialog = {
189		dId:false
190		, fId:false
191		, width:950
192		, height:800
193		, openWin:[]
194		, init:function(theDId, theZIndex, theWidth, theHeight){
195			if(typeof(theDId) == 'undefined') theDId = "fn_default";
196			if(typeof(theWidth) == 'undefined') theWidth = fn_dialog.width;
197			if(typeof(theHeight) == 'undefined') theHeight = fn_dialog.height;
198			
199			var varDId = theDId + "_dialog";
200			var varFId = theDId + "_iframe";
201
202			fn_dialog.dId = varDId;
203			fn_dialog.fId = varFId;
204		}, open:function(theTitle, theAction, theWidth, theHeight, theDid){
205			
206			var varConfirm = confirm(fn_Message.popupConfirmText);
207			if(!varConfirm) return false;
208			
209			if(typeof(theTitle) != 'undefined' && theTitle != "") theAction += "&tit=" + encodeURIComponent(theTitle);
210			var varWidth, varHeight;
211			if(typeof(theWidth) != 'undefined' && theWidth > 0)	varWidth = theWidth;
212			else varWidth = fn_dialog.width;
213			if(typeof(theHeight) != 'undefined' && theHeight > 0) varHeight = theHeight;
214			else varHeight = fn_dialog.height;
215			var varDid = fn_dialog.dId;
216			if(typeof(theDid) != 'undefined') varDid = theDid;
217			
218			fn_dialog.openWin.push(window.open(theAction, varDid, "width=" + varWidth + ", height=" + varHeight/* + ", innerWidth=" + (varWidth - 150) + ", innerHeight=" + (varHeight - 150)*/ + ", scrollbars=yes"));
219		}, openP:function(theTitle, theAction, theDid, theProperties){
220			
221			var varConfirm = confirm(fn_Message.popupConfirmText);
222			if(!varConfirm) return false;
223			
224			if(typeof(theTitle) != 'undefined') theAction += "&tit=" + encodeURIComponent(theTitle);
225			var varDid = fn_dialog.dId;
226			if(typeof(theDid) != 'undefined') varDid = theDid;
227			fn_dialog.openWin.push(window.open(theAction, varDid, theProperties));
228		}, openF:function(theAction, theDid){
229			// iframe으로 이동
230			window.open(theAction, theDid);
231		}, closeAll:function(){
232			for(var wi = 0, varWin ; varWin = fn_dialog.openWin[wi]; wi ++) {
233				try{if(varWin) varWin.close();}catch(e){console.log('error')}
234			}
235		}, closeReload:function(){
236			/*$("#" + fn_dialog.dId).dialog("option", "close", function(){
237				location.reload();
238			});*/
239		}
240	};
241
242
243var fn_dialog_div = {
244		dId:false
245		, init:function(theDId, theZIndex, theWidth, theHeight){
246			if(typeof(theDId) == 'undefined') theDId = "fn_default";
247			if(typeof(theZIndex) == 'undefined') theZIndex = 10006;
248			if(typeof(theWidth) == 'undefined') theWidth = 950;
249			if(typeof(theHeight) == 'undefined') theHeight = 800;
250			
251			var varDId = theDId + "_dialog";
252			var varFId = theDId + "_iframe";
253			$("#" + varDId).dialog({
254				bgifram: true,
255		   		autoOpen: false,
256				resizable:false,
257		   		modal: true
258		   	});
259
260			$("#" + varDId).dialog("option", "width", theWidth);
261			$("#" + varDId).dialog("option", "height", theHeight);
262			$("#" + varDId).css("z-index",theZIndex + 1);
263			$("#" + varDId).css("overflow",'hidden');
264			$("#" + varDId).css("background",'#FFF');
265			$("#" + varDId).css("padding",'0px');
266			$("#" + varDId).parent().css({"z-index":theZIndex, "padding":"0px","border":"0px","background":"transparent"});
267
268			fn_dialog_div.dId = varDId;
269			fn_dialog_div.fId = varFId;
270			
271			/*if(!$('#' + varFId).is('div')) {
272				$("body").append("<iframe id=\"" + varFId + "\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"yes\" style=\"width:100%; height:100%\"></iframe>");
273			}*/
274				
275		}, open:function(theTitle, theAction, theWidth, theHeight){
276			if(typeof(theTitle) != 'undefined') $("#" + fn_dialog_div.dId).dialog("option", "title", theTitle);
277			
278			var varIsIfm = $("#" + fn_dialog_div.fId).size() > 0;
279			if(typeof(theWidth) != 'undefined' && theWidth > 0)	{
280				if(varIsIfm) $("#" + fn_dialog_div.fId).css("width", theWidth);
281				$("#" + fn_dialog_div.dId).dialog("option", "width", theWidth);
282			}
283			if(typeof(theHeight) != 'undefined' && theHeight > 0) {
284				if(varIsIfm) $("#" + fn_dialog_div.fId).css("height", theHeight);
285				$("#" + fn_dialog_div.dId).dialog("option", "height", theHeight);
286			}
287			if(varIsIfm) {
288				if(typeof(theAction) != 'undefined') eval(fn_dialog_div.fId + ".location.replace('" + theAction + "');");
289			   	$("#" + fn_dialog_div.fId).load(function(){
290			   		$("#" + fn_dialog_div.dId).dialog("option", "position", {
291						my: "center",
292						at: "center"});
293					$("#" + fn_dialog_div.dId).dialog("open");
294				});
295			} else {
296		   		$("#" + fn_dialog_div.dId).dialog("option", "position", {
297					my: "center",
298					at: "center"});
299				$("#" + fn_dialog_div.dId).dialog("open");
300			}
301			
302		}, closeReload:function(){
303			$("#" + fn_dialog_div.dId).dialog("option", "close", function(){
304				location.reload();
305			});
306		}
307	};
308
309/**
310 * dialog background div 생성
311 * @param thePObj
312 * @param theId
313 * @param theStyle
314 */
315var fn_dialog_layer = {
316	dId:false
317	, open:function(thePObj, theId, theStyle){
318		if(typeof(theId) == 'undefined' || !fn_isValFill(theId)) return;
319		fn_dialog_layer.dId = theId;
320		if(!$('#' + fn_dialog_layer.dId).is('div')) {
321			thePObj.append("<div id=\"" + fn_dialog_layer.dId + "\" style=\"position:absolute;background:#eee;opacity:0.7;" + theStyle + "\"></div>");
322		} else $("#" + fn_dialog_layer.dId).show();
323	}, close:function(){
324		$("#" + fn_dialog_layer.dId).hide();
325	}
326};
327
328/**
329 * 처리 후 location.reload();
330 */
331function fn_procWReload(){
332	location.reload();
333	top.fn_removeMaskLayer();
334}
335
336/**
337 * 처리 후 opener.close() -> location.reload();
338 */
339function fn_procReload() {
340	try{
341		//alert((window != top) + ":" + (parent != top));
342		if(opener) {
343			opener.location.reload();
344			location.reload();
345		} else if(window != top) {
346			try{
347				parent.fn_dialog.closeReload();
348			}catch(e){console.log('error')}
349			location.reload();
350		} else {
351			try{
352				top.fn_dialog.closeReload();
353			}catch(e){console.log('error')}
354			top.location.reload();
355		}
356	}catch(e){
357		try{
358			top.fn_dialog.closeReload();
359		}catch(e){console.log('error')}
360		top.location.reload();
361	}
362}
363
364/**
365 * 처리 후 top.location.reload();
366 */
367function fn_procTopReload() {
368	try{
369		//alert((window != top) + ":" + (parent != top));
370		var varOpener = top.opener;
371		if(varOpener) {
372			varOpener.location.reload();
373			top.location.reload();
374		} else if(window != top) {
375			try{
376				parent.fn_dialog.closeReload();
377			}catch(e){console.log('error')}
378			location.reload();
379		} else {
380			try{
381				top.fn_dialog.closeReload();
382			}catch(e){console.log('error')}
383			top.location.reload();
384		}
385	}catch(e){
386		try{
387			top.fn_dialog.closeReload();
388		}catch(e){console.log('error')}
389		top.location.reload();
390	}
391}
392
393/**
394 * 처리 후 location.reload();
395 * opener가 있는 경우 모두 reload
396 */
397function fn_procOpenerLevelReload(theLevel) {
398	try{
399		//alert((window != top) + ":" + (parent != top));
400		if(opener) {
401			var varOpener = opener;
402			var varOpenerLevel = 1;
403			while(varOpener) {
404				varOpener.location.reload();
405				varOpener = varOpener.opener;
406				if(theLevel && varOpenerLevel >= theLevel) break;
407				varOpenerLevel ++;
408			}
409			location.reload();
410		} else if(window != top) {
411			try{
412				parent.fn_dialog.closeReload();
413			}catch(e){console.log('error')}
414			location.reload();
415		} else {
416			try{
417				top.fn_dialog.closeReload();
418			}catch(e){console.log('error')}
419			top.location.reload();
420		}
421	}catch(e){
422		try{
423			top.fn_dialog.closeReload();
424		}catch(e){console.log('error')}
425		top.location.reload();
426	}
427}
428
429/**
430 * 처리 후 페이지 이동
431 * @param theAction
432 * @param theMdl
433 */
434function fn_procAction(theAction, theMdl) {
435	try{
436		var olh = opener.location.host;
437		if(theMdl != 1 && opener) {
438			if(typeof(theAction) == 'undefined') opener.location.reload();
439			else opener.location.href = theAction;
440		} else if(window != top && parent) {
441			if(typeof(theAction) == 'undefined') parent.location.reload();
442			else parent.location.href = theAction;
443		} else {
444			if(typeof(theAction) == 'undefined') top.location.reload();
445			else top.location.href = theAction;
446		}
447		
448	}catch(e){
449		try{
450			if(window != top && parent) {
451				if(typeof(theAction) == 'undefined') parent.location.reload();
452				else parent.location.href = theAction;
453			} else {
454				if(typeof(theAction) == 'undefined') top.location.reload();
455				else top.location.href = theAction;
456			}
457		}catch(e){
458			if(typeof(theAction) == 'undefined') top.location.reload();
459			else top.location.href = theAction;
460		}
461	}
462}
463
464/**
465 * 처리 후 페이지 이동 && opener reload
466 * @param theAction
467 * @param theMdl
468 */
469function fn_procActionOpReload(theAction, theMdl) {
470	try{
471		if(theMdl != 1 && opener) {
472			if(typeof(theAction) == 'undefined') opener.location.reload();
473			else opener.location.href = theAction;
474			self.close();
475		} else if(window != top) {
476			if(opener) opener.location.reload();
477			if(typeof(theAction) == 'undefined') parent.location.reload();
478			else parent.location.href = theAction;
479		} else {
480			if(opener) opener.location.reload();
481			if(typeof(theAction) == 'undefined') top.location.reload();
482			else top.location.href = theAction;
483		}
484	}catch(e){
485		if(opener) opener.location.reload();
486		if(typeof(theAction) == 'undefined') top.location.reload();
487		else top.location.href = theAction;
488	}
489}
490
491/**
492 * 계속 등록
493 * @param theAction
494 * @param theMdl
495 * @param theMessage
496 * @returns {Boolean}
497 */
498function fn_procContinueAction(theAction, theMdl, theMessage) {
499	try{
500		var varMessage = (typeof(theMessage) != 'undefined')?theMessage + "\n":"";
501		varMessage += fn_Message.continueConfirmText;
502		var varConfirm = confirm(varMessage);
503		if(varConfirm) {
504			// 계속등록하는 경우
505			if(theMdl != 1 && opener) {
506				if(typeof(theAction) == 'undefined') opener.location.reload();
507				else opener.location.href = theAction;
508				self.location.reload();
509			} else if(window != top) {
510				parent.location.reload();
511			} else {
512				top.location.reload();
513			}
514			return false;
515		}
516		if(theMdl != 1 && opener) {
517			if(typeof(theAction) == 'undefined') opener.location.reload();
518			else opener.location.href = theAction;
519			self.close();
520		} else if(window != top) {
521			if(typeof(theAction) == 'undefined') parent.location.reload();
522			else parent.location.href = theAction;
523		} else {
524			if(typeof(theAction) == 'undefined') top.location.reload();
525			else top.location.href = theAction;
526		}
527	}catch(e){console.log('error')}
528}
529 
530/*************************************
531 숨김 iframe생성
532 * @param theFId			: iframe id/name
533*************************************/
534function fn_createHiddenIframe(theFId){
535	if(typeof(theFId) == 'undefined' || !fn_isValFill(theFId)) return false;
536	if(!$('#' + theFId).is('iframe')) {
537		$('body').append("<iframe id=\"" + theFId + "\" name=\"" + theFId + "\" title=\"내용없음\" style=\"width:0px;height:0px;\" frameborder=\"0\"></iframe>");
538	}
539	return true;
540}
541
542/*************************************
543 submit시 mask layer 생성
544*************************************/
545var gVarMaskId = "loader_mask";
546function fn_createMaskLayer(){
547	if($("#" + gVarMaskId).length <= 0) {
548		$('body').append("<div id='" + gVarMaskId + "'></div>");
549	
550	    var maskHeight = $(document).height();
551	    var maskWidth  = window.document.body.clientWidth;
552	    
553	    $("#" + gVarMaskId).css({'position':'absolute', 
554	    					'z-index':99999, 
555	    					'background-color':'#000000', 
556	    					'left':0, 
557							'top':0, 'opacity' : '0.3', 
558	    					'width':maskWidth, 'height':maskHeight});
559	}
560}
561
562/*************************************
563 load시 mask layer 삭제
564*************************************/
565function fn_removeMaskLayer(){
566	$("#" + gVarMaskId).remove();
567}
568
569function fn_getLPAD(theStr, theFillChar, theTotalLen) {
570
571	if(typeof(theStr) == 'undefined' || typeof(theFillChar) == 'undefined' || typeof(theTotalLen) == 'undefined') return theStr;
572	
573	var varStrLen = new String(theStr).length;
574	var varFillLen = theTotalLen - varStrLen;
575	var varRtStr = '';
576	for(var i = 0 ; i < varFillLen ; i ++){
577		varRtStr += theFillChar;
578	}
579	varRtStr += theStr;
580	return varRtStr;
581}
582
583/*****************************************************
584  값이 있는지의 여부 체크
585 * @param theVal			: 체크 대상 값
586******************************************************/
587function fn_isValFill(theVal) {
588	try{
589		if(typeof(theVal) == 'undefined') return false;
590		var varValue = theVal.trim();
591		if(varValue == '') {
592			return false;
593		} else {
594			return true;
595		}
596	} catch(e) {
597		return false;
598	}
599	return false;
600}
601
602/*****************************************************
603  값이 있는지의 여부 체크
604 * @param theInput			: object name
605******************************************************/
606function fn_isFill(theInput) {
607	try{
608		var varObj = $(theInput);
609		if(varObj.size() == 0) return true;
610		var varValue = varObj.val().trim();
611		if(varValue != '') return true;
612	}	catch(e)	{
613		return true;
614	}
615	return false;
616}
617
618/*****************************************************
619  값이 있는지의 여부 체크
620 * @param theInput			: object name
621 * @param theText			: 경고문구에 들어갈 object명
622******************************************************/
623function fn_checkFill(theInput, theText) {
624	try{
625		var varObj = $(theInput);
626		if(varObj.size() == 0) return true;
627		var varDisabledChk = varObj.prop("disabled"); 
628		if(varDisabledChk) return true; 
629		if(!fn_isFill(theInput)) {
630			alert(fn_Message.fillText(theText));
631			try {varObj.focus();} catch(e){console.log('error')}
632			return false;
633		}
634	} catch(e) {
635		//alert(e);
636		return true;
637	}
638	return true;
639}
640
641
642function fn_isSelected(theInput) {
643	try{
644		var varObj = $(theInput);
645		if(varObj.size() == 0) return true;
646		var varDisabledChk = varObj.prop("disabled"); 
647		if(varDisabledChk) return true; 
648		try {
649			var varHiddenType = varObj.attr("type").toLowerCase();
650			if(varHiddenType == "hidden") return true;
651		} catch(e) {
652		}
653
654		var varSelObj = varObj.find("option:selected");
655		if(!varSelObj.is("option") || !fn_isFill(varSelObj)) {
656			return false;
657		}
658	} catch(e) {
659		return true;
660	}
661	return true;
662	
663}
664
665/*****************************************************
666  select option 선택값이 있는지의 여부 체크
667 * @param theInput			: object name
668 * @param theText			: 경고문구에 들어갈 object명
669******************************************************/
670function fn_checkSelected(theInput, theText) {
671	try{
672		var varObj = $(theInput);
673		if(varObj.size() == 0) return true;
674		var varDisabledChk = varObj.prop("disabled"); 
675		if(varDisabledChk) return true; 
676		try {
677			var varHiddenType = varObj.attr("type").toLowerCase();
678			if(varHiddenType == "hidden") return true;
679		} catch(e) {
680		}
681
682		var varSelObj = varObj.find("option:selected");
683		if(!varSelObj.is("option") || !fn_isFill(varSelObj)) {
684			alert(fn_Message.checkText(theText));
685			try {theInput.focus();} catch(e){console.log('error')}
686			return false;
687		}
688	} catch(e) {
689		alert(e);
690		return true;
691	}
692	return true;
693	
694}
695
696/***********************************************************************
697* multi select option값 여부 체크
698* @param theObj 		: object
699* @param theNum			: 비교할 수
700* @param theText		: 경고문구에 들어갈 object명
701* @return boolean
702***********************************************************************/
703function fn_checkSelectOption(theInput, theText, theGtIdx){
704	try{
705		var varObj = $(theInput);
706		if(varObj.size() == 0) return true;
707		var varDisabledChk = varObj.prop("disabled"); 
708		if(varDisabledChk) return true; 
709		try {
710			var varHiddenType = varObj.attr("type").toLowerCase();
711			if(varHiddenType == "hidden") return true;
712		} catch(e) {
713		}
714		var varOpt = (theGtIdx > -1)? $(varObj).find("option:gt(" + theGtIdx + ")"):$(varObj).find('option');
715		
716		var varOptSize = varOpt.size();
717		if(typeof(theMinSize) != 'undefined') {
718			if(varOptSize < theMinSize) {
719				alert(fn_Message.checkText(theText));
720				try {varObj.focus();} catch(e){console.log('error')}
721				return false;
722			}
723		} else {
724			if(varOptSize == 0) {
725				alert(fn_Message.checkText(theText));
726				try {varObj.focus();} catch(e){console.log('error')}
727				return false;
728			}
729		}
730		return true;
731	}catch(e){
732		//alert(e);
733		return false;
734	}
735	return false;
736}
737
738/***********************************************************************
739* multi file select option값 여부 체크
740* @param theObj 		: object
741* @param theNum			: 비교할 수
742* @param theText		: 경고문구에 들어갈 object명
743* @return boolean
744***********************************************************************/
745function fn_checkFileSelectOption(theInputLayer, theText, theGtIdx, theMinSize, theMaxSize){
746	try{
747		var varObjLayer = $(theInputLayer);
748		if(varObjLayer.size() == 0) return true;
749		
750		try {
751			var varHiddenType = varObjLayer.hasClass("hide");
752			if(varHiddenType) return true;
753		} catch(e) {}
754		var varOpt = (theGtIdx > -1)? varObjLayer.find("input[type='checkbox']:gt(" + theGtIdx + ")"):varObjLayer.find("input[type='checkbox']");
755		
756		try{
757		var varOptSize = varOpt.size();
758		if(typeof(theMinSize) == 'undefined' && typeof(theMaxSize) == 'undefined') {
759			if(varOptSize == 0) {
760				alert(fn_Message.checkText(theText));
761				try {varObjLayer.find("input[type='checkbox']:gt(0)").focus();} catch(e){console.log('error')}
762				return false;
763			}
764		} else {
765			if(varOptSize == 0 && theMinSize == 0 && theMaxSize > 0) {
766				alert(fn_Message.checkFileMaxLimitCountText(theText, theMaxSize));
767				try {varObjLayer.find("input[type='checkbox']:gt(0)").focus();} catch(e){console.log('error')}
768				return false;
769			} else if(varOptSize < theMinSize || varOptSize > theMaxSize) {
770				alert(fn_Message.checkFileMinMaxLimitCountText(theText, theMinSize, theMaxSize));
771				try {varObjLayer.find("input[type='checkbox']:gt(0)").focus();} catch(e){console.log('error')}
772				return false;
773			}
774		}
775		} catch(e){alert(e);}
776		return true;
777	}catch(e){
778		//alert(e);
779		return false;
780	}
781	return false;
782}
783
784/*****************************************************
785 * checkbox, radio checked 여부
786 * @param theName			: check할 object name
787 * @param theText			: 경고문구에 들어갈 object명
788******************************************************/
789function fn_checkElementChecked(theName, theText){
790	try{
791		var varObjs = $("input[name='" + theName + "']");
792		var varDisabledChk = (varObjs.length == varObjs.filter(":disabled").length); 
793		if(varDisabledChk) return true; 
794		try {
795			var varHiddenType = varObjs.attr("type").toLowerCase();
796			if(varHiddenType == "hidden") return true;
797		} catch(e) {
798		}
799		var varChkObjs = varObjs.filter(":checked");
800		var varChkObjSize = varChkObjs.size();
801		if(varChkObjSize == 0) {
802			alert(fn_Message.checkText(theText));
803			varObjs.filter(":eq(0)").focus();
804			return false;
805		}
806		return true;
807 	} catch(e) {}
808 	return false;
809}
810
811/******************************************
812//이메일 형식 체크
813******************************************/
814function fn_validEmail(theObj) {
815	if (typeof theObj == "undefined" || $(theObj).size() == 0) {
816		return true;
817	}
818	var varDisabledChk = $(theObj).prop("disabled"); 
819	if(varDisabledChk) return true; 
820
821	if(!fn_isFill(theObj)) {
822		return true;
823	}
824
825	var varEmail = $(theObj).val();
826    var arrMatch = varEmail.match(/^(\".*\"|[A-Za-z0-9_-]([A-Za-z0-9_-]|[\+\.])*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9][A-Za-z0-9_-]*(\.[A-Za-z0-9][A-Za-z0-9_-]*)+)$/); //"정규식
827    if (arrMatch == null) {
828		alert(fn_Message.validEmailText);
829		try {theObj.focus();}catch(e){console.log('error')}
830        return false;
831    }
832
833	return true;
834}
835
836/******************************************
837아이디 체크 (이메일 형식)
838******************************************/
839function fn_validEmailID(theObj, theText) {
840	if (typeof theObj == "undefined" || $(theObj).size() == 0) {
841		return true;
842	}
843	var varDisabledChk = $(theObj).prop("disabled"); 
844	if(varDisabledChk) return true; 
845
846	if(!fn_isFill(theObj)) {
847		return true;
848	}
849
850	var varEmail = $(theObj).val();
851    var arrMatch = varEmail.match(/^(\".*\"|[A-Za-z0-9_-]([A-Za-z0-9_-]|[\+\.])*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9][A-Za-z0-9_-]*(\.[A-Za-z0-9][A-Za-z0-9_-]*)+)$/); //"정규식
852    if (arrMatch == null) {
853		alert(fn_Message.validEmailIdText(theText));
854		try {theObj.focus();}catch(e){console.log('error')}
855        return false;
856    }
857
858	return true;
859}
860
861/******************************************
862아이디 체크
863******************************************/
864function fn_validID(theObj, theTitle, theMinLen, theMaxLen){
865	if (typeof theObj == "undefined" || $(theObj).size() == 0) {
866		return true;
867	}
868	var varObj = $(theObj);
869	var varDisabledChk = varObj.prop("disabled"); 
870	if(varDisabledChk) return true; 
871	//if(!fn_checkFill(varObj, theTitle)) return false;
872	if(!fn_isFill(varObj)) return true;
873	
874	var varStr = varObj.val();
875	var retVal = fn_checkSpace(varStr);
876	if(retVal) {
877		alert(fn_Message.validNoSpaceText(theTitle));
878		return false; 
879	} 
880	
881	if(varStr.charAt(0) == '_') {
882		alert(fn_Message.validNoFirstCharText(theTitle));
883	 	return false;
884	}
885
886	if(typeof (theMinLen) == "undefined") theMinLen = 6;
887	if(typeof (theMaxLen) == "undefined") theMaxLen = 12;
888	eval("var isID = /^[a-z0-9_]{" + theMinLen + "," + theMaxLen + "}$/;");
889	if(!isID.test(varStr))	{
890		alert(fn_Message.validNoIDCharText(theTitle, theMinLen, theMaxLen)); 
891		return false;
892	}
893	return true;
894}
895
896/******************************************
897비밀번호 체크
898******************************************/
899function fn_validPW(theObj, theTitle, theMinLen, theMaxLen) {
900	if (typeof theObj == "undefined" || $(theObj).size() == 0) {
901		return true;
902	}
903	var varObj = $(theObj);
904	var varDisabledChk = varObj.prop("disabled"); 
905	if(varDisabledChk) return true; 
906	//if(!fn_checkFill(varObj, theTitle)) return false;
907	if(!fn_isFill(varObj)) return true;
908	
909	var varStr = $(theObj).val();
910	var retVal = fn_checkSpace(varStr);
911	if(retVal){
912		alert(fn_Message.validNoSpaceText(theTitle));
913		return false; 
914	} 
915
916	var varSChar = /[~!@\#$%^&*\()\-=+_'\"]/gi;
917	var varFChar = varStr.charAt(0); 
918	if(varSChar.test(varFChar)){
919		alert(fn_Message.validNoFirstCharText(theTitle));
920	 	return false;
921	}
922	
923	if(typeof (theMinLen) == "undefined") theMinLen = 8;
924	if(typeof (theMaxLen) == "undefined") theMaxLen = 15;
925	eval("var isID = /^[a-zA-Z0-9~!@\#$%^&*\()\-=+_'\"]{" + theMinLen + "," + theMaxLen + "}$/;");
926	if(!isID.test(varStr)){
927		alert(fn_Message.validNoPWCharText(theTitle, theMinLen, theMaxLen)); 
928		return false;
929	}
930	var chk_num = varStr.search(/[0-9]/g);
931	var chk_eng = varStr.search(/[a-zA-Z]/ig);
932	var chk_sp = varStr.search(varSChar);
933	 
934	if(chk_num <0 || chk_eng <0 || chk_sp < 0){
935		alert(fn_Message.validNoPWCharText2(theTitle)); 
936		return false;
937	}
938	
939	if(/(\w)\1\1\1/.test(varStr)){
940		alert(fn_Message.validNoPWCharText3(theTitle)); 
941		return false;
942	}
943
944	return true;
945}
946
947/******************************************
948비밀번호 아이디 포함여부 체크 : 비밀번호는 아이디를 포함하여 사용하실 수 없습니다.
949******************************************/
950function fn_validPWID(thePwdObj, thePwdTitle, theIdObj, theIdTitle) {
951	return fn_validPWIDVal($(thePwdObj).val(), thePwdTitle, $(theIdObj).val(), theIdTitle);
952}
953
954/******************************************
955비밀번호 아이디 포함여부 체크 : 비밀번호는 아이디를 포함하여 사용하실 수 없습니다.
956******************************************/
957function fn_validPWIDVal(thePwdStr, thePwdTitle, theIdStr, theIdTitle) {
958	if(!thePwdStr) return true;
959	if(!theIdStr) return false;
960	
961	if(thePwdStr.search(theIdStr) > -1 || theIdStr.search(thePwdStr) > -1){
962		alert(fn_Message.validNoPWCharText4(thePwdTitle, theIdTitle)); 
963		return false;
964	}
965	return true;
966}
967
968//이메일 형식 체크
969function fn_checkEmail(theInput) {
970
971	if (typeof theInput == "undefined") {
972		return true;
973	}
974	var varDisabledChk = $(theInput).prop("disabled"); 
975	if(varDisabledChk) return true; 
976
977	if(!fn_isFill(theInput)) {
978		return true;
979	}
980
981	var varEmail = $(theInput).val();
982    var arrMatch = varEmail.match(/^(\".*\"|[A-Za-z0-9_-]([A-Za-z0-9_-]|[\+\.])*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z0-9][A-Za-z0-9_-]*(\.[A-Za-z0-9][A-Za-z0-9_-]*)+)$/); //"정규식
983    if (arrMatch == null) {
984		alert(fn_Message.validEmailText);
985		try {theInput.focus();}catch(e){console.log('error')}
986        return false;
987    }
988
989	return true;
990}
991
992function fn_isHomePhone(theFlag, theInput) {
993
994	try {
995		if(theInput){
996
997			var varDisabledChk = $(theInput).prop("disabled"); 
998			if(varDisabledChk) return true; 
999			
1000			var varVal = $(theInput).val();
1001			if(!fn_isValFill(varVal)) return true;
1002			
1003			if(theFlag == 1 && !varVal.match(/^((02)|(031)|(032)|(033)|(041)|(042)|(043)|(051)|(052)|(053)|(054)|(055)|(061)|(062)|(063)|(064)|(070)|(0502)|(0504)|(0505)|(0506))$/)) return false;
1004			else if(theFlag == 2 && !varVal.match(/^\d{3,4}$/)) return false;
1005			else if(theFlag == 3 && !varVal.match(/^\d{4}$/)) return false;
1006
1007		}
1008	} catch(e) {}
1009	return true;
1010}
1011
1012function fn_isMobilePhone(theFlag, theInput) {
1013
1014	try {
1015		if(theInput){
1016
1017			var varDisabledChk = $(theInput).prop("disabled"); 
1018			if(varDisabledChk) return true; 
1019			
1020			var varVal = $(theInput).val();
1021			if(!fn_isValFill(varVal)) return true;
1022			
1023			if(theFlag == 1 && !varVal.match(/^((010)|(011)|(016)|(017)|(018)|(019))$/)) return false;
1024			else if(theFlag == 2 && !varVal.match(/^\d{3,4}$/)) return false;
1025			else if(theFlag == 3 && !varVal.match(/^\d{4}$/)) return false;
1026		}
1027	} catch(e) {}
1028	return true;
1029}
1030
1031/*****************************************************************************
1032전화번호 형식 체크
1033*****************************************************************************/
1034function fn_checkHomePhone(theInput1, theInput2, theInput3, theText)
1035{
1036	try {
1037		var varDisabledChk1 = $(theInput1).prop("disabled"); 
1038		var varDisabledChk2 = $(theInput2).prop("disabled"); 
1039		var varDisabledChk3 = $(theInput3).prop("disabled"); 
1040		if(varDisabledChk1 && varDisabledChk2 && varDisabledChk3) return true; 
1041		
1042		var varFillCnt = 0;
1043		if(!fn_isHomePhone(1, theInput1)) {
1044			alert(fn_Message.validText(theText));
1045			$(theInput1).focus();
1046			return false;
1047		} else if(fn_isFill(theInput1)) {
1048			varFillCnt ++;
1049		}
1050		if(!fn_isHomePhone(2, theInput2)) {
1051			alert(fn_Message.validText(theText));
1052			$(theInput2).focus();
1053			return false;
1054		} else if(fn_isFill(theInput2)) {
1055			varFillCnt ++;
1056		} else if(varFillCnt > 0) {
1057			alert(fn_Message.fillAllText(theText));
1058			$(theInput2).focus();
1059			return false;
1060		}
1061		if(!fn_isHomePhone(3, theInput3)) {
1062			alert(fn_Message.validText(theText));
1063			$(theInput3).focus();
1064			return false;
1065		} else if(fn_isFill(theInput3)) {
1066			varFillCnt ++;
1067		} else if(varFillCnt > 0) {
1068			alert(fn_Message.fillAllText(theText));
1069			$(theInput3).focus();
1070			return false;
1071		}
1072		
1073	} catch(e) {}
1074	return true;
1075}
1076
1077/*****************************************************************************
1078휴대번호 형식 체크
1079*****************************************************************************/
1080function fn_checkMobilePhone(theInput1, theInput2, theInput3, theText)
1081{
1082	try {
1083		var varDisabledChk1 = $(theInput1).prop("disabled"); 
1084		var varDisabledChk2 = $(theInput2).prop("disabled"); 
1085		var varDisabledChk3 = $(theInput3).prop("disabled"); 
1086		if(varDisabledChk1 && varDisabledChk2 && varDisabledChk3) return true; 
1087		
1088		var varFillCnt = 0;
1089		if(!fn_isMobilePhone(1, theInput1)) {
1090			alert(fn_Message.validText(theText));
1091			$(theInput1).focus();
1092			return false;
1093		} else if(fn_isFill(theInput1)) {
1094			varFillCnt ++;
1095		}
1096		if(!fn_isMobilePhone(2, theInput2)) {
1097			alert(fn_Message.validText(theText));
1098			$(theInput2).focus();
1099			return false;
1100		} else if(fn_isFill(theInput2)) {
1101			varFillCnt ++;
1102		} else if(varFillCnt > 0) {
1103			alert(fn_Message.fillAllText(theText));
1104			$(theInput2).focus();
1105			return false;
1106		}
1107		if(!fn_isMobilePhone(3, theInput3)) {
1108			alert(fn_Message.validText(theText));
1109			$(theInput3).focus();
1110			return false;
1111		} else if(fn_isFill(theInput3)) {
1112			varFillCnt ++;
1113		} else if(varFillCnt > 0) {
1114			alert(fn_Message.fillAllText(theText));
1115			$(theInput3).focus();
1116			return false;
1117		}
1118	} catch(e) {}
1119	return true;
1120}
1121
1122/*****************************************************
1123  입력값유형  체크
1124******************************************************/
1125var fn_itemTypeReg = {
1126		  11: '(0|([1-9]+[0-9]*))*',
1127		  12: '(^[0]{1}(\\.\\d+)?$)|(^[1-9]+\\d*(\\.\\d+)?$)', 
1128		  //11: '(0|([1-9]+[0-9]*))*',
1129		  1: '0-9', 
1130		  2: 'a-z', 
1131		  3: 'A-Z', 
1132		  4: '0-9', 
1133		  5: '^ㄱ-ㅎㅏ-ㅣ가-힣'
1134};
1135
1136function fn_checkItemTypeForm(theItemTypes, theInput, theText, theDsetText) {
1137	var varItemTypes, varItemTypeName = '', varItemTypeLen, varItemType, varRegs = '', varBool = false, varVal;
1138	//alert(fn_isValFill(theItemTypes));
1139	
1140	//alert(theItemTypes + ':' + fn_isValFill(theItemTypes));
1141	if(!fn_isValFill(theItemTypes) || theItemTypes == '0') return true;
1142
1143	try{
1144		if(!theInput) return true;
1145		
1146		var varDisabledChk = $(theInput).prop("disabled"); 
1147		if(varDisabledChk) return true; 
1148		
1149		varVal = $(theInput).val();
1150		if(!fn_isValFill(varVal)) return true;
1151
1152		if(theItemTypes == '1')	{
1153			varItemTypeName += fn_Message.checkItemType[1];
1154			if(!fn_isValFill(theDsetText)) {
1155				varRegs += '/';
1156				varRegs += fn_itemTypeReg[12];
1157				varRegs += '/g';
1158				
1159				varBool = fn_isNumber(theInput);
1160			}else{
1161				varRegs += '/^(';
1162				varRegs += fn_itemTypeReg[11];
1163				//varRegs += '|';
1164				varItemTypeName += ', ';
1165				varRegs += '[' + fn_getRegText(theDsetText) + ']*';
1166				varItemTypeName += '\'' + theDsetText.replace(/(,\s)+/g, '\', \'') + '\'';
1167				varRegs += ')+$/g';
1168				eval('varBool = ' + 'varVal.match(' + varRegs + ');');
1169			}
1170		}else{
1171			varItemTypes = theItemTypes.split(',');
1172			varItemTypeLen = varItemTypes.length;
1173			//varRegs = new Array();
1174			if(varItemTypeLen > 0) varRegs += '/^([';
1175			for(var i = 0 ; i < varItemTypeLen ; i ++) {
1176				varItemType = varItemTypes[i];
1177				//alert('varItemType:' + varItemType);
1178				if(i > 0){
1179					varItemTypeName += ', ';
1180					//varRegs += '|';
1181				}
1182				varRegs += fn_itemTypeReg[varItemType];
1183				//alert(varRegs[i]);
1184				varItemTypeName += fn_Message.checkItemType[varItemType];
1185			}
1186			if(fn_isValFill(theDsetText)){
1187				if(varItemTypeLen > 0){
1188					//varRegs += '|';
1189					varItemTypeName += ', ';
1190				}
1191				varRegs += fn_getRegText(theDsetText);
1192				varItemTypeName += '\'' + theDsetText.replace(/(,\s)+/g, '\', \'') + '\'';
1193			}
1194			//if(varItemTypeLen > 0) varRegs += ')';
1195			if(varItemTypeLen > 0) varRegs += ']*)$/g';
1196			eval('varBool = ' + 'varVal.match(' + varRegs + ');');
1197			//return;
1198		}
1199		
1200		if(!varBool){
1201			alert(fn_Message.itemTypeText(varItemTypeName, theText));
1202			try {
1203				theInput.focus();
1204			} catch(e){console.log('error')}
1205			return false;
1206		}
1207	}catch(e){
1208		return true;
1209	}
1210	return true;
1211}
1212
1213function fn_onlyItemTypeForm(theItemTypes, theInput, theText, theDsetText) {
1214	var varResult = fn_checkItemTypeForm(theItemTypes, theInput, theText, theDsetText);
1215	if(!varResult){
1216		var varVal = $(theInput).val();
1217		if(varVal != ''){
1218			var varLen = varVal.length;
1219			$(theInput).val(varVal.substring(0, varLen - 1));
1220		}
1221	}
1222	return varResult;
1223}
1224
1225/*****************************************************
1226입력가능값  체크
1227******************************************************/
1228function fn_getRegText(theDsetText) {
1229	var varTexts, varTextLen, varRegText = '';
1230	varTexts = theDsetText.split(',');
1231	varTextLen = varTexts.length;
1232	
1233	for(var i = 0 ; i < varTextLen ; i ++){
1234		varRegText += varTexts[i];
1235	}
1236	return varRegText;
1237}
1238
1239/******************************************
1240입력값 체크
1241******************************************/
1242function fn_checkTextForm(theUseText, theDsetText, theInput, theText) {
1243	if(typeof(theInput) == 'undefined' || !fn_isValFill(theDsetText)) return true;
1244	var varDisabledChk = theInput.prop("disabled"); 
1245	if(varDisabledChk) return true; 
1246	var varVal, varTexts, varTextLen, varRegText = '', varBool = false;
1247	varVal = $(theInput).val();
1248	varTexts = theDsetText.split(',');
1249	varTextLen = varTexts.length;
1250	if(theUseText == 2)	{
1251		// 불가능
1252
1253		for(var i = 0 ; i < varTextLen ; i ++) {
1254			if(varVal.indexOf(varTexts[i]) == -1) varBool = true;
1255			else {
1256				varBool = false;
1257				break;
1258			}
1259		}
1260	} else {
1261		// 가능
1262		varRegText = 'varBool = (varVal.match(/[';
1263		for(var i = 0 ; i < varTextLen ; i ++) {
1264			if(i > 0) varRegText += '|';
1265			varRegText += varTexts[i];
1266		}
1267		varRegText += ']/g));';
1268		eval(varRegText);
1269	}
1270	if(!varBool) {
1271		alert(fn_Message.impossibleText(theDsetText, theText, true));
1272		try {
1273		theInput.focus();
1274		} catch(e){console.log('error')}
1275		return false;
1276	}
1277	return true;
1278}
1279
1280/******************************************
1281입력값 체크 : 금지단어
1282******************************************/
1283function fn_checkPrvTextForm(theDsetText, theInput, theText) {
1284	if(typeof(theInput) == 'undefined' || !fn_isValFill(theDsetText)) return true;
1285	var varDisabledChk = theInput.prop("disabled"); 
1286	if(varDisabledChk) return true; 
1287	var varVal, varTexts, varTextLen, varRegText = '', varMatch = false;
1288	varVal = $(theInput).val();
1289	varTexts = theDsetText.split(',');
1290	varTextLen = varTexts.length;
1291	// 불가능
1292
1293	var varTextType = 0;
1294	var varCommentText;
1295	for(var i = 0 ; i < varTextLen ; i ++) {
1296		varRegText = 'varMatch = varVal.match(/^' + varTexts[i] + '$/g);';
1297		eval(varRegText);
1298		//alert('>' + varVal + ':' + varRegText + ':' + varMatch);
1299		if(varMatch) {
1300			varCommentText = varTexts[i];
1301			var varRegIdx = varCommentText.indexOf('[');
1302			if(varRegIdx == 0) {
1303				// 끝나는 문자
1304				varRegIdx = varCommentText.indexOf(']+');
1305				if(varRegIdx != -1)	varCommentText = varCommentText.substring(varRegIdx + 2);
1306				//varComment = "'" + varCommentText + "'로 끝나는";
1307				varTextType = 2;
1308			} else if(varRegIdx > 0) {
1309				// 시작하는 문자
1310				varCommentText = varCommentText.substring(0, varRegIdx);
1311				//varComment = "'" + varCommentText + "'로 시작하는";
1312				varTextType = 1;
1313			}// else varComment = varCommentText;
1314			break;
1315		}
1316	}
1317	if(varMatch) {
1318		var varMessage;
1319		if(varTextType == 1) varMessage = fn_Message.impossibleBeginText(varCommentText, theText, true);
1320		else if(varTextType == 2) varMessage = fn_Message.impossibleEndText(varCommentText, theText, true);
1321		else varMessage = fn_Message.impossibleText(varCommentText, theText, true);
1322		alert(varMessage);
1323		try {
1324			theInput.focus();
1325		} catch(e){alert(e);}
1326		return false;
1327	}
1328	
1329	return true;
1330}
1331
1332/**
1333 * 글자수 제한
1334 * @param theObj 
1335 * @param theMaxLen : character기준
1336 * @param theText
1337 * @return
1338 */
1339function fn_checkStrMaxLenForm(theObj, theText, theMaxLen){
1340	var varDisabledChk = $(theObj).prop("disabled"); 
1341	if(varDisabledChk) return true; 
1342	if(!fn_isFill(theObj)) return true;
1343	var valStr = $(theObj).val();
1344	var varDataType = $(theObj).attr("data-type");
1345	if(varDataType == "current") valStr = valStr.replace(/,/g, "");
1346	var valLen = valStr.length;
1347	if(valLen > theMaxLen) {
1348		alert(fn_Message.limitTLenText(theText, theMaxLen));
1349		$(theObj).val(valStr.substring(0, theMaxLen));
1350		return false;
1351	}
1352	return true;
1353}
1354
1355/**
1356 * 글자수 제한
1357 * @param theObj
1358 * @param theText
1359 * @param theMinLen
1360 * @param theMaxLen
1361 * @returns {Boolean}
1362 */
1363function fn_checkStrLenForm(theObj, theText, theMinLen, theMaxLen){
1364	var varDisabledChk = $(theObj).prop("disabled"); 
1365	if(varDisabledChk) return true; 
1366	if(!fn_isFill(theObj)) return true;
1367	var valStr = $(theObj).val();
1368	var varDataType = $(theObj).attr("data-type");
1369	if(varDataType == "current") valStr = valStr.replace(/,/g, "");
1370	var valLen = valStr.length;
1371
1372	if(valLen < theMinLen) {
1373		alert(fn_Message.limitBTLenText(theText, theMinLen, theMaxLen));
1374		return false;
1375	}
1376	if(valLen > theMaxLen) {
1377		alert(fn_Message.limitTLenText(theText, theMaxLen));
1378		$(theObj).val(valStr.substring(0, theMaxLen));
1379		return false;
1380	}
1381	return true;
1382}
1383
1384/*****************************************************************************
1385이메일 setting
1386*****************************************************************************/
1387function fn_initEmailValue(theObj, theTargetId, theTargetVal){
1388	var varVal = $(theObj).find("option:selected").val();
1389	if(varVal != '0'){
1390		$('#' + theTargetId).val(varVal);
1391		$('#' + theTargetId).prop('readOnly', true);
1392	}else{
1393		$('#' + theTargetId).prop('readOnly', false);
1394	}
1395}
1396
1397function fn_setEmailValue(theObj, theTargetId, theTargetVal){
1398	var varVal = $(theObj).find("option:selected").val();
1399	if(varVal != '0'){
1400		$('#' + theTargetId).val(varVal);
1401		$('#' + theTargetId).prop('readOnly', true);
1402	}else{
1403		var varTargetVal = (typeof(theTargetVal) == 'undefined')?"":theTargetVal;
1404		$('#' + theTargetId).val(varTargetVal);
1405		$('#' + theTargetId).prop('readOnly', false);
1406		$('#' + theTargetId).focus();
1407	}
1408}
1409
1410
1411/***********************************
1412 select option 순서 위아래 수정
1413 * @param theObj 			: source select
1414 * @param theFlag			: 위/아래(1/2)
1415 * @param theSIdx			: option start index
1416 * @return
1417***********************************/
1418function fn_moveUDOptions(theObj, theFlag, theSIdx) {
1419	var varSelectedObj = $(theObj).find('option:selected');
1420	var varSelectedCnt = $(varSelectedObj).size();
1421	
1422	if(varSelectedCnt <= 0)	{
1423		alert('이동할 ' + $(theObj).attr('title') + '를 선택하세요.');
1424		return;
1425	}
1426	
1427	var varIsChecked = false;
1428	var varSIdx;
1429	var varTIdx;
1430	var varTObj;
1431	if(theFlag == '1') {
1432		// 위
1433		$(varSelectedObj).each(function(index, item){
1434			if(varIsChecked) return;
1435			var varOptions = $(theObj).find('option');
1436			varSIdx = $(varOptions).index(item);
1437			if(varSIdx <= theSIdx){
1438				alert('위로 이동하실 수 없습니다.');
1439				varIsChecked = true;
1440				return;
1441			}
1442			varTIdx = varSIdx - 1;
1443			varTObj = $(varOptions).eq(varTIdx);
1444			$(varTObj).before(item);
1445		});
1446	} else {
1447		// 아래
1448		varSelectedObj = $(varSelectedObj).get().reverse();
1449		var varOptionMaxIdx = $(theObj).find('option').size() - 1;
1450		$(varSelectedObj).each(function(index, item){
1451			if(varIsChecked) return;
1452			var varOptions = $(theObj).find('option');
1453			//alert($(theObj).find('option').index(item));
1454			varSIdx = $(varOptions).index(item);
1455			if(varSIdx < theSIdx || varSIdx >= varOptionMaxIdx){
1456				alert('아래로 이동하실 수 없습니다.');
1457				varIsChecked = true;
1458				return;
1459			}
1460			varTIdx = varSIdx + 1;
1461			varTObj = $(varOptions).eq(varTIdx);
1462			$(varTObj).after(item);
1463		});
1464	}
1465}
1466
1467
1468/***********************************
1469 ul, checkbox 순서 위아래 수정
1470 * @param theObj 			: source ul
1471 * @param theFlag			: 위/아래(1/2)
1472 * @param theSIdx			: option start index
1473 * @return
1474***********************************/
1475function fn_moveUDLiChecks(theTxt, theObj, theFlag, theSIdx) {
1476	var varSelectedObj = $(theObj).find('input[type="checkbox"]:checked').parent("li");
1477	var varSelectedCnt = $(varSelectedObj).size();
1478	
1479	if(varSelectedCnt <= 0)	{
1480		alert('이동할 ' + theTxt + '를 선택하세요.');
1481		return;
1482	}
1483	
1484	var varIsChecked = false;
1485	var varSIdx;
1486	var varTIdx;
1487	var varTObj;
1488	if(theFlag == '1') {
1489		// 위
1490		$(varSelectedObj).each(function(index, item){
1491			if(varIsChecked) return;
1492			var varOptions = $(theObj).find('>li');
1493			varSIdx = $(varOptions).index(item);
1494			if(varSIdx <= theSIdx){
1495				alert('위로 이동하실 수 없습니다.');
1496				varIsChecked = true;
1497				return;
1498			}
1499			varTIdx = varSIdx - 1;
1500			varTObj = $(varOptions).eq(varTIdx);
1501			$(varTObj).before(item);
1502		});
1503	} else {
1504		// 아래
1505		varSelectedObj = $(varSelectedObj).get().reverse();
1506		var varOptionMaxIdx = $(theObj).find('>li').size() - 1;
1507		$(varSelectedObj).each(function(index, item){
1508			if(varIsChecked) return;
1509			var varOptions = $(theObj).find('>li');
1510			//alert($(theObj).find('option').index(item));
1511			varSIdx = $(varOptions).index(item);
1512			if(varSIdx < theSIdx || varSIdx >= varOptionMaxIdx){
1513				alert('아래로 이동하실 수 없습니다.');
1514				varIsChecked = true;
1515				return;
1516			}
1517			varTIdx = varSIdx + 1;
1518			varTObj = $(varOptions).eq(varTIdx);
1519			$(varTObj).after(item);
1520		});
1521	}
1522}
1523
1524// 통화 format
1525function fn_getValFormatCurrent(theVal) {
1526	var varVal = (typeof(theVal) == "number")? theVal.toString():theVal;
1527	if(!fn_isValFill(varVal)) return;
1528	varVal = varVal.replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1529	return varVal;
1530}
1531
1532function fn_setFormatCurrent(theObj) {
1533	if(!fn_isFill(theObj)) return;
1534	var varVal = $(theObj).val();
1535	varVal = varVal.toString().replace(/,/g, "").replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1536	var varCM = varVal.match(/,/g);
1537	var varCMLen = (varCM)?varCM.length:0;
1538	var varAttrML = $(theObj).attr("maxlength");
1539	$(theObj).attr("maxlength", new Number(varAttrML) + varCMLen);
1540	$(theObj).val(varVal);
1541}
1542
1543function fn_setNFormatCurrent(theObj) {
1544	if(!fn_isFill(theObj)) return;
1545	var varVal = $(theObj).val();
1546	var varCM = varVal.match(/,/g);
1547	var varCMLen = (varCM)?varCM.length:0;
1548	
1549	varVal = varVal.replace(/,/g, "");
1550	var varAttrML = $(theObj).attr("maxlength");
1551	$(theObj).attr("maxlength", new Number(varAttrML) - varCMLen);
1552	$(theObj).val(varVal);
1553}
1554
1555// 통화 체크
1556function fn_checkCurrent(theInput, theText){
1557	try{
1558		var varObj = $(theInput);
1559		if(varObj.size() == 0) return true;
1560		var varDisabledChk = varObj.prop("disabled"); 
1561		if(varDisabledChk) return true; 
1562		if(!fn_isFill(theInput)) return true;
1563
1564		varVal = varObj.val().replace(/,/g, "");
1565		if(!fn_isNumberVal(varVal, 0)) {
1566			alert(fn_Message.numberText(theText));
1567			try {varObj.focus();} catch(e){console.log('error')}
1568			return false;
1569		}
1570	} catch(e) {
1571		//alert(e);
1572		return true;
1573	}
1574	return true;
1575}
1576
1577/*****************************************************
1578숫자 체크
1579******************************************************/
1580function fn_isNumberVal(theVal, theFirstNumber) {
1581	var varValue, varLen;
1582	try{
1583		varValue = theVal.replace(/^\s*|\s*$/g, ''); // 좌우 공백 제거
1584		if (varValue == '' || isNaN(varValue)) return false;
1585		
1586		if(theFirstNumber != undefined)	{
1587			varLen = varValue.length;
1588			if(varLen > 1 && varValue.charAt(0) == theFirstNumber) return false;
1589		}
1590		return true;
1591	}catch(e){
1592		return false;
1593	}
1594	return false;
1595}
1596
1597/*****************************************************
1598숫자 체크 /숫자문자체크
1599******************************************************/
1600function fn_isNumber(theInput, theFirstNumber) {
1601	var varValue, varLen;
1602	try{
1603		if(theInput) {
1604			varValue = $(theInput).val().replace(/^\s*|\s*$/g, ''); // 좌우 공백 제거
1605			//alert('2:' + isNaN('terr'));
1606			if (varValue == '' || isNaN(varValue)) return false;
1607			
1608			if(theFirstNumber != undefined)	{
1609				varLen = varValue.length;
1610				if(varLen > 1 && varValue.charAt(0) == theFirstNumber) return false;
1611			}
1612			return true;
1613		}
1614	}catch(e){
1615		return false;
1616	}
1617	return false;
1618}
1619
1620/**
1621 * 3차 select option 초기 setting
1622 * @param theId
1623 */
1624function fn_setInitItemOrderOption(theId){
1625	try{
1626		var varMaxLevel = new Number($("#" + theId).attr("data-max"));
1627		for(var varIdx = 1 ; varIdx <= varMaxLevel ; varIdx ++) {
1628			(function(varIdx){
1629				$("#" + theId + varIdx).change(function(){
1630					// 저장값 setting
1631					var varClassIdx;
1632					for(var varSIdx = varIdx ; varSIdx >= 1 ; varSIdx --) {
1633						varClassIdx = $("#" + theId + varSIdx).find("option:selected").val();
1634						if(varClassIdx != '') break;
1635					}
1636					$("#" + theId + " option[value='" + varClassIdx + "']").prop("selected", true);
1637					
1638					// 다음 level setting
1639					if(varIdx < varMaxLevel) {
1640						for(var varSIdx = varIdx + 1 ; varSIdx <= varMaxLevel ; varSIdx ++) {
1641							$("#" + theId + varSIdx + " option:gt(0)").remove();
1642						}
1643						
1644						var varPClassIdx = $(this).find("option:selected").val();
1645						var varClassOpts = $("#" + theId + " option[data-pcode='" + varPClassIdx + "']");
1646						$("#" + theId + (varIdx + 1)).append(varClassOpts.clone());
1647					}
1648				});
1649			})(varIdx);
1650		}
1651	}catch(e){console.log('error')}
1652}
1653
1654/*****************************************************
16553차 select option 채우기
1656******************************************************/
1657function fn_setItemOrderOption(theId){
1658	try {
1659		var varSelOptObj = $("#" + theId).find("option:selected");
1660		var varSelClassIdx = varSelOptObj.val();
1661		var varClassIdx = varSelClassIdx;
1662		if(varClassIdx == '') {
1663			var varClassOpts = $("#" + theId + " option[data-pcode='0']");
1664			$("#" + theId + "1").append(varClassOpts.clone());
1665		} else {
1666			var varDataLevel = new Number(varSelOptObj.attr("data-level"));
1667			var varPCode;
1668			for(var varIdx = varDataLevel ; varIdx >= 1 ; varIdx --) {
1669				varSelOptObj = $("#" + theId + " option[value='" + varClassIdx + "']");
1670				varPCode = varSelOptObj.attr("data-pcode");
1671				var varClassOpts = $("#" + theId + " option[data-pcode='" + varPCode + "']");
1672				$("#" + theId + varIdx).append(varClassOpts.clone());
1673				$("#" + theId + varIdx).find("option[value='" + varClassIdx + "']").prop("selected", true);
1674				varClassIdx = varPCode;
1675			}
1676
1677			var varMaxLevel = new Number($("#" + theId).attr("data-max"));
1678			if(varDataLevel < varMaxLevel) {
1679				varClassIdx = varSelClassIdx;
1680				var varIdx = varDataLevel + 1
1681				var varObj = $("#" + theId + varIdx);
1682				var varPClassIdx = varClassIdx;
1683				var varClassOpts = $("#" + theId + " option[data-pcode='" + varPClassIdx + "']");
1684				$("#" + theId + varIdx).append(varClassOpts.clone());
1685			}
1686		}
1687	} catch(e){console.log('error')}
1688}
1689
1690
1691/*****************************************************
1692tree형태 select 전체 선택
1693******************************************************/
1694function fn_setAllTreeSelectObjs(theObj) {
1695	var varChked = $(theObj).prop("checked");
1696	
1697	var varObjName = $(theObj).attr("name");
1698	var varCObjs = $("input[name='" + varObjName + "']").filter("[data-l!='1']");
1699	if(varChked) varCObjs.prop("checked", varChked);
1700	varCObjs.prop("disabled", varChked);
1701}
1702
1703/*****************************************************
1704tree형태 select 개별 선택
1705******************************************************/
1706function fn_setTreeSelectObjs(theObj) {
1707	var varChked = $(theObj).prop("checked");
1708	var varObjName = $(theObj).attr("name");
1709	var varCObjs = $("input[name='" + varObjName + "']").filter("[data-p='" + $(theObj).val() + "']");
1710	if(varCObjs.size() > 0) {
1711		// child가 있는 경우 
1712		
1713		var varPCd = $(theObj).attr("data-p");
1714		//var varLevel = $(this).attr("data-l");
1715		
1716		var varSLObjs = $("input[name='" + varObjName + "']").filter("[data-p='" + varPCd + "']");
1717		var varIdx = varSLObjs.index($(theObj));
1718		var varNextObj = varSLObjs.filter(":eq(" + (varIdx + 1) + ")");
1719
1720		var varTObjs = $("input[name='" + varObjName + "']");
1721		var varSIdx = varTObjs.index($(theObj));
1722		var varSObjs = varTObjs.filter(":gt(" + varSIdx + ")");
1723		if(varNextObj.is('input')) {
1724			// 같은 level이 있는 경우
1725			var varEIdx = varTObjs.index(varNextObj);
1726			var varCnt = varEIdx - varSIdx;
1727			if(varCnt > 1) {
1728				var varChkObjs = varSObjs.filter(":lt(" + (varCnt - 1) + ")");
1729				/*if(varChked) */varChkObjs.prop("checked", varChked);
1730				varChkObjs.prop("disabled", varChked);
1731			}
1732		} else {
1733			// 같은 level이 없는 경우 
1734			// 1. 다음 상위있는 경우
1735			var varLevel = new Number($(theObj).attr("data-l"));
1736			var varEIdx = -1;
1737			$.each(varSObjs, function(i){
1738				var varSLevel = new Number($(this).attr("data-l"));
1739				if(varLevel > varSLevel) {
1740					varEIdx = i;
1741					return false;
1742				}
1743			});
1744			
1745			if(varEIdx > -1) {
1746				var varChkObjs = varSObjs.filter(":lt(" + varEIdx + ")");
1747				/*if(varChked) */varChkObjs.prop("checked", varChked);
1748				varChkObjs.prop("disabled", varChked);
1749			} else {
1750				// 2. 마지막인 경우
1751				/*if(varChked) */varSObjs.prop("checked", varChked);
1752				varSObjs.prop("disabled", varChked);
1753			}
1754		}
1755	}
1756}
1757
1758/***********************************
1759 * select option 이동
1760 * @param theSObj			: source select
1761 * @param theTObj			: target select
1762 * @param theSelected		: 이전 선택option selected true/false여부
1763 * @return
1764 ***********************************/
1765function fn_moveLROptions(theSObj, theTObj, theSelected) {
1766
1767	$(theTObj).find('option:selected').prop('selected', theSelected);
1768	$(theSObj).find('option:selected').each(function(index, item){
1769		$(theTObj).append(item);
1770	});
1771}
1772/***********************************
1773 select option 순서 위아래 수정
1774 * @param theObj 			: source select
1775 * @param theFlag			: 위/아래(1/2)
1776 * @param theSIdx			: option start index
1777 * @return
1778***********************************/
1779function fn_moveUDOptions(theObj, theTitle, theFlag, theSIdx) {
1780	var varSelectedObj = $(theObj).find('option:selected');
1781	var varSelectedCnt = $(varSelectedObj).size();
1782	if(varSelectedCnt <= 0){
1783		alert('이동할 ' + theTitle + '를 선택하세요.');
1784		return;
1785	}
1786	
1787	var varTmpOption;
1788	var varIsChecked = false;
1789	var varSIdx;
1790	var varTIdx;
1791	var varTObj;
1792	if(theFlag == '1'){
1793		// 위
1794		$(varSelectedObj).each(function(index, item){
1795			if(varIsChecked) return;
1796			var varOptions = $(theObj).find('option');
1797			varSIdx = $(varOptions).index(item);
1798			if(varSIdx <= theSIdx){
1799				alert('위로 이동하실 수 없습니다.');
1800				varIsChecked = true;
1801				return;
1802			}
1803			varTIdx = varSIdx - 1;
1804			varTObj = $(varOptions).eq(varTIdx);
1805			$(varTObj).before(item);
1806		});
1807	} else {
1808		// 아래
1809		varSelectedObj = $(varSelectedObj).get().reverse();
1810		var varOptionMaxIdx = $(theObj).find('option').size() - 1;
1811		$(varSelectedObj).each(function(index, item){
1812			if(varIsChecked) return;
1813			var varOptions = $(theObj).find('option');
1814			//alert($(theObj).find('option').index(item));
1815			varSIdx = $(varOptions).index(item);
1816			if(varSIdx < theSIdx || varSIdx >= varOptionMaxIdx){
1817				alert('아래로 이동하실 수 없습니다.');
1818				varIsChecked = true;
1819				return;
1820			}
1821			varTIdx = varSIdx + 1;
1822			varTObj = $(varOptions).eq(varTIdx);
1823			$(varTObj).after(item);
1824			//alert(varTIdx);
1825		});
1826	}
1827}
1828
1829/*****************************************************
1830object 전체 scroll
1831******************************************************/
1832function fn_addScrollObject(theTObj, theHeight, theWidth){
1833
1834	var varDHeight = theHeight.replace(/px/gi, "");
1835	var varTHeight = theTObj.height();
1836
1837	if(varTHeight <= varDHeight) return false;
1838	
1839	theTObj.css("border", "0px");
1840	var varDLStr = "<div style='";
1841	if(typeof(theWidth) != 'undefined') varDLStr += "width:" + theWidth + "px;";
1842	varDLStr += "height:" + theHeight + "; overflow-y:auto;'></div>";
1843	var varDLObj = $(varDLStr);
1844
1845	$(theTObj).before(varDLObj);
1846	varDLObj.append(theTObj);
1847	
1848	var varTBorderColor = theTObj.css("borderTopColor");
1849	if(varTBorderColor == '') varTBorderColor = "#6b6b6b";
1850	varDLObj.css("border-top", "2px solid " + varTBorderColor);
1851	varDLObj.css("border-bottom", "1px solid " + varTBorderColor);
1852}
1853
1854
1855/*****************************************************
1856테이블 head 고정
1857******************************************************/
1858function fn_fixedTableHead(theTObj, theWidth, theHeight){
1859	
1860	if(!theTObj.is("table")) return false;
1861	var varTHeight = theTObj.find("tbody").height();
1862
1863	if(varTHeight == 0) {
1864		if ( (navigator.appName == 'Netscape' && navigator.userAgent.search('Trident') != -1) || (agent.indexOf("msie") != -1) ) {
1865			setTimeout(function(){ fn_setFixedTableHead(theTObj, theWidth, theHeight); }, 100);
1866		}
1867	} else {
1868		fn_setFixedTableHead(theTObj, theWidth, theHeight);
1869	}
1870}
1871
1872function fn_setFixedTableHead(theTObj, theWidth, theHeight){
1873	
1874	if(!theTObj.is("table")) return false;
1875
1876	var varDHeight = theHeight.replace(/px/gi, "");
1877	var varTHeight = theTObj.find("tbody").height();
1878	
1879	if(varTHeight <= varDHeight) return false;
1880	
1881	theTObj.css("border", "0px");
1882	var varDivObj = $("<div style='clear:both;position:relative;'><div style='width:" + theWidth + "; height:" + theHeight + "; overflow-x:hidden; overflow-y:auto;'></div></div>");
1883
1884	
1885	$(theTObj).before(varDivObj);
1886	var varTHObj = theTObj.clone();
1887	varTHObj.find(">tbody").remove();
1888	varDivObj.prepend(varTHObj);
1889	varDivObj.find(">div").append(theTObj);
1890
1891	theTObj.find(">thead").hide();
1892	
1893	var varTBorderColor = theTObj.css("borderTopColor");
1894	if(varTBorderColor == '') varTBorderColor = "#6b6b6b";
1895	varDivObj.css("border-top", "2px solid " + varTBorderColor);
1896	varDivObj.find(">div").css("border-bottom", "1px solid " + varTBorderColor);
1897	
1898	var varTWidth = varDivObj.find(">div>table").width();
1899	if(varTWidth > 0) {
1900		fn_setFixedTableHeadAddWidth(theTObj, "tbody");
1901		varDivObj.find(">div>table").css("width", (varTWidth + 20) + "px");
1902		fn_setFixedTableHeadAddWidth(varDivObj.find(">table"), "thead");
1903	}
1904}
1905
1906function fn_setFixedTableHeadAddWidth(theTObj, theType) {
1907	var varIsCol = theTObj.find(">colgroup").is("colgroup");
1908	if(varIsCol) {
1909		var varLastCol = theTObj.find(">colgroup>col:last-child");
1910		var varLastColWidth = varLastCol.width();
1911		if(varLastColWidth > 0) varLastCol.attr("width", varLastColWidth + 20 + "px");
1912	} else {
1913		theTObj.find(theType + ">tr>td:last-child").css("width", theTObj.find("tbody>tr>td:last-child").width() + 20 + "px");
1914	}
1915}
1916
1917var fn_checkObj = {
1918	checkedId:false
1919	, checkedBtn:false
1920	, checkeds:false
1921	, checkForm:false
1922	, reset:function(){
1923		// 중복확인 setting
1924		$(fn_checkObj.checkedBtn).text(fn_Message.duplicateCheck);
1925		var varObj = $("*[name^=" + fn_checkObj.checkedId + "]");
1926		varObj.val("");
1927		varObj.not("[data-readonly]").prop("readonly", false);
1928		varObj.filter("select").not(":selected").prop("disabled", false);
1929		varObj.css("backgroundColor", "#fff");
1930		varObj.focus();
1931		fn_checkObj.checkForm.obj.val("");
1932		fn_checkObj.checkeds[fn_checkObj.checkedId] = false;
1933	}, success:function() {
1934		// 중복확인 성공
1935		var varConfirm = confirm(fn_Message.useConfirm($('label[for^=' + fn_checkObj.checkedId + ']').text()));
1936		if(!varConfirm) {
1937			// 미사용
1938			fn_checkObj.reset();
1939			return false;
1940		}
1941
1942		// 사용		
1943		var varObj = $("*[name^=" + fn_checkObj.checkedId + "]");
1944		var varBtnObj = fn_checkObj.checkedBtn;
1945		
1946		fn_useCheckObj(varObj, varBtnObj, fn_checkObj.checkedId);
1947		
1948	}, fail:function(theCode){
1949		// 중복확인 실패
1950		var varMsg;
1951		if(theCode == 1) {
1952			varMsg = fn_Message.existDuplicate($('label[for^=' + fn_checkObj.checkedId + ']').text());
1953		} else {
1954			varMsg = fn_Message.errorsRSAEncrypt;
1955		}
1956		alert(varMsg);
1957		if(theCode == 1) fn_checkObj.reset();
1958
1959		return false;
1960	}, confirm:function(theFormatType){
1961		// 아이디 중복확인
1962		var varObj = $("#" + fn_checkObj.checkedId);
1963		var varObjName = $('label[for^=' + fn_checkObj.checkedId + ']').text();
1964		if(theFormatType == 3)
1965		{
1966			if(fn_isFill($("#" + fn_checkObj.checkedId + "1")) || fn_isFill($("#" + fn_checkObj.checkedId + "2"))) {
1967				$("#" + fn_checkObj.checkedId).val($("#" + fn_checkObj.checkedId + "1").val() + '@' + $("#" + fn_checkObj.checkedId + "2").val());
1968			}
1969		}
1970		if(!fn_checkFill(varObj, varObjName)) return false;
1971		if(theFormatType == '3' && !fn_validEmail()) {
1972			return false;
1973		}
1974		if(theFormatType == '10' && !fn_validID(varObj, varObjName)) {
1975			return false;
1976		}
1977
1978		fn_checkObj.checkForm.obj.val(varObj.val());
1979		fn_checkObj.checkForm.form.submit();
1980	}, check:function(theBtnObj, theObjId, theCheckForm, theFormatType){
1981		// 버튼클릭
1982		//alert($(fn_checkObj.checkForm["form"]).attr('id'));
1983		fn_checkObj.checkForm = theCheckForm;
1984		try {
1985			var varChecked = false;
1986			if(!fn_checkObj.checkeds) {
1987				fn_checkObj.checkeds = {};
1988				fn_checkObj.checkeds[theObjId] = false;
1989			} else {
1990				varChecked = fn_checkObj.checkeds[theObjId];
1991			}
1992			fn_checkObj.checkedId = theObjId;
1993			fn_checkObj.checkedBtn = theBtnObj;
1994			if(varChecked) {
1995				// 중복확인한 경우
1996				var varConfirm = confirm(fn_Message.reconfirm($('label[for^=' + fn_checkObj.checkedId + ']').text()));
1997				if(varConfirm) {
1998					fn_checkObj.reset();
1999				}
2000			} else {
2001				// 중복확인 안한 경우
2002				fn_checkObj.confirm(theFormatType);
2003			}
2004		} catch(e) {}
2005	}
2006};
2007
2008function fn_useCheckObj(theObj, theBtnObj, theId){
2009	$(theBtnObj).text(fn_Message.authenticationComplete);
2010	theObj.prop("readonly", true);
2011	theObj.filter("select").not(":selected").prop("disabled", true);
2012	theObj.css("backgroundColor", "#e5e5e5");
2013
2014	fn_checkObj.checkeds[theId] = true;
2015}
2016
2017// 배열 매칭 값 찾기
2018function getMatchObject(arr, matchVal, keyName) {
2019	if(typeof(arr) == "undefined" || typeof(matchVal) == "undefined") return false;
2020	
2021	var varObj = false;
2022	var arrVal;
2023	$.each(arr, function(i, item){
2024		arrVal = item[keyName];
2025		//alert(arrVal + ":" + matchVal + ":" + (arrVal == matchVal));
2026		if(arrVal == matchVal) {
2027			varObj = item;
2028			return true;
2029		}
2030	});
2031	return varObj;
2032}
2033
2034function fn_getIndexOf(theFlag, theStr1, theStr2) {
2035	if(theStr1 == '' || theStr2 == '') return -1;
2036	
2037	var varStr1 = theFlag + theStr1 + theFlag;
2038	var varStr2 = theFlag + theStr2 + theFlag;
2039	
2040	return varStr1.indexOf(varStr2);
2041	
2042}
2043/*
2044 * strTemp  : [필수] 크로스사이트 스크립팅을 검사할 문자열
2045 * level    : [옵션] 검사레벨
2046 *            0 (기본) -> XSS취약한 문자 제거
2047 *            1 (선택) -> 단순한 <, > 치환
2048 */
2049function replaceXSS(strTemp, level) {
2050  if ( level == undefined || level == 0 ) {
2051    strTemp = strTemp.replace(/\<|\>|\"|\'|\%|\;|\(|\)|\&|\+|\-/g,"");
2052  }
2053  else if (level != undefined && level == 1 ) {
2054    strTemp = strTemp.replace(/\</g, "&lt;");
2055    strTemp = strTemp.replace(/\>/g, "&gt;");
2056  }
2057  return strTemp;
2058}
2059
2060/**
2061 * SNS공유
2062 */
2063function fn_shareSns(theType, theImgSrc) {
2064	    var varUrl = document.URL;
2065	    var varTitle = document.title;
2066	    var varHref, wp;
2067
2068	    if (theType == 'twitter') {
2069	    	varHref = 'https://twitter.com/intent/tweet?text=' + encodeURIComponent(varTitle) + ' ' + encodeURIComponent(varUrl);
2070	        wp = window.open(varHref, theType, 'width=600, height=400');
2071	    } else if (theType == 'facebook') {
2072	    	//페이스북공유
2073    		 var share = {
2074    		        method: 'stream.share',
2075    		        u: varUrl,
2076    		        p: theImgSrc
2077    		    };
2078    	    FB.ui(share, function(response) { console.log(response); }); 
2079	    } else if (theType == 'me2day') {
2080	    	varHref = 'http://me2day.net/posts/new?new_post[body]=' + encodeURIComponent('"' + varTitle + '" : ' + varUrl);
2081	        wp = window.open(varHref, theType, 'width=600, height=560');
2082	    } else if (theType == 'yozm') {
2083	    	varHref = 'http://yozm.daum.net/api/popup/prePost?link=' + encodeURIComponent(varUrl) + '&prefix=' + encodeURIComponent(varTitle);
2084	        wp = window.open(varHref, theType, 'width=400, height=364');
2085	    } else if(theType == 'band') {
2086    		varHref = 'https://band.us/plugin/share?route=' + encodeURIComponent(varUrl) + '&body=' + encodeURIComponent(varTitle) + ' ' + encodeURIComponent(varUrl);
2087    		window.open(varHref, theType, 'width=410, height=540');
2088	    } else if(theType == 'blog') {
2089    		varHref = 'http://blog.naver.com/openapi/share?url=' + encodeURIComponent(varUrl) + '&title=' + encodeURIComponent(varTitle) + ' ' + encodeURIComponent(varUrl);
2090    		window.open(varHref, theType, 'width=410, height=540');
2091	    }
2092	}
2093
2094function fn_contactSubmitForm(theAction) {
2095
2096	var varAction = theAction;
2097	$.ajax({
2098		type:'POST', 
2099		beforeSend:function(request){request.setRequestHeader('Ajax', 'true');}, 
2100		url:varAction, 
2101		async:true, 
2102		success:function(result){
2103		}, 
2104		error:function(request,error){
2105		}
2106	});	
2107}
2108
2109/**
2110 * 날짜 format
2111 */
2112Date.prototype.format = function(f) {
2113    if (!this.valueOf()) return " ";
2114 
2115    var weekName = ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"];
2116    var d = this;
2117     
2118    return f.replace(/(yyyy|yy|MM|dd|E|hh|mm|ss|a\/p)/gi, function($1) {
2119        switch ($1) {
2120            case "yyyy": return d.getFullYear();
2121            case "yy": return (d.getFullYear() % 1000).zf(2);
2122            case "MM": return (d.getMonth() + 1).zf(2);
2123            case "dd": return d.getDate().zf(2);
2124            case "E": return weekName[d.getDay()];
2125            case "HH": return d.getHours().zf(2);
2126            case "hh": return ((h = d.getHours() % 12) ? h : 12).zf(2);
2127            case "mm": return d.getMinutes().zf(2);
2128            case "ss": return d.getSeconds().zf(2);
2129            case "a/p": return d.getHours() < 12 ? "오전" : "오후";
2130            default: return $1;
2131        }
2132    });
2133};
2134
2135String.prototype.string = function(len){var s = '', i = 0; while (i++ < len) { s += this; } return s;};
2136String.prototype.zf = function(len){return "0".string(len - this.length) + this;};
2137Number.prototype.zf = function(len){return this.toString().zf(len);};
2138
2139
2140
2141if (!String.prototype.endsWith) {
2142  String.prototype.endsWith = function(searchString, position) {
2143      var subjectString = this.toString();
2144      if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
2145        position = subjectString.length;
2146      }
2147      position -= searchString.length;
2148      var lastIndex = subjectString.indexOf(searchString, position);
2149      return lastIndex !== -1 && lastIndex === position;
2150  };
2151}
2152
2153function fn_getPageNate(thePageInfo, theListUrl){
2154	var varPageInfo = thePageInfo;
2155	var varPageCon = '';
2156	if(varPageInfo.totalPageCount > varPageInfo.pageSize) {
2157		var varPrevPageNo;
2158		if(varPageInfo.firstPageNoOnPageList > varPageInfo.pageSize) varPrevPageNo = varPageInfo.firstPageNoOnPageList - 1;
2159		else varPrevPageNo = varPageInfo.firstPageNo;
2160		varPageCon += '<a href="' + theListUrl + varPageInfo.firstPageNo + '" class="prevs">처음페이지</a>';
2161		varPageCon += '<a href="' + theListUrl + varPrevPageNo + '" class="prev">이전페이지</a>';
2162	}
2163	for(var pageNo = varPageInfo.firstPageNoOnPageList ; pageNo <=  varPageInfo.lastPageNoOnPageList ; pageNo ++){
2164		varPageCon += '<span class="page-num">';
2165		if(pageNo == varPageInfo.currentPageNo) {
2166			varPageCon += '<strong>' + pageNo + '</strong>';
2167		}
2168		else{
2169			varPageCon += '<a href="' + theListUrl + pageNo + '"';
2170			varPageCon += '>' + pageNo + '</a>';	
2171		}
2172		varPageCon += '</span>';
2173	}
2174	if(varPageInfo.totalPageCount > varPageInfo.pageSize) {
2175		var varNextPageNo;
2176		if(varPageInfo.lastPageNoOnPageList < varPageInfo.totalPageCount) varNextPageNo = varPageInfo.firstPageNoOnPageList + varPageInfo.pageSize;
2177		else varNextPageNo = varPageInfo.lastPageNo;
2178		varPageCon += '<a href="' + theListUrl + varNextPageNo + '" class="next">다음페이지</a>';
2179		varPageCon += '<a href="' + theListUrl + varPageInfo.lastPageNo + '" class="nexts">끝페이지</a>';
2180	}
2181	
2182	return varPageCon;
2183}
2184
2185function fn_getAjaxPageNate(thePageInfo, theListUrl){
2186	var varPageInfo = thePageInfo;
2187	var varPageCon = '';
2188	if(varPageInfo.totalPageCount > varPageInfo.pageSize) {
2189		var varPrevPageNo;
2190		if(varPageInfo.firstPageNoOnPageList > varPageInfo.pageSize) varPrevPageNo = varPageInfo.firstPageNoOnPageList - 1;
2191		else varPrevPageNo = varPageInfo.firstPageNo;
2192		varPageCon += '<a href="' + theListUrl + varPageInfo.firstPageNo + '" class="list_page_num prevs">
2192<img src="../images/common/btn_paginate_prevs.gif" alt="처음 페이지" /></a>';
2193		varPageCon += '<a href="' + theListUrl + varPrevPageNo + '" class="list_page_num prev"><img src="../images/common/btn_paginate_prev.gif" alt="이전 페이지" /></a>';
2194	}
2195	for(var pageNo = varPageInfo.firstPageNoOnPageList ; pageNo <=  varPageInfo.lastPageNoOnPageList ; pageNo ++){
2196		varPageCon += '<a href="' + theListUrl + pageNo + '" class="list_page_num';
2197		if(pageNo == varPageInfo.currentPageNo) {
2198			varPageCon += ' on';
2199		}
2200		varPageCon += '">' + pageNo + '</a>';
2201	}
2202	if(varPageInfo.totalPageCount > varPageInfo.pageSize) {
2203		var varNextPageNo;
2204		if(varPageInfo.lastPageNoOnPageList < varPageInfo.totalPageCount) varNextPageNo = varPageInfo.firstPageNoOnPageList + varPageInfo.pageSize;
2205		else varNextPageNo = varPageInfo.lastPageNo;
2206		varPageCon += '<a href="' + theListUrl + varNextPageNo + '" class="list_page_num next"><img src="../images/common/btn_paginate_next.gif" alt="다음 페이지" /></a>';
2207		varPageCon += '<a href="' + theListUrl + varPageInfo.lastPageNo + '" class="list_page_num nexts"><img src="../images/common/btn_paginate_nexts.gif" alt="끝페이지" /></a>';
2208	}
2209	
2210	return varPageCon;
2211}
2212
2213function fn_getUsrPageNate(thePageInfo, theListUrl){
2214	var varPageInfo = thePageInfo;
2215	var varPageCon = '';
2216	if(varPageInfo.totalPageCount > varPageInfo.pageSize) {
2217		var varPrevPageNo;
2218		
2219		if(varPageInfo.firstPageNoOnPageList > varPageInfo.pageSize) varPrevPageNo = varPageInfo.firstPageNoOnPageList - 1;
2220		else varPrevPageNo = varPageInfo.firstPageNo;
2221		
2222		varPageCon += '<a href="' + theListUrl + varPageInfo.firstPageNo + '" data-url="' + theListUrl + '" class="list_page_num prevs"><img src="../images/ic_page_first.png" alt="처음 페이지" /></a>';
2223		varPageCon += '<a href="' + theListUrl + varPrevPageNo + '" data-url="' + theListUrl + '" class="list_page_num prev"><img src="../images/ic_page_before.png" alt="이전 페이지" /></a>';
2224	}
2225	for(var pageNo = varPageInfo.firstPageNoOnPageList ; pageNo <=  varPageInfo.lastPageNoOnPageList ; pageNo ++){
2226		varPageCon += '<a href="' + theListUrl + pageNo + '" data-url="' + theListUrl + '" class="list_page_num';
2227		if(pageNo == varPageInfo.currentPageNo) {
2228			varPageCon += ' on';
2229		}
2230		varPageCon += '">' + pageNo + '</a>';
2231	}
2232	if(varPageInfo.totalPageCount > varPageInfo.pageSize) {
2233		var varNextPageNo;
2234		if(varPageInfo.lastPageNoOnPageList < varPageInfo.totalPageCount) varNextPageNo = varPageInfo.firstPageNoOnPageList + varPageInfo.pageSize;
2235		else varNextPageNo = varPageInfo.lastPageNo;
2236		varPageCon += '<a href="' + theListUrl + varNextPageNo + '" data-url="' + theListUrl + '" class="list_page_num next"><img src="../images/ic_page_next.png" alt="다음 페이지" /></a>';
2237		varPageCon += '<a href="' + theListUrl + varPageInfo.lastPageNo + '" data-url="' + theListUrl + '" class="list_page_num nexts"><img src="../images/ic_page_last.png" alt="끝 페이지" /></a>';
2238	}
2239	
2240	return varPageCon;
2241}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.