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(val) { if(val == 'Y') setCookie("popup1", "checked" ,1 ); document.getElementById('popup1').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 = /[^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; }; 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 delSpecial(str) { //숫자,영문, 한글 -_() 빼고 모두 제거 var reg = /[^\w\sㄱ-힣\-\_\(\)\,\@\.]/g; return str.replace(reg, ''); } 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 ServicePay() { var basicprice = 9000; var addidprice = 5000; var orderid = $('#ORDER_ID').val(); var serviceId = $('#SERVICE_ID').val(); var usercount= parseInt($('select[name=usercount]').val()); var month = parseInt($('select[name=servicemonth]').val()); var monthprice = basicprice + ((usercount-5)*addidprice); var sumprice = monthprice *month; var vatprice = sumprice*0.1; var totalprice = vatprice + sumprice; $('input[name=AMOUNT]').val(totalprice); $('#sumprice').html(commaStr(sumprice)); $('#vatprice').html(commaStr(vatprice)); $('#totalprice').html(commaStr(totalprice)); $.post('/myinfo/service/service_action.php','mode=checksum&serviceId='+serviceId+'&orderId='+orderid+'&amount='+totalprice, function(data) { $('#CHECK_SUM').val(data); }); } */ function ServicePay() { var basicprice = 20000; var addidprice = 5000; var smsprice = 20; var managerprice = 300; var orderid = $('#ORDER_ID').val(); var serviceId = $('#SERVICE_ID').val(); var usercount= parseInt($('select[name=usercount]').val()); var month = parseInt($('select[name=servicemonth]').val()); var smsservice = parseInt($('select[name=smsservice]').val()); var managerservice = parseInt($('select[name=managerservice]').val()); var monthprice = basicprice + ((usercount-5)*addidprice) + (smsservice*smsprice) + (managerservice*managerprice); var sumprice = monthprice *month; var vatprice = sumprice*0.1; var totalprice = vatprice + sumprice; $('input[name=AMOUNT]').val(totalprice); $('#sumprice').html(commaStr(sumprice)); $('#vatprice').html(commaStr(vatprice)); $('#totalprice').html(commaStr(totalprice)); $.post('/myinfo/service/service_action.php','mode=checksum&serviceId='+serviceId+'&orderId='+orderid+'&amount='+totalprice+'&smsservice='+smsservice, function(data) { $('#CHECK_SUM').val(data); }); } function TaxView() { if($('#paytype2').prop('checked') == true ) $('.banknametr').css('display','table-row'); else $('.banknametr').css('display','none'); if($('#taxorder1').prop('checked') == true && ($('#paytype2').prop('checked') == true || $('#paytype3').prop('checked') == true || $('#paytype4').prop('checked') == true)) { $('#taxdiv').css('display','block'); $('#taxdiv2').css('display','none'); } else if(($('#taxorder1').prop('checked') == true || $('#taxorder3').prop('checked') == true) && $('#paytype1').prop('checked') == true) { $('#taxdiv').css('display','none'); $('#taxdiv2').css('display','none'); $('#taxorder2').prop('checked',true); alert('신용카드 결제는 신용카드 영수증으로 대신합니다.'); } else if($('#taxorder3').prop('checked') == true && ($('#paytype2').prop('checked') == true || $('#paytype3').prop('checked') == true || $('#paytype4').prop('checked') == true)) { $('#taxdiv').css('display','none'); $('#taxdiv2').css('display','block'); } else { $('#taxdiv').css('display','none'); $('#taxdiv2').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('정상적인 쿠폰이 아닙니다.'); }); } function startGraph(mode, type, val) { $('form[name=searchform] input[name=mode]').val(mode); if(type == 'bar') setBarGraph('mode='+mode+val); else setPieGraph('mode='+mode+val); } function setBarGraph(val) { $.get('../graph/lib/runchart.php', val , function(data) { var chart = c3.generate({ bindto: "#run_chart", data: { x : 'x', columns: data, axes: { data1: 'y', data2: 'y2' }, labels: { format: { data1: function (value, id, i, j) { var strArray = value.toString().split('.'); if(value == 0 ) var res = ""; else if(strArray.length < 1) var res = strArray[1]+ '분'; else if(strArray.length == 1) var res = strArray[0]+ '시간'; else var res = strArray[0]+ '시간'+ strArray[1]+'분'; return res; }, data2: function (value, id, i, j) { var res = (value == 0 ) ? "" : value + "건"; return res; } } }, type: 'bar', types: { 'data2': 'line', }, names: { data1: '상담시간', data2: '상담건수' } }, tooltip: { format: { value: function (value, ratio, id, index) { if(id === 'data1') { var strArray = value.toString().split('.'); if(value == 0 ) var res = "0분"; else if(strArray.length < 1) var res = strArray[1]+ '분'; else if(strArray.length == 1) var res = strArray[0]+ '시간'; else var res = strArray[0]+ '시간'+ strArray[1]+'분'; } else { var res = value + "건"; } return res; } } }, axis: { x: { type: 'category' // this needed to load string x value }, y2: { show: true } } }); },'json'); } function setPieGraph(val) { $.get('../graph/lib/runpiechart.php', val , function(data) { var chart1 = c3.generate({ bindto: "#run_chart1", data: { columns: data, type: 'pie', }, pie : { label: { format: function (value, ratio, id) { return value + "건"; } } }, padding: { top: 0, left: 0 }, size: { width: 400,height: 400 } }); },'json'); $.get('../graph/lib/runpiechart2.php', val , function(data) { console.log(data); var chart2 = c3.generate({ bindto: "#run_chart2", data: { columns: data, type: 'pie', }, pie : { label: { format: function (value, ratio, id) { var strArray = value.toString().split('.'); if(value == 0 ) var res = "0분"; else if(strArray.length < 1) var res = strArray[1]+ '분'; else if(strArray.length == 1) var res = strArray[0]+ '시간'; else var res = strArray[0]+ '시간'+ strArray[1]+'분'; return res; } } }, padding: { top: 0, right: 50 }, size: { width: 400,height: 400 } }); },'json'); /* swfobject.embedSWF( "../graph/runremote_chart.swf", "run_chart1", "400", "380", "9.0.0", "expressInstall.swf", {"data-file":"../graph/lib/runpiechart.php?"+val} ); swfobject.embedSWF( "../graph/runremote_chart.swf", "run_chart2", "400", "380", "9.0.0", "expressInstall.swf", {"data-file":"../graph/lib/runpiechart2.php?"+val} ); */ }