
// validate form fields
function validate( form )
{
	// Make sure all of the fields are filled out.
	for ( i = 0; i < form.elements.length; i++ )
	{
		if ( form.elements[i].value.length < 1 )
		{
			alert( "Missing one or more values.  Please fill out the entire form and submit again." );
			return false;
		}
	}
	
	// validate email address
	emailRegex  = /(^[a-z0-9]([a-z0-9_+\.-]*)@([a-z0-9_\.]*)([.][a-z]{2,3})$)|(^[a-z0-9]([a-z0-9_+\.-]*)@([a-z0-9_\.]*)(\.[a-z]{2,3})(\.[a-z]{2,3})*$)/i;

	if ( !emailRegex.test( form.elements[0].value ) )
	{
		form.elements[0].select();
		alert( "Invalid address in 'EMAIL'. Please correct and submit again." );
		return false;
	}

	// Validate city and state.
	placeRegex  = /^[a-zA-Z\. -]+$/;

	if ( !placeRegex.test( form.elements[1].value ) )
	{
		form.elements[1].select();
		alert( "Invalid characters in 'CITY'. Please correct and submit again." );
		return false;
	}

	if ( !placeRegex.test( form.elements[2].value ) )
	{
		form.elements[2].select();
		alert( "Invalid characters in 'STATE'. Please correct and submit again." );
		return false;
	}

	return true;
}


