// function checkSearchForm()
// for the directory search form 
// modifications:
// 7-21-03 Mike Mertsock mjm2@alfred.edu - total redo so it makes sure at least one criteria was entered.
function checkSearchForm() {
	var f = document.directorySearch;
	
	/*get rid of extra spaces
	f.firstname.value = trim( f.firstname.value );
	f.lastname.value  = trim( f.lastname.value );
	f.email.value = trim( f.email.value );
	f.major.value = trim( f.major.value );
	f.minor.value = trim( f.minor.value );
	f.homecity.value = trim( f.homecity.value );
	f.homestate.value = trim( f.homestate.value ); */
	
	var textFields = [ "firstname", "lastname", "email", "major", "minor", "homecity", "homestate" ];
	var thisField = null;
	
	// dataCount is the way we check if anything was entered/chosen in the form. you do this 
	// by adding up the number of characters entered in each text field (done in the loop 
	// below) and added the option number selected for each select (b/c 0 means nothing was selected)
	var dataCount = 0;
	
	// do this for all the text fields
	for ( fieldNumber = 0; fieldNumber < textFields.length; fieldNumber++ )	{
		thisField = eval( "f." + textFields[fieldNumber] );
		thisField.value = trim( thisField.value ); //get rid of extra spaces
		dataCount += thisField.value.length; //add to datacount (see explaination above)
	}
	
	dataCount += f.classyear.options.selectedIndex;
	dataCount += f.school.options.selectedIndex;
	
	if ( dataCount == 0 ) {
		alert( "Please type and/or select some criteria for searching, or use the browse links below." );
		f.firstname.focus();
		return false;
	} else {
		return true;
	}
	
}