// ============================================================================
// form validation routines
//
// Created on 07/16/2008 by Mike Patton (mike@tweakedgeek.com)
// ============================================================================

function validate(f) {
	var errors = new Array();
	if ( f.NAME.value == '' )
		errors[errors.length] = "Enter your name in the space provided.";
	if ( f.TITLE.value == '' )
		errors[errors.length] = "Enter your title in the space provided.";
	if ( f.COMPANY.value == '' )
		errors[errors.length] = "Enter your company name in the space provided.";
	if ( f.ADDR.value == '' )
		errors[errors.length] = "Enter your street address in the space provided.";
	if ( f.CITY.value == '' )
		errors[errors.length] = "Enter your city in the space provided.";
	if ( f.STATE.value == '' )
		errors[errors.length] = "Enter your state in the space provided.";
	if ( f.ZIPCODE.value == '' )
		errors[errors.length] = "Enter your zipcode in the space provided.";
	if ( f.PHONE.value == '' )
		errors[errors.length] = "Enter your phone number in the space provided.";
	if ( f.EMAIL.value == '' )
		errors[errors.length] = "Enter your e-mail address in the space provided.";
	if ( f.ORGTYPE.options[f.ORGTYPE.selectedIndex].value == 'Other' && f.OTH_ORG.value == '' )
		errors[errors.length] = "Select your organization type from the available options. If you select Other, enter the type of organization in the space provided.";

	if ( errors.length == 0 ) {
		f.action = 'http://www.healthrespubs.com/cgi-bin/mailer.pl';
		return true;
	} else {
		alert( 'The form you have submitted has errors. Please correct the items below then submit this form again:\n\n' + errors.join( '\n' ) );
		return false;
	}
}
		