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 = /[^0-9a-z]/i; var res = true; if(regex.test(this)) { res = false; } return res; } // 패스워드 규칙 숫자 1자 이상 , 영문 한자이상 포함 String.prototype.checkPass = function() { var regex = /[0-9]+.*[a-zA-Z]+|[a-zA-Z]+.*[0-9]+/; var res = false; if(regex.test(this)) { res = true; } return res; } String.prototype.onlyNumber = function() { var res = true; if(isNaN(this)) { alert('숫자만 가능합니다.'); res = false; } return res; } String.prototype.bytes = function() { var str = this; var l = 0; for (var i=0; i 128) ? 2 : 1; return l; } Number.prototype.zerodate = function() { return (this > 9 ? "" : "0")+this; }; var obj = { textcheck : function(len) { var res = true; var title = this.getAttribute('comment'); if(this.value == "") { alert(title +' 란을 입력해주세요.'); this.focus(); res = false; } else if(len && this.value.length < len) { alert(title +' 란을 '+ len + '자 이상 입력해주세요.'); this.focus(); res = false; } return res; }, selcheck : function(len) { var res = true; var title = this.getAttribute('comment'); if(this.value == "") { alert(title +' 란을 선택해주세요.'); res = false; } return res; }, boxcheck: function() { var res = true; var title = this.getAttribute('comment'); if(this.checked == false) { alert(title +' 란을 체크해주세요.'); this.focus(); res = false; } return res; } } 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 getMonthTime(STIME){ vn_day1 = new Date(); vn_day2 = new Date(vn_day1.getFullYear(), vn_day1.getMonth()-STIME, vn_day1.getDate()); var syear = vn_day2.getFullYear(); var smonth = vn_day2.getMonth()+1; var sday = vn_day2.getDate(); if ( smonth < 10) { smonth = '0'+smonth; } if ( sday < 10) { sday = '0'+sday; } var newdate = syear + '-' + smonth + '-' + sday; document.searchform.s_date.value = newdate; } function getMonthTime2(STIME){ vn_day1 = new Date(); vn_day2 = new Date(vn_day1.getFullYear(), vn_day1.getMonth()-STIME, '1'); var syear = vn_day2.getFullYear(); var smonth = vn_day2.getMonth()+1; if ( smonth < 10) { smonth = '0'+smonth; } en_day1 = new Date(syear,smonth,0); //말일구하기 var sday = en_day1.getDate(); var newdate = syear + '-' + smonth ; document.searchform.s_date.value = newdate + '-' + '01'; document.searchform.e_date.value = newdate + '-' + sday; } function getDayTime(STIME){ vn_day1 = new Date(); vn_day2 = new Date(vn_day1.getFullYear(), vn_day1.getMonth(), vn_day1.getDate()-STIME ); var syear = vn_day1.getFullYear(); var smonth = vn_day2.getMonth()+1; var sday = vn_day2.getDate(); if ( smonth < 10) { smonth = '0'+smonth; } if ( sday < 10) { sday = '0'+sday; } var newdate = syear + '-' + smonth + '-' + sday; document.searchform.s_date.value = newdate; document.searchform.e_date.value = newdate; } function ServicePay() { var month, basicuser,chatuser,pushcount,basic_sum,chat_sum; var pushpay = {"1000":3000,"2000":5000,"5000":10000,"8000":15000,"12000":20000,"20000":30000,"40000":50000,"70000":80000,"100000":100000} var basicprice = 1000; var chatprice = 10000; var chataddprice = 2000; var orderid = $('#ORDER_ID').val(); var serviceId = $('#SERVICE_ID').val(); month = parseInt($('select[name=servicemonth]').val()); if($('#usechat').prop('checked') == true) { $('#chatdiv').css('display','block'); chatuser = parseInt($('select[name=chatuser]').val()); chat_sum = (chatprice + (chataddprice * chatuser))*month; } else { $('#chatdiv').css('display','none'); chat_sum = 0; } if($('#usepush').prop('checked') == true) { $('#pushdiv').css('display','block'); pushcount = $('select[name=pushcount]').val(); push_sum = (pushpay[pushcount])*month; } else { $('#pushdiv').css('display','none'); push_sum = 0; } basicuser = parseInt($('select[name=basicuser]').val()); basic_sum = (basicprice * basicuser)*month; sumprice = basic_sum + chat_sum + push_sum; taxprice = sumprice*0.1; totalprice = taxprice + sumprice; $('input[name=AMOUNT]').val(totalprice); $('#pay1_txt').html(commaStr(basic_sum)); $('#pay2_txt').html(commaStr(chat_sum)); $('#pay3_txt').html(commaStr(push_sum)); $('#tax_txt').html(commaStr(taxprice)); $('#sum_txt').html(commaStr(sumprice)); $('#total_txt').html(commaStr(totalprice)); $.post('/myinfo/service/service_action.php','mode=checksum&serviceId='+serviceId+'&orderId='+orderid+'&amount='+totalprice, function(data) { $('#CHECK_SUM').val(data); }); } function TaxView() { if($('#taxorder1').prop('checked') == true && $('#paytype2').prop('checked') == true) { $('#taxdiv').css('display','block'); } else if($('#taxorder1').prop('checked') == true && $('#paytype1').prop('checked') == true) { $('#taxdiv').css('display','none'); $('#taxorder2').prop('checked',true); alert('신용카드 결제는 신용카드 영수증으로 대신합니다.'); } else $('#taxdiv').css('display','none'); } function taxorder(val) { $('#taxorderdiv').css('display','block'); $('#ordernum').val(val); $('#mode').val('ordertax'); } function freeorder() { $().ready(function() { $('body').append('
'); $('#freeorderform').submit(); }); /* $.post('/myinfo/service/service_action.php','&mode=freeorder',function(data) { if(data==200) alert('체험판 신청이 완료되었습니다.\r\n중복신청 심의 후 15분이내 승인하여 드립니다.'); else alert('체험판 신청 대상이 아닙니다.'); }); */ } function checkkey() { var c1 = $('#coupon1').val(); var c2 = $('#coupon2').val(); var c3 = $('#coupon3').val(); var c4 = $('#coupon4').val(); if(c1 =="" || c2 =="" || c3 =="" || c4 =="") { alert("쿠폰번호를 정상적으로 입력해주세요"); return; } $.post('/myinfo/service/service_action.php','&mode=coupon&coupon='+c1+c2+c3+c4, function(data) { if(data==200) { $('#couponcheck').val('1'); alert('정상적인 쿠폰니다.\r\n3개월이상 결제시 15일 6개월이상 결제시 30일이 적용됩니다.'); } else alert('정상적인 쿠폰이 아닙니다.'); }); }