////////////////////////////////////////////////////////////////////////
// Filename: formedit.js
// Desc:	Generic routine to check form for required fields.
// Author:	Relevant Arts Enterprise, Inc. <http://www.relevantarts.com/>
//			John A. Lock <jlock@relevantarts.com>
// Created:	2000-Nov-06
// History:
////////////////////////////////////////////////////////////////////////

function CheckForm() {
	var AlertMsg = "Please enter something in the following required fields:\n\n";
	var CursorField = "";
	var FormStatus = true;
	// Iterate through all passed field names
	for (var ctr = 0; ctr < CheckForm.arguments.length; ctr++) {
		// If the field is empty, add it to the alert message
		if (CheckForm.arguments[ctr].value == "") {
			AlertMsg += "   - " + CheckForm.arguments[ctr].name + "\n";
			// If there's no cursor field yet, make it this one
			if (CursorField == "") {
				CursorField = CheckForm.arguments[ctr];
			}
			// Set the return value to false so we can alert the user
			FormStatus = false;
		}
	}
	// If there are missing fields, tell the user about them and
	// place the cursor at the first one.
	if (!FormStatus) {
		alert(AlertMsg);
		CursorField.focus();
	}
	return FormStatus;
}
