function ValidateForm(f)
{
	// Loop through all the elements (form input tags).
	for(i=0; i<f.length; i++)
	{
		// Determine if the field is required.
		if(f[i].id == "required")
		{
			// All required fields can be checked for NULL.
			if(f[i].value.length == 0)
			{
				/*************************************************************/
				// NOTE:	You may change the alert message to whatever you 
				//			want.  DO NOT CHANGE ANYTHING ELSE!		
				alert("You did not enter information in for a required field!");
				/*************************************************************/
				
				f[i].focus();
				return false;
			}
			
			// Validate any field that is required and contains the word email
			// within the name property of the tag.
			if(f[i].name.toLowerCase().indexOf("email") > -1)
			{
				// Test the email value with the email validation function.
				if(!ValidateEmail(f[i].value))
				{
					/*************************************************************/
					// NOTE:	You may change the alert message to whatever you 
					//			want.  DO NOT CHANGE ANYTHING ELSE!
					alert("You did not enter a valid email address!");
					/*************************************************************/
					
					f[i].focus();
					f[i].select();
					return false;
				}
			}
			
			// Validate any field that is required and contains the word phone
			// within the name property of the tag.
			if(f[i].name.toLowerCase().indexOf("phone") > -1)
			{
				// Test the phone value with the phone validation function.
				if(!ValidatePhone(f[i].value))
				{
					/*************************************************************/
					// NOTE:	You may change the alert message to whatever you 
					//			want.  DO NOT CHANGE ANYTHING ELSE!
					alert("You did not enter a valid phone number!");
					/*************************************************************/
					
					f[i].focus();
					f[i].select();
					return false;
				}
			}
			
			// Validate any field that is required and contains the word zipcode
			// within the name property of the tag.
			if(f[i].name.toLowerCase().indexOf("zipcode") > -1)
			{
				// Test the phone value with the phone validation function.
				if(!ValidateZipCode(f[i].value))
				{
					/*************************************************************/
					// NOTE:	You may change the alert message to whatever you 
					//			want.  DO NOT CHANGE ANYTHING ELSE!
					alert("You did not enter a valid zipcode!");
					/*************************************************************/
					
					f[i].focus();
					f[i].select();
					return false;
				}
			}
		}
	}
	
	// Definition for the window.open function
	// window.open(THE PAGE TO OPEN, NULL VALUE, PROPERTIES FOR WINDOW)
	// To change the properties for the window simply change the no to a yes
	// or yes to no, for the width and heigth properties simply change the 
	// pixel size.
	
	//window.open("thank-you.asp", "","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=300, height=200");
	return true;
}

function ValidateEmail(sz)
{
	// Regular expressions for email validation.
	// DO NOT CHANGE!!!!!!
	var isEmail1 = /^\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.\w+$/;
	var isEmail2 =/^.*@[^_]*$/;
	
	// Returns boolean value.
	return (isEmail1.test(sz) && isEmail2.test(sz));
}

function ValidatePhone(sz)
{
	// Regular expressions for phone validation.
	// DO NOT CHANGE!!!!!!
	var isPhone = /^\d{10}$/;
	var szPhone = sz.replace("-", "").replace("(", "").replace(")", "").replace("-", "").replace(" ", "");	
	
	// Returns boolean value.
	return isPhone.test(szPhone);
}

function ValidateZipCode(sz)
{
	// Regular expressions for zipcode validation.
	// DO NOT CHANGE!!!!!!
	var isZipCode = /^\d{5}\-\d{4}|\d{5}$/;
	
	// Returns true if surfer enters either a 5 digit zipcode or
	// a 10 digit zipcode, ie (12345 or 12345-6789) anythings else
	// will return false.
	return isZipCode.test(sz);
}