String.prototype.trim = function() { var x=this; x=x.replace(/^\s*(.*)/, "$1"); x=x.replace(/(.*?)\s*$/, "$1"); return x; } function FormatData(str) { var tstr; var xstr; tstr = str.value.toLowerCase().trim(); 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; } 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 revieworder(xstart,xend) { // this function opens all the tabs, and adds its 'submit' to the top for (c=xstart; c <= 6; c++) { z = 'slg_' + c; y = 'tab_' + c; if (document.all[y]) { document.all[y].className = 'tabOffFill'; } document.all[z].style.display = "none"; } for (c=xstart; c <= xend; c++) { z = 'slg_' + c; y = 'tab_' + c; if (document.all[y]) { document.all[y].className = 'tabOffFill'; } document.all[z].style.display = ""; } document.all.tab_7.className = 'tabOnFill'; document.all.slg_7.style.display = ""; } 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'; } document.all[z].style.display = "none"; } if (slugdisplay=='none') { eval('document.all.slg_'+slugid+'.style.display = \'\''); //document.images['slg'+slugid].src = '/images/slug.up.gif'; x = 'tab_'+slugid; // alert(document.all[x].className); document.all[x].className = 'tabOnFill'; } else { //eval('document.all.slg_'+slugid+'.style.display = "none"'); //document.images['slg'+slugid].src = '/images/slug.down.gif'; //x = 'tab_'+slugid; // alert(document.all[x].className); //document.all[x].className = 'tabOffFill'; } } function openwin(mypage,width,height) { var tmp; if (!width) { width = 440; } if (!height) { height = 320; } tmp = window.open(mypage,'newwindow','width='+width+',height='+height+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes'); } 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; var _test = Date.parse(_value); if (isNaN(_test)) { oo.value = ""; alert("Not a valid date!"); oo.focus(); } 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 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 ) { var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/ if(!objRegExp.test(strValue)) { return false; } else { var strSeparator = strValue.substring(2,3) var arrayDate = strValue.split(strSeparator); var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31, '08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31} var intDay = parseInt(arrayDate[1]); //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 } //check for February var intYear = parseInt(arrayDate[2]); var intMonth = parseInt(arrayDate[0]); if( ((intYear % 4 == 0 && intDay <= 29) || (intYear % 4 != 0 && intDay <=28)) && intDay !=0) return true; //Feb. had valid number of days } return false; } 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 = ""; }