function validateAFFSignupForm(f) { if (f.invitation_code.value.length == 0) { alert("Please enter an Invitation Code."); f.invitation_code.focus(); return false; } // validate nickname if (f.username.value.length == 0) { alert("Please enter a Username."); f.username.focus(); return false; } if ((f.username.value.length < 2) || (f.username.value.length > 12)) { alert("The nickname must be between 2 and 12 letters and/or numbers."); f.username.focus(); return false; } // validate email if (f.email.value.length == 0) { alert("Please enter your email address."); f.email.focus(); return false; } if (f.email.value != f.email1.value) { alert("The two emails do not match. Please retype."); f.email.focus(); return false; } var i = 1; var s = f.email.value; var l = s.length; while ((i < l) && (s.charAt(i) != "@")) { i++; } if ((i >= l) || (s.charAt(i) != "@")) { alert("The email address is invalid. Please enter your full email address (eg. name@server.com)"); f.email.focus(); return false; } else { i += 2; } while ((i < l) && (s.charAt(i) != ".")) { i++; } if ((i >= l - 1) || (s.charAt(i) != ".")) { alert("The email address is invalid. Please enter your full email address (eg. name@server.com)"); f.email.focus(); return false; } // validate password if (f.password1.value.length == 0) { alert("Please enter a password.\n-it must be 8-12 numbers AND letters long\n-it must contain BOTH numbers and letters."); f.password1.focus(); return false; } var numberOfDigits = 0; var numberOfLetters = 0; var numberOfGarbageChars = 0; s = f.password1.value; for (i = 0; i < s.length; i++) { var c = s.charAt(i); if ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) ) { numberOfLetters++; } else if ((c >= "0") && (c <= "9")) { numberOfDigits++; } else { numberOfGarbageChars++; } } if (numberOfGarbageChars > 0) { alert("The password may only contain letters (a-z A-Z) and numericals (0-9)."); f.password1.focus(); return false; } if (((f.password1.value.length < 8) || (f.password1.value.length > 12)) && ((numberOfDigits == 0) || (numberOfLetters == 0))) { alert("The password must be between 8 and 12 numbers and letters."); f.password1.focus(); return false; } else if ((numberOfDigits == 0) || (numberOfLetters == 0)) { alert("The password must contain both letters AND numbers."); f.password1.focus(); return false; } else if ((f.password1.value.length < 8) || (f.password1.value.length > 12)) { alert("The password must be between 8 and 12 characters."); f.password1.focus(); return false; } if (f.password2.value.length == 0) { alert("Please retype your password in the second password box."); f.password2.focus(); return false; } if (f.password1.value != f.password2.value) { alert("The two passwords do not match. Please retype."); f.password1.focus(); return false; } if(f.firstName.value.length == 0){ alert("Please enter your First Name."); f.firstName.focus(); return false; } if(f.lastName.value.length == 0){ alert("Please enter your Last Name."); f.lastName.focus(); return false; } if(f.contact.value.length == 0){ alert("Please enter your Contact and select the type below."); f.contact.focus(); return false; } else{ var ct_checked = false; for (var i=0; i < f.contact_type.length; i++) { if (f.contact_type[i].checked) { ct_checked = true; } } if(!ct_checked){ alert("Please select your Contact Type below the Contact text field."); return false; } } if(f.company.value.length == 0){ alert("Please enter your Company."); f.company.focus(); return false; } if(f.domain.value.length == 0){ alert("Please enter your Domain."); f.domain.focus(); return false; } if(!f.antispam.checked){ alert("You must agree to our AntiSpam Policy."); f.antispam.focus(); return false; } if(!f.terms.checked){ alert("You must agree to our Terms & Conditions."); f.terms.focus(); return false; } if(!f.aff_agreement.checked){ alert("You must agree to our Affiliate Agreement."); f.aff_agreement.focus(); return false; } return true; //confirmSignupWindow(f); }