// JavaScript Document

function CyJS_Utils_IsEmailValid(checkThisEmail)
{
var myEMailIsValid = true;
var myAtSymbolAt = checkThisEmail.indexOf('@');
var myLastDotAt = checkThisEmail.lastIndexOf('.');
var mySpaceAt = checkThisEmail.indexOf(' ');
var myLength = checkThisEmail.length;

if (myAtSymbolAt < 1 ) 
 {myEMailIsValid = false}

if (myLastDotAt < myAtSymbolAt) 
 {myEMailIsValid = false}


if (myLength - myLastDotAt <= 2) 
 {myEMailIsValid = false}

if (mySpaceAt != -1) 
 {myEMailIsValid = false}

if (myEMailIsValid == false)
 {alert("Gelieve een geldig e-mailadres in te vullen.")}

return myEMailIsValid
}
function ValidateBerekenbeeldhoek(theForm)
{
  if (theForm.brandpuntsafstand1.value<0 )
  {
    alert("De brandpuntsafstand moet een positief getal zijn");
    theForm.brandpuntsafstand1.focus();
    return (false);
  }
}
function ValidateAanmelden(theForm)
{

  if (theForm.gebruikersnaam.value == "")
  {
    alert("Gelieve uw gebruikersnaam in te vullen");
    theForm.gebruikersnaam.focus();
    return (false);
  }

  if (theForm.wachtwoord.value == "")
  {
    alert("Gelieve uw wachtwoord in te vullen.");
    theForm.wachtwoord.focus();
    return (false);
  }
  return (true);
}
function ValidateWachtwoordvergeten(theForm)
{

  if (theForm.email.value == "")
  {
    alert("Gelieve uw e-mailadres in te vullen");
    theForm.email.focus();
    return (false);
  }

  return CyJS_Utils_IsEmailValid(theForm.email.value);
}
function ValidateValideren(theForm)
{
  if (theForm.Toegangscode.value == "")
  {
    alert("Gelieve de Toegangscode in te vullen");
    theForm.Toegangscode.focus();
    return (false);
  }
  return (true);
}

function ValidateRegistreren(theForm)
{
  if (theForm.Toegangscode.value == "")
  {
    alert("Gelieve uw persoonlijke registratiecode in te vullen");
    theForm.Toegangscode.focus();
    return (false);
  }
  if (theForm.naam.value == "")
  {
    alert("Gelieve uw naam in te vullen");
    theForm.naam.focus();
    return (false);
  }
    if (theForm.voornaam.value == "")
  {
    alert("Gelieve uw voornaam in te vullen");
    theForm.voornaam.focus();
    return (false);
  }
      if (theForm.email.value == "")
  {
    alert("Gelieve uw E-mail adres in te vullen");
    theForm.email.focus();
    return (false);
  }
  if (theForm.gebruikersnaam.value == "")
  {
    alert("Gelieve de gewenste gebruikersnaam in te vullen");
    theForm.gebruikersnaam.focus();
    return (false);
  }

  if (theForm.wachtwoord.value == "")
  {
    alert("Gelieve het gewenste wachtwoord in te vullen.");
    theForm.wachtwoord.focus();
    return (false);
  }
  
    if (theForm.wachtwoord2.value == "")
  {
    alert("Gelieve het gewenste wachtwoord te bevestigen.");
    theForm.wachtwoord.focus();
    return (false);
  }
  if (theForm.wachtwoord2.value != theForm.wachtwoord.value)
  {
    alert("De twee ingevulde wachtwoorden zijn niet gelijk aan elkaar.");
    theForm.wachtwoord.focus();
    return (false);
  }
  return CyJS_Utils_IsEmailValid(theForm.email.value);
}
function ValidatePreform(theForm)
{
	if (theForm.klant[0].checked == true){
		if (theForm.registratiecode.value == "" ){
			alert("Gelieve de registratiecode in te vullen.");
		    theForm.registratiecode.focus();
    		return (false);
		}
	}
	return (true);
}
function ValidateBestelDVD(theForm)
{
    if (theForm.naam.value == "")
  {
    alert("Gelieve uw naam in te vullen");
    theForm.naam.focus();
    return (false);
  }
  if (theForm.voornaam.value == "")
  {
    alert("Gelieve uw voornaam in te vullen");
    theForm.voornaam.focus();
    return (false);
  }
    if (theForm.adres.value == "")
  {
    alert("Gelieve uw adres in te vullen");
    theForm.adres.focus();
    return (false);
  }
      if (theForm.postcode.value == "")
  {
    alert("Gelieve uw postcode in te vullen");
    theForm.postcode.focus();
    return (false);
  }
      if (theForm.woonplaats.value == "")
  {
    alert("Gelieve uw woonplaats in te vullen");
    theForm.woonplaats.focus();
    return (false);
  }
        if (theForm.land.value == "")
  {
    alert("Gelieve uw land in te vullen");
    theForm.land.focus();
    return (false);
  }
  
  if (theForm.email.value == "")
  {
    alert("Gelieve uw e-mailadres in te vullen");
    theForm.email.focus();
    return (false);
  }  
  	return (true);
}
function ValidateBoekkopen(theForm)
{
  if (theForm.naam.value == "")
  {
    alert("Gelieve uw naam in te vullen");
    theForm.naam.focus();
    return (false);
  }
    if (theForm.voornaam.value == "")
  {
    alert("Gelieve uw voornaam in te vullen");
    theForm.voornaam.focus();
    return (false);
  }
      if (theForm.email.value == "")
  {
    alert("Gelieve uw E-mail adres in te vullen");
    theForm.email.focus();
	return (false);    
  }  
  if (theForm.straat.value == "")
  {
    alert("Gelieve uw straat in te vullen");
    theForm.straat.focus();
    return (false);
  }
    if (theForm.nummer.value == "")
  {
    alert("Gelieve uw huisnummer in te vullen");
    theForm.nummer.focus();
    return (false);
  }
      if (theForm.postcode.value == "")
  {
    alert("Gelieve uw postcode in te vullen");
    theForm.postcode.focus();
    return (false);
  }
      if (theForm.plaats.value == "")
  {
    alert("Gelieve uw woonplaats in te vullen");
    theForm.plaats.focus();
    return (false);
  }
   if (theForm.land.value == "")
  {
    alert("Gelieve uw land in te vullen");
    theForm.land.focus();
    return (false);
  }
  return CyJS_Utils_IsEmailValid(theForm.email.value);
}
function ValidateContactformulier(theForm)
{
  if (theForm.naam.value == "")
  {
    alert("Gelieve uw naam in te vullen");
    theForm.naam.focus();
    return (false);
  }
      if (theForm.email.value == "")
  {
    alert("Gelieve uw E-mail adres in te vullen");
    theForm.email.focus();
	return (false);    
  }  
  if (theForm.bericht.value == "")
  {
    alert("Gelieve een bericht in te vullen");
    theForm.bericht.focus();
    return (false);
  }    
  return CyJS_Utils_IsEmailValid(theForm.email.value);
}
