// JavaScript Document

/*
Form Verify
	This script is to allow for required fields in a form.  You simply
		pass it a couple of parameters, and it makes sure that their 
		values are not equal to ''.  If they are, it returns false.
		
	INSTRUCTIONS: make sure that you specify a name in the form tag of
		your form.  See the example below, because you will also need 
		to put something in the onSubmit clause of the form tag.
		
	Example: <form name="testForm" action="something.cfm" onSubmit="return formVerify('testForm', 'field1,field3');">
	
	Input fields:
		formName: simply the name of your form.  As shown above, this would be testForm in the example.
		formFields: a comma delimited list of form fields with no spaces.
		warningText: text that will be displayed when the form fails it's check
*/

function formVerify (formName, formFields, warningText) {
	fields = formFields.split(',');
	abort = 0;
	
	for ( x = 0; x < fields.length; x = x + 1 ) {
		fieldVal = eval( 'document.' + formName + '.' + fields[x] + '.value' );
		
		if ( fieldVal == '' ) {
			abort = 1;
			xx = eval( 'document.' + formName + '.' + fields[x] );
			xx.focus();
			break;
		}
	}

	if ( abort == 1 ) {
		alert( warningText );
		return false;
	} else {
		return;
	}
}