function popcontact(URL) {
var popup_width = 600
var popup_height = 300
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+popup_width+',height='+popup_height+'');");
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)

		if (str.indexOf(at)==-1){
		   alert("You must enter a valid EMAIL Address.")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("You must enter a valid EMAIL Address.")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("You must enter a valid EMAIL Address.")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("You must enter a valid EMAIL Address.")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("You must enter a valid EMAIL Address.")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("You must enter a valid EMAIL Address.")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("You must enter a valid EMAIL Address.")
		    return false
		 }

 		 return true					
	}

function Validator(theForm)
{

	isValid = false;
	nBox = window.document.getElementsByName("progid");
	for (i=0; i<nBox.length; i++)
	{
	//alert(nBox[i].checked);
		if (nBox[i].checked == true)
		{
			isValid = true;
		}
	}

	if (isValid == false)
	{
	  alert("You must select a program to attend.");
	  //theForm.progid.focus();
	  return (false);
	}


  if (theForm.FirstName.value == "")
  {
    alert("Please enter your First Name.");
    theForm.FirstName.focus();
    return (false);
  }
 
  if (theForm.FirstName.value.length < 1)
  {
    alert("Please enter your First Name.");
    theForm.FirstName.focus();
    return (false);
  }
 
  if (theForm.LastName.value == "")
  {
    alert("Please enter your Last Name.");
    theForm.LastName.focus();
    return (false);
  }
 
  if (theForm.LastName.value.length < 1)
  {
    alert("Please enter your Last Name.");
    theForm.LastName.focus();
    return (false);
  }
 
  if (theForm.Title.value == "")
  {
    alert("Please enter your Title.");
    theForm.Title.focus();
    return (false);
  }
 
  if (theForm.Title.value.length < 1)
  {
    alert("Please enter your Title.");
    theForm.Title.focus();
    return (false);
  }
 
  if (theForm.Agency.value == "")
  {
    alert("Please enter your Agency\'s Name.");
    theForm.Agency.focus();
    return (false);
  }
 
  if (theForm.Agency.value.length < 1)
  {
    alert("Please enter your Agency\'s Name.");
    theForm.Agency.focus();
    return (false);
  }
 
  if (theForm.address.value == "")
  {
    alert("Please enter your Local Agency Address.");
    theForm.address.focus();
    return (false);
  }
 
  if (theForm.address.value.length < 1)
  {
    alert("Please enter your Local Agency Address.");
    theForm.address.focus();
    return (false);
  }
 
  if (theForm.City.value == "")
  {
    alert("Please enter your City.");
    theForm.City.focus();
    return (false);
  }
 
  if (theForm.City.value.length < 1)
  {
    alert("Please enter your City.");
    theForm.City.focus();
    return (false);
  }
 
  if (theForm.State.value == "")
  {
    alert("Please enter a 2 character state abbreviation");
    theForm.State.focus();
    return (false);
  }
 
  if (theForm.State.value.length < 2)
  {
    alert("Please enter a 2 character state abbreviation");
    theForm.State.focus();
    return (false);
  }
 
  if (theForm.zip.value == "")
  {
    alert("Please enter a valid ZIPCODE.");
    theForm.zip.focus();
    return (false);
  }
 
  if (theForm.zip.value.length < 1)
  {
    alert("Please enter a valid ZIPCODE.");
    theForm.zip.focus();
    return (false);
  }

  if (theForm.Email.value == "")
  {
    alert("Please enter a valid email address.");
    theForm.Email.focus();
    return (false);
  }
 
  if (echeck(theForm.Email.value)==false)
  {
	theForm.Email.value="";
	theForm.Email.focus();
	return (false);
  }

  if (echeck(theForm.Email.value) == false)
  {
    alert("Please enter a valid email address.");
    theForm.Email.focus();
    return (false);
  }
 
  if (theForm.Telephone.value == "")
  {
    alert("Please enter a valid telephone number including area code.");
    theForm.Telephone.focus();
    return (false);
  }
 
  if (theForm.Telephone.value.length < 10)
  {
    alert("Please enter a valid telephone number including area code.");
    theForm.Telephone.focus();
    return (false);
  }

  if (theForm.WorkCounty.value == "99999")
  {
    alert("Please choose a valid Work County.");
    theForm.WorkCounty.focus();
    return (false);
  }

  if (theForm.WorkSetting.value == "99999")
  {
    alert("Please choose a valid Work Setting.");
    theForm.WorkSetting.focus();
    return (false);
  }

  if (theForm.Occupation.value == "99999")
  {
    alert("Please choose a valid Occupation.");
    theForm.Occupation.focus();
    return (false);
  }

  if (theForm.OccYears.value == "99999")
  {
    alert("Please choose a valid number of Occupational Years.");
    theForm.OccYears.focus();
    return (false);
  }

  if (theForm.Education.value == "99999")
  {
    alert("Please choose an Education level.");
    theForm.Education.focus();
    return (false);
  }

  if (theForm.Race.value == "99999")
  {
    alert("Please select a Race.");
    theForm.Race.focus();
    return (false);
  }

  if (theForm.Ethnicity.value == "99999")
  {
    alert("Please select an Ethnicity.");
    theForm.Ethnicity.focus();
    return (false);
  }

  if (theForm.SuperName.value == "")
  {
    alert("Please enter your Supervisor\'s Name.");
    theForm.SuperName.focus();
    return (false);
  }
 
  if (theForm.SuperName.value.length < 1)
  {
    alert("Please enter your Supervisor\'s Name.");
    theForm.SuperName.focus();
    return (false);
  }
 
  if (theForm.SuperPhone.value == "")
  {
    alert("Please enter your Supervisor\'s phone number including area code.");
    theForm.SuperPhone.focus();
    return (false);
  }
 
  if (theForm.SuperPhone.value.length < 10)
  {
    alert("Please enter your Supervisor\'s phone number including area code.");
    theForm.SuperPhone.focus();
    return (false);
  }
  return (true);
}
