//<SCRIPT LANGUAGE="javascript">
<!--


function newstr(str2)	{
	if(str2 == null)	str2 = "";
	str = ""
	for(j = 0; j < str2.length; j++)	{
		if(str2.charAt(j) == "\"")	str += "&quot;";
		else	{if (str2.charAt(j) == "'")	str += "`";
		else	{if (str2.charAt(j) == "|")	str += "!";
		else	str += str2.charAt(j);}}
	}
	return str;
}

function Validator(theForm)
{
  var str = "";

  if (theForm.Naam.value == "")
  {
    alert("U heeft het \"Naam\" veld niet goed ingevuld.");
    theForm.Naam.focus();
    return (false);
  }

  if (theForm.Naam.value.length < 1)
  {
    alert("U heeft het \"Naam\" veld niet goed ingevuld.");
    theForm.Naam.focus();
    return (false);
  }

  if (theForm.Adres.value == "")
  {
    alert("U heeft het \"Adres\" veld niet goed ingevuld.");
    theForm.Adres.focus();
    return (false);
  }

  if (theForm.Adres.value.length < 1)
  {
    alert("U heeft het \"Adres\" veld niet goed ingevuld.");
    theForm.Adres.focus();
    return (false);
  }

  if (theForm.Postcode.value == "")
  {
    alert("U heeft het \"Postcode\" veld niet goed ingevuld.");
    theForm.Postcode.focus();
    return (false);
  }

  if (theForm.Postcode.value.length < 1)
  {
    alert("U heeft het \"Postcode\" veld niet goed ingevuld.");
    theForm.Postcode.focus();
    return (false);
  }

  if (theForm.Plaats.value == "")
  {
    alert("U heeft het \"Plaats\" veld niet goed ingevuld.");
    theForm.Plaats.focus();
    return (false);
  }

  if (theForm.Plaats.value.length < 1)
  {
    alert("U heeft het \"Plaats\" veld niet goed ingevuld..");
    theForm.Plaats.focus();
    return (false);
  }

  if (theForm.Telefoon.value == "")
  {
    alert("U heeft het \"Telefoonnummer\" veld niet goed ingevuld.");
    theForm.Telefoon.focus();
    return (false);
  }

  if (theForm.Telefoon.value.length < 10)
  {
    alert("Aub het \"Telefoonnummer\" veld van 10 cijfers voorzien.");
    theForm.Telefoon.focus();
    return (false);
  }

  var checkOK = "0123456789-+";
  var checkStr = theForm.Telefoon.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  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;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("AUB alleen cijfers in het \"Telefoonnummer\" veld gebruiken.");
    theForm.Telefoon.focus();
    return (false);
  }

  if ((theForm.Fax.value != "") && (theForm.Fax.value.length <10))
  {
    alert("U heeft het \"Faxnummer\" veld niet goed ingevuld.");
    theForm.Fax.focus();
    return (false);
  }

  var checkOK = "0123456789-+";
  var checkStr = theForm.Fax.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  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;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("AUB alleen cijfers in het \"Faxnummer\" veld gebruiken.");
    theForm.Fax.focus();
    return (false);
  }

  if (theForm.email.value == "")
  {
    alert("U heeft het \"E-Mail\" veld niet goed ingevuld.");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email.value.length < 1)
  {
    alert("U heeft het \"E-Mail\" veld niet goed ingevuld.");
    theForm.email.focus();
    return (false);
  }

var eersteaapje = theForm.email.value.indexOf('@');
var laatsteaapje = theForm.email.value.lastIndexOf('@');
var punt = theForm.email.value.lastIndexOf('.');
    if (eersteaapje != laatsteaapje || punt <= eersteaapje + 1 || punt >= theForm.email.value.length -1) {
         alert("Sorry, dit email adres lijkt niet te kloppen."
   +" kontroleer het voorvoegsel en het '@' teken.");
         theForm.email.focus();
         return (false);
     }

	theForm.Bedrijf.value = newstr(theForm.Bedrijf.value);
	theForm.Adres.value = newstr(theForm.Adres.value);
	theForm.Postcode.value = newstr(theForm.Postcode.value);
	theForm.Plaats.value = newstr(theForm.Plaats.value);
	theForm.Naam.value = newstr(theForm.Naam.value);
	theForm.Telefoon.value = newstr(theForm.Telefoon.value);
	theForm.Fax.value = newstr(theForm.Fax.value);
	theForm.email.value = newstr(theForm.email.value);
  return (true);
}


//-->
//</SCRIPT>
