
<!--

/* 
	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("if (!document."+FName+"."+FieldsToCheckArray[i]+".disabled && document."+FName+"."+FieldsToCheckArray[i]+".type != 'hidden') 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

	// Set value of element to today
	function set_today(input)
	{
		var today = new Date();
		var intMonth = today.getMonth() + 1;
		var intYear = today.getYear();
		
		if (intYear < 2000) {
			intYear += 1900;
		}
		input.value = today.getDate() + "/" + intMonth + "/" + intYear;
	}

//-->

