function getLength(str) { return(str.length+(escape(str)+"%u").match(/%u/g).length-1); } //usage : variable.trim String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/gi, ""); } //usage : variable.replaceAll String.prototype.replaceAll = function(str1, str2) { var temp_str = ""; if (this.trim() != "" && str1 != str2) { temp_str = this.trim(); while (temp_str.indexOf(str1) > -1) { temp_str = temp_str.replace(str1, str2); } } return temp_str; } function OnlyNumber() { if ( event.keyCode < 48 || 57 < event.keyCode ) { event.returnValue=false; return; } } function OnlyNumber2() { if ( ((event.keyCode < 48) || (57 < event.keyCode)) && (45 != event.keyCode) ) { event.returnValue=false; return; } } function CheckValidBookID(val) { for(i=0;i= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch == '_')) continue; else return(false); } return (true); } function GetStrByte(val) { if(val < 1024) return val + " B"; else if(val >= 1024 && val < 1024 * 1024) return parseInt(val/1024) + "." + parseInt((val%1024)/100) + " KB"; else return parseInt(val/1024/1024) + "." + parseInt((val%1024)/100) + " MB"; } function trim(s) { var i, j; var ns; var strlen = s.length; for (i = 0, ns = ''; i < strlen; i++) if (s.charAt(i) != ' ') break; for (j = strlen - 1; j >= 0; j--) if (s.charAt(j) != ' ') break; if(i > j) return ''; ns = s.substring(i, j+1); return ns; } function rtrim(s) { var j; var ns; for (j = s.length - 1; j >= 0; j--) if (s.charAt(j) != ' ') break; ns = s.substring(0, j + 1); return ns; } /* check mail format */ function CheckEmail(str) { var filter=/^.+@.+\..{2,3}$/ if (filter.test(str)) return true; else return false; } function CheckEmail3(value) { if(value == "") return false; var tmp_input = value; tmp_input = tmp_input.replace(/(,| |\t)+$/, ""); tmp_input = tmp_input.replace(/\s+/g, ""); var emailpattern = /[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*@[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+(\.[-!#$%&'*+\/^_~{}|0-9a-zA-Z]+)*/; var email_array = tmp_input.split(","); var email_count = email_array.length; var t; var result; var b_rtn_value = true; for (var i = 0; i < email_count; i++) { t = str_extract_java(email_array[i], "<", ">"); result = t.match(emailpattern); if (result == null) b_rtn_value = false; else if (result[0] != t) b_rtn_value = false; } return b_rtn_value; } /* µÎ°³ÀÇ ¹®ÀÚ¿­ »çÀÌÀÇ ¹®ÀåÀ» °ËÃâÇØ ³»´Â ÇÔ¼ö */ function str_extract_java(value, start, end) { var tmp; var stStr = eval("/"+start+"/"); var endStr = eval("/["+end+" ]+/g"); if ((value.search(stStr)) == -1) return value; tmp = value.split(start); tmp = tmp[1]; tmp = tmp.replace(endStr, ""); return tmp; } /* function CheckEmail(email) { var filter=/^.+@.+\..{3,4}$/; if(!filter.test(email)) return false; if(IsHangul(email) == true) return false; return true; } */ function setJustCookie( name, value ) { document.cookie = name + "=" + value + "; path=/;" } function setCookie( name, value, expiredays ) { var todayDate = new Date(); todayDate.setDate( todayDate.getDate() + expiredays ); document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" } function getCookie( name ) { var nameOfCookie = name + "="; var x = 0; while ( x <= document.cookie.length ) { var y = (x+nameOfCookie.length); if ( document.cookie.substring( x, y ) == nameOfCookie ) { if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) endOfCookie = document.cookie.length; return unescape( document.cookie.substring( y, endOfCookie ) ); } x = document.cookie.indexOf( " ", x ) + 1; if ( x == 0 ) break; } return ""; } function GetCookie(sName) { var aCookie = document.cookie.split(';'); for (var i=0; i < aCookie.length; i++) { var aCrumb = aCookie[i].split('='); if (sName == trim(aCrumb[0])) { return unescape(aCrumb[1]); } } return null; } function CheckNum() { if(event.keyCode < 48 || event.keyCode > 57) event.keyCode=null; } function CheckSpecialChars() { var ch = event.keyCode; if((ch >= 49 && ch <= 58) || (ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122)) return; else event.keyCode = null; } function IsNumber(t) { var i,j; var Digit = '1234567890' astr = Digit; //0À϶§.. false°¡ ¸®ÅϵǼ­.. if(t == "0") return(true); if(t.length == 0) return(false); if (astr.length > 1) { for(i=0;i= ' ' && ch <= '/') || (ch >= ':' && ch <= '@') || (ch >= '[' && ch <= '`') || (ch >= '{' && ch <= '~')) return(true); } return(false); } function IsAlphaNumeric(t) { var i,j; for(i=0;i= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z')) j=0; else return(false); } return(true); } function CheckEmail2(email) { myreg = /(\w)@\w.\w.\w/; if(!myreg.test(email)) return false; if(IsHangul(email) == true) return(false); return true; } function IsHangul(str) { for (i = 0; i < str.length; i++) { ch = str.substring(i, i+1); if (ch < ' ' || ch > '~') return(true); } return(false); } function SetNextFocus(thisobj, nextobj, len) { if(thisobj.value.length == len) nextobj.focus(); } // Áֹεî·Ï¹øÈ£ üũ function CheckJoomin(ssn) { var key = "234567892345"; var total = 0; for(var i=0; i<12; i++) { total = total + ssn.charAt(i)*key.charAt(i); } total = 11 - (total % 11); switch(total) { case 11: total=1; break; case 10: total=0; break; default: total=total; break; } if(ssn.charAt(12) != total) { return false; } return true; } // »ç¾÷ÀÚµî·Ï¹øÈ£ üũ function CheckBizNo(vencode) { if (vencode.length == 10) return true; else return false; if(vencod == "") return false; var sum = 0; var getlist =new Array(10); var chkvalue =new Array("1","3","7","1","3","7","1","3","5"); for(var i=0; i<10; i++) { getlist[i] = vencod.substring(i, i+1); } for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; } sum = sum + parseInt((getlist[8]*5)/10); sidliy = sum % 10; sidchk = 0; if(sidliy != 0) { sidchk = 10 - sidliy; } else { sidchk = 0; } if(sidchk != getlist[9]) { return false; } return true; } function hexa(numb){ var k=0; var kk=0; var str = ""; k = numb; while(1) { kk = k % 16; k = Math.floor(k/16); str = convert(kk) + str; if (k == 0) break; } //str = convert(kk) + str; return(str); } function convert(nr){ var chr; if (nr==10){chr="A"} else if (nr==11){chr="B"} else if (nr==12){chr="C"} else if (nr==13){chr="D"} else if (nr==14){chr="E"} else if (nr==15){chr="F"} else {chr=nr;} return(chr); } /* °øÅëÆË¾÷ sm0321 */ var Popup=null; function CommPopup(URL, Width, Height, ScrollBar, Resizable) { var iMyWidth; var iMyHeight; iMyWidth = (window.screen.width/2) - 450; iMyHeight = (window.screen.height/2) - 350; if(Popup != null && !Popup.closed) Popup.close(); src=URL; if(!ScrollBar) ScrollBar = no; if(!Resizable) Resizable = no; etc = 'toolbar=no,location=no,status=no,scrollbars=' + ScrollBar + ',width=' + Width + ',height=' + Height + ',resizable=' + Resizable + ",left=" + iMyWidth + ",top=" + iMyHeight Popup = window.open(src,'', etc); Popup.window.focus(); } function imgStrSize(val) { // ÷ºÎÆÄÀÏ´ç 10M·Î Á¦ÇÑ //À̹ÌÁö Å©±â °è»ê if(val > 1024 && val < 1048576) { strFileSize = Math.round(eval(val)/1000)+"KB"; } else if(val<1024) { strFileSize = eval(val)+"B"; } else { intMB = (eval(val)/1000)/1000 ; intMB = Math.round(intMB*100)/100 strFileSize = intMB+"MB"; } return strFileSize; } function imgReSize(imgWidth, imgHeight, maxWidth, imgObj) { if(imgWidth > maxWidth) { heightValue = parseInt((maxWidth * imgHeight)/imgWidth); widthValue = maxWidth; } else { heightValue = imgHeight; widthValue = imgWidth; } imgObj.style.width = widthValue; imgObj.style.height = heightValue; } function imgReSizeFixed(imgWidth,imgHeight,maxWidth,maxHeight, imgObj) { if (imgWidth > maxWidth) { widthValue = maxWidth; } else { widthValue = imgWidth; } WidthRate = (widthValue / imgWidth) ; if (imgHeight > maxHeight) { heightValue = maxHeight ; } else { heightValue = imgHeight ; } HeightRate = (heightValue / imgHeight) ; if (maxWidth == 0) { WidthRate = 100; } if (maxHeight == 0) { HeightRate = 100; } if (HeightRate < WidthRate) { widthValue = imgWidth * HeightRate ; heightValue = imgHeight * HeightRate ; } else { widthValue = imgWidth * WidthRate; heightValue = imgHeight * WidthRate; } imgObj.style.width = widthValue; imgObj.style.height = heightValue; } function getmulticontent(source, maxlength, separate_str) { var content_size = getLength(source); var multicontent = ""; if(maxlength >= content_size) { return source; } var oldpos = 0; var j=0; var i=0; while(i < content_size) { if(source.charCodeAt(i) < 256) { j++; } else { j += 2; } i++; if(j >= maxlength) { if(j > maxlength) i--; scontent = source.substring(oldpos, i); if(scontent.length) multicontent += scontent + separate_str; oldpos = i; j=0; } } multicontent = multicontent.substring(0, multicontent.length - separate_str.length); return multicontent; } function MoveItems(sourceObj, targetObj, dupcheck, removeitemonduple) { var newOpt; var isduple = false; var dupleindex = new Array(); var selindex = sourceObj.selectedIndex; for(var k=0; k < targetObj.options.length; k++) targetObj.options[k].selected = false; var cnt = sourceObj.options.length; for(var k=0; k < cnt; k++) { dupleindex[k] = 0; if(sourceObj.options[k].value != "" && sourceObj.options[k].selected) { var srcval = sourceObj.options[k].value; /* Áߺ¹Ã¼Å© ½ÃÀÛ */ isduple = false; if(dupcheck == true) { for(var j=0; j < targetObj.options.length; j++) { if(targetObj.options[j].value == srcval) { isduple = true; dupleindex[k] = 1; } } } if(isduple == true) continue; /* Áߺ¹Ã¼Å© ³¡ */ var fnm = sourceObj.options[k].text; var newOpt2 = new Option(fnm, srcval); var selcnt = targetObj.options.length; targetObj.options[selcnt]=newOpt2; targetObj.options[selcnt].selected = true; } } for(var k=cnt-1 ; k >= 0; k--) { if(sourceObj.options[k].value != "" && sourceObj.options[k].selected && (dupleindex[k] == 0 || (dupleindex[k] == 1 && removeitemonduple == true))) { sourceObj.remove(k); } } if(selindex == sourceObj.options.length) selindex = sourceObj.options.length -1; if(selindex != -1) sourceObj.options[selindex].selected = true; } function SetNumberFormat(obj) { var str = obj.value; obj.value = GetNumberFormat(str.replaceAll(",", "")); } function GetNumberFormat(str) { var str2 = ""; var j = 0; for(i=str.length; i > 0 ;i--) { ch = str.substring(i, i-1); str2 = ch + str2; j++; if(j%3 == 0) str2 = "," + str2; } if(j%3 == 0) str2 = str2.substring(1, str2.length); return str2; } function SetNextFocus(thisobj, nextobj, len) { if(thisobj.value.length == len) nextobj.focus(); } //Àüü ¸µÅ© Blur function bluring(){ if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); } //document.onfocusin=bluring; function ShowFlash(divid, swfpath, fwidth, fheight) { var strFlash = ''; strFlash += ''; strFlash += ''; strFlash += ''; strFlash += ''; strFlash += ''; divid.innerHTML = strFlash ; } function showFlash_kscs(url,w,h,id,bg,vars,win){ // Ç÷¡½Ã ÄÚµå Á¤ÀÇ var flashStr= ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""+ ""; // Ç÷¡½Ã ÄÚµå Ãâ·Â document.write(flashStr); }