PageSourceSearch

https://lexcloud.ai/lib/comm.js

js lexcloud.ai collected 2026-10-05 14:30:04 UTC 42,022 bytes, 1,548 lines download raw bytes

1/*
2	공통으로 사용하는 script 를 저장하는 파일입니다.
3	Auth : 엄익민 (NEXTBIZ)
4*/
5/* @ cc_on _d = document; eval(‘var document = _d’) @*/
6
7// 글자수 제한.
8function in_ti(word, length) {
9	if(word.length > length) { word = word.substring(0, length) + ".."; }	
10	document.write(word);
11}
12
13// launchCenter(url, name, width, height, att)
14function launchCenter(url, name, width, height, att) 
15{
16  var str = "height=" + height + ",innerHeight=" + height;
17  str += ",width=" + width + ",innerWidth=" + width;
18  if (window.screen) {
19	var ah = screen.availHeight - 30;
20	var aw = screen.availWidth - 10;
21
22	var xc = (aw - width) / 2;
23	var yc = (ah - height) / 2;
24
25	str += ",left=" + xc + ",screenX=" + xc;
26	str += ",top=" + yc + ",screenY=" + yc;
27	str += "," + att
28  }
29  return window.open(url, name, str);
30}
31
32// keyCode 가 13 일 경우 tab.
33function enterTab(e, FocusName) {
34  var focusname_obj = document.getElementsByName(FocusName);
35  var ev = (window.event) ? window.event.keyCode : e.keyCode;
36
37  if (ev == 13) { eval(focusname_obj[0].focus()); }
38}
39
40// keyCode 가 13 일 경우만 submit
41function enterSubmit(e, SubmitName) {
42	var ev = (window.event) ? window.event.keyCode : e.keyCode;
43
44	if (ev == 13) {
45		if(SubmitName != "") { eval(SubmitName + "()"); }
46	}
47}
48
49// 준비중
50function ready() {
51	window.alert("해당메뉴는 서비스 준비중입니다.");
52}
53
54// add event listener (cf. onload)
55function addLoadEvent(func)
56{
57	var oldonload = window.onload;
58	window.onload = (typeof window.onload != 'function') ? func : function() {
59		if (oldonload) { oldonload(); }
60		func();
61	}
62}
63
64// mailto : 단순메일링크 생성
65function mailTo(mailAdd)
66{
67	if ( confirm(mailAdd+" 로 이메일을 발송하시겠습니까?") ) {
68		window.location.href = "mailto:"+mailAdd;
69	}
70}
71
72// 이미지 미리보기 (이미지만 보임)
73function imgPreWin(picName, windowName, windowWidth, windowHeight)
74{
75	var winHandle = window.open("", "_blank","left=0, top=0,toolbar=no,scrollbars=no,resizable=no,width=" + windowWidth + ",height=" + windowHeight);
76	if (winHandle != null)
77	{
78		var htmlString = "<html><head><title>"+windowName+"</title></head>"
79			+ "<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>"
80			+ "<a href=javascript:window.close()><img src='" + picName + "' border='0' alt='창 닫기'></a>"
81			+ "</body></html>";
82		winHandle.document.open();
83		winHandle.document.write(htmlString);
84		winHandle.document.close();
85	}
86	if(winHandle != null) winHandle.focus();
87}
88
89// Email 형식 chk.
90function emailChk(elID)
91{
92	var validFlag = false;
93	re=/^[0-9a-zA-Z-_.]*@[0-9a-zA-Z-_.]*[.][a-zA-Z]*$/i;
94	validFlag = ( elID.length<6 || !re.test(elID) ) ? false : true;
95	return validFlag;
96}
97
98// 파일이 존재하지 않을 경우 return msg.
99function noFileMsg() {
100	alert("파일이 실제 하지 않습니다.\n\n관리자에게 문의하여 주시기 바랍니다.");
101}
102
103// onkeydown event 발생시에 focus 이동
104function moveFocus(elID1, len, elID2) {
105	if (elID1 && elID2) {
106		if ( elID1.length >= len) elID2.focus();
107	}
108}
109
110// 날짜체크
111function isJDate(ymd) {
112	var validFlag = true;
113
114	if (ymd.split("-").length != 3) validFlag = false;
115
116	yy = ymd.split("-")[0];
117	mm = ymd.split("-")[1];
118	dd = ymd.split("-")[2];
119
120	if (isNaN(yy)) validFlag = false;
121	if ((yy < 1901) || (yy > 2078)) validFlag = false;
122	if (isNaN(mm)) validFlag = false;
123	if ((mm < 1) || (mm > 12)) validFlag = false;
124	if (isNaN(dd)) validFlag = false;
125
126	if (mm == 1 || mm == 3 || mm == 5 || mm == 7 || mm == 8 || mm == 10 || mm == 12) {
127		kk = 31;
128	} else if (mm == 4 || mm == 6 || mm == 9 || mm == 11) {
129		kk = 30;
130	} else if ((yy % 4 == 0 && yy % 100 != 0) || (yy % 400 == 0)) {
131		kk = 29;
132	} else {
133		kk = 28;
134	}
135	
136	if ((dd < 1) || (dd > kk)) validFlag = false;
137
138	return validFlag;
139}
140
141
142// comma 삽입
143function commaIn(number) {
144	number = (Math.floor(parseFloat(number) * 100 + 0.5) / 100).toString();
145
146	var num1 = number;
147	var num2 = "";
148	if(number.split(".").length >= 2) {
149		num1 = number.split(".")[0];
150		num2 = number.split(".")[1];
151	}
152
153	len = num1.length;
154	s = Math.floor(len / 3);
155	t = len % 3;
156
157	if(t == 0) {
158		t = 3;
159		s--;
160	}
161
162	r = num1.substr(0, t);
163
164	for(i = 0; i < s; i++) { r += "," + num1.substr(3 * i + t, 3); }
165	if(num2.length > 2) r += "." + num2.substr(0, 2);
166	else if(num2 != "") r += "." + num2;
167
168	return r;
169}
170
171// 금액 반올림
172function priceRound(price, mh, curr=false) {
173	let rprice;
174	if (curr) {
175		rprice = Math.floor((price * 100) + 0.5) / 100;
176	} else {
177		if (mh == 2) {
178			rprice = Math.floor((price * 100) + 0.5) / 100;
179		} else {
180			rprice = Math.floor(price + 0.5);
181		}
182	}
183
184	// 정수가 아니면
185	let rprice_arr = (rprice).toString().split('.');
186	if(rprice_arr[1] != undefined){
187		rprice = rprice.toFixed(2).replace(/0+$/, "");
188		if(rprice.charAt(rprice.length-1) == '.') rprice = rprice.replace('.','');
189		rprice = Number(rprice);
190	}
191
192	return rprice;
193}
194
195// 금액 버림
196function priceFloor(price, mh, curr=false) {
197	if (curr) {
198		return Math.floor((price * 100)) / 100;
199	} else {
200		if (mh == 2) {
201			return Math.floor((price * 100)) / 100;
202		} else {
203			return Math.floor(price);
204		}
205	}
206}
207
208// 금액 부가세
209function priceVat(price, mh, curr=false) {
210	if (price <= 0) price = 0;
211
212	if (curr) {
213		if (mh == 2) {
214			return Math.floor(price * (0.12 * 100)) / 100;
215		} else {
216			return Math.floor(price * (0.1 * 100)) / 100;
217		}
218	} else {
219		if (mh == 2) {
220			return Math.floor(price * (0.12 * 100)) / 100;
221		} else {
222			return Math.floor(price * 0.1);
223		}
224	}
225}
226
227// 금액 부가세 제외
228function priceVat2(price, mh, curr=false) {
229	if (price <= 0) price = 0;
230
231	if (curr) {
232		if (mh == 2) {
233			return (Math.ceil(price / (1.12 * 100)) / 100);
234		} else {
235			return (Math.ceil(price / (1.1 * 100)) / 100);
236		}
237	} else {
238		if (mh == 2) {
239			return (Math.ceil(price / (1.12 * 100)) / 100);
240		} else {
241			return (Math.ceil(price / 1.1));
242		}
243	}
244}
245
246// 금액 원천징수
247function priceWtax(price, per, curr=false) {
248	if (price <= 0) price = 0;
249
250	if (curr) {
251		return Math.floor(price * per) / 100;
252	} else {
253		return Math.floor(price * (per / 100));
254	}
255}
256
257// 금액 Discount 된 가격
258function priceDiscount(price, mh, per, curr=false) {
259	if (price <= 0) {
260		price = 0;
261	}
262
263	if (per <= 0) {
264		per = 0;
265	}
266
267	let rtn = ''
268		, tmp_per = (100 - per) / 100
269		, tmp_price = Math.floor((price * tmp_per) * 100) / 100
270		;
271
272	if (curr) {
273		rtn = Math.floor(tmp_price * 100) / 100;
274	} else {
275		if (mh == 2) {
276			rtn = Math.floor(tmp_price * 100) / 100;
277		} else {
278			rtn = Math.floor(tmp_price);
279		}
280	}
281
282
283	return rtn;
284}
285
286// 금액 Discount 되기 전 가격
287function priceDiscount2(price, mh, per, curr=false) {
288	if (price <= 0) {
289		price = 0;
290	}
291
292	if (per <= 0) {
293		per = 0;
294	}
295
296	let rtn = ''
297		, tmp_per = (100 - per) / 100
298		, tmp_price = Math.floor((price / tmp_per) * 100) / 100
299		;
300
301	if (curr) {
302		rtn = Math.floor(tmp_price * 100) / 100;
303	} else {
304		if (mh == 2) {
305			rtn = Math.floor(tmp_price * 100) / 100;
306		} else {
307			rtn = Math.floor(tmp_price);
308		}
309	}
310
311
312	return rtn;
313}
314
315// 도메인정보 return
316function domainSett(mh) {
317	let domain = ''
318		, str = window.location.hostname
319		, dev = ['dev-www.lexcloud.ai','dev-ph.lexcloud.ai','dev-eqqui.lexcloud.ai','dev-www.journallab.com']
320		;
321
322	if (mh == 1) {
323		if (dev.indexOf(str) >= 0) {
324			domain = 'https://dev-www.lexcloud.ai';
325		}
326		else {
327			domain = 'https://www.lexcloud.ai';
328		}
329	}
330	else if (mh == 2) {
331		if (dev.indexOf(str) >= 0) {
332			domain = 'https://dev-ph.lexcloud.ai';
333		}
334		else {
335			domain = 'https://ph.lexcloud.ai';
336		}
337	}
338	else if (mh == 3) {
339		if (dev.indexOf(str) >= 0) {
340			domain = 'https://dev-eqqui.lexcloud.ai';
341		}
342		else {
343			domain = 'https://eqqui.lexcloud.ai';
344		}
345	}
346	else if (mh == 4) {
347		if (dev.indexOf(str) >= 0) {
348			domain = 'https://dev-www.journallab.com';
349		}
350		else {
351			domain = 'https://journallab.com';
352		}
353	}
354
355	return domain;
356}
357
358// chk : is numeric
359function isNumber(s) {
360	s += ''; // 문자열로 변환
361	s = s.replace(/^\s*|\s*$/g, ''); // 좌우 공백 제거
362	if (s == '' || isNaN(s)) return 0;
363	return s;
364}
365
366// quick menu
367function initMoving(target, position, topLimit, btmLimit) {
368	if (!target)
369		return false;
370 
371	var obj = target;
372	obj.initTop = position;
373	obj.topLimit = topLimit;
374	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;
375 
376	obj.style.position = "absolute";
377	obj.top = obj.initTop;
378	obj.left = obj.initLeft;
379 
380	if (typeof(window.pageYOffset) == "number") {
381		obj.getTop = function() {
382			return window.pageYOffset;
383		}
384	} else if (typeof(document.documentElement.scrollTop) == "number") {
385		obj.getTop = function() {
386			return document.documentElement.scrollTop;
387		}
388	} else {
389		obj.getTop = function() {
390			return 0;
391		}
392	}
393 
394	if (self.innerHeight) {
395		obj.getHeight = function() {
396			return self.innerHeight;
397		}
398	} else if(document.documentElement.clientHeight) {
399		obj.getHeight = function() {
400			return document.documentElement.clientHeight;
401		}
402	} else {
403		obj.getHeight = function() {
404			return 100;
405		}
406	}
407 
408	obj.move = setInterval(function() {
409		pos = (obj.initTop > 0) ? obj.getTop() + obj.initTop : obj.getTop() + obj.getHeight() + obj.initTop;
410 
411		if (pos > obj.bottomLimit) pos = obj.bottomLimit;
412		if (pos < obj.topLimit) pos = obj.topLimit;
413 
414		interval = obj.top - pos;
415		obj.top = obj.top - interval / 3;
416		obj.style.top = obj.top + "px";
417	}, 30)
418}
419
420// 간단한 img resize
421function resizeImg(imgEl, imgX, imgY) {
422	if ( imgEl && (!isNaN(imgX) && !isNaN(imgY)) ) {
423		var imgXbo = false;
424
425		if (imgEl.width > imgX) {
426			imgEl.width = imgX;
427			imgXbo = true;
428		}
429		if (imgEl.height > imgY) {
430			if (imgXbo == true) imgEl.width = imgEl.width/(imgEl.height/imgY);
431			imgEl.height = imgY;
432		}
433	}
434}
435
436
437// 아이디 형식 chk
438function CheckChar(name) {
439	strarr = new Array(name.value.length);
440
441	if((name.value.charAt(0) < "a" || name.value.charAt(0) > "z") && (name.value.charAt(0) < "A" || name.value.charAt(0) > "Z")) {
442		return true;
443	}
444
445	for(i = 0; i < name.value.length; i++) {
446		strarr[i] = name.value.charAt(i)
447		if(strarr[i] == " ")
448			return true;
449		else if((strarr[i] >= 0) && (strarr[i] <= 9))
450			continue;
451		else if((strarr[i] >= "a") && (strarr[i] <= "z"))
452			continue;
453		else if((strarr[i] >= "A") && (strarr[i] <= "Z"))
454			continue;
455		else {
456			return true;
457		}
458	}		
459	return false;
460}
461
462
463// URL 형식 chk
464function CheckUrl(name) {
465	strarr = new Array(name.value.length);
466
467	for(i = 0; i < name.value.length; i++) {
468		strarr[i] = name.value.charAt(i)
469		if(strarr[i] == " ")
470			return true;
471		else if((strarr[i] >= 0) && (strarr[i] <= 9))
472			continue;
473		else if((strarr[i] >= "a") && (strarr[i] <= "z"))
474			continue;
475		else if((strarr[i] >= "A") && (strarr[i] <= "Z"))
476			continue;
477		else {
478			return true;
479		}
480	}		
481	return false;
482}
483
484
485//  resize window xbrowse
486function resizeWin(x, y) {
487	if (isNaN(x) || isNaN(y)) return;
488	var len = (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) ? 200 : 0;
489	var t = setTimeout(function() {
490			var innerWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
491			var innerHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
492			var targetWidth = x;
493			var targetHeight = y;
494			window.resizeBy(targetWidth-innerWidth, targetHeight-innerHeight);
495		}, len);
496}
497
498
499// youtube
500function flashYouTube(url,w,h){
501	var flashStr=
502	"<object width='"+w+"' height='"+h+"'>"+
503	"<param name='movie' value='"+url+"'></param>"+
504	"<param name='allowFullScreen' value='true'></param>"+
505	"<param name='allowscriptaccess' value='always'></param>"+
506	"<embed src='"+url+"' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='"+w+"' height='"+h+"'></embed>"+
507	"</object>";
508	document.write(flashStr);
509}
510
511
512/* 올리북 */
513function ollybook(ID, addTitle) {
514	window.open("http://zone.ollybook.com/" + ID + "/" + addTitle + "/", "OllyBook", "width=900,height=680,top=100,left=100,scrollbars=no");
515}
516
517
518// iframe auto resize
519function iframe_autoresize(arg) {
520	if (arg.src) {
521		arg.height = eval(arg.name+".document.body.scrollHeight");
522	}	
523}
524
525
526// hash 를 json 으로 반환 (jQuery 사용)
527function hashToJSON()
528{
529	if (document.location.hash) {
530		var tar = decodeURIComponent(document.location.hash);
531		tar = tar.replace("#", "");
532		var json = $.parseJSON(tar);
533		return json;
534	}
535	else {
536		return null;
537	}
538}
539
540// json 을 string 으로 반환
541function JSONtoString(object) {
542	var results = [];
543	for (var property in object) {
544		var value = object[property];
545		if (value)
546			results.push('"'+property.toString()+'":"'+value+'"');
547	}
548
549	return '{' + results.join(',') + '}';
550}
551
552
553// set : file size unit & redefine value of the size
554// set : size
555function getSizeTxt(val)
556{
557	var ret = 0;
558	if ( Math.floor(val/1048576)+1 >= 1000 ) {			// unit : GB
559		ret = (Math.floor((val/1073741824 +0.5) *100) /100)+" GB";
560	}
561	else if ( Math.floor(val/1024)+1 >= 1000 ) {			// unit : MB
562		ret = (Math.floor((val/1048576 +0.5) *100) /100)+" MB";
563	}
564	else if ( val >= 1000 ) {								// unit : KB
565		ret = (Math.floor((val/1024 +0.5) *100) /100)+" KB";
566	}
567	else {													// unit : byte
568		ret = (Math.floor((val +0.5) *100) /100)+" byte";
569	}
570	return ret;
571}
572
573
574var rfv = {
575	chk:function(f) {
576		if (!f instanceof Array || f.length != 2) return false;
577		
578		var $el = "";
579		var f0 = f[0], f1 = f[1];
580		for (var i in f0)
581		{
582			// case : class 로 전달된 경우 (checkbox 형식 확인)
583			if (f0[i].indexOf('.cls_') > -1) {
584				if ($(f0[i]+":checked").length <= 0) {
585					alert(f1[i]+' 중 최소 하나이상 선택해 주세요.');
586					$(f0[i]).get(0).focus();
587					return false;
588				}
589			}
590			// case : class 로 전달된 경우 (date 형식 확인)
591			else if (f0[i].indexOf('.date_') > -1) {
592				for (var j = 0; j < $(f0[i]).size(); j++) {
593					if ($(f0[i] + ":eq(" + j + ")").val() == "") {
594						alert(f1[i]+' 정보를 입력해 주세요.');
595						$(f0[i] + ":eq(" + j + ")").focus();
596						return false;
597					}
598				}
599			}
600			// case : 기본 ID 로 구분
601			else {
602				$el = $('#'+f0[i]);
603				if ($el.val() == "") {
604					alert(f1[i]+' 정보를 입력해 주세요.');
605					$el.focus();
606					return false;
607				}
608			}
609		}
610		return true;
611	}
612}
613
614// create : form el.
615function createForm(id, method, action, enctype, target, onsubmit, fs)
616{
617	if (id == '' || method == '' || action == '') return;
618
619	// 객체가 이미 있을 경우 return
620	if ($('#'+id).length > 0) return $('#'+id);
621
622	var method = method.toLowerCase();
623	if (method != 'get' && method != 'post') return;
624
625	var f = document.createElement('form');
626	f.id = id;
627	f.name = id;
628	f.method = method;
629	f.action = action;
630	
631	if (enctype == 'Y') { f.enctype = "multipart/form-data"; }
632	if (target != '') { f.target = target; }
633	if (onsubmit != '') { f.setAttribute('onsubmit', onsubmit); }
634
635	// fs 가 세쌍으로 묶여 있을 경우만(id+name+value)
636	if (fs instanceof Array || fs.length == 3)
637	{
638		var fs0 = fs[0], fs1 = fs[1], fs2 = fs[2], i = '';
639		for (var k in fs0)
640		{
641			i = document.createElement('input');
642			i.type = "hidden";
643			i.id = fs0[k];
644			i.name = fs1[k];
645			i.value = fs2[k];
646			f.appendChild(i);
647		}
648	}
649
650	return f;
651}
652
653
654// sns
655function snsTo(sTarget, sUri, sDsc) {
656	//sDsc = encodeURIComponent(sDsc);
657	switch (sTarget) {
658	case 'facebook':
659		window.open('http://www.facebook.com/sharer.php?u=' + sUri + '&t=' + sDsc, 'snsTo','resizable=no,width=800,height=500');
660		break;
661	case 'twitter':
662		window.open('http://twitter.com/share?url=' + sUri + '&text='
663				+ sDsc, 'snsTo', 'width=600,height=300');
664		break;
665	}
666}
667
668
669function strip_tags(input, allowed) {
670  //  discuss at: http://phpjs.org/functions/strip_tags/
671  // original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
672  // improved by: Luke Godfrey
673  // improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
674  //    input by: Pul
675  //    input by: Alex
676  //    input by: Marc Palau
677  //    input by: Brett Zamir (http://brett-zamir.me)
678  //    input by: Bobby Drake
679  //    input by: Evertjan Garretsen
680  // bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
681  // bugfixed by: Onno Marsman
682  // bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
683  // bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
684  // bugfixed by: Eric Nagel
685  // bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
686  // bugfixed by: Tomasz Wesolowski
687  //  revised by: Rafał Kukawski (http://blog.kukawski.pl/)
688  //   example 1: strip_tags('<p>Kevin</p> <br /><b>van</b> <i>Zonneveld</i>', '<i><b>');
689  //   returns 1: 'Kevin <b>van</b> <i>Zonneveld</i>'
690  //   example 2: strip_tags('<p>Kevin <img src="someimage.png" onmouseover="someFunction()">van <i>Zonneveld</i></p>', '<p>');
691  //   returns 2: '<p>Kevin van Zonneveld</p>'
692  //   example 3: strip_tags("<a href='http://kevin.vanzonneveld.net'>Kevin van Zonneveld</a>", "<a>");
693  //   returns 3: "<a href='http://kevin.vanzonneveld.net'>Kevin van Zonneveld</a>"
694  //   example 4: strip_tags('1 < 5 5 > 1');
695  //   returns 4: '1 < 5 5 > 1'
696  //   example 5: strip_tags('1 <br/> 1');
697  //   returns 5: '1  1'
698  //   example 6: strip_tags('1 <br/> 1', '<br>');
699  //   returns 6: '1 <br/> 1'
700  //   example 7: strip_tags('1 <br/> 1', '<br><br/>');
701  //   returns 7: '1 <br/> 1'
702
703  allowed = (((allowed || '') + '')
704	.toLowerCase()
705	.match(/<[a-z][a-z0-9]*>/g) || [])
706	.join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
707  var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
708	commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
709  return input.replace(commentsAndPhpTags, '')
710	.replace(tags, function($0, $1) {
711	  return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
712	});
713}
714
715
716function in_array(needle, haystack, argStrict) {
717  //  discuss at: http://phpjs.org/functions/in_array/
718  // original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
719  // improved by: vlado houba
720  // improved by: Jonas Sciangula Street (Joni2Back)
721  //    input by: Billy
722  // bugfixed by: Brett Zamir (http://brett-zamir.me)
723  //   example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
724  //   returns 1: true
725  //   example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'});
726  //   returns 2: false
727  //   example 3: in_array(1, ['1', '2', '3']);
728  //   example 3: in_array(1, ['1', '2', '3'], false);
729  //   returns 3: true
730  //   returns 3: true
731  //   example 4: in_array(1, ['1', '2', '3'], true);
732  //   returns 4: false
733
734  var key = '',
735	strict = !! argStrict;
736
737  //we prevent the double check (strict && arr[key] === ndl) || (!strict && arr[key] == ndl)
738  //in just one for, in order to improve the performance 
739  //deciding wich type of comparation will do before walk array
740  if (strict) {
741	for (key in haystack) {
742	  if (haystack[key] === needle) {
743		return true;
744	  }
745	}
746  } else {
747	for (key in haystack) {
748	  if (haystack[key] == needle) {
749		return true;
750	  }
751	}
752  }
753
754  return false;
755}
756
757function uniqid(prefix, more_entropy) {
758  //  discuss at: http://phpjs.org/functions/uniqid/
759  // original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
760  //  revised by: Kankrelune (http://www.webfaktory.info/)
761  //        note: Uses an internal counter (in php_js global) to avoid collision
762  //        test: skip
763  //   example 1: uniqid();
764  //   returns 1: 'a30285b160c14'
765  //   example 2: uniqid('foo');
766  //   returns 2: 'fooa30285b1cd361'
767  //   example 3: uniqid('bar', true);
768  //   returns 3: 'bara20285b23dfd1.31879087'
769
770  if (typeof prefix === 'undefined') {
771	prefix = '';
772  }
773
774  var retId;
775  var formatSeed = function(seed, reqWidth) {
776	seed = parseInt(seed, 10)
777	  .toString(16); // to hex str
778	if (reqWidth < seed.length) { // so long we split
779	  return seed.slice(seed.length - reqWidth);
780	}
781	if (reqWidth > seed.length) { // so short we pad
782	  return Array(1 + (reqWidth - seed.length))
783		.join('0') + seed;
784	}
785	return seed;
786  };
787
788  // BEGIN REDUNDANT
789  if (!this.php_js) {
790	this.php_js = {};
791  }
792  // END REDUNDANT
793  if (!this.php_js.uniqidSeed) { // init seed with big random int
794	this.php_js.uniqidSeed = Math.floor(Math.random() * 0x75bcd15);
795  }
796  this.php_js.uniqidSeed++;
797
798  retId = prefix; // start with prefix, add current milliseconds hex string
799  retId += formatSeed(parseInt(new Date()
800	.getTime() / 1000, 10), 8);
801  retId += formatSeed(this.php_js.uniqidSeed, 5); // add seed hex string
802  if (more_entropy) {
803	// for more entropy we add a float lower to 10
804	retId += (Math.random() * 10)
805	  .toFixed(8)
806	  .toString();
807  }
808
809  return retId;
810}
811
812// chk : is mobile (true: mobile, false: else)
813var IS_MOBILE = function () {
814	var check = false;
815	(function(a,b){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera);
816	return check;
817}
818
819/* 
820 * 원본 : http://stackoverflow.com/questions/19999388/jquery-check-if-user-is-using-ie 
821 * 수정본 : http://tonks.tistory.com/107 
822 */ 
823var IS_IE = function() {
824	var word;
825	var version = "N/A";
826
827	var agent = navigator.userAgent.toLowerCase();
828	var name = navigator.appName;
829
830	// IE old version ( IE 10 or Lower )
831	if ( name == "Microsoft Internet Explorer" ) word = "msie ";
832
833	else {
834		// IE 11
835		if ( agent.search("trident") > -1 ) word = "trident/.*rv:";
836
837		// IE 12  ( Microsoft Edge )
838		else if ( agent.search("edge/") > -1 ) word = "edge/";
839	}
840
841	var reg = new RegExp( word + "([0-9]{1,})(\\.{0,}[0-9]{0,1})" );
842
843	if (  reg.exec( agent ) != null  ) version = RegExp.$1 + RegExp.$2;
844
845	return version;
846}
847
848// window width 를 기준으로 현재 디바이스를 지정
849function getDevice() {
850	var $html = $('html');
851	var $w_w = $(this).width();
852
853	if ($w_w <= 519) { $html.data('res', 'mobile_v'); }
854	else if ($w_w <= 759) { $html.data('res', 'mobile_l'); }
855	else if ($w_w <= 1023) { $html.data('res', 'tablet'); }
856	else if ($w_w <= 1079) { $html.data('res', 'desktop'); }
857	else { $html.data('res', 'desktop_w'); }
858}
859
860// extract url by given string
861var extractDomain = function(url) {
862	if (url == '') return;
863	
864	var patt = new RegExp(/^(file|gopher|news|nntp|telnet|https?|ftps?|sftp):\/\/([a-z0-9-]+\.)+[a-z0-9]{2,4}.*$/);
865	var result = patt.test(url);
866
867	// 외부 url
868	if (result) {
869		var domain;
870		// find & remove protocol (http, ftp, etc.) and get domain
871		if (url.indexOf("://") > -1) domain = url.split('/')[2];
872		else domain = url.split('/')[0];
873
874		// find & remove port number
875		domain = domain.split(':')[0];
876		return domain;
877	}
878	// 내부 url
879	else {
880		return document.domain;
881	}
882}
883
884
885function autoHypenPhone(str) {
886	str = str.replace(/[^0-9]/g, '');
887	var tmp = '';
888	if (str.length < 4) {
889		return str;
890	} else if (str.length < 7) {
891		tmp += str.substr(0, 3);
892		tmp += '-';
893		tmp += str.substr(3);
894		return tmp;
895	} else if (str.length < 11) {
896		tmp += str.substr(0, 3);
897		tmp += '-';
898		tmp += str.substr(3, 3);
899		tmp += '-';
900		tmp += str.substr(6);
901		return tmp;
902	} else {
903		tmp += str.substr(0, 3);
904		tmp += '-';
905		tmp += str.substr(3, 4);
906		tmp += '-';
907		tmp += str.substr(7);
908		return tmp;
909	}
910	return str;
911}
912
913// 구글코드 언어
914function transLang(code) {
915	var lang = '';
916
917	$.ajax({
918		url : '../proj/json.lang.google.nx',
919		type : 'POST',
920		// async : false,
921		dataType : 'json',
922		data : { google_code : code }
923	})
924	.done(function(json) {
925		if (!json.success) {
926			if (json.msg) alert(json.msg);
927			return false;
928		}
929
930		lang = json.l_name;
931	})
932	.fail(function( jqXHR, textStatus ) {
933		alert( "Request failed: " + textStatus );
934	});
935	
936	return lang;
937}
938
939// text 추출
940function trim_text(value) {
941	value = value.replace(/\s+/g, ""); // 공백 제거
942	value = value.replace(/\n/g, ""); // 행바꿈 제거
943	value = value.replace(/\r/g, ""); // 엔터 제거
944	return value;
945}
946
947// <br> 제거
948function trim_br(value) {
949	if (typeof value != "undefined") {
950		value = value.replace("<br>", ""); // <br> 제거
951	}
952	
953	return value;
954}
955
956// 단어수 카운트
957function word_count(value) {
958	value = value.replace(/[\{\}\[\]\/?.,;:|\)*~`!^_+<>@\#$%&\\\=\(\"]/g, ' '); // 특수문자 제거
959	value = value.replace(/\n/g, ' '); // 개행을 공백으로 변경
960	value = value.replace(/\r/g, ' ');
961	value = value.replace(/\r\n/g, ' ');
962	value = value.replace(/\s+/g, ' ') // 공백을 " "로 변경
963
964	var _value = value.split(' '); // 공백기준 문자열 분리
965
966	_value = _value.filter(function(item) {
967		return item != "";
968	});
969
970	return _value;
971}
972
973
974var num_arrs = [];
975var completeCnt = 0;
976// pdf rendaering
977function renderPDF(url, canvasContainer, name, fileNum, fileCnt, options) {
978
979	options = options || { scale : 1 };
980
981	function renderPage(page) {
982		var viewport = page.getViewport(options.scale);
983		var wrapper = document.getElementById("can_" + fileNum);
984		var canvas = document.createElement("canvas");
985		canvas.id = "canvas-" + page.pageIndex;
986		canvas.className = "canvas";
987		var ctx = canvas.getContext("2d");
988		var renderContext = {
989			canvasContext : ctx,
990			viewport : viewport
991		};
992
993		canvas.height = viewport.height;
994		canvas.width = viewport.width;
995		wrapper.appendChild(canvas);
996
997		page.render(renderContext);
998	}
999
1000	function renderPages(pdfDoc) {
1001		for (var num = 1; num <= pdfDoc.numPages; num++) {
1002			pdfDoc.getPage(num).then(renderPage);
1003		}
1004
1005		total_pages = pdfDoc.numPages;
1006
1007		setTimeout(function() {
1008			saveImage(name, fileNum, fileCnt);
1009		}, 1000);
1010	}
1011
1012	PDFJS.disableWorker = true;
1013	PDFJS.getDocument(url, null, null, function(progress) {
1014		var percent_loaded = (progress.loaded/progress.total) * 100;
1015
1016	}).then(function(pdf_doc) {
1017		if (pdf_doc.numPages > 20) {
1018			alert('PDF 파일의 경우 20장 이하로 올려주세요.');
1019			// return false;
1020			completeCnt++;
1021
1022
1023			// 마지막 파일 추출이 끝났는지 체크
1024			if (fileCnt == completeCnt) {
1025				// canvas 영역 삭제
1026				$(".can_").remove();
1027
1028				$('.estm_loding2').hide();
1029
1030				// 파일추가 center 표시
1031				// $('#cent_h_file').fadeIn();
1032				// setTimeout(function() {
1033				// 	$('#cent_h_file').fadeOut();
1034				// }, 3000);
1035
1036				completeCnt = 0;
1037			}
1038		} else {
1039			renderPages(pdf_doc);
1040		}
1041		
1042		// renderPages(pdf_doc);
1043	});
1044}
1045
1046
1047function saveImage(name, fileNum, fileCnt) {
1048	var total_txt = '';
1049	var content = '';
1050
1051	var req = [];
1052	setTimeout(function() {
1053		for (var i = 0; i < total_pages; i++)
1054		{
1055			req[i] = new Promise(function(resolve, reject) 
1056			{
1057				var drawCanvas = $("#can_" + fileNum + " #canvas-" + i).get(0);
1058
1059				$.ajax({
1060					url: '../lib/pdfToimg.nx',
1061					type: 'POST',
1062					dateType : "TEXT",
1063					data: {
1064						imgUpload : drawCanvas.toDataURL("image/jpeg"),
1065						file_name : name,
1066						file_num : i
1067					},
1068					success: function(result) {
1069						resolve(result);
1070					}
1071				});
1072			});
1073		};
1074
1075
1076		Promise.all(req).then(function(response) {
1077			for (var j = 0; j < response.length; j++) {
1078				content = content + trim_br(response[j]);
1079			}
1080
1081
1082			$('[data-num="' + fileNum + '"] .js-ct').val(content);
1083
1084			var _cont = content.substr(0,500);
1085			
1086			// 출발어 선택
1087			$.ajax({
1088				type : "POST",
1089				// async : false,
1090				data : "&q=" + _cont,
1091				url : "https://translation.googleapis.com/language/translate/v2/detect?key=AIzaSyC78tNWJmwIvzZJUYgaLciyJwkPjLlSciA",
1092
1093				success:function(response) {
1094					$('[data-num="' + fileNum + '"] .js-origin option[data-gcode="' + response.data.detections[0][0].language + '"]').prop('selected', true).trigger('change');
1095				}
1096			});
1097
1098			completeCnt++;
1099
1100
1101			// 마지막 파일 추출이 끝났는지 체크
1102			if (fileCnt == completeCnt) {
1103				// canvas 영역 삭제
1104				$(".can_").remove();
1105
1106				$('.estm_loding2').hide();
1107
1108				// 파일추가 center 표시
1109				$('#cent_h_file').fadeIn();
1110				setTimeout(function() {
1111					$('#cent_h_file').fadeOut();
1112				}, 3000);
1113
1114				completeCnt = 0;
1115			}
1116
1117			if (origin == 'ko' || origin == 'ja' || origin == 'zh-CN' || origin == 'zh-TW') {
1118				$('[data-num="' + fileNum + '"] .js-total').val(trim_text(content).length);
1119				$('[data-num="' + fileNum + '"] .js-total2').val(trim_text(content).length);
1120			}
1121			else {
1122				$('[data-num="' + fileNum + '"] .js-total').val(word_count(content).length);
1123				$('[data-num="' + fileNum + '"] .js-total2').val(word_count(content).length);
1124			}
1125
1126			$('.estm_loding').hide();
1127
1128			onch_Byte();
1129		});
1130	}, 2000);
1131	
1132}
1133
1134
1135var openFile = function (file, fileNum, fileCnt) {
1136	// 사용처 : 프로젝트 상세 원본파일 추가, 견적요청, 파일견적
1137	var reader = new FileReader();
1138	var fileext = file.name;
1139	var content = '';
1140	fileext = fileext.slice(fileext.lastIndexOf(".")+1).toLowerCase(); // 파일정보로 확장자 찾기, 비교위해 소문자 구분
1141
1142	reader.onload = function() {
1143		try {
1144			if (fileext == "docx") {
1145				var zip = new JSZip(reader.result); // JSZIP 인스턴스생성
1146				var doc = new window.docxtemplater().loadZip(zip); // docxtemplater.js 이용 loadzip
1147				var text = doc.getFullText(); // text내용 가져옴
1148				content = text; // 글자수세기에 불필요한 요소 삭제
1149			}
1150			else if (fileext =="xls" || fileext == "xlsx") {
1151				var fileData = reader.result; // result 값 저장
1152
1153				if (reader.readAsBinaryString) {
1154					var excel = XLSX.read(fileData, {type : 'binary'});
1155				} else {
1156					// IE readAsBinaryString 미지원으로 인한 소스
1157					// IE buffer IE10이상 부터 지원
1158					var excel = XLSX.read(fileData, {type : 'buffer'});
1159				}
1160
1161				var total_txt = "";
1162				excel.SheetNames.forEach(function(sheetName){
1163					var text = XLSX.utils.sheet_to_csv(excel.Sheets[sheetName]);
1164					total_txt = total_txt + text;
1165				})
1166				content = total_txt;
1167			}
1168			else if (fileext == "pptx") {
1169				var zip = new JSZip(reader.result); // JSZIP 인스턴스생성
1170				var doc = new window.docxtemplater().loadZip(zip); // docxtemplater.js 이용 loadzip
1171				var text = "";
1172
1173				// 슬라이드 갯수만큼 xml추출
1174				for (var i = 1; i <= doc.targets.length; i++) {
1175					// 슬라이드별 xml 추출
1176					var slides = zip.files["ppt/slides/slide" + i + ".xml"].asText();
1177
1178					// xml 형식으로 변환
1179					parser = new DOMParser();
1180					xmlDoc = parser.parseFromString(slides, "text/xml");
1181
1182					// a:t 특정 태그 내용만 추출
1183					var xml = xmlDoc.getElementsByTagName("a:t");
1184
1185					for (var j = 0; j < xml.length; j++) {
1186						text += xml[j].textContent;
1187					}
1188					// 슬라이드별 구분위해 엔터키 추가
1189					text += "\n\n";
1190				}
1191				content = text;
1192			}
1193			else if (fileext == "pdf") {
1194				// renderPDF(URL.createObjectURL(file), document.getElementById("holder"), file.name, fileNum, fileCnt);
1195				completeCnt++;
1196			}
1197			else if (fileext == "txt" || fileext == "srt" || fileext == "md") {
1198				var text = reader.result;
1199				content = text;
1200			}
1201			else {
1202				completeCnt++;
1203			}
1204		}
1205		catch(e) {
1206			console.log(e);
1207			alert('"'+file.name+'" 파일을 읽어오는 도중 오류가 발생하였습니다. 파일을 확인해 주세요.');
1208		}
1209
1210
1211		if (content != '') {
1212			$('[data-num="' + fileNum + '"] .js-ct').val(content);
1213		}
1214
1215
1216		var origin = '';
1217		if (fileext == "docx" || fileext =="xls" || fileext == "xlsx" || fileext == "pptx" || fileext == "txt" || fileext == "srt" || fileext == "md") {
1218			var _cont = content.substr(0,500);
1219
1220			// 출발어 선택
1221			axios.post('https://translation.googleapis.com/language/translate/v2/detect?key=AIzaSyC78tNWJmwIvzZJUYgaLciyJwkPjLlSciA', `&q=${_cont}`)
1222			.then(res => {
1223				const json = res.data.data
1224
1225				origin = json.detections[0][0].language;
1226				// $('[data-num="' + fileNum + '"] .js-origin option[data-gcode="' + json.detections[0][0].language + '"]').prop('selected', true).trigger('change');
1227				$('[data-num="' + fileNum + '"] .js-origin option[data-gcode="' + json.detections[0][0].language + '"]').prop('selected', true).trigger('change');
1228
1229				if (origin == 'ko' || origin == 'ja' || origin == 'zh-CN' || origin == 'zh-TW') {
1230					$('[data-num="' + fileNum + '"] .js-total').val(trim_text(content).length).trigger('change');;
1231					$('[data-num="' + fileNum + '"] .js-total2').val(trim_text(content).length).trigger('change');;
1232					$('[data-num="' + fileNum + '"] .js-total3').val(word_count(content).length);;
1233				}
1234				else {
1235					$('[data-num="' + fileNum + '"] .js-total').val(word_count(content).length).trigger('change');;
1236					$('[data-num="' + fileNum + '"] .js-total2').val(word_count(content).length).trigger('change');;
1237					$('[data-num="' + fileNum + '"] .js-total3').val(trim_text(content).length);;
1238				}
1239
1240				$('.estm_loding').hide();
1241
1242				completeCnt++;
1243
1244				num_arrs[fileNum] = origin;
1245
1246				// 마지막 파일 추출이 끝났는지 체크
1247				if (fileCnt == completeCnt) {
1248					onch_originAll(num_arrs);
1249
1250					// canvas 영역 삭제
1251					$(".can_").remove();
1252
1253					$('.estm_loding2').hide();
1254
1255					// 파일추가 center 표시
1256					$('#cent_h_file').fadeIn();
1257					setTimeout(function() {
1258						$('#cent_h_file').fadeOut();
1259					}, 3000);
1260
1261
1262					num_arrs = [];
1263					completeCnt = 0;
1264				}
1265			})
1266			.catch(err => console.log(err))
1267		} else {
1268			// 마지막 파일 추출이 끝났는지 체크
1269			if (fileCnt == completeCnt) {
1270				onch_originAll(num_arrs);
1271				
1272				// canvas 영역 삭제
1273				$(".can_").remove();
1274
1275				$('.estm_loding2').hide();
1276
1277				// 파일추가 center 표시
1278				$('#cent_h_file').fadeIn();
1279				setTimeout(function() {
1280					$('#cent_h_file').fadeOut();
1281				}, 3000);
1282
1283
1284				completeCnt = 0;
1285			}
1286		}
1287	}
1288	// filereader 파일읽기
1289	if (fileext == "txt" || fileext == "srt" || fileext == "md") {
1290		reader.readAsText(file,"UTF-8");
1291	} else {
1292		if(reader.readAsBinaryString) {
1293			reader.readAsBinaryString(file);
1294		} else {
1295			// IE readAsBinaryString 미지원으로 인한 소스
1296			// IE buffer IE10이상 부터 지원
1297			reader.readAsArrayBuffer(file);
1298		}
1299	}
1300}
1301
1302// function number_format(number) {
1303//     var nArr = String(number).split('').join(',').split('');
1304//     for (var i = nArr.length - 1, j = 1; i >= 0; i--, j++)
1305//         if (j % 6 != 0 && j % 2 == 0) nArr[i] = '';
1306//     return nArr.join('');
1307// }
1308
1309function checkSize () {
1310	var width = parseInt(window.innerWidth);
1311	if (width > 1280) return 'pc';
1312	else if (width > 1023 && width < 1281) return 'vertical-tablet';
1313	else if (width > 768 && width < 1024) return 'tablet';
1314	else return 'mobile'
1315}
1316
1317function checkParentSize () {
1318	var width = parseInt(parent.window.innerWidth);
1319	if (width > 1280) return 'pc';
1320	else if (width > 1023 && width < 1281) return 'vertical-tablet';
1321	else if (width > 768 && width < 1024) return 'tablet';
1322	else return 'mobile'
1323}
1324
1325
1326// Talk Check Size
1327function talkCheckSize () {
1328	var width = parseInt(window.innerWidth);
1329	if (width > 768) return 'pc';
1330	else return 'mobile';
1331}
1332
1333
1334// 사업자 등록번호 체크 
1335function checkCompanyNumber(value) {
1336	var valueMap = value.replace(/-/gi, '').split('').map(function (item) {
1337		return parseInt(item, 10);
1338	});
1339
1340	if (valueMap.length === 10) {
1341		var multiply = new Array(1, 3, 7, 1, 3, 7, 1, 3, 5);
1342		var checkSum = 0;
1343
1344		for (var i = 0; i < multiply.length; ++i) {
1345			checkSum += multiply[i] * valueMap[i];
1346		}
1347
1348		checkSum += parseInt((multiply[8] * valueMap[8]) / 10, 10);
1349		return Math.floor(valueMap[9]) === (10 - (checkSum % 10));
1350	}
1351
1352	return false;
1353}
1354
1355// 사업자번호 자동 완성
1356function companyAutoHypen(companyNum) {
1357	companyNum = companyNum.replace(/[^0-9]/g, '');
1358	var tempNum = '';
1359
1360	if (companyNum.length < 4) {
1361		return companyNum;
1362	}
1363	else if (companyNum.length < 6) {
1364		tempNum += companyNum.substr(0, 3);
1365		tempNum += '-';
1366		tempNum += companyNum.substr(3, 2);
1367		return tempNum;
1368	}
1369	else if (companyNum.length < 11) {
1370		tempNum += companyNum.substr(0, 3);
1371		tempNum += '-';
1372		tempNum += companyNum.substr(3, 2);
1373		tempNum += '-';
1374		tempNum += companyNum.substr(5);
1375		return tempNum;
1376	}
1377	else {
1378		tempNum += companyNum.substr(0, 3);
1379		tempNum += '-';
1380		tempNum += companyNum.substr(3, 2);
1381		tempNum += '-';
1382		tempNum += companyNum.substr(5);
1383		return tempNum;
1384	}
1385}
1386
1387function onclick2(url){
1388	if(event.ctrlKey || event.metaKey){
1389		window.open(url);
1390	}else{
1391		window.location.href=url;
1392	}
1393}
1394
1395
1396// Excel Down js
1397/*
1398 * url : excel data 생성파일 url
1399 * fileName : excel 파일명
1400 * param : 파라메다
1401 * ex) param : [{'idx' : 0},{'name' : 'aa'}...]
1402 */
1403let procExcelDown = false;
1404function js_excelDown(url, fileName, param) {
1405	if (procExcelDown) return false;
1406	procExcelDown = true;
1407
1408	// 로딩바 전체화면(보이기)
1409	$('.estm_loding2').show();
1410
1411	let frm = new FormData();
1412
1413	for (let i = 0; i < param.length; i++) {
1414		let _key = Object.keys(param[i]);
1415		let _value = Object.values(param[i]);
1416
1417		if (_value[0] != '') {
1418			frm.append(_key[0], _value[0]);
1419		}
1420	}
1421
1422	axios.post(url, frm)
1423	.then((r) => {
1424		let json = r.data;
1425
1426		exportExcel(json.itms, fileName);
1427		
1428		procExcelDown = false;
1429
1430		// 로딩바 전체화면(가리기)
1431		$('.estm_loding2').hide();
1432	})
1433	.catch((e) => {
1434		console.log(e);
1435
1436		alert(NX.trans('d5l3vo')); // 오류가 발생했습니다. 잠시 후 다시 시도해주세요.
1437		
1438		procExcelDown = false;
1439
1440		// 로딩바 전체화면(가리기)
1441		$('.estm_loding2').hide();
1442	})
1443}
1444
1445function exportExcel(data, fileName) {
1446	// 현재시간
1447	let date = new Date();
1448
1449	// workbook 생성
1450	let wb = XLSX.utils.book_new();
1451
1452	// 시트 만들기 
1453	let newWorksheet = XLSX.utils.json_to_sheet(data);
1454
1455	// 셀 넓이 지정
1456	let objectMaxLength = [];
1457	for (let i = 0; i < data.length; i++) {
1458		let value = Object.values(data[i]);
1459
1460		for (let j = 0; j < value.length; j++) {
1461			if (typeof value[j] == 'number') {
1462				objectMaxLength[j] = 10;
1463			}
1464			else {
1465				objectMaxLength[j] = ((objectMaxLength[j] >= value[j].length) ? objectMaxLength[j] : value[j].length);
1466			}
1467		}
1468	}
1469
1470	let wscols = [];
1471	for (let i = 0; i < objectMaxLength.length; i++) {
1472		wscols.push({width : ((objectMaxLength[i] > 10) ? objectMaxLength[i] : 10)});
1473	}
1474
1475	newWorksheet["!cols"] = wscols;
1476	
1477	// workbook에 새로만든 워크시트에 이름을 주고 붙인다.  
1478	XLSX.utils.book_append_sheet(wb, newWorksheet, 'Sheet');
1479
1480	// 엑셀 파일 만들기 
1481	let wbout = XLSX.write(wb, {bookType:'xlsx',  type: 'binary'});
1482
1483	// 파일명
1484	let _tit = fileName + '_' + date.getFullYear() + (date.getMonth() + 1) + date.getDate() + date.getHours() + date.getMinutes() + date.getSeconds();
1485
1486	// 엑셀 파일 내보내기
1487	saveAs(new Blob([s2ab(wbout)],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}), _tit + ".xlsx");
1488}
1489
1490function s2ab (s) {
1491	let buf = new ArrayBuffer(s.length); // convert s to arrayBuffer
1492	let view = new Uint8Array(buf); // create uint8array as viewer
1493
1494	for (let i = 0; i < s.length; i++) {
1495		view[i] = s.charCodeAt(i) & 0xFF; // convert to octet
1496	}
1497
1498	return buf;
1499}
1500
1501function checkPassword(password) {
1502	var pattern1 = /[0-9]/;
1503	var pattern2 = /[a-zA-Z]/;
1504	var pattern3 = /[~!@\#$%<>^&*]/; // 원하는 특수문자 추가 제거
1505
1506	var sum = 0;
1507	sum += pattern1.test(password) ? 1 : 0;
1508	sum += pattern2.test(password) ? 1 : 0;
1509	sum += pattern3.test(password) ? 1 : 0;
1510
1511	if (sum < 3 || password.length < 8) {
1512		$("#span_pw").css("color", "#F18E1A");
1513		$("#span_pw").text(NX.trans("f8xv5b")); // 영문 대소문자, 숫자, 특수기호(~!@\#$%<>^&*)를 모두 사용하여 8자리 이상으로 입력해 주세요.
1514		return false;
1515	} else {
1516		$("#span_pw").css("color", "#307122");
1517		$("#span_pw").text(NX.trans("6am7s2")); // 사용이 가능합니다.
1518		return true;
1519	}
1520}
1521
1522// 인증번호 횟수제한 쿠키 체크
1523function getCertifyCookie() {
1524	const sessionData = document.cookie.match('(^|;) ?nx_session=([^;]*)(;|$)');
1525	console.log(sessionData);
1526	let coinData = null;
1527	if (sessionData && sessionData[2]) {
1528		coinData = document.cookie.match('(^|;) ?certCoin' + sessionData[2] + '=([^;]*)(;|$)');
1529	}
1530
1531	if (coinData) {
1532		return coinData[2];
1533	} else {
1534		return 5;
1535	}
1536}
1537
1538function setCertifyCookie( value, path = '/' ) {
1539	var todayDate = new Date();
1540	const sessionData = document.cookie.match('(^|;) ?nx_session=([^;]*)(;|$)');
1541	todayDate.setHours( todayDate.getHours() + 1 );
1542	document.cookie = "certCoin" + (sessionData? sessionData[2] : '') + "=" + value + "; path=" + path + "; expires=" + todayDate.toGMTString() + ";"
1543}
1544
1545function clearCertifyCookie() {
1546	const sessionData = document.cookie.match('(^|;) ?nx_session=([^;]*)(;|$)');
1547	document.cookie = "certCoin" + (sessionData? sessionData[2] : '') + "=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT;";
1548}

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.