// JavaScript - Registration.asp Form Validation
<!--
function FormRegistration_Validator(theForm){		//Checks the form on submition.
	// check to see if the field is blank
	if (theForm.emailaddress.value == ""){
		alert("Please enter your email address.");
		theForm.emailaddress.focus();
		return false;
	}

	// test if valid email address, must have @ and .
	var checkEmail = "@.";
	var checkStr = theForm.emailaddress.value;
	var EmailValid = false;
	var EmailAt = false;
	var EmailPeriod = false;
	for (i = 0;  i < checkStr.length;  i++){
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkEmail.length;  j++){
			if (ch == checkEmail.charAt(j) && ch == "@")
				EmailAt = true;
			if (ch == checkEmail.charAt(j) && ch == ".")
				EmailPeriod = true;
			if (EmailAt && EmailPeriod)
				break;
			if (j == checkEmail.length)
				break;
		}
		// if both the @ and . were in the string
		if (EmailAt && EmailPeriod){
			EmailValid = true
			break;
		}
	}

	if (!EmailValid){
		alert("Please enter a valid email address.");
		theForm.emailaddress.focus();
		return false;
	}
	
	if (theForm.username.value == ""){		// check to see if the field is blank
		alert("Please enter a nickname.");
		theForm.username.focus();
		return false;
	}
	
	// require a maximum of 25 characters in the nickname field
	if (theForm.username.value.length > 25){
		alert("Please enter no more than 25 characters for your nickname.");
		theForm.username.focus();
		return false;
	}

	if (theForm.firstname.value == ""){		// check to see if the field is blank
		alert("Please enter your first name.");
		theForm.firstname.focus();
		return false;
	}

	if (theForm.lastname.value == ""){		// check to see if the field is blank
		alert("Please enter your last name.");
		theForm.lastname.focus();
		return false;
	}

	if (theForm.password.value == ""){		// check to see if the field is blank
		alert("Please enter a password.");
		theForm.password.focus();
		return false;
	}

	if (theForm.confirmpassword.value == ""){		// check to see if the field is blank
		alert("Please enter a confirmation password.");
		theForm.confirmpassword.focus();
		return false;
	}
	
	// check if both password fields are the same
	if (theForm.password.value != theForm.confirmpassword.value){
		alert("Your passwords do not match. Please double-check your passwords and retype.");
		theForm.password.focus();
		return false;
	}

	// require at least 5 characters in the password field
	if (theForm.password.value.length < 6){
		alert("Please enter at least 6 characters for your Password.");
		theForm.password.focus();
		return false;
	}
	
	// require a maximum of 15 characters in the password field
	if (theForm.password.value.length > 15){
		alert("Please enter no more than 15 characters for your Password.");
		theForm.password.focus();
		return false;
	}
	
	// check if no drop down or first drop down is selected, if so, invalid selection
	if (theForm.location.selectedIndex <= 0) {
		alert("Please select a country.");
		theForm.location.focus();
		return false;
	}
	
	if (theForm.postalcode.value == ""){		// check to see if the field is blank
			alert("Please enter a zip code or postal code.");
			theForm.postalcode.focus();
			return false;
	}
	

	// check that gender is selected
	if (!(theForm.rGender[0].checked || theForm.rGender[1].checked)) {
		alert("Please select your gender");
		return false;
	}
	
	// check if no drop down or first drop down is selected, if so, invalid selection
	if (theForm.DOByear.selectedIndex <= 0){
		alert("Please select the year of your birth.");
		theForm.DOByear.focus();
		return false;
	}
	
	/* OI, 03/19/07 - commented out the DOBDay/DOBMonth validations
	// check if no drop down or first drop down is selected, if so, invalid selection
	if (theForm.DOBday.selectedIndex <= 0){
		alert("Please select the day of your birth.");
		theForm.DOBday.focus();
		return false;
	}

	// check if no drop down or first drop down is selected, if so, invalid selection
	if (theForm.DOBmonth.selectedIndex <= 0){
		alert("Please select the month of your birth.");
		theForm.DOBmonth.focus();
		return false;
	}
	*/

	/* OI, 03/26/07 - commented out the security code & "how heard" validation
	if (theForm.securityCode.value == ""){		// check to see if the field is blank
		alert("Please enter a security code.");
		theForm.securityCode.focus();
		return false;
	}
	
	// check if no drop down or first drop down is selected, if so, invalid selection
	if (theForm.how_heard.selectedIndex <= 0){
		alert("Please select how you heard about us.");
		theForm.how_heard.focus();
		return false;
	}
	*/
	
	//disable form button
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById){
		//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theForm.length;i++){
			var tempobj=theForm.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
				//disable em
				tempobj.disabled=true
			}
		}
		return (true);
	}

// End Validation Scripts
//-->

// JavaScript - ViewHelp popup function
<!--
		function ViewHelp(url, h, w)
		{
			var winleft = (screen.width - w) / 2;
			var wintop = (screen.height - h) / 2; 

			window.open(url,'helpWin','toolbar=no,menubar=no,scrollbars=no,top='+wintop+',left='+winleft+',width='+w+',height='+h+',status=yes,resizable=yes');
		}
// End ViewHelp Script
//-->