function IsNumeric(sText)
{
   var ValidChars = "0123456789- ";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }


function form_validator(theForm)
{

  if (theForm.plaats.value == "" || theForm.plaats.value == null)
  {
    alert("Geef de plaats van de activiteit aan.");
    theForm.plaats.focus();
    return (false);
  }
  
  if (theForm.locatie.value == "")
  {
    alert("Vul de locatie van de activiteit in.");
    theForm.locatie.focus();
    return (false);
  }
  
  if (theForm.categorie.value == "" || theForm.categorie.value == "xxx" || theForm.categorie.value == null)
  {
    alert("Geef aan tot welke categorie de activiteit behoort.");
    theForm.categorie.focus();
    return (false);
  }
  
  if (theForm.wat.value == "")
  {
    alert("Vul de Titel van de activiteit in");
    theForm.wat.focus();
    return (false);
  }

  if (theForm.wanneer.value == "" || theForm.wanneer.value == null)
  {
    alert("Geef de datum van de activiteit aan.");
    theForm.wanneer.focus();
    return (false);
  }
  
  if (theForm.aanvang.value == "")
  {
    alert("Vul de aanvang van de activiteit in.");
    theForm.aanvang.focus();
    return (false);
  }

  if (theForm.naam_con.value == "")
  {
    alert("Vul uw naam in.");
    theForm.naam_con.focus();
    return (false);
  }
  
  if (theForm.adres_con.value == "")
  {
    alert("Vul uw adres in.");
    theForm.adres_con.focus();
    return (false);
  }

  if (theForm.postcode_con.value == "")
  {
    alert("Vul uw postcode in.");
    theForm.postcode_con.focus();
    return (false);
  }
  
  if (theForm.plaats_con.value == "")
  {
    alert("Vul uw woonplaats in.");
    theForm.plaats_con.focus();
    return (false);
  }

  if (theForm.telefoon_con.value == "")
  {
    alert("Vul uw telefoonnummer in.");
    theForm.telefoon_con.focus();
    return (false);
  }
  
  if (!IsNumeric(theForm.telefoon_con.value))
    {
    alert("Vul een juist telefoonnummer in.");
    theForm.telefoon_con.focus();
    return (false);
  }
  
  if (theForm.telefoon_con.value.lenght < 9)
  {
    alert("Een juist telefoonnummer bestaat uit 10 cijfers.");
    theForm.telefoon_con.focus();
    return (false);
  }
  
  if (theForm.telefoon_con.value.lenght > 11)
  {
    alert("Een juist telefoonnummer bestaat uit 10 cijfers.");
    theForm.telefoon_con.focus();
    return (false);
  }
  
   if (theForm.email_con.value == "")
  {
    alert("Vul uw e-mailadres in.");
    theForm.email_con.focus();
    return (false);
  }

return(true)
}

