//String.prototype.trim = function() { // var x=this; // x=x.replace(/^\s*(.*)/, "$1"); // x=x.replace(/(.*?)\s*$/, "$1"); // return x; //} function ucme(obj) { _t = obj.value; if (_t) { _x = _t.toUpperCase(); obj.value = _x; } } function swapSelects(flag) { var selects = dw_main.document.getElementsByTagName("select"); for (var i = 0; i < selects.length; i++) { if (flag==1) { //selects[i].style.visibility = (flag) ? "visible" : "hidden"; selects[i].style.visibility = "hidden"; } else { selects[i].style.visibility = "visible"; } } } function opencalx(mypage,width,height) { var tmp; limit = 5000; today = new Date(); num = today.getTime(); num = Math.round(Math.abs(Math.sin(num) * 1000000)) % limit; if (!width) { width = 440; } if (!height) { height = 320; } var winl = (screen.width - width) / 2; var wint = (screen.height - height) / 2; tmp = window.open(mypage,'newwindow'+num,'width='+width+',height='+height+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,left='+winl+',top='+wint); } function FormatData(str) { var tstr; var xstr; //tstr = str.value.toLowerCase().trim(); tstr = str.value.toLowerCase(); xstr = tstr.substring(0,1).toUpperCase(); nextUp = 0; for (k=1; k < tstr.length; k++) { xchar = tstr.substring(k,(k+1)); if (nextUp==1) { xstr = xstr + xchar.toUpperCase(); nextUp = 0; } else { xstr = xstr + xchar; } if (xchar==' ') { nextUp = 1; } } str.value=xstr; } function AllUpper(str) { var tstr; var xstr; tstr = str.value.toUpperCase(); str.value=tstr; } var slugdisplay=''; function toggleslug(slugid) { eval('slugdisplay = document.all.slg_'+slugid+'.style.display'); if (slugdisplay=='none') { eval('document.all.slg_'+slugid+'.style.display = \'\''); document.images['slg'+slugid].src = '/images/slug.up.gif'; } else { eval('document.all.slg_'+slugid+'.style.display = "none"'); document.images['slg'+slugid].src = '/images/slug.down.gif'; } } function showtab(slugid) { eval('document.all.slg_'+slugid+'.style.display = \'\''); } function cancelOrder(type) { // this cancels an order from the main page.. xx = confirm('Proceeding will cancel the order and purge your data. Click OK to continue.'); if (xx) { document.OrderEntry.STAT.value = "2"; document.OrderEntry.submit(); } } function validateOrder(type) { var mt; var passed; var promotionamount; mt = document.OrderEntry.marketType.value; // this function validates the entire order.. // passed = false; promotionamount = "0"; if (type==1 || type==3 || type==4) { if (document.OrderEntry.promotionamount != null) { promotionamount = document.OrderEntry.promotionamount.value; } } promotionamount = promotionamount.replace("$", ""); promotionamount = promotionamount.replace(",", ""); promotionamount = promotionamount * 1; if (type==1) { // this is a proposal.. document.OrderEntry.STAT.value = "1"; } if (type==3) { // this is a submitted residential order.. document.OrderEntry.STAT.value = "3"; } if (type==4) { // this is a submitted commercial order.. document.OrderEntry.STAT.value = "4"; } if (type==6) { // this is order edit... document.OrderEntry.STAT.value = "6"; } if (type==9) { // this is a credit resubmit.. document.OrderEntry.STAT.value = "9"; } stripAlpha(document.OrderEntry.PrimaryPhoneNumber); stripAlpha(document.OrderEntry.Zip); stripAlpha(document.OrderEntry.Zip4); stripAlpha(document.OrderEntry.BillZip); stripAlpha(document.OrderEntry.BillZip4); stripAlpha(document.OrderEntry.ReferralPhone); if (document.OrderEntry.ppn.value == "-1") { } else { document.OrderEntry.ppn.value = document.OrderEntry.PrimaryPhoneNumber.value; } if (mt==1) { // these are the residential rules.. if (!document.OrderEntry.FirstName.value) { alert('First Name is a required field.'); } else if (!document.OrderEntry.LastName.value) { alert('Last Name is a required field.'); } else if (!document.OrderEntry.AddressNumber.value) { alert('Street Number is a required field.'); } else if (!document.OrderEntry.addressstreetname.value) { alert('Street Name is a required field.'); } else if (!document.OrderEntry.City.value) { alert('City is a required field.'); } else if (!document.OrderEntry.State.value) { alert('State is a required field.'); } else if (!document.OrderEntry.Zip.value) { alert('Zip is a required field.'); } //else if (!document.OrderEntry.SSN.value) { alert('SSN is a required field.'); } else if (!document.OrderEntry.billFirstName.value) { alert('Billing First Name is a required field.'); } else if (!document.OrderEntry.billLastName.value) { alert('Billing Last Name is a required field.'); } //else if (!document.OrderEntry.billaddressnumber.value) { alert('Billing Street Number is a required field.'); } else if (!document.OrderEntry.billaddressstreetname.value) { alert('Billing Street Name is a required field.'); } else if (!document.OrderEntry.BillCity.value) { alert('Billing City is a required field.'); } else if (!document.OrderEntry.BillState.value) { alert('Billing State is a required field.'); } else if (!document.OrderEntry.BillZip.value) { alert('Billing Zip is a required field.'); } else if (document.OrderEntry.ordertype.selectedIndex<1) { alert('Order Type is a required field.'); } else if (!document.OrderEntry.dyno_contactphone.value) { alert('Contact Phone is a required field.'); } else if (!document.OrderEntry.dyno_timetocall.value) { alert('Time to Call is a required field.'); } else if (document.OrderEntry.HowHeard.selectedIndex<1) { alert('How Heard is a required field.'); } else if (document.OrderEntry.clectoclec.selectedIndex<1) { alert('Current Carrier is a required field.'); } //else if (!document.OrderEntry.Localsalescode1.value) { alert('Local Sales Code 1 is a required field.'); } else if (promotionamount > 0) { if (document.OrderEntry.dyno_initialterm.value !="36M") { alert('Promotion Amount only valid for 36M initial term.'); }else { if ((promotionamount % 250 )!= 0 ){ alert('Promotion amount must a multiple of 250.'); } } } else if (!document.OrderEntry.dyno_atres[0].checked && !document.OrderEntry.dyno_atres[1].checked && !document.OrderEntry.dyno_atres[2].checked) { alert('\'At Residence\' is a required field.'); } //else if (!(document.OrderEntry.conferencingusage.value%100 >0)) //{ // alert('Conferencing Usage Commitment must be a multiple of 100.'); //} //else if (document.OrderEntry.company.selectedIndex<1) { alert('Company is a required field.'); } //else if (document.OrderEntry.aggregator.selectedIndex<1) { alert('Aggregator is a required field.'); } else { passed = true; } // warn about the ssn.. if (!document.OrderEntry.SSN.value) { kk = confirm('Even though SSN is not a required field, it is HIGHLY recommended. Click OK to continue processing order without SSN.'); if (kk) { if (passed==true) { passed = true; } } else { passed = false; } } } else if (mt==2 && type!=1) { var commAlert; commAlert='' // these are the commercial rules.. if (!document.OrderEntry.FirstName.value) { commAlert='First Name is a required field.'; } if (!document.OrderEntry.LastName.value) { commAlert= commAlert + '\n' + 'Last Name is a required field.'; } if (!document.OrderEntry.CompanyName.value) { commAlert= commAlert + '\n' + 'Company Name is a required field.'; } if (!document.OrderEntry.BillCompany.value) { commAlert= commAlert + '\n' + 'Billing Company Name is a required field.'; } if (!document.OrderEntry.AddressNumber.value) { commAlert= commAlert + '\n' + 'Street Number is a required field.'; } if (!document.OrderEntry.addressstreetname.value) { commAlert= commAlert + '\n' + 'Street Name is a required field.'; } if (!document.OrderEntry.City.value) { commAlert= commAlert + '\n' + 'City is a required field.'; } if (!document.OrderEntry.State.value) { commAlert= commAlert + '\n' + 'State is a required field.'; } if (!document.OrderEntry.Zip.value) { commAlert= commAlert + '\n' + 'Zip is a required field.'; } if (!document.OrderEntry.SSN.value) { commAlert= commAlert + '\n' + 'Fed. Tax ID Number is a required field.'; } if (!document.OrderEntry.dyno_contactphone.value) { commAlert= commAlert + '\n' + 'Contact Phone is a required field.'; } if (document.OrderEntry.ordertype.selectedIndex<1) { commAlert= commAlert + '\n' + 'Order Type is a required field.'; } if (document.OrderEntry.salesoffice.selectedIndex<1) { commAlert= commAlert + '\n' + 'Sales Office is a required field.'; } if (document.OrderEntry.saleschannel.selectedIndex<1) { commAlert= commAlert + '\n' + 'Sales Channel is a required field.'; } if (document.OrderEntry.HowHeard.selectedIndex<1) { commAlert= commAlert + '\n' + 'How Heard is a required field.'; } if (!document.OrderEntry.dyno_timetocall.value) { commAlert= commAlert + '\n' + 'Time to Call is a required field.'; } //if (!document.OrderEntry.Localsalescode1.value) { commAlert= commAlert + '\n' + 'Local Sales Code 1 is a required field.'; } if (document.OrderEntry.clectoclec.selectedIndex<1) { commAlert= commAlert + '\n' + 'Current Carrier is a required field.'; } if (!document.OrderEntry.dyno_contractaccountname.value){ commAlert= commAlert + '\n' + 'Contract Account Name is a required field.'; } if (!document.OrderEntry.dyno_standard.value) { commAlert= commAlert + '\n' + 'Standard is a required field.'; } if (!document.OrderEntry.dyno_autorenew.value) { commAlert= commAlert + '\n' + 'AutoRenew is a required field.'; } if (!document.OrderEntry.dyno_initialterm.value) { commAlert= commAlert + '\n' + 'Initial Term is a required field.'; } if (!document.OrderEntry.dyno_ongoingterm.value) { commAlert= commAlert + '\n' + 'Ongoing Term is a required field.'; } if (!document.OrderEntry.dyno_signer.value) { commAlert= commAlert + '\n' + 'Signer is a required field.'; } if (!document.OrderEntry.dyno_estldusage.value) { commAlert= commAlert + '\n' + 'Estimated Usage is a required field.'; } if (!((document.OrderEntry.conferencingusage.value % 100) == 0)) { commAlert= commAlert + '\n' + 'Conferencing Usage Commitment must be a multiple of 100.'; } if (promotionamount > 0) { if (document.OrderEntry.dyno_initialterm.value !="36M") { commAlert= commAlert + '\n' + 'Promotion Amount only valid for 36M initial term.'; }else { if ((promotionamount % 250 )!= 0 ){ commAlert= commAlert + '\n' + 'Promotion amount must a multiple of 250.'; } } } if (type!=1) { if (!document.OrderEntry.dyno_sigdate.value) { commAlert= commAlert + '\n' + 'Signature Date is a required field.'; } else { if (!validateUSDate(document.OrderEntry.dyno_sigdate.value)) { commAlert= commAlert + '\n' + 'Invalid Signature Date - '+document.OrderEntry.dyno_sigdate.value+' - Please enter the date in the format mm/dd/yyyy.'; document.OrderEntry.dyno_sigdate.focus(); } } }else { if (!document.OrderEntry.dyno_sigdate.value ) { } else { if (!validateUSDate(document.OrderEntry.dyno_sigdate.value)) { commAlert= commAlert + '\n' + 'Invalid Signature Date - '+document.OrderEntry.dyno_sigdate.value+' - Please enter the date in the format mm/dd/yyyy.'; document.OrderEntry.dyno_sigdate.focus(); } } } if (type!=1) { if (!document.OrderEntry.reqduedate.value) { commAlert= commAlert + '\n' + 'Requested Due Date is a required field.'; } else { if (!validateUSDate(document.OrderEntry.reqduedate.value)) { commAlert= commAlert + '\n' + 'Invalid Requested Due Date - '+document.OrderEntry.reqduedate.value+' - Please enter the date in the format mm/dd/yyyy.'; document.OrderEntry.reqduedate.focus(); } } } // Logic Error, removed by KSH 7/29/08 //if (!document.OrderEntry.dyno_sigdate.value) { // we could need to stop ourselves.. //if (type==1) //{ // we can go on.. //passed = true; //} //else //{ //commAlert= commAlert + '\n' + 'Signature Date is a required field.'; //} //} // //if (document.OrderEntry.company.selectedIndex<1) { commAlert= commAlert + '\n' + 'Company is a required field.'; } //if (document.OrderEntry.aggregator.selectedIndex<1) { commAlert= commAlert + '\n' + 'Aggregator is a required field.'; } if (commAlert!='') { alert(commAlert); } else { passed = true; } } if (type != 1) { // make sure a billing option is selected if(document.OrderEntry.ordertype.selectedIndex==1){//only require billing option new orders if (document.OrderEntry.BillingOption[0].checked!=true && document.OrderEntry.BillingOption[1].checked!=true) { alert('Please select a Billing Option (Monthly Paper Billing or OBP).'); passed = false; } // now check the billing options; make sure we are good on these.. if (document.OrderEntry.BillingOption[1].checked) { // we are e-bill.. need to make sure we have selected an email address.. if (!document.OrderEntry.BillingEmail.value) { alert('You must enter an email address to use E-Bill.'); passed = false; } } } if (document.OrderEntry.hasVOIP) { if (document.OrderEntry.hasVOIP.value == '1') { // we are voip.. need to verify email address is selected.. if (!document.OrderEntry.Email.value) { alert('You must enter an email address to order VOIP.'); passed = false; } else if (!isValidEmail(document.OrderEntry.Email.value)) { alert('You have entered an invalid email address. Please check the address.'); passed = false; } } } // now check the payment options.. //if (document.OrderEntry.PaymentOption[1].checked) { // checking account.. we need to collect these fields. // stripAlpha(document.OrderEntry.CheckingAccountNumber); // stripAlpha(document.OrderEntry.CheckingRoutingNumber); //} //if (document.OrderEntry.PaymentOption[2].checked) { // credit card.. need to verify we have the info we need.. // if (!document.OrderEntry.PaymentCCardNumber.value) { // alert('You must enter the Credit Card Number.'); // passed = false; // } // if (!document.OrderEntry.PaymentExpDate.value) { // alert('You must enter the Expiration Date.'); // passed = false; // } // if (!document.OrderEntry.PaymentCardName.value) { // alert('You must enter the Name on Card.'); // passed = false; // } //} }else { passed =true; if (!document.OrderEntry.dyno_sigdate.value) { } else { if (!validateUSDate(document.OrderEntry.dyno_sigdate.value)) { commAlert= commAlert + '\n' + 'Invalid Signature Date - '+document.OrderEntry.dyno_sigdate.value+' - Please enter the date in the format mm/dd/yyyy.'; document.OrderEntry.dyno_sigdate.focus(); passed= false; } } if (!document.OrderEntry.reqduedate.value) { } else { if (!validateUSDate(document.OrderEntry.reqduedate.value)) { commAlert= commAlert + '\n' + 'Invalid Requested Due Date - '+document.OrderEntry.reqduedate.value+' - Please enter the date in the format mm/dd/yyyy.'; document.OrderEntry.reqduedate.focus(); passed= false; } } } if (passed==true) { //alert('submit!'); document.OrderEntry.submit(); } } function revieworder(xstart,xend) { // fist, check if our order even has SON/ON/CN if (!document.OrderEntry.SON.value) { alert('You must add lines to your order before submitting.'); } else { // this function opens all the tabs, and adds its 'submit' to the top for (c=xstart; c <= 10; c++) { z = 'slg_' + c; y = 'tab_' + c; if (document.all[y]) { document.all[y].className = 'tabOffFill'; } if (document.all[z]) { document.all[z].style.display = "none"; } } for (c=xstart; c <= 10; c++) { z = 'slg_' + c; y = 'tab_' + c; if (document.all[y]) { document.all[y].className = 'tabOffFill'; } if (document.all[z]) { document.all[z].style.display = ""; } } document.all.tab_6.className = 'tabOnFill'; document.all.slg_6.style.display = ""; document.all.slg_5.style.display = "none"; document.all.slg_4.style.display = "none"; } } function toggletab(slugid,xstart,xend) { eval('slugdisplay = document.all.slg_'+slugid+'.style.display'); // hide all the others first.. for (c=xstart; c <= xend; c++) { z = 'slg_' + c; y = 'tab_' + c; if (document.all[y]) { document.all[y].className = 'tabOffFill'; } if (document.all[z]) { document.all[z].style.display = "none"; } } if (slugdisplay=='none') { eval('document.all.slg_'+slugid+'.style.display = \'\''); x = 'tab_'+slugid; document.all[x].className = 'bh_off'; } eval('document.all.slg_'+slugid+'.style.display = \'\''); x = 'tab_'+slugid; document.all[x].className = 'tabOnFill'; } function row_show(iid, hid) { if (document.getElementById(iid).style.visibility == 'visible') { document.getElementById(iid).style.visibility = 'hidden'; document.getElementById(iid).style.display = 'none'; document.getElementById(hid).className = 'ord_row_header_off'; } else { document.getElementById(iid).style.visibility = 'visible'; document.getElementById(iid).style.display = ''; document.getElementById(hid).className = 'ord_row_header_on'; } } function toggletab2(slugid,xstart,xend) { eval('slugdisplay = document.all.slg_'+slugid+'.style.display'); // hide all the others first.. for (c=xstart; c <= xend; c++) { z = 'slg_' + c; y = 'tab_' + c; if (document.all[y]) { document.all[y].className = 'ord_tab tabOffFill'; } if (document.all[z]) { document.all[z].style.display = "none"; } } if (slugdisplay=='none') { eval('document.all.slg_'+slugid+'.style.display = \'\''); x = 'tab_'+slugid; document.all[x].className = 'bh_off'; } eval('document.all.slg_'+slugid+'.style.display = \'\''); x = 'tab_'+slugid; document.all[x].className = 'ord_tab tabOnFill'; } function togglet(slugid,xstart,xend) { eval('slugdisplay = document.all.slg_'+slugid+'.style.display'); // hide all the others first.. for (c=xstart; c <= xend; c++) { z = 'slg_' + c; y = 'tab_' + c; if (document.all[y]) { document.all[y].className = 'bh_off'; } document.all[z].style.display = "none"; } if (slugdisplay=='none') { eval('document.all.slg_'+slugid+'.style.display = \'\''); x = 'tab_'+slugid; document.all[x].className = 'tabOnFill'; } eval('document.all.slg_'+slugid+'.style.display = \'\''); x = 'tab_'+slugid; document.all[x].className = 'bh_on'; } function openwin(mypage,width,height) { var tmp; limit = 5000; today = new Date(); num = today.getTime(); num = Math.round(Math.abs(Math.sin(num) * 1000000)) % limit; if (!width) { width = 440; } if (!height) { height = 320; } var winl = (screen.width - width) / 2; var wint = (screen.height - height) / 2; tmp = window.open(mypage,'newwindow'+num,'width='+width+',height='+height+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,left='+winl+',top='+wint); } function openwin2(mypage,width,height) { var tmp; limit = 5000; today = new Date(); num = today.getTime(); num = Math.round(Math.abs(Math.sin(num) * 1000000)) % limit; if (!width) { width = 640; } if (!height) { height = 480; } var winl = (screen.width - width) / 2; var wint = (screen.height - height) / 2; tmp = window.open(mypage,'newwindow'+num,'width='+width+',height='+height+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,left='+winl+',top='+wint); } function OPprint(oid,sid) { var tmp; var myname; var mypage; var w; var h; myname = 'op'; mypage = '/orders/detail_local_op.asp?oid=' + oid + '&sid=' + sid; limit = 5000; today = new Date(); num = today.getTime(); num = Math.round(Math.abs(Math.sin(num) * 1000000)) % limit; if (!w) { w = 400; } if (!h) { h = 0; } var winl = 1; var wint = 1; tmp = window.open(mypage,myname+num,'width='+w+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,left='+winl+',top='+wint); } function NETOPprint(oid,sid) { var tmp; var myname; var mypage; var w; var h; myname = 'op'; mypage = '/orders/detail_net_op.asp?oid=' + oid + '&sid=' + sid; limit = 5000; today = new Date(); num = today.getTime(); num = Math.round(Math.abs(Math.sin(num) * 1000000)) % limit; if (!w) { w = 400; } if (!h) { h = 0; } var winl = 1; var wint = 1; tmp = window.open(mypage,myname+num,'width='+w+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,left='+winl+',top='+wint); } function openwinX(mypage,myname,w,h) { var tmp; limit = 5000; today = new Date(); num = today.getTime(); num = Math.round(Math.abs(Math.sin(num) * 1000000)) % limit; if (!w) { w = 440; } if (!h) { h = 320; } var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; tmp = window.open(mypage,myname+num,'width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,left='+winl+',top='+wint); } function openwinY(mypage,myname,w,h) { var tmp; if (!w) { w = 440; } if (!h) { h = 320; } var winl = (screen.width - w) / 2; var wint = (screen.height - h) / 2; tmp = window.open(mypage,myname,'width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes,left='+winl+',top='+wint); } function radio_button_checker(form,field) { // set var radio_choice to false var radio_choice = false; // Loop from zero to the one minus the number of radio button selections for (counter = 0; counter < eval("document."+form+"."+field+".length"); counter++) { // If a radio button has been selected it will return true // (If not it will return false) if (eval("document."+form+"."+field+"[counter].checked")) { radio_choice = true; } } if (!radio_choice) { // If there were no selections made display an alert box return (false); } else { return true; } } function radio_button_checker_single(form,field) { // set var radio_choice to false var radio_choice = false; // Loop from zero to the one minus the number of radio button selections // If a radio button has been selected it will return true // (If not it will return false) if (eval("document."+form+"."+field+".checked")) { radio_choice = true; } if (!radio_choice) { // If there were no selections made display an alert box return (false); } else { return true; } } function chkNAN(char2chk) { var validNum = "0123456789"; if (validNum.indexOf(char2chk) == "-1") { stripLast = true; return(0); } } var stripLast; var lastCount; var lastCountDate; stripLast = false; lastCount = 0; lastCountDate = 0; function maskIt(fld) { var isNamedFone; fldVal = fld.value; var tmpStr = ""; keyCount = fldVal.length; keyEntered =fldVal.substring(keyCount-1,keyCount); if (keyCount < 2) isNamedFone = false; if (!isNamedFone) isNamedFone = chkNAN(keyEntered); keyCount++; with (document.OrderEntry) { switch (keyCount) { case 2: tmpStr += fldVal; fld.value = tmpStr; break; case 4: fld.value += "-"; break; case 8: fld.value += "-"; break; } } if (stripLast) { // we want to strip the last character if the character is not a valid int, OR // it could be a - if if ( ((fld.value.substring(fld.value.length-1,fld.value.length)=="-")&&(fld.value.length==keyCount-1)&&(lastCount>keyCount)) ) { } else { fld.value = fld.value.substring(0,fld.value.length-1); } stripLast = false; } lastCount = fld.value.length; } function maskDate(fld) { var isNamedFone; fldVal = fld.value; var tmpStr = ""; keyCount = fldVal.length; keyEntered =fldVal.substring(keyCount-1,keyCount); if (keyCount < 2) isNamedFone = false; if (!isNamedFone) isNamedFone = chkNAN(keyEntered); keyCount++; with (document.OrderEntry) { switch (keyCount) { case 2: tmpStr += fldVal; fld.value = tmpStr; break; case 3: fld.value += "/"; break; case 6: fld.value += "/"; break; } } if (stripLast) { // we want to strip the last character if the character is not a valid int, OR // it could be a - if if ( ((fld.value.substring(fld.value.length-1,fld.value.length)=="/")&&(fld.value.length==keyCount-1)&&(lastCountDate>keyCount)) ) { } else { fld.value = fld.value.substring(0,fld.value.length-1); } stripLast = false; } lastCountDate = fld.value.length; } function GetNumericString(strString) { var strValidChars = "0123456789"; var strChar; var retString = ""; // test strString consists of valid characters listed above for (i = 0; i < strString.length; i++) { strChar = strString.charAt(i); if (strValidChars.indexOf(strChar) != -1) { retString = retString + strChar } //end if } //for return retString; } function checkMyDate(oo) { var _value = oo.value; if (_value) { var _test = Date.parse(_value); if (isNaN(_test)) { oo.value = ""; alert("Not a valid date!"); oo.focus(); } else { return true; } } else { return true; } } function parseSSN(ii) { var i; i = GetNumericString(ii.value); ii.value = i; if ((i.length<9)&&(i.length>0)) { alert('The SSN entered is not valid. Please Verify the entry.'); ii.focus(); } if (i.length>9) { alert('The SSN entered is not valid. Please Verify the entry.'); ii.focus(); } } function stripAlpha(ii) { var i; i = GetNumericString(ii.value); ii.value = i; } function parseDOB(ii) { var i; i = ii.value; if (i.length>0) { // validate the date.. if (!validateUSDate(i)) { alert('Invalid Date - '+i+' - Please verify the entry'); ii.focus(); } } } function validateUSPhone( strValue ) { /************************************************ DESCRIPTION: Validates that a string contains valid US phone pattern. Ex. (999) 999-9999 or (999)999-9999 PARAMETERS: strValue - String to be tested for validity RETURNS: True if valid, otherwise false. *************************************************/ var objRegExp = /^d{4}\-\d{3}\-\d{4}$/; //check for valid us phone with or without space between //area code return objRegExp.test(strValue); } function validateUSDate( strValue ) { /************************************************ DESCRIPTION: Validates that a string contains only valid dates with 2 digit month, 2 digit day, 4 digit year. Date separator can be ., -, or /. Uses combination of regular expressions and string parsing to validate date. Ex. mm/dd/yyyy or mm-dd-yyyy or mm.dd.yyyy PARAMETERS: strValue - String to be tested for validity RETURNS: True if valid, otherwise false. REMARKS: Avoids some of the limitations of the Date.parse() method such as the date separator character. *************************************************/ var objRegExp = /^\d{1,2}(\-|\/|)\d{1,2}\1\d{2,4}$/ //check to see if in correct format if(!objRegExp.test(strValue)) return false; //doesn't match pattern, bad date else{ //The first part could have 1 or 2 digits so we need to look //for a / or a . var locSeparator = strValue.indexOf('/'); /* if (locSeparator == -1) { locSeparator = strValue.indexOf('.'); } */ var strSeparator = strValue.substring(locSeparator,locSeparator+1) var arrayDate = strValue.split(strSeparator); //create a lookup for months not equal to Feb. var arrayLookup = { '01' : 31,'03' : 31, '1' :31, '3' : 31, '04' : 30,'05' : 31, '4' :30, '5' : 31, '06' : 30,'07' : 31, '6' :30, '7' : 31, '08' : 31,'09' : 30, '8' :31, '9' : 30, '10' : 31,'11' : 30,'12' : 31} var intDay = parseInt(arrayDate[1],10); //check if month value and day value agree if(arrayLookup[arrayDate[0]] != null) { if(intDay <= arrayLookup[arrayDate[0]] && intDay != 0) return true; //found in lookup table, good date } var strYear = arrayDate[2] if (strYear.length == 2) { strYear = '20' + strYear; } var intMonth = parseInt(arrayDate[0],10); if (intMonth == 2) { var intYear = parseInt(strYear); if (intDay > 0 && intDay < 29) { return true; } else if (intDay == 29) { if ((intYear % 4 == 0) && (intYear % 100 != 0) || (intYear % 400 == 0)) { // year div by 4 and ((not div by 100) or div by 400) ->ok return true; } } } } return false; //any other values, bad date } function moveNext(field, digits, nextfield){ if (field.value.length >= digits) { //field.blur(); nextfield.focus(); } } function qualifynumber(x) { var SubmitForm = true; var agreez; var ani; var valid = true; var kk; kk = GetNumericString(x.NPA.value); x.NPA.value = kk; kk = GetNumericString(x.NXX.value); x.NXX.value = kk; kk = GetNumericString(x.NUMB.value); x.NUMB.value = kk; if (x.NPA.value.length < 3) { alert("Fill in NPA.") x.NPA.focus(); SubmitForm = false; } else if (x.NXX.value.length < 3) { alert("Fill in NXX.") x.NXX.focus(); SubmitForm = false; } else { kk = GetNumericString(x.NUMB.value); x.NUMB.value = kk; if (x.NUMB.value.length < 4) { x.NUMB.value = "XXXX"; valid = false; } if (valid==true) { x.submit(); } else { ani = x.NPA.value + "-" + x.NXX.value + "-" + x.NUMB.value; alert('The number you have entered - ' + ani + ' - does not appear to be a valid number.\nPlease verify the number and try again.'); x.NUMB.focus(); SubmitForm = false; } } return SubmitForm; } function qualifyclear(x) { x.NPA.value = ""; x.NXX.value = ""; x.NUMB.value = ""; } function workflow_display(sid, branch_id) { alert('Coming Soon...'); } function isValidEmail(str) { return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); }