// Form Validation Script

<!--
function filterFileType(field) {
	if (
		(field.value.indexOf('.zip') == -1) 
		&& (field.value.indexOf('.sit') == -1)
		&& (field.value.indexOf('.hqx') == -1)	
		&& (field.value.indexOf('.ZIP') == -1) 
		&& (field.value.indexOf('.SIT') == -1)
		&& (field.value.indexOf('.HQX') == -1)
	   )	
	{
		return false;
	}
  return true;
} 
function FrontPage_Form1_Validator(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter a value for the \"Your name\" field.");
    theForm.Name.focus();
    return (false);
  }
  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"Email Address 1\" field.");
    theForm.email.focus();
    return (false);
  }
  if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.email.value))) 
	{
		alert("The email you entered is not a valid email address.");
	    theForm.email.focus();
	    return (false);
	}

  if (theForm.Company.value == "")
  {
    alert("Please enter a value for the \"Company Name\" field.");
    theForm.Company.focus();
    return (false);
  }
  

  if (theForm.Address1.value == "")
  {
    alert("Please enter a value for the \"Address 1\" field.");
    theForm.Address1.focus();
    return (false);
  }

  if (theForm.ProjectName.value == "")
  {
    alert("Please enter a value for the \"Project Name\" field.");
    theForm.ProjectName.focus();
    return (false);
  }

  if (theForm.PhoneNumber.value == "")
  {
    alert("Please enter a value for the \"Phone Number\" field.");
    theForm.PhoneNumber.focus();
    return (false);
  }

	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.EMail.value))) 
	{
		alert("The email you entered is not a valid email address.");
	    theForm.EMail.focus();
	    return (false);
	}
	/*test of google email*/
if (theForm.EMail.value == 'google@google.com') 
	{
		alert("The email you entered is not a valid email address.");
	    theForm.EMail.focus();
	    return (false);
	}


  if (theForm.ServiceNeeded.value == "")
  {
    alert("Please enter a value for the \"Job Instructions\" field.");
    theForm.ServiceNeeded.focus();
    return (false);
  }

  if (theForm.DateNeeded.value == "")
  {
    alert("Please enter a value for the \"Date Needed\" field.");
    theForm.DateNeeded.focus();
    return (false);
  }
//text entered by rj to test if radio checked
  if (theForm.WorkLocationNeeded.value == "")
  {
    alert("Please select Chicago for work to be done at the Chicago office in the \"Work Location\" field\r\ror\r\rDuPage for work to be done at the Glen Ellyn office in the \"Work Location\" field.");
    theForm.WorkLocationNeeded.focus();
    return (false);
  }
//end of test by rj
	if (!filterFileType(theForm.TheFile)) 
	{
		alert("Please upload only .zip, .sit or .hqx files");
		theForm.TheFile.focus();
		return (false);
	}
	//text entered by rj to test if select proofs
  if (theForm.SelectProofNeeded.value == "")
  {
    alert("Please make a selection in the\n \"Select Proof Needed\" field.");
    theForm.SelectProofNeeded.focus();
    return (false);
  }
//end of test by rj

	postIt();

  return (true);
}

//-->