//********************************************************// // À¯Æ¿¸®Æ¼ »ç¿ëÇÔ¼ö Á¤ÀÇ //********************************************************// /////////////////////////////////////////////////////////////// ////// Ŭ¸³º¸µå·Î ³»¿ë ÀúÀå (CTRL + C) /////////////////////////////////////////////////////////////// function copyClip(meintext) { if (window.clipboardData) { window.clipboardData.setData("Text", meintext); } else if (window.netscape) { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); if (!clip) return; var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); if (!trans) return; trans.addDataFlavor('text/unicode'); var str = new Object(); var len = new Object(); var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); var copytext=meintext; str.data=copytext; trans.setTransferData("text/unicode",str,copytext.length*2); var clipid=Components.interfaces.nsIClipboard; if (!clip) return false; clip.setData(trans,null,clipid.kGlobalClipboard); } return false; } //popup function popWindow(pop,width,height,scroll) { var url = pop; var wd = width; var he = height; window.open(url,"","toolbar=0,menubar=0,scrollbars=" + scroll + ",resizable=no,width=" + wd +",height=" + he + ";") } //popup function popWindowCenter(pop,width,height,scroll) { var url = pop; var wd = width; var he = height; var top = (window.screen.height-he)/2; var left = (window.screen.width-wd)/2; window.open(url,"","toolbar=0,menubar=0,scrollbars=" + scroll + ",resizable=no,top="+top+",left="+left+",width=" + wd +",height=" + he + ";") } /////////////////////////////////////////////// ///////// ¼ýÀÚ۸¸ Çã¿ë ÇÔ¼ö /////////////////////////////////////////////// function checkKeyDownNumber(e) { ev = (e||window.event); if(ev.srcElement) { var key = ev.keyCode; if ((key >= 48 && key <= 57) // Űº¸µå »ó´Ü ¼ýÀÚŰ //|| (key >= 96 && key <= 105) // ŰÆÐµå ¼ýÀÚŰ || key == 8 // ¹é½ºÆäÀ̽º Ű || key == 37 // ¿ÞÂÊ È­»ìÇ¥ Ű || key == 39 // ¿À¸¥ÂÊ È­»ìÇ¥ Ű || key == 46 // DEL Ű || key == 13 // ¿£ÅÍ Å° || key == 9 // Tab Ű ) ev.returnValue=true; else ev.returnValue=false; } } /////////////////////////////////////////////// ///////// ÁöÁ¤Å° ÀԷ½à ÇÔ¼ö½ÇÇà ÇÔ¼ö /////////////////////////////////////////////// function keyPressHandler(code, funcName) { if(isNaN(code)) { return false; } else if(event.keyCode == code) { if(funcName){ eval(funcName); } return false; } } /////////////////////////////////////////////// ///////// Äí۰ü·Ã ÇÔ¼ö /////////////////////////////////////////////// // Äí۸¦ »ý¼ºÇÑ´Ù (Ȱ¼ºÁÖ±â´Â ÀÏ´ÜÀ§·Î ¼³Á¤) function setCookie(name, value, expireSeconds){ var todayDate = new Date(); if(expireSeconds > 0 ) todayDate.setSeconds( todayDate.getSeconds() + expireSeconds ); var expires = expireSeconds > 0 ? "expires=" +todayDate.toGMTString()+";" : ""; document.cookie = name + "=" + escape( value ) + "; path=/; "+expires; } // »ý¼ºµÈ Äí۰ªÀ» °¡Á®¿Â´Ù. 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 deleteCookie( cookieName ){ var expireDate = new Date(); expireDate.setDate( expireDate.getDate() - 1 ); document.cookie = cookieName + "= " + "; path=/; expires=" + expireDate.toGMTString(); } // ÇöÁ¦ ºê¸®¿ìÁ®°¡ Äí۸¦ »ç¿ëÇÒ ¼ö ÀÖ´ÂÁö üũÇÑ´Ù. function checkCookieEnabled() { setCookie("checkCookie","Y",5); var value = getCookie("checkCookie"); return value == "Y" ? true : false; } //------------------------------------------------------- //¹ÙÀÌÆ® °è»ê, return ÃѹÙÀÌÆ®¼ö //------------------------------------------------------- function getByte(instr) { var len = 0; for(i=0; i 4) { len += 2; } else { len++; } } return len; } //------------------------------------------------------- // ¹®ÀÚ¿­¿¡¼­ ¾ÕµÚ °ø¹é Á¦°Å , return °ø¹é Á¦°ÅµÈ ¹®ÀÚ¿­ // »ç¿ë¹ý : "string".trim(); //------------------------------------------------------- String.prototype.trim = function() { return this.replace(/\s/g, ""); } //------------------------------------------------------- // ¹®ÀÚ¿­¿¡¼­ ¾Õ °ø¹é Á¦°Å , return °ø¹é Á¦°ÅµÈ ¹®ÀÚ¿­ // »ç¿ë¹ý : "string".ltrim(); //------------------------------------------------------- String.prototype.ltrim = function() { var i, j = 0; var objstr for (i = 0; i < this.length; i++) { if (this.charAt(i) == ' ') j = j + 1; else break; } return this.substr(j, this.length - j + 1) } //------------------------------------------------------- // ¹®ÀÚ¿­¿¡¼­ µÚ °ø¹é Á¦°Å , return °ø¹é Á¦°ÅµÈ ¹®ÀÚ¿­ // »ç¿ë¹ý : "string".rtrim(); //------------------------------------------------------- String.prototype.rtrim = function() { var i, j = 0; for (i = this.length - 1; i >= 0; i--) { if (this.charAt(i) == ' ') j = j + 1; else break; } return this.substr(0, this.length - j); } //------------------------------------------------------- // ¼ýÀÚ(¼Ò¼öÁ¡ Á¸Àç)¿¡ , Ãß°¡µÈ Æ÷¸ËÀ¸·Î º¯°æ //------------------------------------------------------- function formatNumber(strOrg) { strOrg = "" + strOrg; if(strOrg == "") return ""; var strNum = ""; for(i=0; i 0) { strInt = strNum.substring(0,dot); strFlt = strNum.substring(dot); } else strInt = strNum; var smod = strInt.length % 3; var strRtn = ""; if(smod > 0) strRtn = strInt.substring(0,smod); for(i=smod; i 0 && (i - smod) % 3 == 0) strRtn += "," strRtn += strInt.charAt(i); } if(dot > 0) strRtn += strFlt; return strRtn; } //------------------------------------------------------- // ¼ýÀÚ¿¡¼­ , Á¦°Å //------------------------------------------------------- function removeComma(str) { var len = str.length; var rstr = ""; if (len > 0) { for (var i = 0; i < len; i++) { var ch = str.charAt(i); if (ch != ',') rstr += ch; } } return rstr; } //------------------------------------------------------- // ¼ýÀÚ¿¡ , Ãß°¡ //------------------------------------------------------- function insertComma(vstr) { var str = vstr; str += ""; var comval = ""; var inversecomval = ""; for ( k = 0 ; k < str.length ; k++ ) { if ( k != 0 && k%3 == 0 ) { comval += ","; } comval += str.charAt(str.length-(k+1)); } for ( k = 0 ; k < comval.length; k++ ) { inversecomval += comval.charAt(comval.length-(k+1)); } return inversecomval; } function getFillZero(value, length) { var val = new String(value); var valLength = val.length; for(var i = 1; i <= length - valLength; i++) { val = "0"+val; } return val; } //------------------------------------------------------------------------- //À̹ÌÁö ¸®»çÀÌÁî : °¡·Î Á¦ÇÑÀ» ÆÄ¶ó¹ÌÅÍ·Î ³Ñ±è //------------------------------------------------------------------------- function imgResizeTo(obj, limitWidth) { var imgWidth = 0; var imgHeight = 0; var imgRatio = 0; var i = 0; if(obj == null) return; imgWidth = obj.width; imgHeight = obj.height; imgRatio = 0 if (imgWidth > limitWidth) { imgRatio= imgHeight * limitWidth / imgWidth; obj.width= limitWidth; obj.height= imgRatio; } } //------------------------------------------------------------------------- //À̹ÌÁö ¸®»çÀÌÁî : °¡·Î Á¦ÇÑÀ» ÆÄ¶ó¹ÌÅÍ·Î ³Ñ±è, num ¹Ù²Ü À̹ÌÁö °³¼ö //------------------------------------------------------------------------- function imgResizeToNumW(idName, limitWidth, num) { var obj var imgWidth = 0; var imgHeight = 0; var imgRatio = 0; var i = 0; for(i = 0; i <= num; i++) { obj = document.getElementById(idName + i); if(obj == null) continue; imgWidth = obj.width; imgHeight = obj.height; imgRatio = 0 if (imgWidth > limitWidth) { imgRatio= imgHeight * limitWidth / imgWidth; obj.width= limitWidth; obj.height= imgRatio; } } } //------------------------------------------------------------------------- //À̹ÌÁö ¸®»çÀÌÁî : ¼¼·Î Á¦ÇÑÀ» ÆÄ¶ó¹ÌÅÍ·Î ³Ñ±è, num ¹Ù²Ü À̹ÌÁö °³¼ö //------------------------------------------------------------------------- function imgResizeToNumH(idName, limitHeight, num) { var obj var imgWidth = 0; var imgHeight = 0; var imgRatio = 0; var i = 0; for(i = 0; i <= num; i++) { obj = document.getElementById(idName + i); if(obj == null) continue; imgWidth = obj.width; imgHeight = obj.height; imgRatio = 0 if (imgHeight > limitHeight) { imgRatio= imgWidth * limitHeight / imgHeight; obj.height= limitHeight; obj.width= imgRatio; } } } //------------------------------------------------------------------------- //iframe »çÀÌÁî ³ôÀÌ Á¶Àý // »ç¿ë¹ý : //------------------------------------------------------------------------- function resizeiFrameHeight(obj){ var innerBody = obj.contentWindow.document.body; var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight); if (navigator.appName != "Microsoft Internet Explorer") { //ie°¡ ¾Æ´Ò °æ¿ì innerHeight = innerBody.offsetHeight } obj.style.height = innerHeight; } //------------------------------------------------------------------------- //À©µµ¿ì âũ±â Á¶Àý // »ç¿ë¹ý : //------------------------------------------------------------------------- function resizeWin(){ var winW, winH, sizeToW, sizeToH; if ( parseInt(navigator.appVersion) > 3 ) { if ( navigator.appName=="Netscape" ) { winW = window.innerWidth; winH = window.innerHeight; } if ( navigator.appName.indexOf("Microsoft") != -1 ) { winW = document.documentElement.scrollWidth; winH = document.documentElement.scrollHeight; } } sizeToW = 0; sizeToH = 0; if ( winW > 1000 ) sizeToW = 1000 - document.documentElement.clientWidth; else if ( Math.abs(document.documentElement.clientWidth - winW ) > 3 ) sizeToW = winW - document.documentElement.clientWidth; if ( winH > 680 ) sizeToH = 680 - document.documentElement.clientHeight; else if ( Math.abs(document.documentElement.clientHeight - winH) > 4 ) sizeToH = winH - document.documentElement.clientHeight; if ( sizeToW != 0 || sizeToH != 0 ) window.resizeBy(sizeToW, sizeToH); } // Debug ¿ë. ¿ìÃø¿¡ ¸Þ¼¼Áö ¹Ú½º¸¦ ¶ç¿î ÈÄ ³»¿ëÀ» »Ñ·ÁÁØ´Ù. var trace = function(text) { var debug = true; if(debug) { if(!$("traceMsg")) { var objDiv = new Element("div",{id:"traceMsg"}); objDiv.setStyle({overflow:"auto",zIndex:"1200",position:"absolute",top:"30px",right:"30px",width:"300px",height:"500px", backgroundColor:"#FFFFFF",filter:"Alpha(opacity=70)",opacity:(70/100)}); objDiv.update("
"); $$("body")[0].insert(objDiv); } $("traceMsgOut").innerHTML = text+"
"+$("traceMsgOut").innerHTML; } } // ÀÔ·ÂÆû¿¡ ´ëÇÑ ¹®ÀÚ¿­ ±æÀÌ Á¦ÇÑ (ÇѱÛó¸®) var checkValueLength = function(obj,title,maxLength) { var str = new String(); var strLength = 0; for(i=0; i < obj.value.length; i++) { var addLength = Validate.isKor(obj.value.charAt(i)) ? 2 : 1; strLength += addLength if(strLength > maxLength) { alert(title+"Àº(´Â) ¿µ¹®±âÁØ "+maxLength+"ÀÚ, Çѱ۱âÁØ "+Math.floor(maxLength/2)+"ÀÚ ÀÌÇÏ ÀԷ°¡´ÉÇÕ´Ï´Ù."); obj.value = str; strLength -= addLength; break; } str += obj.value.charAt(i); } return strLength; } /*select box À§·Î ·¹ÀÌ¾î ¶ç¿ì±â */ // Internet Explorer¿¡¼­ ¼¿·ºÆ®¹Ú½º¿Í ·¹À̾ °ãÄ¥½Ã ·¹À̾ ¼¿·ºÆ® ¹Ú½º µÚ·Î ¼û´Â Çö»óÀ» ÇØ°áÇÏ´Â ÇÔ¼ö // ·¹À̾ ¼¿·ºÆ® ¹Ú½º¸¦ ħ¹üÇÏ¸é ¼¿·ºÆ® ¹Ú½º¸¦ hidden ½ÃÅ´ // »ç¿ë¹ý : //