PageSourceSearch

https://terkeri.co.kr/_lib/functions.js

js terkeri.co.kr collected 2026-10-09 23:07:41 UTC 19,588 bytes, 696 lines download raw bytes

1$(document).ready(function(){
2	$('.onlyNumber').keydown(function() {
3		onlyNumber();
4	}).trigger('keydown');
5
6	/*비동기 기본 셋팅*/
7	$.ajaxSetup({
8		type: "POST",
9		async: true,
10		dataType:"html",
11		beforeSend : function(){
12			popupLoadingOpen();
13		},
14		success:function() {
15			layerModalClose();
16		},
17		error:function(request,status,error) {
18			//alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
19			alert("데이터 처리중 오류가 발생했습니다.\n다시 시도해 주세요.");
20			layerModalClose();
21		}
22	});
23});
24
25/* 심플모달 시작 */
26function layerModalOpen(data){
27	var obj = null;
28
29	if (typeof(data) == "string") {
30		if (!document.getElementById("simplemodal_div")) {
31			$("<div>", {"id": "simplemodal_div"})
32				.html("<span id='simplemodal_span'></span>")
33				.appendTo(document.body)
34				.hide();
35		}
36
37		obj = $("#simplemodal_div").find("#simplemodal_span").html(data);
38	} else {
39		obj = data;
40	}
41	$(obj).modal({
42		zIndex: 20000,
43		overlayId: "simplemodal-overlay",
44		containerId: "simplemodal-container",
45		overlayClose:false,
46		autoResize:true,
47		escClose: false,
48		autoPosition:true,
49		close : false
50	});
51}
52
53/* 팝업로딩 */
54function popupLoadingOpen(){
55	layerModalOpen("<div class=\"loading\"><img src=\"/images/loading.gif\" alt=\"Loading\"></div>");
56	$("#simplemodal-overlay").css("background","none");
57}
58
59/* 심플모달 닫기 */
60function layerModalClose() {
61	$("#simplemodal_div, #loading_div").remove();
62	$.modal.close();
63}
64
65/* 레이어 팝업 띄우기 */
66function fnLayerPopupOpen(data){
67	if (!document.getElementById("layerPopupWrap")) {
68		$("<div>", {"id": "layerPopupWrap"}).appendTo(document.body);
69	}
70	$("#layerPopupWrap").html(data).hide();
71
72	var $layerWrap = $(".popWrap");
73	var winW = $(document).width();
74	var winH = $(document).height();
75
76	$layerWrap.prepend('<div class="dimmed"></div>');
77	$(".dimmed").css({"width": winW, "height": winH});
78
79	$("#layerPopupWrap").show();
80	if ( $layerWrap.is(":visible") ) {
81		var popH= ($('.popCon').height()+42)/2;
82		var popW= $('.popCon').width()/2;
83		$(".popCon").css({
84			"top": '50%',
85			"left" : '50%',
86			"margin-top":-popH, 
87			"margin-left":-popW
88		});
89	}
90	$layerWrap.find(".btnClose, .btnClose2").on('click', function(e) {
91		e.preventDefault();
92		fnLayerPopupClose();
93	});
94
95	layerModalClose();
96}
97
98/* 레이어 팝업 닫기 */
99function fnLayerPopupClose(){
100	$(".popWrap").hide();
101	$("#layerPopupWrap").remove();
102}
103
104function isValidEmail( string1, string2 ) {
105	var message = "";
106
107	if( string1 == "" || string2 == "" ) {
108		message = "이메일을 입력해 주시기 바랍니다.";
109		return message;
110	}
111	if( isSpace( string1 + string2 ) ) {
112		messages = "이메일 주소를 빈공간없이 넣어주시기 바랍니다.";
113		return message;
114	}
115	if( -1 == string2.indexOf('.') ) {
116		message = "이메일 형식이 잘못 되었습니다.";
117		return message;
118	}
119	var isEmail = /^[a-zA-Z0-9_+.-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4}$/;
120	if( !isEmail.test(string1 + '@' + string2) ) {
121		message = "이메일 형식이 잘못 되었습니다.";
122		return message;
123	}
124	return message;
125}
126
127function uemailListChange(emailDomain){
128	if (emailDomain != "") {
129		$('#email2').val(emailDomain);
130		$('#email2').attr('readonly', true);
131	} else {
132		$('#email2').attr('readonly', false);
133		$('#email2').val('');
134	}
135}
136
137function isSpace( string ) {
138	if(string.search(/\s/) != -1) {
139		return true;
140	} else {
141		return false;
142	}
143}
144
145/* 숫자키만 입력 받을수 있게 설정 */
146function onlyNumber(){
147	$(":input").filter(".onlyNumber")
148
149	.bind("cut copy paste", function(e){
150		 e.preventDefault();
151	}).keypress(function(event){
152		if (event.which && (event.which < 48 || event.which > 57)) {
153			//alert("숫자만 입력 가능합니다.");
154			event.preventDefault();
155		}
156	}).css("imeMode", "disabled")
157}
158
159function openVideo(vodurl){
160	params="vodurl="+vodurl;
161	jQuery.ajax({type:"POST", url:'/sub/ajax_VideoView.asp',data:params,dataType:"html",
162		success:function(msg){
163			document.getElementById("layerVideoDiv").style.display="inline";
164			document.getElementById("listDiv").innerHTML=msg;
165		}
166	});
167}
168function closeVideo(){
169	document.getElementById("layerVideoDiv").style.display="none";
170}
171
172function MainItemSearchGo(){
173	if ( document.mainSearch.itemsearchStr.value.length==0 || document.mainSearch.itemsearchStr.value.length<1 ){
174		alert("검색어를 입력해주세요.\n검색어는 1자이상 입력해주세요.");
175		document.mainSearch.itemsearchStr.focus();
176		return ;
177	}
178	document.mainSearch.submit();
179}
180
181function viewTempPopup(actDiv,temCode,idx){
182	var params = "idx="+idx;
183
184	if(temCode==1){
185		pageName="/library/popskin/pop1.asp"
186	}else if(temCode==2){
187		pageName="/library/popskin/pop2.asp"
188	}else if(temCode==3){
189		pageName="/library/popskin/pop3.asp"
190	}else if(temCode==4){
191		pageName="/library/popskin/pop4.asp"
192	}else if(temCode==5){
193		pageName="/library/popskin/pop5.asp"
194	}else if(temCode==6){
195		pageName="/library/popskin/pop6.asp"
196	}else if(temCode==7){
197		pageName="/library/popskin/pop7.asp"
198	}else if(temCode==8){
199		pageName="/library/popskin/pop8.asp"
200	}else if(temCode==9){
201		pageName="/library/popskin/pop9.asp"
202	}else if(temCode==10){
203		pageName="/library/popskin/pop10.asp"
204	}
205
206	$.ajax({type:"POST", url:pageName,data:params,dataType:"html",
207		success:function(msg){
208			document.getElementById(actDiv).innerHTML=msg;
209		}
210	});
211}
212
213function numOnMask(me){ 
214	if (event.keyCode<48||event.keyCode>57){//숫자외금지 
215		event.returnValue=false; 
216	}
217	var tmpH 
218	if(me.charAt(0)=="-"){//음수가 들어왔을때 '-'를 빼고적용되게.. 
219		tmpH=me.substring(0,1);
220		me=me.substring(1,me.length); 
221	} //me.indexOf('-') 
222	if(me.length > 3){ 
223		var c=0; 
224		var myArray=new Array(); 
225		for(var i=me.length;i>0;i=i-3){ 
226			myArray[c++]=me.substring(i-3,i); 
227		} 
228		myArray.reverse(); 
229		me=myArray.join(","); 
230	} 
231	if(tmpH){ 
232		me=tmpH+me; 
233	}
234	return me;
235} 
236function numOffMask(me){ 
237	var tmp=me.split(",");
238	tmp=tmp.join("");
239
240	return tmp;
241}
242function check_value(me){ 
243	if(me.value!="-"){
244		var myStr=numOffMask(me.value);
245
246		if (isNaN(myStr)) {
247			//alert("숫자만 입력할 수 있습니다.");
248			me.value=''; 
249		}else{
250			me.value=numOnMask(myStr); 
251		}
252	}
253	//me.focus();
254}
255
256function autotab(field){
257	 if (field.getAttribute&&field.value.length==field.getAttribute("maxlength")) {
258		var i;
259		for (i = 0; i < field.form.elements.length; i++)
260			if (field == field.form.elements[i])
261				break;
262		i = (i + 1) % field.form.elements.length;
263		field.form.elements[i].focus();
264		return false;
265	} 
266	else
267	return true;
268}
269
270function jumin_check(userNo1,userNo2){
271	a = Array(6);
272	b = Array(7);
273	var f=document.pageForm;
274	var num1, num2, total, tot;
275
276	if(userNo1.length==6 && userNo2.length==7){
277		num1=userNo1;
278		num2=userNo2;
279
280		for(var i=0; i<6; i++){
281			a[i]=parseInt(num1.charAt(i));
282		}
283
284		for(var j=0; j<7; j++){
285			b[j]=parseInt(num2.charAt(j));
286		}
287
288		total = (a[0]*2) + (a[1]*3) + (a[2]*4) + (a[3]*5) + (a[4]*6) + (a[5]*7) + (b[0]*8) + (b[1]*9) + (b[2]*2) + (b[3]*3) + (b[4]*4) + (b[5]*5);
289		tot = 11 - (total % 11);
290		if(tot==11){
291			tot = 1;
292		}else if(tot==10){
293			tot = 0;
294		}
295
296		if(b[6]!=tot){
297			alert("주민번호가 올바르지않습니다.");
298			return(false);
299		}return(true);
300	}else{
301		alert("주민등록번호를 올바로 입력하세요.");
302		return(false);
303	}
304}
305
306function closeLayer(obj){
307	obj.style.visibility='hidden';
308}
309function closetoLayer(obj){
310	setCookie( obj, "done" , 1 );
311	document.all[obj].style.visibility = "hidden";
312}
313function setCookie( name, value, expiredays ) { 
314	var todayDate = new Date(); 
315	todayDate.setDate( todayDate.getDate() + expiredays ); 
316	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
317}
318function getCookie( name ){ 
319 var nameOfCookie = name + "=";
320 var x = 0; 
321 while ( x <= document.cookie.length ) { 
322  var y = (x+nameOfCookie.length);
323  if ( document.cookie.substring( x, y ) == nameOfCookie ) {
324   if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) endOfCookie = document.cookie.length; 
325   return unescape( document.cookie.substring( y, endOfCookie ) );
326  } 
327  x = document.cookie.indexOf( " ", x ) + 1;
328  if ( x == 0 ) break; 
329 } 
330 return "";
331}
332
333function getFileExtension( filePath ){
334	var extension = "";
335	var lastIndex = -1;
336		lastIndex = filePath.lastIndexOf('.');
337
338	if ( lastIndex != -1 ){
339		extension = filePath.substring( lastIndex+1, filePath.len );
340	} else{
341		extension = "";
342	}
343		return extension;
344}
345
346function uploadImg_check( value,msg,sort ){
347	var src = getFileExtension(value);
348
349	if(sort==1 && value==""){return true;}
350	if ( src == ""){
351		alert(msg);
352		return false;
353	} else if ( !((src.toLowerCase() == "gif") || (src.toLowerCase() == "jpg") || (src.toLowerCase() == "jpeg") || (src.toLowerCase() == "png")) ) {
354		alert('gif,jpg,png 파일만 업로드 하실 수 있습니다.');
355		return false;
356	}else{return true;}
357}
358
359function uploadFlvImg_check( value,msg,sort ){
360	var src = getFileExtension(value);
361
362	if(sort==1 && value==""){return true;}
363	if ( src == ""){
364		alert(msg);
365		return false;
366	} else if ( !((src.toLowerCase() == "flv")) ) {
367		alert('플래쉬동영상 파일만 업로드 하실 수 있습니다.');
368		return false;
369	}else{return true;}
370}
371
372function popOpen(Width,Height,idx,sTop,sLeft) {
373	if( getCookie( "pop"+idx ) != "done" ){ 
374		var Option="left="+sLeft+",top="+sTop+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+Width+", height="+parseInt(Height+21);
375		window.open("/popup.asp?idx="+idx,"pop"+idx,Option);
376	}
377}
378function engpopOpen(Width,Height,idx,sTop,sLeft) {
379	if( getCookie( "engpop"+idx ) != "done" ){ 
380		var Option="left="+sLeft+",top="+sTop+",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+Width+", height="+parseInt(Height+21);
381		window.open("/eng/popup.asp?idx="+idx,"engpop"+idx,Option);
382	}
383}
384
385function mainLoginSend(form) {
386	if(form.userid.value=="") {
387		alert("아이디를 입력해 주십시오.");
388		form.userid.focus();
389		return;
390	}
391	if(form.passwd.value=="") {
392		alert("패스워드를 입력해 주십시오.");
393		form.passwd.focus();
394		return;
395	}
396	form.submit();
397}
398
399function mainLoginInputSendit(form) {
400	if(event.keyCode==13) { 
401		mainLoginSend(form);
402	}
403}
404
405function zipcodeck(myname,w,h,scroll,frm,zip,addr1,addr2){
406	var urlstr="/common/zipsearch.asp?frm="+frm+"&fzip="+zip+"&faddr1="+addr1+"&faddr2="+addr2;
407	var winl=(screen.width - w)/2;
408	var wint=(screen.height - h)/2;
409	winprops='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll
410	window.open(urlstr,myname,winprops)
411}
412
413function itemsearch(){
414	if(document.itemshform.searchstr.value==""){
415		alert("검색하실 제품 단어를 입력하세요.");
416		document.itemshform.searchstr.focus();
417		return;
418	}document.itemshform.submit();
419}
420
421function openModal(width,height,fileUrl,scroll){
422	var OpenFile=fileUrl;
423	var ReturnValue=window.showModalDialog(OpenFile,'','scroll:'+scroll+'; help:no; center:yes; status:no; dialogWidth:'+width+'px; dialogHeight:'+height+'px');
424	if(ReturnValue==1){
425		return true;
426	}
427}
428
429
430function openWindow(Width,Height,Url,winname,scroll) {
431	var winPosLeft = (screen.width - Width) / 2; // 새창 Y 좌표
432	var winPosTop = (screen.height - Height) / 2; // 새창 X 좌표
433
434	var Option="top="+winPosTop+",left="+winPosLeft+", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars="+scroll+", resizable=no,width="+Width+", height="+Height;
435	obj = window.open(Url,winname,Option);
436	obj.focus();
437}
438
439function login(){
440	alert("로그인이 필요한 페이지입니다.\n로그인 처리를 해주세요.");
441	return;
442}
443
444function downChk(){
445	alert("다운로드 권한이 없습니다.\n확인후 다시시도해주세요.");
446	return;
447}
448
449function inputSendit(thisform) {
450	if(event.keyCode==13) {
451		thisform.submit();
452	}
453}
454
455function formatNumber(v1,v2){
456	var str=new Array(); //콤마스트링을 조합할 배열
457	v1=String(v1); //숫자를 스트링으로 변환
458	for(var i=1;i<=v1.length;i++){ //숫자의 길이만큼 반복
459		if(i%v2) str[v1.length-i]=v1.charAt(v1.length-i); //자리수가 아니면 숫자만삽입
460		else  str[v1.length-i]=','+v1.charAt(v1.length-i); //자리수 이면 콤마까지 삽입
461	}
462	return str.join('').replace(/^,/,''); //스트링을 조합하여 반환
463}
464
465
466
467function regularExp(Str,Patten){
468	var chk
469	if(Patten=="hangle"){chk=/[^ ㄱ-힣]/;}		// 한글,공백 허용
470	else if(Patten=="charcode"){chk=/[^ \wㄱ-힣]/}	// 한영문자,숫자,공백,_ 허용
471	else if(Patten=="intcode"){chk=/[^\d-]/;}	// 숫자,- 허용
472	else{chk=Patten}
473	return chk.test(Str);
474}
475
476
477function OpenWin_Upload() {
478	window.open("../TextEditor/fileupload.asp","FileUpload","scrollbars=yes,height=470,width=720,top=20,left=50");
479}
480
481function setCookie( name, value, expiredays ){
482  var endDate = new Date();
483  endDate.setDate( endDate.getDate()+ expiredays );
484  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + endDate.toGMTString() + ";"
485}
486
487function get_Cookie( name ){
488    var nameOfCookie = name + "=";
489    var x = 0;
490    while ( x <= document.cookie.length ){
491        var y = (x+nameOfCookie.length);
492        if ( document.cookie.substring( x, y ) == nameOfCookie ){
493            if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
494                endOfCookie = document.cookie.length;
495            return unescape( document.cookie.substring( y, endOfCookie ) );
496        }
497        x = document.cookie.indexOf( " ", x ) + 1;
498        if ( x == 0 ) break;
499    }
500    return "";
501}
502
503function changeMenu(index){
504	if(index==0){
505		document.all.MenuTable1.style.display='block';
506		document.all.MenuTable2.style.display='none';
507		setCookie( "menuSort", 0 , 1);
508	}else{
509		document.all.MenuTable1.style.display='none';
510		document.all.MenuTable2.style.display='block';
511		setCookie( "menuSort", 1 , 1);
512	}
513}
514
515function vodView(title,url){
516	var Option="top=0, left=0, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars="+scroll+", resizable=no,width=400, height=300";
517	window.open('/player/player.asp?title='+title+'&ViewFileUrl='+url,'player',Option);
518}
519
520function addRow() {
521	var tbl = document.getElementById("inRow").getElementsByTagName("TBODY")[0];
522	var html1 = "<input name='files' type='file' class='input' style='width:350px'><input type='hidden' name='filedel_idx' value='0'>";
523	var row = document.createElement("tr");
524	var col1 = document.createElement("td");
525	col1.className="HK_noBoarder";
526	row.appendChild(col1);
527	col1.innerHTML = html1;
528	tbl.appendChild(row);
529}
530function changeFilech(cnt,val){
531	var delchk = document.getElementsByName('delchk');
532	var filedel_idx = document.getElementsByName('filedel_idx');
533
534	if(delchk[cnt].checked){filedel_idx[cnt].value=val}
535	else{filedel_idx[cnt].value=""}
536}
537
538function changeFileArea(){
539	if(document.getElementById("fileArea").style.display=="none"){
540		document.getElementById("fileArea").style.display="inline";
541	}else{
542		document.getElementById("fileArea").style.display="none";
543	}
544}
545
546
547//에디터 관련 스크립트======================================================================================
548function alditor_PlayNow(obj, w, h, url){
549	try	{
550		if (url){
551			var el = obj;
552			var sURL = url;
553			var sID = url;
554		} else {
555			var el = obj.previousSibling;
556			while (el.tagName!="A")
557			el = el.previousSibling;
558			var sURL = el.href;
559			var sID = el.href;
560		}
561		var sExt = sID.substring(sID.lastIndexOf("."));
562		var sComp = sExt.toUpperCase();
563
564		if (document.getElementById(sID)==null){
565			var embedHolder = document.createElement("div");
566			var embed = document.createElement("EMBED");
567			if (w) { embed.width = w;	}
568			if (h) 	{ embed.height = h;	}
569			if (sComp==".SWF"){
570				embed.quality = "high";
571				embed.wmode = "transparent";
572			} else {
573				embed.autostart = true;
574			}
575			embed.id = sID;
576			embed.src = sURL;
577			embedHolder.appendChild(embed);
578			el.parentNode.insertBefore(embedHolder,el);
579		} else {
580			document.getElementById(sID).parentNode.parentNode.removeChild(document.getElementById(sID).parentNode);
581		}
582	}
583	catch(e){}
584}
585
586function alditor_ShowHide(obj){
587	try{
588		var targetDiv = document.getElementById(obj.id + 'sh');
589		if (targetDiv.className == 'showhideDiv') {
590			obj.title = obj.innerHTML;
591		}
592		obj.innerHTML = (targetDiv.className == 'showhideDiv')? '가리기' : obj.title ;
593		targetDiv.className = (targetDiv.className == 'showhideDiv')? 'showhideDivShow' : 'showhideDiv' ;
594	}
595	catch(e) {}
596}
597//==========================================================================================================
598
599var Drag={
600	"obj":null,
601
602	"init":function(a, aRoot, ee){
603			if (!ee) {
604				a.onmousedown=Drag.start;
605			}
606			a.root = aRoot;
607			if(isNaN(parseInt(a.root.style.left))) { a.root.style.left="0px"; }
608			if(isNaN(parseInt(a.root.style.top))) { a.root.style.top="0px"; }
609			a.root.onDragStart = new Function();
610			a.root.onDragEnd = new Function();
611			a.root.onDrag = new Function();
612
613			if (!!ee) {
614				var b = Drag.obj = a;
615				ee = Drag.fixE(ee);
616				var c = parseInt(b.root.style.top);
617				var d = parseInt(b.root.style.left);
618				b.root.onDragStart(d,c,ee.clientX,ee.clientY);
619				b.lastMouseX = ee.clientX;
620				b.lastMouseY = ee.clientY;
621				document.onmousemove    = Drag.Drag;
622				document.onmouseup      = Drag.end;
623			}
624
625		},
626
627	"start":function(a){
628			
629			var b=Drag.obj=this;
630			a=Drag.fixE(a);
631
632			var c = parseInt(b.root.style.top);
633			var d = parseInt(b.root.style.left);
634
635			b.root.onDragStart(d,c,a.clientX,a.clientY);
636
637			b.lastMouseX = a.clientX;
638			b.lastMouseY = a.clientY;
639
640			document.onmousemove    = Drag.Drag;
641			document.onmouseup      = Drag.end;
642			return false;
643		},
644
645
646	"Drag":function(a){
647			a = Drag.fixE(a);
648			var b = Drag.obj;
649			var c = a.clientY;
650			var d = a.clientX;
651			var e = parseInt(b.root.style.top);
652			var f = parseInt(b.root.style.left);
653			var h,g;
654			h = f + d - b.lastMouseX;
655			g = e + c - b.lastMouseY;
656			b.root.style.left   = h + "px";
657			b.root.style.top    = g + "px";
658			b.lastMouseX        = d;
659			b.lastMouseY        = c;
660			b.root.onDrag(h, g, a.clientX, a.clientY);          
661			return false;
662		},
663
664
665	"end":function(){
666			document.onmousemove    = null;
667			document.onmouseup      = null;
668			Drag.obj.root.onDragEnd(parseInt(Drag.obj.root.style.left),parseInt(Drag.obj.root.style.top));          
669			Drag.obj = null;
670		},
671
672
673	"fixE":function(a){
674			if(typeof a == "undefined") { a=window.event; }
675			if(typeof a.layerX == "undefined") { a.layerX=a.offsetX; }
676			if(typeof a.layerY == "undefined") { a.layerY=a.offsetY; }
677			return a;
678		}
679};
680
681function hangul_chk(word) {
682	var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";
683
684	for (i=0; i< word.length; i++){
685		idcheck = word.charAt(i);
686
687		for ( j = 0 ;  j < str.length ; j++){
688			if (idcheck == str.charAt(j)) break;
689
690			if (j+1 == str.length){
691				return false;
692			}
693   		}
694   	}
695   	return true;
696}

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.