PageSourceSearch

https://gbsinbo.co.kr/resources/js/common.js

js gbsinbo.co.kr collected 2026-10-06 06:45:49 UTC 58,823 bytes, 2,097 lines download raw bytes

1/*
2 * 치환
3 */
4function replaceAll(str, str1, str2){
5	if( typeof str == "string") {
6		return str.replace(new RegExp(str1, "g"), str2);
7	}
8}
9
10/*
11 * 영문, 숫자만 입력받기
12 */
13function inputEngNum(val){
14	var regExp = new RegExp('^[a-z]+[0-9]*$');
15
16	if(!regExp.test(val)){
17		return "올바르지 않은 값입니다.";
18	}
19
20	return "";
21}
22
23/*
24 * 영문, 숫자만 입력받기
25 */
26function inputEngNum2(obj){
27	$(obj).val($(obj).val().replace(/[^a-z0-9]/gi,''));
28}
29
30/*
31 * 새창 띄우기
32 */
33function popupOpen(url, openName, widthVal, heightVal, top, left){
34	var screenWidth = window.screen.width;
35
36	if(openName == "" || openName == null){
37		openName = "newOpen";
38	}
39	if (widthVal == "" || widthVal == null) {
40		widthVal  = 650;
41	}
42	if (heightVal == "" || heightVal == null) {
43		heightVal = 500;
44	}
45	if(top == "" || top == null){
46		top = 40
47	}
48	if(left == "" || left == null){
49		left = (screenWidth - widthVal) / 2;
50	}
51
52	var winPtr = window.open(url, openName, "width=" + widthVal + ", height=" + heightVal + ", left=" + left + ", top=" + top + ", scrollbars=yes, resizable=no, status=yes, toolbar=no");
53	winPtr.focus();
54	return winPtr;
55}
56
57/*
58 * 새창 띄우기2
59 */
60function popupOpen2(url, openName, widthVal, heightVal, top, left){
61	var screenWidth = window.screen.width;
62
63	if(openName == "" || openName == null){
64		openName = "newOpen2";
65	}
66	if (widthVal == "" || widthVal == null) {
67		widthVal  = 650;
68	}
69	if (heightVal == "" || heightVal == null) {
70		heightVal = 500;
71	}
72	if(top == "" || top == null){
73		top = 60
74	}
75	if(left == "" || left == null){
76		left = ((screenWidth - widthVal) / 2) + 20;
77	}
78
79	var winPtr = window.open(url, openName, "width=" + widthVal + ", height=" + heightVal + ", left=" + left + ", top=" + top + ", scrollbars=yes, resizable=no, status=yes, toolbar=no");
80	winPtr.focus();
81	return winPtr;
82}
83
84/*
85 * 새창 띄우기3
86 */
87function popupOpen3(url, openName, widthVal, heightVal, top, left){
88	var screenWidth = window.screen.width;
89
90	if(openName == "" || openName == null){
91		openName = "newOpen3";
92	}
93	if (widthVal == "" || widthVal == null) {
94		widthVal  = 650;
95	}
96	if (heightVal == "" || heightVal == null) {
97		heightVal = 500;
98	}
99	if(top == "" || top == null){
100		top = 60
101	}
102	if(left == "" || left == null){
103		left = ((screenWidth - widthVal) / 2) + 20;
104	}
105
106	var winPtr = window.open(url, openName, "width=" + widthVal + ", height=" + heightVal + ", left=" + left + ", top=" + top + ", scrollbars=yes, resizable=yes, status=yes, toolbar=no");
107	winPtr.focus();
108	return winPtr;
109}
110
111/*
112 * 레이어팝업
113 */
114function layerPopOpen(obj, focusObj) {
115	$(obj).addClass("open");
116	$(obj).find("input").each( function() {
117		$(this).val("");
118	});
119	$(obj).find("textarea").each( function() {
120		$(this).val("");
121	});
122	$(focusObj).focus();
123}
124
125function layerPopClose(obj) {
126	$(obj).removeClass("open");
127}
128
129/*
130 * 숫자 입력
131 */
132function numeric(){
133	// 숫자만 입력받음
134	$("input.numeric1").on("input", function(){
135        $(this).val($(this).val().replace(/[^0123456789]/g, ''));
136	}).blur(function(){
137		$(this).val($(this).val().replace(/[^0123456789]/g, ''));
138	}).focus(function(){
139		$(this).val($(this).val().replace(/[^0123456789]/g, ''));
140	});
141
142	// 숫자와 '-', '.' 만 입력받음
143	$("input.numeric2").on("input", function(){
144		$(this).val($(this).val().replace(/[^0123456789.\-]/, ''));
145	}).blur(function(){
146		$(this).val($(this).val().replace(/[^0123456789.\-]/, ''));
147	}).focus(function(){
148		$(this).val($(this).val().replace(/[^0123456789.\-]/, ''));
149	});
150
151	// 숫자만 입력받으면서 comma 입력
152	$("input.numeric3").on("input", function(){
153		$(this).val(getComma($(this).val().replace(/[^0123456789]/g, '')));
154
155		if($(this).next("div.numToKorean").length > 0){
156			var isAmount = $(this).hasClass("amount");
157			if(isAmount){
158				$(this).next("div.numToKorean").html("금 " + numToKorean(replaceAll($(this).val(), ",", ""), "HIGH") + "원정");
159			}else{
160				$(this).next("div.numToKorean").html(numToKorean(replaceAll($(this).val(), ",", ""), "HIGH"));
161			}
162		}
163
164		if($(this).val() == ""){
165			$(this).next("div.numToKorean").html("");
166		}
167	});
168}
169
170/*
171 * 영문소문자 입력
172 */
173function englower(){
174	// 숫자만 입력받음
175	$("input.englower").on("input", function(){
176        $(this).val($(this).val().replace(/[^a-z]/g, ''));
177	}).blur(function(){
178		$(this).val($(this).val().replace(/[^a-z]/g, ''));
179	}).focus(function(){
180		$(this).val($(this).val().replace(/[^a-z]/g, ''));
181	});
182}
183
184/*
185 * 라벨을 form 위에 겹치기
186 */
187function labelOverlap(){
188	var arrInput = $("input.input");
189
190	$.each(arrInput, function(){
191		if($(this).val() != ""){
192			if($(this).prev("label") != undefined){
193				$(this).prev("label.over").addClass("hide");
194			}
195		}
196	});
197
198	arrInput.focus(
199		function(){
200			$(this).prev("label").addClass("hide");
201		}
202	).blur(
203		function(){
204			if($(this).val() == ""){
205				$(this).prev("label").removeClass("hide");
206				$(this).prev("label").css("left", $(this).attr("offsetLeft")+3);
207				$(this).prev("label").css("top", $(this).attr("offsetTop"));
208			}
209		}
210	);
211
212	$.each(arrInput, function(){
213		$(this).prev("label.over").css("left", $(this).attr("offsetLeft")+3);
214		$(this).prev("label.over").css("top", $(this).attr("offsetTop"));
215	});
216}
217
218/*
219 * 페이지 이동
220 */
221function pageMove(pageIndex, formID){
222	if(formID == null || formID == ""){
223		formID = "form1";
224	}
225
226	var form = $("#"+formID);
227	form.find("[name=pageIndex]").val(pageIndex);
228	form.attr({action:"", target:"", method:"get"});
229	form.submit();
230}
231
232/*
233 * 상단 페이지 이동
234 */
235function smallPageMove(smallPageNo, formID){
236	if(formID == null || formID == ""){
237		formID = "form1";
238	}
239
240	$("#smallPageNo").val(smallPageNo);
241
242	$("#"+formID).attr({action:"", target:""});
243	$("#"+formID).submit();
244}
245
246/*
247 * 달력
248 */
249function datePicker(obj, date){
250	$.datepicker.regional['ko'] = {
251		closeText : '닫기',
252		prevText : '이전달',
253		nextText : '다음달',
254		currentText : '오늘',
255		monthNames : [ '1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월' ],
256		monthNamesShort : [ '1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월' ],
257		dayNames : [ '일', '월', '화', '수', '목', '금', '토' ],
258		dayNamesShort : [ '일', '월', '화', '수', '목', '금', '토' ],
259		dayNamesMin : [ '일', '월', '화', '수', '목', '금', '토' ],
260		weekHeader : 'Wk',
261		dateFormat : 'yy-mm-dd',
262		firstDay : 0,
263		isRTL : false,
264		showMonthAfterYear : true,
265		yearSuffix: '년',
266		buttonImageOnly: false
267	};
268
269	$.datepicker.setDefaults($.datepicker.regional['ko']);
270
271	$(obj).datepicker({
272		showAnim : "fadeIn",
273		showButtonPanel : true,
274		autoSize : false,
275		dateFormat : "yy-mm-dd",
276		changeMonth : true,
277		changeYear : true,
278		// yearRange : "1913",
279		yearRange : "1915:c+10",
280		duration : 500,
281		showOtherMonths : true,
282		selectOtherMonths : true,
283		defaultDate : date
284	});
285
286	$(obj).attr("autocomplete","off");
287}
288
289function datePicker2(obj){
290	$.datepicker.regional['ko'] = {
291			closeText : '닫기',
292			prevText : '이전달',
293			nextText : '다음달',
294			currentText : '오늘',
295			monthNames : [ '1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월' ],
296			monthNamesShort : [ '1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월' ],
297			dayNames : [ '일', '월', '화', '수', '목', '금', '토' ],
298			dayNamesShort : [ '일', '월', '화', '수', '목', '금', '토' ],
299			dayNamesMin : [ '일', '월', '화', '수', '목', '금', '토' ],
300			weekHeader : 'Wk',
301			dateFormat : 'yymmdd',
302			firstDay : 0,
303			isRTL : false,
304			showMonthAfterYear : true
305	};
306
307	$.datepicker.setDefaults($.datepicker.regional['ko']);
308
309	$(obj).datepicker({
310		showAnim : "fadeIn",
311		showButtonPanel : true,
312		autoSize : false,
313		dateFormat : "yymmdd",
314		changeMonth : true,
315		changeYear : true,
316		// yearRange : "1913",
317		yearRange : "1915:c+10",
318		duration : 500,
319		showOtherMonths : true,
320		selectOtherMonths : true
321	});
322	
323}
324
325function datePicker3(obj, date){
326	$.datepicker.regional['ko'] = {
327		closeText : '닫기',
328		prevText : '이전달',
329		nextText : '다음달',
330		currentText : '오늘',
331		monthNames : [ '1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월' ],
332		monthNamesShort : [ '1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월' ],
333		dayNames : [ '일', '월', '화', '수', '목', '금', '토' ],
334		dayNamesShort : [ '일', '월', '화', '수', '목', '금', '토' ],
335		dayNamesMin : [ '일', '월', '화', '수', '목', '금', '토' ],
336		weekHeader : 'Wk',
337		dateFormat : 'yy-mm-dd',
338		firstDay : 0,
339		isRTL : false,
340		showMonthAfterYear : true,
341		yearSuffix: '년',
342		buttonImageOnly: false
343	};
344
345	$.datepicker.setDefaults($.datepicker.regional['ko']);
346
347	$(obj).datepicker({
348		showAnim : "fadeIn",
349		showButtonPanel : true,
350		autoSize : false,
351		dateFormat : "yy-mm-dd",
352		changeMonth : true,
353		changeYear : true,
354		// yearRange : "1913",
355		yearRange : "1915:c+10",
356		duration : 500,
357		showOtherMonths : true,
358		selectOtherMonths : true,
359		defaultDate : date,
360	    beforeShow: function(input, inst) {
361	    	setTimeout(function(){
362	    		$("<caption>상담희망날짜 - 일,월,화,수,목,금,토</caption>").prependTo(".ui-datepicker-calendar");
363	    		$(".ui-state-highlight").attr("title","오늘");
364	    	}, 500);
365	    }
366	});
367
368	$(obj).attr("autocomplete","off");
369}
370
371function dateTimePicker(obj){
372	$(obj).datetimepicker({
373		format:'Y-m-d H:i',
374		step:10,
375	});
376}
377
378//월 선택 달력
379function dateMonthPicker(obj){
380	$(obj).monthpicker({
381		pattern : 'yyyy-mm'
382		, monthNames:['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월']
383	});
384}
385
386//기간 선택 달력
387function dateRangePicker(obj){
388	obj.dateRangePicker({
389		startOfWeek: 'monday',
390    	separator : ' ~ ',
391    	format: 'YYYY-MM-DD',
392    	language:'ko',
393    	autoClose: true
394	});
395}
396
397// div 중 클래스명이 tabs 인 것들을 탭화 처리
398function tabs(){
399	$("div.tabs ul.list li a.title").mouseover(function(){
400		$(this).parent().parent().find("li.active").removeClass("active");
401		$(this).parent("li").addClass("active");
402
403		$(this).parent().parent().parent().css("height", $(this).parent().parent().parent().find("ul.list li.active ul.content").height()+35);
404	});
405
406	$.each($("div.tabs"), function(){
407		$(this).css("height", $(this).find("ul.list li.active ul.content").height()+35);
408	});
409}
410
411//ajax 페이징
412function ajaxPaging(rowCount, recordCount, pageNo, callback, params){
413	var	pageCount		= 10;	// 페이지당 보여줄 페이징 수
414	var startRecord		= 0;	// 리스트 시작레코드 번호
415	var endRecord		= 0;	// 리스트 끝레코드 번호
416	var totalPage		= 0;	// 전체페이지수
417	var startPage		= 0;	// 시작페이지 번호
418	var endPage			= 0;	// 끝페이지 번호
419
420	//이전페이지 * 보여질레코드수 +1
421	startRecord = parseInt(((pageNo - 1) * rowCount + 1), 10);
422
423	//시작레코드 + 보여질레코드수 -1 구해서 만일 전체레코드수 보다 크다면 endRecord = 전체레코드수
424	endRecord = parseInt((startRecord + rowCount - 1), 10);
425
426	if(endRecord > recordCount){
427		endRecord = recordCount;
428	}
429
430	// (전체글수 / 보여질레코드수)의 나머지가 있을경우 +1
431	if(parseInt(recordCount % rowCount) > 0){
432		totalPage = parseInt((recordCount / rowCount), 10) + 1;
433	}else{
434		totalPage = parseInt((recordCount / rowCount), 10);
435	}
436
437	//(이전페이지 / 보여질페이지수) * 보여질페이지수 +1;
438	startPage = parseInt(((pageNo - 1) / pageCount), 10) * pageCount + 1;
439
440	// (시작페이지 + 보여질페이지수 -1 )가 만일 전체페이지수 보다 크다면 endPage = 전체 페이지수
441	endPage =  startPage + pageCount - 1;
442
443	if(endPage > totalPage){
444		endPage = totalPage;
445	}
446
447	var paramStr = "";
448
449	if(params){
450		for(var i = 0; i < params.length; i++){
451			paramStr += "\""+params[i]+"\"";
452
453			if(i < (params.length - 1)){
454				paramStr += ", ";
455			}
456		}
457	}
458
459	if(startPage == 0){
460		startPage = 1;
461	}
462
463	if(endPage == 0){
464		endPage = 1;
465	}
466
467	var returnStr = "<div class='comp-paging' aria-label='페이지 선택' role='navigation'>";
468	returnStr += "<div>";
469
470
471	if(paramStr != ""){
472		returnStr += "<p class='prev'><a href='javascript:;' onclick='"+callback+"("+paramStr+", "+ (startPage == 1 ? 1 : (startPage - 1)) + ");' ><span>이전</span></a></p>";
473	}else{
474		returnStr += "<p class='prev'><a href='javascript:;' onclick='"+callback+"("+ (startPage == 1 ? 1 : (startPage - 1)) + ");' ><span>이전</span></a></p>";
475	}
476
477	returnStr += "<ol class='number'>";
478
479	if(startPage > 0){
480		for(var i = startPage; i <= endPage; i++){
481			if(i == pageNo){
482				returnStr += "<li>
482<a href='javascript:void(0)' aria-live='assertive' aria-current='page'><span>"+i+"</span></a></li>";
483			}else{
484				if(paramStr != ""){
485					returnStr += "<li><a href='javascript:void(0)' aria-live='assertive' onclick='"+callback+"("+paramStr+", "+i+");'><span>"+i+"</span></a></li>";
486				}else{
487					returnStr += "<li><a href='javascript:void(0)' aria-live='assertive' onclick='"+callback+"("+i+");'><span>"+i+"</span></a></li>";
488				}
489			}
490		}
491	}
492
493	returnStr += "</ol>";
494
495	if(paramStr != ""){
496		returnStr += "<p class='next'><a href='javascript:;' onclick='"+callback+"("+paramStr+", " + (endPage == totalPage ? totalPage : (endPage + 1)) + ");'><span>다음</span></a></p>";
497	}else{
498		returnStr += "<p class='next'><a href='javascript:;' onclick='"+callback+"(" + (endPage == totalPage ? totalPage : (endPage + 1)) + ");'><span>다음</span></a></p>";
499	}
500
501	returnStr += "</div>";
502	returnStr += "</div>";
503
504	return returnStr;
505}
506
507function ajaxFrontPaging(rowCount, recordCount, pageNo, callback, params){
508	var	pageCount		= 10;	// 페이지당 보여줄 페이징 수
509	var startRecord		= 0;	// 리스트 시작레코드 번호
510	var endRecord		= 0;	// 리스트 끝레코드 번호
511	var totalPage		= 0;	// 전체페이지수
512	var startPage		= 0;	// 시작페이지 번호
513	var endPage			= 0;	// 끝페이지 번호
514
515	//이전페이지 * 보여질레코드수 +1
516	startRecord = parseInt(((pageNo - 1) * rowCount + 1), 10);
517
518	//시작레코드 + 보여질레코드수 -1 구해서 만일 전체레코드수 보다 크다면 endRecord = 전체레코드수
519	endRecord = parseInt((startRecord + rowCount - 1), 10);
520
521	if(endRecord > recordCount){
522		endRecord = recordCount;
523	}
524
525	// (전체글수 / 보여질레코드수)의 나머지가 있을경우 +1
526	if(parseInt(recordCount % rowCount) > 0){
527		totalPage = parseInt((recordCount / rowCount), 10) + 1;
528	}else{
529		totalPage = parseInt((recordCount / rowCount), 10);
530	}
531
532	//(이전페이지 / 보여질페이지수) * 보여질페이지수 +1;
533	startPage = parseInt(((pageNo - 1) / pageCount), 10) * pageCount + 1;
534
535	// (시작페이지 + 보여질페이지수 -1 )가 만일 전체페이지수 보다 크다면 endPage = 전체 페이지수
536	endPage =  startPage + pageCount - 1;
537
538	if(endPage > totalPage){
539		endPage = totalPage;
540	}
541
542	var paramStr = "";
543
544	if(params){
545		for(var i = 0; i < params.length; i++){
546			paramStr += "\""+params[i]+"\"";
547
548			if(i < (params.length - 1)){
549				paramStr += ", ";
550			}
551		}
552	}
553
554	if(startPage == 0){
555		startPage = 1;
556	}
557
558	if(endPage == 0){
559		endPage = 1;
560	}
561
562	var returnStr = "<ul class='page'>";
563	returnStr += "<ul class='pagination time-paging fclear'>";
564
565	if(paramStr != ""){
566		returnStr += "<li class='prev'><a href='javascript:;' class='prev' onclick='"+callback+"("+paramStr+", "+ (startPage == 1 ? 1 : (startPage - 1)) + ");' ><span class='none'>이전</span></a></li>";
567	}else{
568		returnStr += "<li class='prev'><a href='javascript:;' class='prev' onclick='"+callback+"("+ (startPage == 1 ? 1 : (startPage - 1)) + ");' ><span class='none'>이전</span></a></li>";
569	}
570
571	if(startPage > 0){
572		for(var i = startPage; i <= endPage; i++){
573			if(i == pageNo){
574				returnStr += "<li class='active'><a href='#'>"+i+"</span></li>";
575			}else{
576				if(paramStr != ""){
577					returnStr += "<li><a href='javascript:;' onclick='"+callback+"("+paramStr+", "+i+");'>"+i+"</a></li>";
578				}else{
579					returnStr += "<li><a href='javascript:;' onclick='"+callback+"("+i+");'>"+i+"</a></li>";
580				}
581			}
582		}
583	}
584
585	if(paramStr != ""){
586		returnStr += "<li class='next'><a href='javascript:;' class='next' onclick='"+callback+"("+paramStr+", " + (endPage == totalPage ? totalPage : (endPage + 1)) + ");'><span class='none'>다음</span></a></li>";
587	}else{
588		returnStr += "<li class='next'><a href='javascript:;' class='next' onclick='"+callback+"(" + (endPage == totalPage ? totalPage : (endPage + 1)) + ");'><span class='none'>다음</span></a></li>";
589	}
590
591	returnStr += "</ul>";
592	returnStr += "</ul>";
593
594	return returnStr;
595}
596
597// 천 단위로 컴마 붙이기
598function getComma(n) {
599	var reg = /(^[+-]?\d+)(\d{3})/;   // 정규식
600	n += '';                          // 숫자를 문자열로 변환
601
602	while (reg.test(n)){
603		n = n.replace(reg, '$1' + ',' + '$2');
604	}
605
606	return n;
607}
608
609// 주소 복사
610function copyUrl() {
611	if($.browser.msie){
612		window.clipboardData.setData("text", window.location.href);
613	    alert("주소가 클립보드에 복사되었습니다.");
614	}else{
615		alert("주소복사 기능은 Internet Explorer에서만 가능합니다.");
616	}
617}
618
619/*
620*ChangeFocus(cur,next)
621* 텍스트 필드에서 현재 입력한 값이 필드에 설정한 maxlength와 같은면 다음 필드로 포인트를 이동
622* <input type="text" id="idNum1" name="idNum1" maxlength="6" onkeyup="ChangeFocus(this,idNum2)" />
623* <input type="text" id="idNum2" name="idNum2" maxlength="7" />
624* 2011-12-29
625*/
626function changeFocus(cur,next)
627{
628	maxlenth = parseInt(cur.getAttribute("maxlength"),10);
629	if( cur.value.length == maxlenth) {
630		if(typeof next != "object")
631			next = document.getElementById(next);
632		if(next != undefined)
633			next.focus();
634	}
635}
636
637function fileDown(encFileName){
638	document.location.href = contextPath+"/common/filedown.tc?encFileName="+encFileName;
639}
640
641function getHtml(text){
642	var html = "";
643
644	if(text != "") {
645		html = replaceAll(text, "&", "&amp;");
646		html = replaceAll(html, "<", "&lt;");
647		html = replaceAll(html, ">", "&gt;");
648		html = replaceAll(html, " ", "&nbsp;");
649		html = replaceAll(html, "\n", "<br />");
650		html = replaceAll(html, "\r\n", "<br />");
651		html = replaceAll(html, "\'", "&apos;");
652	    html = replaceAll(html, "\"", "&quot;");
653	}
654
655	return html;
656}
657
658function getHtml2(text){
659	var html = "";
660
661	if(text != "") {
662		html = replaceAll(text, "&", "&amp;");
663		html = replaceAll(html, "<", "&lt;");
664		html = replaceAll(html, ">", "&gt;");
665		html = replaceAll(html, " ", "&nbsp;");
666		html = replaceAll(html, "\'", "&apos;");
667		html = replaceAll(html, "\"", "&quot;");
668	}
669
670	return html;
671}
672
673function validation(){
674	var bool = true;
675	var msg = "";
676
677	// 필수 입력값 체크
678	$.each($(".notNull"), function(){
679		if($(this).val() == "" || $(this).val() == null || $(this).val() == undefined){
680			var alertObj = $(this).attr("title");
681			if(alertObj == undefined){
682				alertObj = $(this).attr("alt");
683			}
684
685			msg = (alertObj + " 항목은 반드시 입력하셔야 합니다.");
686
687			if($(this).hasClass("editor")){
688				editorFocus($(this).attr("id"));
689			}else{
690				$(this).focus();
691			}
692
693			bool = false;
694			return bool;
695		}
696	});
697
698	// 최소길이 입력값 체크
699	if(bool){
700		$.each($("input[class*='min-']"), function(){
701			var strClass = $(this).attr("class");
702			strClass = strClass.substring(strClass.indexOf("min-"));
703
704			var minLength = 0;
705			if(strClass.indexOf(" ") == -1){
706				minLength = strClass.substring(strClass.indexOf("min-") + 4);
707			}else{
708				minLength = strClass.substring(strClass.indexOf("min-") + 4, strClass.indexOf(" "));
709			}
710
711			var alertObj = $(this).attr("title");
712
713			if($(this).val().length < minLength){
714				msg = (alertObj + " 항목은 최소 " + minLength + " 자리 이상이어야 합니다.");
715				$(this).focus();
716				bool = false;
717				return bool;
718			}
719		});
720	}
721
722	// 최대 길이 입력값 체크
723	if(bool){
724		$.each($("input[class*='max-']"), function(){
725			var strClass = $(this).attr("class");
726			strClass = strClass.substring(strClass.indexOf("max-"));
727
728			var maxLength = 0;
729			if(strClass.indexOf(" ") == -1){
730				maxLength = strClass.substring(strClass.indexOf("max-") + 4);
731			}else{
732				maxLength = strClass.substring(strClass.indexOf("max-") + 4, strClass.indexOf(" "));
733			}
734
735			var alertObj = $(this).attr("title");
736
737			if($(this).val().length > maxLength){
738				msg = (alertObj + " 항목은 최대 " + maxLength + " 자리 이하여야 합니다.");
739				$(this).focus();
740				bool = false;
741				return bool;
742			}
743		});
744	}
745
746	// 값비교 체크(원천 input 의 class 명에 compare-비교값id 를 입력하면 자동 체크)
747	if(bool){
748		$.each($("input[class*='compare-']"), function(){
749			var strClass = $(this).attr("class");
750			var compareId = strClass.substring(strClass.indexOf("compare-") + 8);
751
752			var prevTitle = $(this).attr("title");
753			if(prevTitle == undefined){
754				prevTitle = $(this).attr("alt");
755			}
756
757			var compareTitle = $("#"+compareId).attr("title");
758			if(compareTitle == undefined){
759				compareTitle = $("#"+compareId).attr("alt");
760			}
761
762			if($(this).val() != $("#"+compareId).val()){
763				msg = (prevTitle + " 항목과 " + compareTitle + " 항목의 값은 일치해야 합니다.");
764				$(this).focus();
765				bool = false;
766				return bool;
767			}
768		});
769	}
770
771	// 숫자만 입력 체크
772	if(bool){
773		$.each($(".onlyNum"), function(){
774			var alertObj = $(this).attr("title");
775			if(alertObj == undefined){
776				alertObj = $(this).attr("alt");
777			}
778
779			if(!checkNumber($(this).val())){
780				msg = (alertObj + " 항목은 숫자만 입력 가능합니다.");
781
782				$(this).focus();
783
784				bool = false;
785				return bool;
786			}else{
787				if($(this).hasClass("notZero") && $(this).val() == "0"){
788					msg = (alertObj + " 항목은 0이상의 값이 입력되어야 합니다.");
789
790					$(this).focus();
791
792					bool = false;
793					return bool;
794				}
795			}
796		});
797	}
798
799	// 영문 및 숫자만 입력 체크
800	if(bool){
801		$.each($(".engNum"), function(){
802			if(!checkEnglishNum($(this).val())){
803				var alertObj = $(this).attr("title");
804				if(alertObj == undefined){
805					alertObj = $(this).attr("alt");
806				}
807
808				msg = (alertObj + " 항목은 영문 및 숫자만 입력 가능합니다.");
809
810				$(this).focus();
811
812				bool = false;
813				return bool;
814			}
815		});
816	}
817
818
819	// 이메일 주소 체크
820	if(bool){
821		$.each($(".email"), function(){
822			var email = $(this).val();
823			var regex=/^[-A-Za-z0-9_]+[-A-Za-z0-9_.]*[@]{1}[-A-Za-z0-9_]+[-A-Za-z0-9_.]*[.]{1}[A-Za-z]{1,5}$/;
824
825			if(regex.test(email) === false) {
826				var alertObj = $(this).attr("title");
827				if(alertObj == undefined){
828					alertObj = $(this).attr("alt");
829				}
830
831				msg = (alertObj + " 항목의 이메일 형식이 잘못되었습니다.");
832
833				$(this).focus();
834
835				bool = false;
836				return bool;
837			}
838		});
839	}
840
841	return {bool:bool, msg:msg};
842}
843
844function validationObj(obj){
845	var bool = true;
846	var msg = "";
847
848	// 필수 입력값 체크
849	if($(obj).hasClass("notNull")){
850		if($(obj).val() == "" || $(obj).val() == null || $(obj).val() == undefined){
851			var alertObj = $(obj).attr("title");
852			if(alertObj == undefined){
853				alertObj = $(obj).attr("alt");
854			}
855
856			msg = (alertObj + " 항목은 반드시 입력하셔야 합니다.");
857
858			if($(obj).hasClass("editor")){
859				editorFocus($(obj).attr("id"));
860			}else{
861				$(obj).focus();
862			}
863
864			bool = false;
865		}
866	}
867
868	// 최소길이 입력값 체크
869	if(bool){
870		if($(obj).is("[class*='min-']")){
871			var strClass = $(obj).attr("class");
872			strClass = strClass.substring(strClass.indexOf("min-"));
873
874			var minLength = 0;
875			if(strClass.indexOf(" ") == -1){
876				minLength = strClass.substring(strClass.indexOf("min-") + 4);
877			}else{
878				minLength = strClass.substring(strClass.indexOf("min-") + 4, strClass.indexOf(" "));
879			}
880
881			var alertObj = $(obj).attr("title");
882
883			if($(obj).val().length < minLength){
884				msg = (alertObj + " 항목은 최소 " + minLength + " 자리 이상이어야 합니다.");
885				bool = false;
886			}
887		}
888	}
889
890	// 최대 길이 입력값 체크
891	if(bool){
892		if($(obj).is("[class*='max-']")){
893			var strClass = $(obj).attr("class");
894			strClass = strClass.substring(strClass.indexOf("max-"));
895
896			var maxLength = 0;
897			if(strClass.indexOf(" ") == -1){
898				maxLength = strClass.substring(strClass.indexOf("max-") + 4);
899			}else{
900				maxLength = strClass.substring(strClass.indexOf("max-") + 4, strClass.indexOf(" "));
901			}
902
903			var alertObj = $(obj).attr("title");
904
905			if($(obj).val().length > maxLength){
906				msg = (alertObj + " 항목은 최대 " + maxLength + " 자리 이하여야 합니다.");
907				bool = false;
908			}
909		}
910	}
911
912	// 값비교 체크
913	if(bool){
914		if($(obj).is("[class*='compare-']")){
915			var strClass = $(obj).attr("class");
916			var compareId = strClass.substring(strClass.indexOf("compare-") + 8);
917
918			var prevTitle = $(obj).attr("title");
919			if(prevTitle == undefined){
920				prevTitle = $(obj).attr("alt");
921			}
922
923			var compareTitle = $("#"+compareId).attr("title");
924			if(compareTitle == undefined){
925				compareTitle = $("#"+compareId).attr("alt");
926			}
927
928			if($(obj).val() != $("#"+compareId).val()){
929				msg = (prevTitle + " 항목과 " + compareTitle + " 항목의 값은 일치해야 합니다.");
930				bool = false;
931			}
932		}
933	}
934
935	// 숫자만 입력 체크
936	if(bool){
937		if($(obj).hasClass("onlyNum")){
938			var alertObj = $(obj).attr("title");
939			if(alertObj == undefined){
940				alertObj = $(obj).attr("alt");
941			}
942
943			if(!checkNumber($(obj).val())){
944				msg = (alertObj + " 항목은 숫자만 입력 가능합니다.");
945
946				bool = false;
947			}else{
948				if($(obj).hasClass("notZero") && $(this).val() == "0"){
949					msg = (alertObj + " 항목은 0이상의 값이 입력되어야 합니다.");
950
951					bool = false;
952				}
953			}
954		}
955	}
956
957	// 영문 및 숫자만 입력 체크
958	if(bool){
959		if($(obj).hasClass("engNum")){
960			if(!checkEnglishNum($(obj).val())){
961				var alertObj = $(obj).attr("title");
962				if(alertObj == undefined){
963					alertObj = $(obj).attr("alt");
964				}
965
966				msg = (alertObj + " 항목은 영문 및 숫자만 입력 가능합니다.");
967
968				bool = false;
969			}
970		}
971	}
972
973	// 이메일 주소 체크
974	if($(obj).hasClass("email")){
975		var email = $(obj).val();
976		var regex=/^[-A-Za-z0-9_]+[-A-Za-z0-9_.]*[@]{1}[-A-Za-z0-9_]+[-A-Za-z0-9_.]*[.]{1}[A-Za-z]{1,5}$/;
977
978		if(regex.test(email) === false) {
979			msg = "잘못된 이메일 형식입니다.";
980			bool = false;
981		}
982	}
983
984	return {bool:bool, msg:msg};
985}
986
987function validationParents(obj){
988	var bool = true;
989	var msg = "";
990
991	// 필수 입력값 체크
992	$.each($(obj).find($(".notNull")), function(){
993		if($(this).val() == "" || $(this).val() == null || $(this).val() == undefined){
994			var alertObj = $(this).attr("title");
995			if(alertObj == undefined){
996				alertObj = $(this).attr("alt");
997			}
998
999			msg = (alertObj + " 항목은 반드시 입력하셔야 합니다.");
1000
1001			if($(this).hasClass("editor")){
1002				editorFocus($(this).attr("id"));
1003			}else{
1004				$(this).focus();
1005			}
1006
1007			bool = false;
1008			return bool;
1009		}
1010	});
1011
1012	// 최소길이 입력값 체크
1013	if(bool){
1014		$.each($(obj).find($("input[class*='min-']")), function(){
1015			var strClass = $(this).attr("class");
1016			strClass = strClass.substring(strClass.indexOf("min-"));
1017
1018			var minLength = 0;
1019			if(strClass.indexOf(" ") == -1){
1020				minLength = strClass.substring(strClass.indexOf("min-") + 4);
1021			}else{
1022				minLength = strClass.substring(strClass.indexOf("min-") + 4, strClass.indexOf(" "));
1023			}
1024
1025			var alertObj = $(this).attr("title");
1026
1027			if($(this).val().length < minLength){
1028				msg = (alertObj + " 항목은 최소 " + minLength + " 자리 이상이어야 합니다.");
1029				$(this).focus();
1030				bool = false;
1031				return bool;
1032			}
1033		});
1034	}
1035
1036	// 최대 길이 입력값 체크
1037	if(bool){
1038		$.each($(obj).find($("input[class*='max-']")), function(){
1039			var strClass = $(this).attr("class");
1040			strClass = strClass.substring(strClass.indexOf("max-"));
1041
1042			var maxLength = 0;
1043			if(strClass.indexOf(" ") == -1){
1044				maxLength = strClass.substring(strClass.indexOf("max-") + 4);
1045			}else{
1046				maxLength = strClass.substring(strClass.indexOf("max-") + 4, strClass.indexOf(" "));
1047			}
1048
1049			var alertObj = $(this).attr("title");
1050
1051			if($(this).val().length > maxLength){
1052				msg = (alertObj + " 항목은 최대 " + maxLength + " 자리 이하여야 합니다.");
1053				$(this).focus();
1054				bool = false;
1055				return bool;
1056			}
1057		});
1058	}
1059
1060	// 값비교 체크(원천 input 의 class 명에 compare-비교값id 를 입력하면 자동 체크)
1061	if(bool){
1062		$.each($(obj).find($("input[class*='compare-']")), function(){
1063			var strClass = $(this).attr("class");
1064			var compareId = strClass.substring(strClass.indexOf("compare-") + 8);
1065
1066			var prevTitle = $(this).attr("title");
1067			if(prevTitle == undefined){
1068				prevTitle = $(this).attr("alt");
1069			}
1070
1071			var compareTitle = $("#"+compareId).attr("title");
1072			if(compareTitle == undefined){
1073				compareTitle = $("#"+compareId).attr("alt");
1074			}
1075
1076			if($(this).val() != $("#"+compareId).val()){
1077				msg = (prevTitle + " 항목과 " + compareTitle + " 항목의 값은 일치해야 합니다.");
1078				$(this).focus();
1079				bool = false;
1080				return bool;
1081			}
1082		});
1083	}
1084
1085	// 숫자만 입력 체크
1086	if(bool){
1087		$.each($(obj).find($(".onlyNum")), function(){
1088			var alertObj = $(this).attr("title");
1089			if(alertObj == undefined){
1090				alertObj = $(this).attr("alt");
1091			}
1092
1093			if(!checkNumber($(this).val())){
1094				msg = (alertObj + " 항목은 숫자만 입력 가능합니다.");
1095
1096				$(this).focus();
1097
1098				bool = false;
1099				return bool;
1100			}else{
1101				if($(this).hasClass("notZero") && $(this).val() == "0"){
1102					msg = (alertObj + " 항목은 0이상의 값이 입력되어야 합니다.");
1103
1104					$(this).focus();
1105
1106					bool = false;
1107					return bool;
1108				}
1109			}
1110		});
1111	}
1112
1113	// 영문 및 숫자만 입력 체크
1114	if(bool){
1115		$.each($(obj).find($(".engNum")), function(){
1116			if(!checkEnglishNum($(this).val())){
1117				var alertObj = $(this).attr("title");
1118				if(alertObj == undefined){
1119					alertObj = $(this).attr("alt");
1120				}
1121
1122				msg = (alertObj + " 항목은 영문 및 숫자만 입력 가능합니다.");
1123
1124				$(this).focus();
1125
1126				bool = false;
1127				return bool;
1128			}
1129		});
1130	}
1131
1132
1133	// 이메일 주소 체크
1134	if(bool){
1135		$.each($(obj).find($(".email")), function(){
1136			var email = $(this).val();
1137			var regex=/^[-A-Za-z0-9_]+[-A-Za-z0-9_.]*[@]{1}[-A-Za-z0-9_]+[-A-Za-z0-9_.]*[.]{1}[A-Za-z]{1,5}$/;
1138
1139			if(regex.test(email) === false) {
1140				var alertObj = $(this).attr("title");
1141				if(alertObj == undefined){
1142					alertObj = $(this).attr("alt");
1143				}
1144
1145				msg = (alertObj + " 항목의 이메일 형식이 잘못되었습니다.");
1146
1147				$(this).focus();
1148
1149				bool = false;
1150				return bool;
1151			}
1152		});
1153	}
1154
1155	return {bool:bool, msg:msg};
1156}
1157
1158/* ********************************************************
1159 * 필드값 Number 체크 함수
1160 ******************************************************** */
1161function checkNumber(str) {
1162	var flag = true;
1163	if (str.length > 0) {
1164		for (var i = 0; i < str.length; i++) {
1165			if (str.charAt(i) < '0' || str.charAt(i) > '9') {
1166				if(str.charAt(i) != '-'){
1167					flag = false;
1168				}
1169			}
1170		}
1171	}
1172	return flag;
1173}
1174
1175/* ********************************************************
1176 * 필드값 영문 체크 함수
1177 ******************************************************** */
1178function checkEnglish(str) {
1179	var regexp = /[a-zA-Z]/;
1180	var bool = true;
1181
1182	for(var i = 0; i < str.length; i++){
1183		var chkStr = str.charAt(i);
1184		bool = regexp.test(chkStr);
1185
1186		if(!bool){
1187			return bool;
1188		}
1189	}
1190
1191    return bool;
1192}
1193
1194/* ********************************************************
1195 * 필드값 영문/숫자 체크 함수
1196 ******************************************************** */
1197function checkEnglishNum(str) {
1198	var regexp = /[a-zA-Z0-9]/;
1199	var bool = true;
1200
1201	for(var i = 0; i < str.length; i++){
1202		var chkStr = str.charAt(i);
1203		bool = regexp.test(chkStr);
1204
1205		if(!bool){
1206			return bool;
1207		}
1208	}
1209
1210	return bool;
1211}
1212
1213function addCss(cssPath){
1214	$("head").append("<link rel=\"stylesheet\" href=\""+cssPath+"\" type=\"text/css\">");
1215}
1216
1217// 전체 체크/해제
1218function fnCheckAll(objName){
1219	$("#btnCheckAll").click(function(){
1220		if($(this).find("span").text() == "선택"){
1221			$("input[name='"+objName+"']").prop("checked", true);
1222			$(this).find("span").text("해제");
1223		}else if($(this).find("span").text() == "해제"){
1224			$("input[name='"+objName+"']").prop("checked", false);
1225			$(this).find("span").text("선택");
1226		}
1227	});
1228}
1229
1230function execDaumPostcode(obj) {
1231	new daum.Postcode({
1231
1232		oncomplete: function(data) {
1233			var fullAddr = ''; // 최종 주소 변수
1234            var extraAddr = ''; // 조합형 주소 변수
1235
1236            var fullAddr = ''; // 최종 주소 변수
1237            var extraAddr = ''; // 조합형 주소 변수
1238
1239            // 사용자가 선택한 주소 타입에 따라 해당 주소 값을 가져온다.
1240            if (data.userSelectedType === 'R') { // 사용자가 도로명 주소를 선택했을 경우
1241                fullAddr = data.roadAddress;
1242            } else { // 사용자가 지번 주소를 선택했을 경우(J)
1243                fullAddr = data.jibunAddress;
1244            }
1245
1246            // 사용자가 선택한 주소가 도로명 타입일때 조합한다.
1247            if(data.userSelectedType === 'R'){
1248                //법정동명이 있을 경우 추가한다.
1249                if(data.bname !== ''){
1250                    extraAddr += data.bname;
1251                }
1252                // 건물명이 있을 경우 추가한다.
1253                if(data.buildingName !== ''){
1254                    extraAddr += (extraAddr !== '' ? ', ' + data.buildingName : data.buildingName);
1255                }
1256                // 조합형주소의 유무에 따라 양쪽에 괄호를 추가하여 최종 주소를 만든다.
1257                fullAddr += (extraAddr !== '' ? ' ('+ extraAddr +')' : '');
1258            }
1259
1260            // 선택된 주소 정보를 해당 필드에 넣는다.
1261            $(obj).parent().find('input[name="addr"]').val(fullAddr);
1262            $(obj).parent().parent().find('input[name="dtlAddr"]').focus();
1263		},
1264	}).open();
1265}
1266
1267/** Cookie 가져오기 */
1268function getCookie(name){
1269	var start=document.cookie.indexOf(name+'=');
1270	var len=start+name.length+1;
1271	if((!start)&&(name!=document.cookie.substring(0,name.length))) return null;
1272	if(start==-1) return null;var end=document.cookie.indexOf(';',len);
1273	if(end==-1)end=document.cookie.length;
1274
1275	return unescape(document.cookie.substring(len,end));
1276}
1277
1278/** Cookie 등록하기 */
1279function setCookie(name,value,expires,path,domain,secure){
1280	var today=new Date();
1281	today.setTime(today.getTime());
1282	if(expires){expires=expires*1000*60*60*24;}
1283
1284	var expires_date=new Date(today.getTime()+(expires));
1285	document.cookie=name+"="+escape(value)+((expires)?";expires="+expires_date.toGMTString():"")+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+((secure)?";secure":"");
1286}
1287
1288/** Cookie 삭제하기 */
1289function deleteCookie(name,path,domain){
1290	//if(getCookie(name)) document.cookie=name+'='+((path)?';path='+path:'')+((domain)?';domain='+domain:'')+';expires=Thu, 01-Jan-1970 00:00:01 GMT';
1291	if(getCookie(name)) document.cookie=name+'='+((path)?';path='+path:'')+((domain)?';domain='+domain:'')+';';
1292}
1293
1294function goLogin(){
1295	document.location.href = contextPath + "/login/login.tc";
1296}
1297
1298function goNamecheck(siteDir){
1299	var url = "";
1300	if(siteDir != ""){
1301		url = contextPath + "/namecheck/login.tc?siteDir="+siteDir;
1302	}else{
1303		url = contextPath + "/namecheck/login.tc";
1304	}
1305
1306	var referLink = document.createElement('a');
1307    referLink.href = url;
1308    document.body.appendChild(referLink);
1309    referLink.click();
1310}
1311
1312function goPage(url) {
1313	document.location.href = contextPath + url;
1314}
1315
1316function getBoardListJson(mngNo, pageIndex, recordCountPerPage){
1317	var resultList;
1318
1319	$.ajax({
1320		type: "POST",
1321		url: contextPath+"/board/list.json",
1322		async:false,
1323		data: {mngNo:mngNo, pageIndex:pageIndex, recordCountPerPage:recordCountPerPage},
1324		success: function(data){
1325			resultList = data.resultList;
1326		},
1327		error: function(request, status, error){
1328			alert("code:"+request.status+"\r\n"+"message:"+request.responseText+"\r\n"+"error:"+error);
1329		},
1330		complete: function(){
1331		}
1332	});
1333
1334	return resultList;
1335}
1336
1337function unifiedSearch(){
1338	var keyword = $("#unifiedSearchKeyword").val();
1339
1340	if(keyword == ""){
1341		alert("검색어를 입력하세요.");
1342		return false;
1343	}
1344
1345	if(keyword.length < 2){
1346		alert("검색어는 2글자 이상 입력하세요.");
1347		return false;
1348	}
1349}
1350
1351/*
1352 * 클래스 토글
1353 */
1354function toggleClass($obj,cls) {
1355	if($obj.hasClass(cls)) {
1356		$obj.removeClass(cls);
1357	} else {
1358		$obj.addClass(cls);
1359	}
1360}
1361
1362/*
1363 * iframe 높이 자동 설정
1364 */
1365function iframeAutoResize(obj) {
1366	var iframeHeight=(obj).contentWindow.document.body.scrollHeight + "px";
1367	(obj).style.height=iframeHeight;
1368}
1369
1370/* ********************************************************
1371 * TRIM
1372 ******************************************************** */
1373function strTrim(str) {
1374	if(str.length==0){
1375		return "";
1376	}else{
1377		return str.replace(/(^\s*)|(\s*$)/gi, "");
1378	}
1379}
1380
1381/* ********************************************************
1382 * Byte 길이 체크
1383 ******************************************************** */
1384function getByteLength(inputText, inputLen) {
1385	var len = 0;
1386	for (var i = 0; i < inputText.length; i++) {
1387		var c = escape(inputText.charAt(i));
1388		if (c.length == 1) {
1389			len++;
1390		} else if (c.indexOf("%u") != -1) {
1391			len += 2;
1392		} else if (c.indexOf("%") != -1) {
1393			len += c.length / 3;
1394		}
1395	}
1396	if (len >
1396 inputLen) {
1397		return false;
1398	}
1399	return true;
1400}
1401
1402/**********************************************************
1403 * 길이 체크 메시지
1404 * str :컬럼ID
1405 * text :컬럼명
1406 * nullCked : Null 체크 여부
1407 * size:사이즈
1408 ******************************************************** */
1409function validChecked(str, text, nullCkYn, size) {
1410	//널체크
1411	var useCnVal = strTrim($("#"+str).val());
1412	if (nullCkYn == 'Y' && useCnVal.length == 0) {
1413		$("#"+str).focus();
1414		alert(text + '을(를) 입력(선택)해 주십시오.');
1415		return false;
1416	}
1417
1418	//바이트길이 체크
1419	if (!getByteLength(useCnVal, size)) {
1420		$("#"+str).focus();
1421		alert(text + '의 입력길이가 초과되었습니다.\n' + size + 'Byte 이하로 작성해 주십시오.');
1422		return false;
1423	}
1424	return true;
1425}
1426
1427function validCheckedAN(str, text, nullCkYn, size) {
1428	//널체크
1429	var useCnVal = strTrim($("#"+str).val());
1430	if (nullCkYn == 'Y' && useCnVal.length == 0) {
1431		$("#"+str).focus();
1432		alert(text + '을(를) 입력(선택)해 주십시오.');
1433		return false;
1434	}
1435
1436	//바이트길이 체크
1437	if (!getByteLength(useCnVal, size)) {
1438		$("#"+str).focus();
1439		alert(text + '의 입력길이가 초과되었습니다.\n' + size + 'Byte 이하로 작성해 주십시오.');
1440		return false;
1441	}
1442
1443	var pattern = /[^(-@a-zA-Z0-9)]/;
1444	//한글제외
1445	if (pattern.test(useCnVal)) {
1446		$("#"+str).focus();
1447		alert(text + '은(는) 영문 또는 숫자만 허용합니다.');
1448		return false;
1449	}
1450	return true;
1451}
1452
1453function validMaxChecked(str, text, nullCkYn, size, max) {
1454	var val = $("#"+str).val();
1455	//널체크
1456	var useCnVal = strTrim(val);
1457	if (nullCkYn == 'Y' && useCnVal.length == 0) {
1458		alert(text + '을(를) 입력해 주십시오.');
1459		$("#"+str).focus();
1460		return false;
1461	}
1462
1463	//바이트길이 체크
1464	if (!getByteLength(useCnVal, size)) {
1465		alert(text + '의 입력길이가 초과되었습니다.\n' + size + 'Byte 이하로 입력해 주십시오.');
1466		$("#"+str).focus();
1467		return false;
1468	}
1469
1470	// 최고값 체크
1471	if (val > max) {
1472		alert(text + '은(는) ' + max + '보다 작은값으로  입력해 주십시오.');
1473		$("#"+str).focus();
1474		return false;
1475	}
1476
1477	return true;
1478}
1479
1480// get방식 목록보기
1481function fnListGet(url, className){
1482	if(className == undefined || className == ""){
1483		className = "search_input";
1484	}
1485
1486	$("."+className).each(function(index){
1487		if(index == 0){
1488			url += "?";
1489		}else{
1490			url += "&";
1491		}
1492
1493		url += $(this).attr("name");
1494		url += "=";
1495		url += $(this).val();
1496	});
1497
1498	document.location.href = url;
1499}
1500
1501function autoCompleteBtn(){
1502	$("button.btn-auto-complete").click(function(){
1503		$(this).prev("input").focus();
1504		$(this).prev("input").autocomplete("search", $(this).prev("input").val());
1505	});
1506}
1507
1508// 자동 하이픈 추가
1509// 연락처
1510function autoHypenHp($obj) {
1511	var tmp = "";
1512	var str = $obj.val();
1513	str = str.replace(/[^0-9]/g, '');
1514	if( str.length < 4 ) {
1515		tmp = str;
1516	} else if( str.length < 7 ) {
1517		tmp += str.substr(0,3);
1518		tmp += "-";
1519		tmp += str.substr(3);
1520	} else if( str.length < 11 ) {
1521		tmp += str.substr(0,3);
1522		tmp += "-";
1523		tmp += str.substr(3,3);
1524		tmp += "-";
1525		tmp += str.substr(6);
1526	} else {
1527		tmp += str.substr(0,3);
1528		tmp += "-";
1529		tmp += str.substr(3,4);
1530		tmp += "-";
1531		tmp += str.substr(7,4);
1532	}
1533	str = tmp;
1534	$obj.val(str);
1535}
1536
1537//사업자번호
1538function autoHypenBizNum($obj) {
1539	var tmp = "";
1540	var str = $obj.val();
1541	str = str.replace(/[^0-9]/g, '');
1542	if( str.length < 4 ) {
1543		tmp = str;
1544	} else if( str.length < 6 ) {
1545		tmp += str.substr(0,3);
1546		tmp += "-";
1547		tmp += str.substr(3);
1548	} else if( str.length < 11 ) {
1549		tmp += str.substr(0,3);
1550		tmp += "-";
1551		tmp += str.substr(3,2);
1552		tmp += "-";
1553		tmp += str.substr(5);
1554	} else {
1555		tmp += str.substr(0,3);
1556		tmp += "-";
1557		tmp += str.substr(3,2);
1558		tmp += "-";
1559		tmp += str.substr(5,5);
1560	}
1561	str = tmp;
1562	$obj.val(str);
1563}
1564
1565//주민등록번호
1566function autoHypenReg($obj) {
1567	var tmp = "";
1568	var str = $obj.val();
1569	str = str.replace(/[^0-9]/g, '');
1570	if( str.length < 7 ) {
1571		tmp = str;
1572	} else if( str.length < 14 ) {
1573		tmp += str.substr(0,6);
1574		tmp += "-";
1575		tmp += str.substr(6);
1576	} else {
1577		tmp += str.substr(0,6);
1578		tmp += "-";
1579		tmp += str.substr(6);
1580	}
1581	str = tmp;
1582	$obj.val(str);
1583}
1584
1585//생년월일
1586function autoHypenBirth($obj) {
1587	var tmp = "";
1588	var str = $obj.val();
1589	str = str.replace(/[^0-9]/g, '');
1590	if( str.length < 5 ) {
1591		tmp = str;
1592	} else if( str.length < 7 ) {
1593		tmp += str.substr(0,4);
1594		tmp += "-";
1595		tmp += str.substr(4);
1596	} else {
1597		tmp += str.substr(0,4);
1598		tmp += "-";
1599		tmp += str.substr(4,2);
1600		tmp += "-";
1601		tmp += str.substr(6,2);
1602	}
1603	str = tmp;
1604	$obj.val(str);
1605}
1606
1607
1608function autoHypen() {
1609	$(".autoHypen").keyup(function(event) {
1610		event.preventDefault();
1611		autoHypenHp($(this));
1612	});
1613
1614	$(".autoHypen2").keyup(function(event) {
1615		event.preventDefault();
1616		autoHypenBizNum($(this));
1617	});
1618
1619	$(".autoHypen3").keyup(function(event) {
1620		event.preventDefault();
1621		autoHypenReg($(this));
1622	});
1623
1624	$(".autoHypen4").keyup(function(event) {
1625		event.preventDefault();
1626		autoHypenBirth($(this));
1627	});
1628}
1629
1630// 문자로 채우기
1631function leftpad(str, char, length) {
1632	var padStr = "";
1633	for(var i=0 ; i<length ; i++) {
1634		padStr += char;
1635	}
1636	return padStr.substring(0, padStr.length - str.length) + str;
1637}
1638
1639function documentPreview(fileId, fileSeq){
1640	popupOpen3(contextPath+"/jfile/preview.tc?fileId="+fileId+"&fileSeq="+fileSeq, "documentPreview", 1000, 800);
1641}
1642
1643function moveScrollUrlHash() {
1644	if(document.URL.indexOf("#") >= 0) {
1645		var hash = document.URL.substring(document.URL.indexOf("#")+1);
1646		if(hash.indexOf("#") >= 0) {
1647			var tabHash =  hash.substring(hash.indexOf("#")+1);
1648			hash = hash.substring(0,hash.indexOf("#"));
1649
1650			var tab = $("[data-target='#"+tabHash+"']");
1651			tab.siblings().removeClass("active");
1652			tab.addClass("active");
1653
1654			$(".tab_cont").addClass("vis_hidden");
1655			$("#"+tabHash).removeClass("vis_hidden");
1656		}
1657
1658		if( hash != "" ) {
1659			setTimeout(function() {
1660				$('html,body').animate({
1661					scrollTop: ($("#"+hash).offset().top - $("header").outerHeight() - 20)
1662				},0);
1663			}, 500);
1664		}
1665	};
1666}
1667
1668function moveScrollHash(hash) {
1669	if( hash != "" ) {
1670		setTimeout(function() {
1671			$('html,body').animate({
1672				scrollTop: ($("#"+hash).offset().top - $("header").outerHeight() - 20)
1673			},0);
1674		}, 500);
1675	}
1676}
1677function focusCont() {
1678	$("#focus_cont").focus();
1679	setTimeout(function() {
1680		$('html,body').animate({
1681			scrollTop: ($("#focus_cont").offset().top - $("header").outerHeight() - 20)
1682		},0);
1683	}, 200);
1684}
1685
1686// 문자열에서 HTML 제거
1687function strip_tags (input, allowed) {
1688    allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
1689    var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
1690        cmntsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
1691    return input.replace(cmntsAndPhpTags, '').replace(tags, function ($0, $1) {        return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
1692    });
1693}
1694
1695//RSA
1696//함수호출시 jsbn.js, rsa.js, prng4.js, rng.js 스크립트 파일을 인클루드해야함
1697function rsaEnc(plaintext, publicKeyModulus, publicKeyExponent) {
1698	var rsa = new RSAKey();
1699	rsa.setPublic(publicKeyModulus, publicKeyExponent);
1700	var encValue = rsa.encrypt(plaintext);
1701	return encValue;
1702}
1703
1704//ACCORDION FUNCTION
1705$(document).on("click", ".js-acco .btn-question", function() {
1706    var parentBox = $(this).closest("li"),
1707        qName = $(this),
1708        openClass = "open",
1709        aName = ".answer",
1710        spd = 300;
1711
1712    if (parentBox.hasClass(openClass)) {
1713        parentBox.find(aName).slideUp(spd);
1714    } else {
1715        parentBox.find(aName).slideDown(spd);
1716        parentBox
1717            .siblings()
1718            .find(aName)
1719            .slideUp(spd);
1720    }
1721    parentBox
1722        .toggleClass(openClass)
1723        .siblings()
1724        .removeClass(openClass);
1725    return false;
1726});
1727
1728//ACCORDION
1729function accordionEvent(
1730    accordionName,
1731    qName,
1732    aName,
1733    openClass,
1734    allGroupName) {
1735    if ($(accordionName).length < 1) return false;
1736    var spd = 300;
1737
1738    $(accordionName)
1739        .find(qName)
1740        .on("click", function() {
1741            var _this = $(this).closest(accordionName);
1742            if (_this.hasClass(openClass)) {
1743                _this.find(aName).slideUp(spd);
1744            } else {
1745                _this.find(aName).slideDown(spd);
1746                _this
1747                    .closest(allGroupName)
1748                    .siblings()
1749                    .find(aName)
1750                    .slideUp(spd);
1751            }
1752            _this
1753                .toggleClass(openClass)
1754                .closest(allGroupName)
1755                .siblings()
1756                .find(accordionName)
1757                .removeClass(openClass);
1758            return false;
1759        });
1760}
1761
1762// 게시판 상세 이동 post
1763function boardDetailPost(siteDir,mn,mngNo,boardNo) {
1764	var html = '';
1765	html += '<form id="boardForm">';
1766	html += '	<input type="hidden" name="mn" value=""/>';
1767	html += '	<input type="hidden" name="mngNo" value=""/>';
1768	html += '	<input type="hidden" name="boardNo" value=""/>';
1769	html += '</form>';
1770	$("body").append(html);
1771
1772	var form = $("#boardForm");
1773	form.find("[name=mn]").val(mn);
1774	form.find("[name=mngNo]").val(mngNo);
1775	form.find("[name=boardNo]").val(boardNo);
1776	if( siteDir == "" ) {
1777		form.attr({"method":"post","action": contextPath + "/board/detail.tc"}).submit();
1778	} else {
1779		form.attr({"method":"post","action": contextPath + "/" + siteDir + "/board/detail.tc"}).submit();
1780	}
1781}
1782
1783//게시판 상세 이동 post
1784function boardDetailPostNewWin(siteDir,mn,mngNo,boardNo) {
1785	var html = '';
1786	html += '<form id="boardForm">';
1787	html += '	<input type="hidden" name="mn" value=""/>';
1788	html += '	<input type="hidden" name="mngNo" value=""/>';
1789	html += '	<input type="hidden" name="boardNo" value=""/>';
1790	html += '</form>';
1791	$("body").append(html);
1792
1793	var form = $("#boardForm");
1794	form.find("[name=mn]").val(mn);
1795	form.find("[name=mngNo]").val(mngNo);
1796	form.find("[name=boardNo]").val(boardNo);
1797	if( siteDir == "" ) {
1798		window.open('','boardWin');
1799		form.attr("action",contextPath + "/board/detail.tc");
1800		form.attr("method", "post");
1801		form.attr("target","boardWin");
1802		form.submit();
1803	} else {
1804		window.open('','boardWin');
1805		form.attr("action",contextPath + "/" + siteDir + "/board/detail.tc");
1806		form.attr("method", "post");
1807		form.attr("target","boardWin");
1808		form.submit();
1809	}
1810}
1811
1812// 북마크
1813function bookmark() {
1814    var bookmarkURL = window.location.href;
1815    var bookmarkTitle = document.title;
1816    var triggerDefault = false;
1817
1818    if (window.sidebar && window.sidebar.addPanel) {
1819        // Firefox version < 23
1820        window.sidebar.addPanel(bookmarkTitle, bookmarkURL, '');
1821    } else if ((window.sidebar && (navigator.userAgent.toLowerCase().indexOf('firefox') > -1)) || (window.opera && window.print)) {
1822        // Firefox version >= 23 and Opera Hotlist
1823        var $this = $(this);
1824        $this.attr('href', bookmarkURL);
1825        $this.attr('title', bookmarkTitle);
1826        $this.attr('rel', 'sidebar');
1827        $this.off(e);
1828        triggerDefault = true;
1829    } else if (window.external && ('AddFavorite' in window.external)) {
1830        // IE Favorite
1831        window.external.AddFavorite(bookmarkURL, bookmarkTitle);
1832    } else {
1833        // WebKit - Safari/Chrome
1834        alert((navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Cmd' : 'Ctrl') + '+D 키를 눌러 즐겨찾기에 등록하실 수 있습니다.');
1835    }
1836}
1837
1838//인쇄
1839function PrintOption(type1,type2){
1840	var browser = 1;
1841	var agent = navigator.userAgent.toLowerCase();
1842	if ( (navigator.appName == 'Netscape' && agent.indexOf('trident') != -1) || (agent.indexOf("msie") != -1)) {
1843	    // ie일 경우
1844		browser = 0;
1845	}else{
1846	    // ie가 아닐 경우
1847		browser = 1;
1848	}
1849
1850	if( $(".slick-slider").length > 0 ) {
1851		//$('.slick-slider').slick('unslick');
1852	}
1853
1854	if (browser) {
1855		var printDiv = $(".sub_content_wrap>.inner").html();
1856		var cssLink = "";
1857		for (var i = 0; i < $("link").length; i++) {
1858			cssLink += $("link")[i].outerHTML;
1859		}
1860		var mywindow = window.open('', 'my div', 'height=800,width=930');
1861		mywindow.document.write('<html><head><title>print</title>');
1862		mywindow.document.write(cssLink);
1863		mywindow.document.write('</head><body><div class="sub_content_wrap">');
1864		mywindow.document.write(printDiv);
1865		mywindow.document.write('</div></body></html>');
1866		mywindow.document.close(); // IE >= 10에 필요
1867		mywindow.focus(); // necessary for IE >= 10
1868		setTimeout(function() {
1869			mywindow.print();
1870			mywindow.close();
1871		}, 300);
1872		//window.print();
1873	//익스플로러일 경우
1874	} else {
1875		var printDiv = $(".sub_content_wrap>.inner").html();
1876		var cssLink = "";
1877		for (var i = 0; i < $("link").length; i++) {
1878			cssLink += $("link")[i].outerHTML;
1879		}
1880		var mywindow = window.open('', 'my div', 'height=800,width=930');
1881		mywindow.document.write('<html><head><title>print</title>');
1882		mywindow.document.write(cssLink);
1883		mywindow.document.write('</head><body>');
1884		mywindow.document.write(printDiv);
1885		mywindow.document.write('</body></html>');
1886		mywindow.document.close(); // IE >= 10에 필요
1887		mywindow.focus(); // necessary for IE >= 10
1888		setTimeout(function() {
1889			mywindow.print();
1890			mywindow.close();
1891		}, 300);
1892
1893		/*var active = '<OBJECT ID="active1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
1894		document.body.insertAdjacentHTML('beforeEnd', active);
1895		active1.ExecWB(type1,type2);
1896		active1.outerHTML ="";*/
1897	}
1898	//setSubSlider();
1899}
1900
1901// 슬릭 위치 설정
1902function setSlickPosition(slick,index) {
1903	slick.slick("slickGoTo",index);
1904}
1905
1906// 로그아웃
1907function logout() {
1908	if( confirm("인증해제 하시겠습니까?") ) {
1909		location.href = contextPath + "/login/logout.tc";
1910	}
1911}
1912function logoutEng() {
1913	if( confirm("Do yout want to logout?") ) {
1914		location.href = contextPath + "/login/logout.tc";
1915	}
1916}
1917
1918function fileDownload(filename){
1919	/*filename = encodeURIComponent(escape(filename));*/
1920	var url = contextPath + "/file/download.tc?filename="+encodeURIComponent(encodeURIComponent(filename));;
1921	location.href = url;
1922}
1923
1924// 모바일 여부 확인
1925function isMobile() {
1926    return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
1927}
1928
1929//숫자포맷
1930function formatNumber(number) {
1931	return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
1932}
1933
1934// 화면 로딩 처리
1935function showLoading(text) {
1936	var html = "";
1937	html += "<div class='cover active'></div>"
1938	html += "<div id='fileUploadAlert'>";
1939	html += "	<i class='icon_spinner7 icon_spin color_purple'></i>";
1940	html += "	<span>"+text+"</span>";
1941	html += "</div>";
1942	$("body").append(html);
1943}
1944function hideLoading() {
1945	$("#fileUploadAlert").remove();
1946	$(".cover").remove();
1947}
1948
1949//두개의 날짜를 비교하여 차이를 알려준다.(date2 - date1)
1950function dateDiff(_date1, _date2) {
1951    var diffDate_1 = _date1 instanceof Date ? _date1 :new Date(_date1);
1952    var diffDate_2 = _date2 instanceof Date ? _date2 :new Date(_date2);
1953
1954    diffDate_1 =new Date(diffDate_1.getFullYear(), diffDate_1.getMonth()+1, diffDate_1.getDate());
1955    diffDate_2 =new Date(diffDate_2.getFullYear(), diffDate_2.getMonth()+1, diffDate_2.getDate());
1956
1957    var diff = Math.abs(diffDate_2.getTime() - diffDate_1.getTime());
1958    diff = Math.ceil(diff / (1000 * 3600 * 24));
1959
1960    return diff;
1961}
1962
1963// 가상숫자패드
1964function virtualNumpad() {
1965	$(".numpad").each(function(){
1966		$(this).attr("data-kioskboard-type", "numpad");
1967		$(this).attr("data-kioskboard-placement", "bottom");
1968		var numArr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
1969		numArr.sort(() => Math.random() - 0.5);
1970
1971		KioskBoard.init({
1972			keysArrayOfObjects: [
1973				{
1974					"0": "Q",
1975					"1": "W",
1976					"2": "E",
1977					"3": "R",
1978					"4": "T",
1979					"5": "Y",
1980					"6": "U",
1981					"7": "I",
1982					"8": "O",
1983					"9": "P"
1984				},
1985				{
1986					"0": "A",
1987					"1": "S",
1988					"2": "D",
1989					"3": "F",
1990					"4": "G",
1991					"5": "H",
1992					"6": "J",
1993					"7": "K",
1994					"8": "L"
1995				},
1996				{
1997					"0": "Z",
1998					"1": "X",
1999					"2": "C",
2000					"3": "V",
2001					"4": "B",
2002					"5": "N",
2003					"6": "M"
2004				}
2005				],
2006				keysJsonUrl: null,
2007				keysSpecialCharsArrayOfStrings: null,
2008
2009				/*
2010				 * Optional: An Array of Numbers can be set to override the built-in numpad keys. (From 0 to 9, in any order.)
2011				 * e.g. [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
2012				 */
2013				keysNumpadArrayOfNumbers: numArr,
2014				language: 'en',
2015				// The theme of keyboard => "light" || "dark" || "flat" || "material" || "oldschool"
2016				theme: 'light',
2017				// Uppercase or lowercase to start. Uppercased when "true"
2018				capsLockActive: true,
2019				/*
2020				 * Allow or prevent real/physical keyboard usage. Prevented when "false"
2021				 * In addition, the "allowMobileKeyboard" option must be "true" as well, if the real/physical keyboard has wanted to be used.
2022				 */
2023				allowRealKeyboard: false,
2024				// Allow or prevent mobile keyboard usage. Prevented when "false"
2025				allowMobileKeyboard: false,
2026				// CSS animations for opening or closing the keyboard
2027				cssAnimations: false,
2028				// CSS animations duration as millisecond
2029				cssAnimationsDuration: 360,
2030				// CSS animations style for opening or closing the keyboard => "slide" || "fade"
2031				cssAnimationsStyle: 'slide',
2032				// Enable or Disable Spacebar functionality on the keyboard. The Spacebar will be passive when "false"
2033				keysAllowSpacebar: true,
2034				// Text of the space key (Spacebar). Without text => " "
2035				keysSpacebarText: 'Space',
2036				// Font family of the keys
2037				keysFontFamily: 'sans-serif',
2038				// Font size of the keys
2039				keysFontSize: '22px',
2040				// Font weight of the keys
2041				keysFontWeight: 'normal',
2042				// Size of the icon keys
2043				keysIconSize: '25px',
2044				// Scrolls the document to the top or bottom(by the placement option) of the input/textarea element. Prevented when "false"
2045				autoScroll: false,
2046		});
2047
2048		KioskBoard.run(this);
2049	});
2050
2051}
2052
2053// 사이냅 문서뷰어
2054function synapView(fileId, fileSeq, rs){
2055	$.ajax({
2056		type: "POST",
2057		url: "/common/synap/preView.json",
2058		data:{"fileId":fileId,"fileSeq":fileSeq},
2059		success:function(data){
2060			var result = data.result;
2061			var fileMask = result.fileMask;
2062			var fileName = fileMask.split('/');
2063			rs = rs.replace("/home/gbworld2022", "");
2064			var win = window.open('/synap/skin/doc.html?fn='+fileName[fileName.length-1]+'&rs='+rs, "PopupWin", "width=1200,height=1200");
2065
2066		},
2067		error: function(request, status, error){
2068			alert("code:"+request.status+"\r\n"+"message:"+request.responseText+"\r\n"+"error:"+error);
2069		},
2070		complete: function(){
2071		}
2072	});
2073}
2074
2075// 코드로 select option Html 생성
2076function createCodeOptionHtml(selectObj, targetObj) {
2077	$.ajax({
2078		type: "POST",
2079		url: contextPath + "/code/list.json",
2080		data:{"searchUpCode":selectObj.val(),"noPaging":"Y","searchUseYn":"Y"},
2081		success:function(data){
2082			var result = data.result;
2083			var resultList = data.resultList;
2084			var alertContent = data.alertContent;
2085
2086			var html = "<option value=''>선택</option>";
2087			$.each(resultList, function(index, item) {
2088				html += "<option value='" + item.code + "'>" + item.codeNm + "</option>"
2089			});
2090			targetObj.empty("");
2091			targetObj.html(html);
2092		},
2093		error: function(request, status, error){
2094			alert("code:"+request.status+"\r\n"+"message:"+request.responseText+"\r\n"+"error:"+error);
2095		}
2096	});
2097}

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.