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, expiredays ) { var today = new Date(); today.setDate( today.getDate() + expiredays ); document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"; } function wclose(x) { if(x == 'Y') setCookie("mainpopup1", "checked" ,1 ); document.getElementById('mainpopup1').style.display = "none"; } String.prototype.email = function() { email_regex = /^([0-9a-zA-Z\._-]+)@([0-9a-zA-Z_-]+)(\.[0-9a-zA-Z_-]+){1,2}$/; if(!email_regex.test(this)){ alert('정상적인 이메일 형식이 아닙니다.'); res = false; } else{ res = true; } return res; } String.prototype.onlyAlphabetNumber = function() { var regex = /[^a-z0-9]/gi; var res = true; if(regex.test(this)) { res = false; } return res; } // 패스워드 규칙 숫자 1자 이상 , 영문 한자이상 포함 String.prototype.checkPass = function() { var regex = /(?=.*\d{1,50})(?=.*[~`!@#$%\^&*()-+=]{1,50})(?=.*[a-zA-Z]{1,50}).{8,50}$/; //var regex = /[0-9]+.*[a-zA-Z]+|[a-zA-Z]+.*[0-9]+/; var res = false; if(regex.test(this)) { res = true; } return res; } function eventNumber(obj){ $(obj).val($(obj).val().replace(/[^0-9]/g,"")); } String.prototype.onlyNumber = function() { var res = true; if(isNaN(this)) { alert('숫자만 가능합니다.'); res = false; } return res; } String.prototype.onlyPhoneNumber = function() { var regex = /[0-9\-]/; var res = false; if(regex.test(this)) { res = true; } return res; } String.prototype.checkPhoneNumber = function() { var regex = /[0-9\-]/; var res = false; var phone_val = this.replace(/-/g,""); if(regex.test(this) && phone_val.length > 7 && phone_val.length < 12) { res = true; } return res; } String.prototype.bytes = function() { var str = this; var l = 0; for (var i=0; i 128 || str.charCodeAt(i) == 10 || str.charCodeAt(i) == 13) ? 2 : 1; } return l; } Number.prototype.zerodate = function() { return (this > 9 ? "" : "0")+this; }; function OnlyAlphabetNumber() { if (!((event.keyCode > 47 && event.keyCode < 58) || (event.keyCode > 64 && event.keyCode < 91) || (event.keyCode > 96 && event.keyCode < 123))){ alert("영문,숫자만 입력가능합니다."); event.returnValue=false; } } function noCTRL() { var ctrl = (document.all) ? event.ctrlKey:e.modifiers & Event.CONTROL_MASK; if (ctrl) { window.event.returnValue = false; } } function CheckAll(frm){ var fr = eval("document."+frm); if(fr.checkall.checked == true){ len = fr.elements.length; var i=0; for(i=0; i$1://$2").replace(regEmail,"$1"); } else { doc = doc.replace(regURL2,"$1$2").replace(regEmail,"$1"); } return doc; } String.prototype.strcut = function(len, tail) { var str = this; var LastStr = ""; var count = 0; var tag = 0; for (var i=0; i <= str.length && count < len; i++) { LastStr = str.charAt(i); if (LastStr == '<') tag = 1; // 태그 시작 if (tag && LastStr == '>') { tag = 0; continue; } // 태그 끝 if (tag) continue; count += (str.charCodeAt(i) > 128) ? 3 : 1; } var res = str.substring(0,i); if (str.length > res.length) return res + tail; else return res; } //숫자 컴마 찍기 function commaStr( num ){ num = num+""; point = num.length%3 len = num.length; str = num.substring(0,point); while( point < len){ if( str != "" ) str += ","; str += num.substring( point , point+3); point +=3; } return str; } function getSearchTime(time, sobj, eobj,type){ var sdate,edate,startdate,enddate; var datetype = (type) ? type : 'd'; edate = new Date(); if (datetype == 'd') { sdate = new Date(edate.getFullYear(), edate.getMonth(), edate.getDate()-time ); } else sdate = new Date(edate.getFullYear(), edate.getMonth()-time, '1'); var syear = sdate.getFullYear(); var smonth = sdate.getMonth()+1; var sday = sdate.getDate(); if (smonth < 10) smonth = '0'+smonth; if (sday < 10) sday = '0'+sday; if(datetype == 'd') { startdate = syear + '-' + smonth + '-' + sday; enddate = syear + '-' + smonth + '-' + sday; } else { var endday = new Date(syear,smonth,0).getDate(); var newdate = syear + '-' + smonth ; startdate = newdate + '-' + '01'; enddate = newdate + '-' + endday; } document.getElementById(sobj).value = startdate; document.getElementById(eobj).value = enddate; } function checkBytes(obj) { var msgres=""; var val = obj.val(); var bytes = val.bytes(); $('#msglength').html(bytes); var maxbytes = $('#msgmaxlength').html(); if(bytes > maxbytes) { for(var n=1; n <= val.length; n++) { if(val.substr(0,n).bytes() <= maxbytes) msgres = val.substr(0,n); else break; } $('#msgcontent').val(msgres); alert(maxbytes+"바이트 이하로 입력해주세요."); checkBytes($('#msgcontent')); } } function checkBytes2(obj, maxlen) { var msgres=""; var val = obj.val(); var bytes = val.bytes(); var maxbytes = maxlen; if(bytes > maxbytes) { for(var n=1; n <= val.length; n++) { if(val.substr(0,n).bytes() <= maxbytes) msgres = val.substr(0,n); else break; } obj.val(msgres); alert(maxbytes+"바이트 이하로 입력해주세요."); //checkBytes2(obj, maxlen); } } function checkPhone(text) { var phone = new RegExp("070|010|011|016|018|019","gi"); var val = text.replace(/-| /gi, ''); var hnum = val.substr(0,3); var res = false; if(phone.test(hnum) && (val.length == 11 || val.length == 10)) res = true; return res; } function onlyNumberKey(obj) { var str = ""; for(var n=0; n <= obj.value.length; n++) { is_pstr = obj.value.substr(n,1).onlyPhoneNumber(); if(is_pstr) str += obj.value.substr(n,1); } obj.value = str; } function openWindow(url, width, height) { window.open(url, '','width='+width+',height='+height); } function checkMinPrice(p1, p2, p3) { this.sms_price = p1; this.lms_price = p2; this.mms_price = p3; } function checkJoinType(v) { if(v == 2) { $('.groupcode1type').css('display','table-row'); $('.groupcode2type').css('display','none'); } else { $('.groupcode1type').css('display','none'); $('.groupcode2type').css('display','table-row'); } } function getCaretPosition(ctrl) { var CaretPos = 0; // IE Support if (document.selection) { ctrl.focus (); var Sel = document.selection.createRange (); Sel.moveStart ('character', -ctrl.value.length); CaretPos = Sel.text.length; } // Firefox support else if (ctrl.selectionStart || ctrl.selectionStart == '0') CaretPos = ctrl.selectionStart; return CaretPos; } checkMinPrice.prototype.check = function() { var price = 0; if($('input[name=pay_sms]').val() < this.sms_price) { price = this.sms_price; alert('sms 금액을 '+price+'(vat포함)원 이상으로 입력해주세요.' ); $('input[name=pay_sms]').val(price); } if($('input[name=pay_lms]').val() < this.lms_price) { price = this.lms_price; alert('lms 금액을 '+price+'(vat포함)원 이상으로 입력해주세요.' ); $('input[name=pay_lms]').val(price); } if($('input[name=pay_mms]').val() < this.mms_price) { price = this.mms_price; alert('mms 금액을 '+price+'(vat포함)원 이상으로 입력해주세요.' ); $('input[name=pay_mms]').val(price); } } function TaxView() { if($('#ordertype2').prop('checked') == true && $('#taxtype1').prop('checked') == false) { $('#taxtype1').prop('checked',true); $('#Taxtype2Div').css('display','none'); $('#Taxtype3Div').css('display','none'); alert('신용카드 결제는 영수증으로 대신 합니다.'); } } function goLogin() { var cf = confirm("로그인이후 이용가능한 기능입니다.\r\n로그인 하시겠습니까?"); if(cf == true) location.href="/member/login.html"; else return; } function checkBizNum(obj) { var checkSum = 0; var checkID = [1,3,7,1,3,7,1,3,5]; var bizNum= $(obj).val(); if ((bizNum = (bizNum+'').match(/\d{1}/g)).length != 10) { return false; } for (var i=0; i<9; i++) { checkSum += checkID[i] * Number(bizNum[i]); } if (10 - ((checkSum + Math.floor(checkID[8] * Number(bizNum[8]) / 10)) % 10) != Number(bizNum[9])) { return false; } return true; }