<!-- Begin
var submitcount=0;

function reset() {
document.MegDilRealEstateHomes.AFirstName.value="";
document.MegDilRealEstateHomes.BLastName.value="";
document.MegDilRealEstateHomes.CCountry.value="";
document.MegDilRealEstateHomes.EEmail.value="";
document.MegDilRealEstateHomes.FMessage.value="";
}

function Validator(theForm){

	if (submitcount != 0) {
     alert("Please do not click the submit button again.\n\nThe request may take a moment to process.");
	 return false; 
    }
  
  if (theForm.AFirstName.value == "")
  {
    alert("Please enter a value for the \"FirstName\" field.");
    theForm.AFirstName.focus();
    return (false);
  }
  
  if (theForm.BLastName.value == "")
  {
    alert("Please enter a value for the \"LastName\" field.");
    theForm.BLastName.focus();
    return (false);
  }
  
  if (theForm.CCountry.selectedIndex < 0)
  {
    alert("Please select one of the \"Country\" options.");
    theForm.CCountry.focus();
    return (false);
  }
  
  else if (theForm.CCountry.selectedIndex == 0)
  {
    alert("The first \"Country\" option is not a valid selection. Please choose your Country.");
    theForm.CCountry.focus();
    return (false);
  }

  if (theForm.EEmail.value == "")
  {
    alert("Please enter a value for the \"Email Address\" field.");
    theForm.EEmail.focus();
    return (false);
  }                    
       else if (theForm.EEmail.value.indexOf("@",1)== -1) // there must be one "@" symbol
	{
          alert("Please enter a valid Email in the \"Email Address\" field.");
          theForm.EEmail.focus();        
	  return (false);
        }
        else if  (theForm.EEmail.value.indexOf("@",theForm.EEmail.value.indexOf("@",1)+1) != -1) // and only one "@" symbol
	{ 		
          alert("Please enter a valid Email in the \"Email Address\" field.");
    	  theForm.EEmail.focus();      
	  return (false);
        }	

	else if  (theForm.EEmail.value.indexOf(".",theForm.EEmail.value.indexOf("@",1))+3 >  theForm.EEmail.value.length) // must be at least 2 characters after the "."
	{               
          alert("Please enter a valid Email in the \"Email Address\" field.");
    	  theForm.EEmail.focus();      
	  return (false);
        }        
        else if  (theForm.EEmail.value.indexOf(".",theForm.EEmail.value.indexOf("@",1)) == -1) // and at least one "." after the "@"
	{                                  
          alert("Please enter a valid Email in the \"Email Address\" field.");
    	  theForm.EEmail.focus();       
          return (false);
        }
        
  if (theForm.FMessage.value == "")
  {
    alert("Please enter a value for the \"Message\" field.");
    theForm.FMessage.focus();
    return (false);
  }

else 
   {
   if (submitcount == 0)
      {
      theForm.SubmitButton.value = "Submitting Request, Please Wait...";
      submitcount++;
      return true;
      }
   else 
      {
      alert("This form has already been submitted. Thanks!");
      return false;
      }
   }
}
//-->
