function DateIsValid(frmField) 
	{
	var i=0,j=0;
	var dateVal = frmField.value;
	var m="",d="",y="";
	var mdays = new Array (0,31,28,31,30,31,30,31,31,30,31,30,31);
	j = dateVal.indexOf("/");
	if (j > 0 && j < 3)	//first delimiter OK
		{
		m = parseInt(dateVal.substring(i,j),10);
		if ((m > 0) && (m < 13))	//month OK
				{
				i = j+1;
				j = dateVal.indexOf("/",i);
				if ((j-i >0) && (j-i <3))	//second delimiter OK
						{
						d = parseInt(dateVal.substring(i,j),10);
						if ((d > 0) && (d < mdays[parseInt(m,10)]))	//day OK
										{
										i = j+1;
										y = dateVal.substr(i);
										if (y.length == 2)
											if (y < 10) y = parseInt(y,10) + 2000;
												else y = parseInt(y,10) + 1900;
										if (y > 1940 && y < 2010)	//date reasonable
														{
														return true;
														}
													else
														{
														alert("Year must be between 1940 and 2009!");
														frmField.focus();
														return false;
														}
										}
								else
										{
										alert("Day must be between 1 and " + mdays[parseInt(m)] + "!");
										frmField.focus();
										return false;
										}
						}
					else
						{
						alert("Invalid Date Format (MM/DD/YYYY)!");
						frmField.focus();
						return false;
						}
				}            
			else
				{
				alert("Month must be between 1 and 12!");
				frmField.focus();
				return false;
				}
		}
			else
				{
				alert("Invalid Date Format (MM/DD/YYYY)!");
				frmField.focus();
				return false;
				}
	}
function FormIsValid(curForm)
	{
	var curElement, i, IsValid=true;
	var tmp="";
	for (i=0; i<curForm.elements.length-1; i++)
		{
		with (curForm.elements[i])
			{
			if ((type != "button") && (type != "reset") && (type != "hidden"))	// no checking for buttons
				{
				switch (fldTypes[i+1])
					{
					case 3:	//Int
						if (isNaN(Number(value)))
								{
								IsValid=false;
								alert("Please enter a number for this field");
								focus();
								return false;
								}
							else if 
								((value < -32000) || (value > 32000))
									{
									IsValid=false;
									alert("Absolute Value must be less than 32000");
									focus();
									return false;
									}
						break;
					case 7:	//Date
						if (curForm.elements[i].value != "")
							IsValid=DateIsValid(curForm.elements[i]);
						if (!IsValid) return
						break;
					case 11:	//Boolean
					case 202:	//Text
					case 203:	//Memo
						break;
					default:
					}
				}
			}
		}
	return IsValid;
	}
function ClearForm(curForm)
	{
	var tmp="";
	for (i=0; i<curForm.elements.length; i++)
		{
		with (curForm.elements[i])
			{
			if ((type != "button") && (type != "reset") && (type != "hidden"))	// no checking for buttons
				{
				switch (fldTypes[i-5])
					{
					case 3:	//Int
						value="";
						break;
					case 7:	//Date
						value="";
						break;
					case 11:	//Boolean
						checked=false;
						break;
					case 202:	//Text
						value="";
						break;
					case 203:	//Memo
						value="";
						break;
					default:
						value="";
					}
				}
			}
		}
	}
