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 ValidateRegistratieCursist(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.email2.value == "")
	  {
		alert("Gelieve uw E-mail adres nogmaals in te vullen");
		theForm.email2.focus();
		return (false);
	  }
	  if (theForm.email.value != theForm.email2.value)
	  {
		alert("Gelieve twee maal hetzelfde E-mail adres in te vullen");
		theForm.email2.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 ValidateRegistreren(theForm)
{
  if (theForm.Toegangscode.value == "" || theForm.Toegangscode.value == "W7")
  {
    alert("Gelieve uw persoonlijke registratiecode volledig in te vullen");
    theForm.Toegangscode.focus();
    return (false);
  }
  if (theForm.gebruikersnaambestaand.value == ""){
	  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.email2.value == "")
	  {
		alert("Gelieve uw E-mail adres nogmaals in te vullen");
		theForm.email2.focus();
		return (false);
	  }
	  if (theForm.email.value != theForm.email2.value)
	  {
		alert("Gelieve twee maal hetzelfde E-mail adres in te vullen");
		theForm.email2.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);
  }
  if (theForm.gebruikersnaambestaand.value != ""){
	  if (theForm.wachtwoordbestaand.value == ""){
		alert("Gelieve uw huidig wachtwoord in te vullen.");
		theForm.wachtwoordbestaand.focus();
		return (false);
	  }
  }
}
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){
var boek="";
for (var i=0; i < theForm.product.length; i++)
   {
   if (theForm.product[i].checked)
      {
       boek = theForm.product[i].value;
      }
   }
  if (boek == "")
  {
    alert("Gelieve aan te duiden welk boek u wenst te bestellen.");    
    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.email2.value == "")
  {
    alert("Gelieve uw E-mail adres nogmaals in te vullen");
    theForm.email2.focus();
    return (false);
  }
  if (theForm.email.value != theForm.email2.value)
  {
    alert("Gelieve twee maal hetzelfde E-mail adres in te vullen");
    theForm.email2.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);
}

function ValidateVerwittigformulier(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);    
  }    
  return CyJS_Utils_IsEmailValid(theForm.email.value);
}
function ValidateSuggestieformulier(theForm)
{
  if (theForm.suggestie.value == "")
  {
    alert("Gelieve uw suggestie in te vullen");
    theForm.suggestie.focus();
    return (false);
  }
  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);    
  }    
  return CyJS_Utils_IsEmailValid(theForm.email.value);
}
function ValidateNieuweOpdracht(theForm)
{
	  if (theForm.start.value == "")
	  {
		alert("Gelieve de startdatum in te vullen");
		theForm.start.focus();
		return (false);
	  }
	if (theForm.einde.value == "")
	  {
		alert("Gelieve de einddatum in te vullen");
		theForm.einde.focus();
		return (false);
	  }
	if (theForm.opdrachttitel.value == "")
	  {
		alert("Gelieve een titel in te vullen");
		theForm.opdrachttitel.focus();
		return (false);
	  }
	  	if (theForm.min.value == "")
	  {
		alert("Gelieve het minimum aantal fotos in te vullen");
		theForm.min.focus();
		return (false);
	  }
	 if (theForm.max.value == "")
	  {
		alert("Gelieve het maximum aantal fotos in te vullen");
		theForm.max.focus();
		return (false);
	  }
	  if (theForm.opdrachttype.value == "")
	  {
		alert("Gelieve het opdrachttype in te vullen");
		theForm.opdrachttype.focus();
		return (false);
	  }		 	 	  
	  return (true);
}
function ValidateNieuweEvaluatie(theForm)
{
	  if (theForm.start.value == "")
	  {
		alert("Gelieve de startdatum in te vullen");
		theForm.start.focus();
		return (false);
	  }
	if (theForm.einde.value == "")
	  {
		alert("Gelieve de einddatum in te vullen");
		theForm.einde.focus();
		return (false);
	  }
  	if (theForm.aantal.value == "")
	  {
		alert("Gelieve het aantal op te lossen vragen in te vullen");
		theForm.aantal.focus();
		return (false);
	  }
	 if (theForm.reeks.value == "")
	  {
		alert("Gelieve het reeksnummer in te vullen");
		theForm.reeks.focus();
		return (false);
	  }
	  if (theForm.evaluatietype.value == "")
	  {
		alert("Gelieve het evaluatietype in te vullen");
		theForm.evaluatietype.focus();
		return (false);
	  }		 	 	  
	  return (true);
}
function ValidateNieuweVraag(theForm)
{
	  if (theForm.Vraag.value == "")
	  {
		alert("Gelieve de vraag in te vullen");
		theForm.Vraag.focus();
		return (false);
	  }
	if (theForm.Antwoord1.value == "")
	  {
		alert("Gelieve Antwoord 1 in te vullen");
		theForm.Antwoord1.focus();
		return (false);
	  }
  	if (theForm.JuistAntwoord.value == "")
	  {
		alert("Gelieve het juiste antwoord in te vullen");
		theForm.JuistAntwoord.focus();
		return (false);
	  }	 	 	  
	  return (true);
}
