
/* ==============================================================================================================
									Copyright Date. 
================================================================================================================= */
var intDate = new Date();
var intYear = intDate.getFullYear();
var strCopyRight = "Copyright &copy; " + intYear;


/* ==============================================================================================================
									Contact Form Fields.
================================================================================================================= */
function FrontPage_Form1_Validator(theForm)
{	
	if (theForm.Subject.selectedIndex == 0)
	{
		alert("A subject is required when submitting an online inquiry");
		theForm.Subject.focus();
		return (false);
	}
	
	if (theForm.Name.value == "")
	{
		alert("In order for us to contact you, a name is required.  Please fill out the \"Name\" field.");
		theForm.Name.focus();
		return (false);
	}
	
	if (theForm.Name.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Name\" field.");
		theForm.Name.focus();
		return (false);
	}
	
	if (theForm.Email.value == "")
	{
		alert("An email address is required.  Please fill out the \"Email\" field.");
		theForm.Email.focus();
		return (false);
	}
	
	if (theForm.Email.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Email\" field.");
		theForm.Email.focus();
		return (false);
	}
	
	var checkOK = "@";
	var checkStr = theForm.Email.value;
	var allValid = true;
	
	ch = checkStr.indexOf(checkOK);
	if (ch == -1)
	{
    	alert("Invalid email address.  Please include the \"@\" character in the \"Email\" field.");
    	theForm.Email.focus();
    	return (false);
	}
	
	if (theForm.Phone.value == "")
	{
		alert("A contact phone number is required.  Please fill out the \"Phone\" field.");
		theForm.Phone.focus();
		return (false);
	}
	
	if (theForm.Phone.value.length < 7)
	{
		alert("Invalid phone number.  Please enter at least 7 digits in the \"Phone\" field.");
		theForm.Phone.focus();
		return (false);
	}
	
	// allow for blanks spaces to be entered by adding a space at the end of the string.
	var checkOK = "0123456789--/\()=+. ";
	var checkStr = theForm.Phone.value;
	var allValid = true;
	for (i = 0; i < checkStr.length; i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0; j < checkOK.length; j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
     }	
	 if (!allValid)
	 {
    	alert("Please enter only digit characters in the \"Phone\" field.  Example, 489-7843");
    	theForm.Phone.focus();
    	return (false);
	 }
	 
	if (theForm.Zip.value == "")
	{
		alert("Please fill out the \"Zip\" field.");
		theForm.Zip.focus();
		return (false);
	}
	
	if (theForm.Zip.value.length < 2)
	{
		alert("Invalid Zip Code.  Please enter at least 2 characters in the \"Zip\" field.");
		theForm.Zip.focus();
		return (false);
	}
	
	// allow for blanks spaces to be entered by adding a space at the end of the string.
	var checkOK = "0123456789--/\()=+ ";
	var checkStr = theForm.Zip.value;
	var allValid = true;
	for (i = 0; i < checkStr.length; i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0; j < checkOK.length; j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
     }	
	 if (!allValid)
	 {
    	alert("Please enter only digit characters in the \"Zip\" field.");
    	theForm.Zip.focus();
    	return (false);
	 }
	 
	return (true);
}
