/************************************************************ ** Description: Checks to see if a radio button (from a group ** of buttons) has been selected. If none is selected, ** will prompt to select one. ** Arguments: (OBJECT) thisForm: form Object where the radio buttons are ** (STRING) rName: Name of the set of radio buttons to check ** Return: (BOOLEAN) true: if a button is selected ** (BOOLEAN) false: if no button is selected ************************************************************/ function isRadCheked(thisForm, rname) { var i=0; var radSelected=-1; var rValues=new Array(); for (i=0; i=0) { return true; } else { var valStr=rValues.join(", "); alert("Please select one of the following:\n"+valStr); thisForm[rname][0].focus(); return false; } } /************************************************************ ** Description: Checks to see if a radio button has been selected. ** Arguments: (OBJECT) thisForm: form Object where the radio buttons are. ** (STRING) button: Name of the radio button(s) to check. ** Return: (MULTI) value of button selected. ** (BOOLEAN) false: if no button is selected ************************************************************/ function radChecked(thisForm, button) { var radValue=false; if (thisForm[button].length) { for (var i=0; i=minLength) passed=true; else if (fldDat.length==0 && !required) passed=true; else if (fldDat.length>maxLength) { if (maxLength!=minLength) alert(fieldTag+" connot be longer than "+maxLength+" "+datType); else alert(fieldTag+" must be "+maxLength+" "+datType); fieldObj.select(); fieldObj.focus(); return false; } else if (fldDat.length="0" && nStr.charAt(i)<="9") i++; if (i!=nStr.length || nStr.length==0) return false; else return true; } /************************************************************ ** Description: Determines if string contains only alphabetic ** ` characters. Blank Field returns FALSE. ** Arguments: (OBJECT) fieldObj: field to test ** Return: (BOOLEAN) true: if passed ** (BOOLEAN) false: if failed or blank ************************************************************/ function strIsAlpha(str) { var aStr=str; var i=0; while (i="A" && aStr.charAt(i).toUpperCase()<="Z") i++; if (i!=aStr.length || aStr.length==0) return false; else return true } /************************************************************ ** Description: Removes whitespace from the beginning and end ** of a string (spaces, newlines, tabs, carrage return) ** Arguments: (STRING) str: string to trim ** Return: (STRING) trimmed string *************************************************************/ function trim(str) { var i = 0; //remove leading whitespace while (i0 && ((str.charAt(i)==" ") || (str.charAt(i)=="\t") || (str.charAt(i)=="\n") || (str.charAt(i)=="\r"))) i--; str=str.substring(0, i+1); return str; } /************************************************************ ** Description: Removes unwanted characters from a string. ** Arguments: (STRING) str: the string to be stripped. ** (STRING) chars: String of characters to keep ** Return: (STRING) the stripped string *************************************************************/ function stripAllBut(str, chars) { var strippedString=""; var chr; var fLength = str.length; for (var i=0; i 16) return false; var dNums=""; var oNums=""; var ccLen=ccNo.length; var sum=0; for(var i=ccLen-1; i>=0; i--) { oNums=oNums+ccNo.charAt(i); if (i!=0) { i--; dNums=dNums+(parseInt(ccNo.charAt(i))*2).toString(); } } for(i=0; i=51 && digits12<=55) return isCreditCard(ccNo); else return false; } else return false; } /************************************************************ ** Description: Tests for valid AMEX Card Number ** Arguments: (STRING) ccNo: credit card number. ** RETURNS: (BOOLEAN) true: if the credit card passes ** (BOOLEAN) false: if failed *************************************************************/ function isAmex(ccNo) { if (ccNo.length == 15) { var digits12=parseInt(ccNo.substring(0,2)); if (digits12==34 || digits12==37) return isCreditCard(ccNo); else return false; } else return false; }