
<!--

/* 
	Accepts the name of a form and a string containing the fields
	to check for nulls.  Alerts the correct error msg if a field is null.
*/
	function validate(FName, FieldsToCheck) {
	
		FieldsToCheckArray = FieldsToCheck.split(',')
		
		for (var i=0; i < FieldsToCheckArray.length; i++) {
			if(eval("document."+FName+"."+FieldsToCheckArray[i]+".value")=='') {
				alert(eval("document."+FName+"."+FieldsToCheckArray[i]+"_errorMsg.value"))
				eval("document."+FName+"."+FieldsToCheckArray[i]+".focus()")
				return false;
			}
		} // end for loop
		
		return true;
	} // end validate function


/*
	Accepts the name of a form, the name of an element on that form,
	the datatype the element is meant to be, and a string to use as an error
	message.  Checks the value of the element matches the datatype and alerts the
	error message if it does not, else returns true.
*/
	function checkData(FName, EName, DType, ErrMsg) {
		
		switch (DType) {
			// it's meant to be a number
			case "number":
				if (isNaN(eval("document."+FName+"."+EName+".value"))) {
					// Not a valid number
					alert(ErrMsg)
					eval("document."+FName+"."+EName+".focus()")
					return false;
				} else {
					// valid number
					return true;
				}
				break;
				
			default: break
		}	// end switch statement
		
	} // end  checkData function



//-->
