/*** prototype ***/ String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); } String.prototype.str_replace = function(str1,str2) { return this.split(str1).join(str2); } String.prototype.josa = function(nm) { var nm1 = nm.trim().substring(0, nm.trim().indexOf("/")); var nm2 = nm.trim().substring(nm.trim().indexOf("/") + 1, nm.trim().length); var a = this.substring(this.length - 1, this.length).charCodeAt(); a = a - 44032; var jongsung = a % 28; return (jongsung) ? nm1 : nm2; } /*** essential func. ***/ function _ID(id) { return document.getElementById(id); } function array_search(needle,haystack){ for(var i in haystack){ if(haystack[i]==needle){return i;} } return false; } function addOnloadEvent(fnc) { if (typeof window.addEventListener!="undefined") window.addEventListener( "load", fnc, false ); else if (typeof window.attachEvent!="undefined") window.attachEvent( "onload", fnc ); else { if (window.onload!=null){ var oldOnload = window.onload; window.onload = function ( e ) { oldOnload( e ); window[fnc](); }; } else window.onload = fnc; } } function get_objectTop(obj) { if (obj.offsetParent==document.body || obj==document.body) return obj.offsetTop; else return obj.offsetTop + get_objectTop(obj.offsetParent); } function get_objectLeft(obj) { if (obj.offsetParent==document.body) return obj.offsetLeft; else return obj.offsetLeft + get_objectLeft(obj.offsetParent); } function embed(src,width,height,vars) { document.write('\ \ \ \ \ \ \ \ \ '); } function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } 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 setCookie (name, value) { var argv = setCookie.arguments; var argc = setCookie.arguments.length; var expires = (2 < argc) ? argv[2] : null; var path = (3 < argc) ? argv[3] : null; var domain = (4 < argc) ? argv[4] : null; var secure = (5 < argc) ? argv[5] : false; document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); } /*** user func. ***/ function comma(x) { var temp = ""; var x = String(uncomma(x)); num_len = x.length; co = 3; while (num_len>0){ num_len = num_len - co; if (num_len<0){ co = num_len + co; num_len = 0; } temp = ","+x.substr(num_len,co)+temp; } return temp.substr(1); } function uncomma(x) { var reg = /(,)*/g; x = parseInt(String(x).replace(reg,""),10); return (isNaN(x)) ? 0 : x; } function autoComma(obj){ if (event.keyCode!=9) obj.value=comma(obj.value); } function onlynumber() { var e = event.keyCode; window.status = e; if (e>=48 && e<=57) return; if (e==8 || e==13 || e==46) return; event.returnValue = false; } function chkBox(El,mode) { if (!El) return; if (typeof(El)!="object") El = document.getElementsByName(El); for (i=0;iobj.getAttribute('max')) ret = obj.getAttribute('max'); obj.value = ret; } /*** ³¯Â¥ ÀÚµ¿ »ðÀÔ ***/ function autoDate(obj1,obj2,val1,val2) { if (typeof(obj1)!=Object) obj1 = _ID(obj1); if (typeof(obj2)!=Object) obj2 = _ID(obj2); obj1.value = val1; obj2.value = val2; } /*** ½ºÅ©·Ñ Á¦¾î ***/ function innerScroll(obj) { if (event.wheelDelta >= 120) obj.scrollTop -= 40; else if (event.wheelDelta <= -120) obj.scrollTop += 40; //obj.scrollBy(0,event.wheelDelta / -3); return false; } function mTop(fstx,fsty,lstx,lsty) { var Timer; var winHeight = document.body.scrollTop; if(Timer) clearTimeout(Timer); startx = 0; starty = winHeight; if(!fstx || fstx < 0) fstx = 0; if(!fsty || fsty < 0) fsty = 0; var speed = 7; if(!lstx) lstx = 0 + startx; if(!lsty) lsty = 0 + starty; lstx += (fstx - startx) / speed; if (lstx < 0) lstx = 0; lsty += (fsty - starty) / speed; if (lsty < 0) lsty = 0; var posX = Math.ceil(lstx); var posY = Math.ceil(lsty); window.scrollTo(posX, posY); if((Math.floor(Math.abs(startx - fstx)) < 1) && (Math.floor(Math.abs(starty - fsty)) < 1)){ clearTimeout(Timer); //window.scroll(fstx,fsty); } else if(posX != fstx || posY != fsty){ Timer = setTimeout("mTop("+fstx+","+fsty+","+lstx+","+lsty+")",15); } else{ clearTimeout(Timer); } } /*** blink ű×È¿°ú ***/ function doBlink() { var blink = document.all.tags("BLINK"); for (var i=0; i < blink.length; i++) { blink[i].style.visibility = (blink[i].style.visibility =="visible") ? "hidden":"visible"; } } if (document.all) setInterval("doBlink()",500); /*** »óǰ ÆË¾÷À©µµ¿ì¿¡¼­ ±¸¸Å¹öư À̺¥Æ® ***/ function exec_dyn(fm,mode) { if (chkForm(fm)){ if (mode=="wishlist") fm.action = "../mypage/wishlist.php"; else fm.action = "../order/cart.php"; fm.mode.value = mode; fm.submit(); } } /*** »óǰ ½ºÅ©·Ñ ***/ function eScroll(obj) { var inner; var _self = this; var d = 1; var cnt = 0; var delay = 100; this.per = 0; this.init = function(){ if (typeof(obj)!='Object') obj = $(obj); obj.style.overflow = "hidden"; //obj.innerHTML = "
" + obj.innerHTML + "" + obj.innerHTML + "
"; this.act(1); } this.go = function(idx) { d = idx; } this.scroll = function() { if (this.per && obj.scrollLeft%this.per==0 && cnt