var TOCIsOpen = 0;
var breedAlg=0;
var hoogAlg=0;
var urlPaginaAlg="";
var opties="";
function ValidateDatumsExcel(theForm)
{

  if (theForm.dagVan.value == "")
  {
    alert("Gelieve de begindatum volledig in te vullen.");
    theForm.dagVan.focus();
    return (false);
  }
  
  if (theForm.maandVan.value == "")
  {
    alert("Gelieve de begindatum volledig in te vullen.");
    theForm.maandVan.focus();
    return (false);
  }
  
    if (theForm.jaarVan.value == "")
  {
    alert("Gelieve de begindatum volledig in te vullen.");
    theForm.jaarVan.focus();
    return (false);
  }
  
    if (theForm.dagTot.value == "")
  {
    alert("Gelieve de einddatum volledig in te vullen.");
    theForm.dagTot.focus();
    return (false);
  }
  
  if (theForm.maandTot.value == "")
  {
    alert("Gelieve de einddatum volledig in te vullen.");
    theForm.maandTot.focus();
    return (false);
  }
  
    if (theForm.jaarTot.value == "")
  {
    alert("Gelieve de einddatum volledig in te vullen.");
    theForm.jaarTot.focus();
    return (false);
  }
  
  return (true);
}
	function bevestigToekennen(nummer)
	{
	var agree=confirm("Weet u zeker dat u deze credits wil toekennen?");
	if (agree == true){
		toekennenURL="../creditstoewijzen.asp?orderid="+nummer+"&viaAdmin=1"
		OpenVenster(toekennenURL,620, 500, 120, 80)
	}
	return(agree)
	}
	function bevestigAankoop(theform)
	{
	var agree=confirm("Weet u zeker dat u deze wandeling wenst aan te kopen?");
	if (agree == true){
		document.koopwandeling.submit()
	}
	return(agree)
	}

	function downloadwandeling(nummer){
		urlPaginaAlg="./download.asp?num=" + nummer;
		OpenVenster(urlpaginaAlg, 400, 300, 200, 150);
	}
       function ReOpenTOC(urlPagina, breed, hoog) {
		urlPaginaAlg=urlPagina;
		breedAlg=breed;
		hoogAlg=hoog;
           if (TOCIsOpen == 1) {
               msg.close()		
               setTimeout("AfterTimer()",200)
           } else {
		opties = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,topmargin=0,leftmargin=0,resizable=no,width=" 
		opties = opties + breedAlg;
		opties = opties + ", height=" + hoogAlg;

		msg=window.open(urlPagina,"MyWindow",opties)
		msg.creator = self
		TOCIsOpen = 1
           }
       }
	   function openPDF(urlPagina, breed, hoog) {
		urlPaginaAlg=urlPagina;
		breedAlg=breed;
		hoogAlg=hoog;
           if (TOCIsOpen == 1) {
               msg.close()		
               setTimeout("AfterTimer()",200)
           } else {
		opties = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,topmargin=0,leftmargin=0,resizable=yes,width=" 
		opties = opties + breedAlg;
		opties = opties + ", height=" + hoogAlg;

		msg=window.open(urlPagina,"MyWindow",opties)
		msg.creator = self
		TOCIsOpen = 1
           }
       }
	    function OpenVenster(urlPagina, breed, hoog, boven, links) {
		urlPaginaAlg=urlPagina;
		breedAlg=breed;
		hoogAlg=hoog;
		bovenAlg=boven;
		linksAlg=links;
        //   if (TOCIsOpen == 1) {
        //       msg.close()		
         //      setTimeout("AfterTimer()",200)
         //  } else {
		opties = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,topmargin="
		opties = opties + bovenAlg;
		opties = opties + ",leftmargin=";
		opties = opties + linksAlg;
		opties = opties + ",resizable=no,width=" 
		opties = opties + breedAlg;
		opties = opties + ", height=" + hoogAlg;

		msg=window.open(urlPagina,"_blanc",opties)
		//msg.creator = self
		TOCIsOpen = 1
        //   }
       }
       function AfterTimer() {

           opties = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=" 
		opties = opties + breedAlg;
		opties = opties + ", height=" + hoogAlg;

		msg=window.open(urlPaginaAlg,"MyWindow",opties)
		msg.creator = self
		TOCIsOpen = 1
       }
       function TryToCloseTOC() {
           if (TOCIsOpen == 1) {
               msg.close()
           }
       }

function openPagina(urlVanDePagina,doel){
	if (doel=='new'){
		window.open(urlVanDePagina)
	}else{
		if (doel=='parent'){
			parent.document.location=urlVanDePagina;
		}else{
			document.location=urlVanDePagina;
		}
	}
	msg.close();
}
       function Venster(urlPagina, breed, hoog) {
		urlPaginaAlg=urlPagina;
		breedAlg=breed;
		hoogAlg=hoog;
           if (TOCIsOpen == 1) {
               msg.close()		
               setTimeout("AfterTimer()",200)
           } else {
		opties = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=" 
		opties = opties + breedAlg;
		opties = opties + ", height=" + hoogAlg;

		msg=window.open(urlPagina,"MyWindow",opties)
		msg.creator = self
		TOCIsOpen = 1
           }
       }
	   
function ValidateCommentaar(theForm)
{

  if (theForm.voornaam.value == "")
  {
    alert("Gelieve uw naam volledig in te vullen.");
    theForm.voornaam.focus();
    return (false);
  }
  if (theForm.naam.value == "")
  {
    alert("Gelieve uw naam volledig in te vullen.");
    theForm.naam.focus();
    return (false);
  }

  if (theForm.commentaar.value == "")
  {
    alert("Gelieve uw reaktie in te geven.");
    theForm.commentaar.focus();
    return (false);
  }
  return (true);
}
function ValidateKwotering(theForm)
{
  if (theForm.kwotering.value <= "0")
  {
    alert("Gelieve een quotering aan te duiden.");
    theForm.kwotering.focus();
    return (false);
  }

  return (true);
}
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 ValidateCreditsbevestigen(theForm)
{

  if (theForm.voornaam.value == "")
  {
    alert("Gelieve uw naam volledig in te vullen.");
    theForm.voornaam.focus();
    return (false);
  }
  
  if (theForm.naam.value == "")
  {
    alert("Gelieve uw naam volledig in te vullen.");
    theForm.naam.focus();
    return (false);
  }
  
  if (theForm.straat.value == "")
  {
    alert("Gelieve uw adres volledig in te vullen.");
    theForm.straat.focus();
    return (false);
  }
  
  if (theForm.nummer.value == "")
  {
    alert("Gelieve uw adres volledig in te vullen.");
    theForm.nummer.focus();
    return (false);
  }
    if (theForm.postcode.value == "")
  {
    alert("Gelieve uw adres volledig in te vullen.");
    theForm.postcode.focus();
    return (false);
  }
    if (theForm.plaats.value == "")
  {
    alert("Gelieve uw adres volledig in te vullen.");
    theForm.plaats.focus();
    return (false);
  }
  
  if (theForm.land.value == "")
  {
    alert("Gelieve uw adres volledig in te vullen.");
    theForm.land.focus();
    return (false);
  }
  return (true);
}
function ValidateCreditsbestellen(theForm)
{
	if (!theForm.aantalcredits[0].checked && !theForm.aantalcredits[1].checked && !theForm.aantalcredits[2].checked ) 
	{
		alert("Gelieve aan te geven hoeveel credits u wenst te kopen.");
		return (false);
	}
	//if (!theForm.betaalwijze[0].checked)
	//{
	//	alert("Gelieve aan te geven hoeveel credits u wenst te kopen.");
	//	return (false);
	//}
    return (true);
}
function ValidateWedstrijd(theForm)
{
	if (!theForm.antwoord[0].checked && !theForm.antwoord[1].checked && !theForm.antwoord[2].checked ) 
	{
		alert("Gelieve de wedstrijdvraag te beantwoorden.");
		return (false);
	}
	if (theForm.schiftingsvraag.value == "")
	{
		alert("Gelieve de schiftingsvraag te beantwoorden.");
		theForm.schiftingsvraag.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);
  }
    return (true);
	
}
function ValidateRegistreren(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.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 (true);
}
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("Het ingevulde e-mailadres is niet geldig. Gelieve te corrigeren.")}

return myEMailIsValid
}

function GratisCredits(theForm)
{
  if (theForm.email.value == "")
  {
    alert("Gelieve uw e-mailadres in te vullen");
    theForm.email.focus();
    return (false);
  }else{
	  return(CyJS_Utils_IsEmailValid(theForm.email.value));
  }
}
function ValidateRegistrerenAdmin(theForm)
{
  if (theForm.naam.value == "")
  {
    alert("Gelieve de naam in te vullen");
    theForm.naam.focus();
    return (false);
  }
    if (theForm.voornaam.value == "")
  {
    alert("Gelieve de voornaam in te vullen");
    theForm.voornaam.focus();
    return (false);
  }
      if (theForm.email.value == "")
  {
    alert("Gelieve het 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 wachtwoord in te vullen.");
    theForm.wachtwoord.focus();
    return (false);
  }
  
    if (theForm.wachtwoord2.value == "")
  {
    alert("Gelieve het wachtwoord te bevestigen.");
    theForm.wachtwoord.focus();
    return (false);
  }
  if (theForm.wachtwoord2.value != theForm.wachtwoord.value)
  {
    alert("De twee ingevulde wachtwoorden dienen gelijk te zijn aan elkaar.");
    theForm.wachtwoord.focus();
    return (false);
  }
  return (true);
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
