	
		
//Functies om de checkboxen van de zoekvelden wel/niet te selecteren		
	function activateStartNummer(fld) {
      if (fld.value != "") {
        document.form.rdZoeken[0].checked = true;
        document.form.txtNaam.value = "";
		document.form.txtFinishtijd_uur.value = "";
		document.form.txtFinishtijd_min.value = "";
		document.form.txtFinishtijd_sec.value = "";
      }
    }
	
	function activateNaam(fld) {
      if (fld.value != "") {
        document.form.rdZoeken[1].checked = true;
        document.form.txtRugnummer.value = "";
		document.form.txtFinishtijd_uur.value = "";
		document.form.txtFinishtijd_min.value = "";
		document.form.txtFinishtijd_sec.value = "";
      }
    }
	
	function activateFinishTijd(fld) {
      if (fld.value != "") {
        document.form.rdZoeken[2].checked = true;
        document.form.txtRugnummer.value = "";
		document.form.txtNaam.value = "";
      }
    }
	
		
		
	// Popup functie
	var win=null;
	function popup(mypage,myname,w,h,pos,infocus){
		if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
		if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
		else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
		settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
		win.focus();}
	
	
	function openpopup(){
		var popurl="SanTwee"
		winpops=window.open(popurl,"","width=400,height=338,")
		}
		
	function changeBgColor(td, color) {
       if (document.getElementById){
		document.getElementById(td).style.backgroundColor = color;}
	}
	
	function popUpZoeken(url, width, heigth) 
	{
		window.open(url, "popup",  'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + width + ',height=' + width + ',left = 300,top = 300');
	}
	
	
function checkSearchFieldsHomepage()
{
	if (document.form.elements["txtRugnummer"].value == ""){
		alert("Vul svp Uw startnummer in");
		document.form.txtRugnummer.focus();
		return false;
	}	
}



function checkSearchFields()
{
	
	if (document.form.txtNaamEvenement) 
	{
		if (document.form.elements["txtNaamEvenement"].value == ""){
			alert("Er is geen evenementnaam ingevuld");
			document.form.txtNaamEvenement.focus();
			return false;
		}
	}
	
	if (document.form.excelfile) 
	{
		if (document.form.elements["excelfile"].value == ""){
			alert("Er is geen CSV file geselecteerd");
			document.form.excelfile.focus();
			return false;
		}
	}

	if (document.form.rdFileSoort) 
	{
		if (
		document.form.elements["rdFileSoort"][0].checked == false && 
		document.form.elements["rdFileSoort"][1].checked == false && 
		document.form.elements["rdFileSoort"][2].checked == false)
		{
			alert("Vul svp in wat voor soort file het is");
			return false;
		}
		else
		{
			if (document.form.elements["rdFileSoort"][0].checked == true) 
			{
				if (document.form.elements["txtInterval"].value == "")
				{
				alert("Er is geen interval ingevuld");
				document.form.txtInterval.focus();
				return false;
				}
			} 
		}
	}
	
	if (document.form.txtSetInterval) 
	{
		if (document.form.elements["txtSetInterval"].value == ""){
			alert("Er is geen interval ingevuld");
			document.form.txtSetInterval.focus();
			return false;
		}
	}
	
	if (document.form.rdZoeken) 
	{
	
		if (
		document.form.elements["rdZoeken"][0].checked == false && 
		document.form.elements["rdZoeken"][1].checked == false && 
		document.form.elements["rdZoeken"][2].checked == false)
		{
			alert("Vul svp in op welke manier U Uw foto('s) wilt zoeken");
			return false;
		}
		
		//checks voor de invoervelden van de zoekfunctionaliteit
		if (document.form.elements["rdZoeken"][0].checked == true) 
		{
			if (document.form.elements["txtRugnummer"].value == ""){
				alert("Vul svp Uw startnummer in");
				document.form.txtRugnummer.focus();
				return false;
			}
		}
		
		if (document.form.elements["rdZoeken"][1].checked == true) 
		{
			if (document.form.elements["txtNaam"].value == ""){
				alert("Vul svp Uw naam in");
				document.form.txtNaam.focus();
				return false;
			}
		}
		
		if (document.form.elements["rdZoeken"][2].checked == true) 
		{
			if (document.form.elements["txtFinishtijd_uur"].value == ""){
				alert("Vul svp het uur van Uw finishtijd in");
				document.form.txtFinishtijd_uur.focus();
				return false;
			}
			
			if (document.form.elements["txtFinishtijd_min"].value == ""){
				alert("Vul svp de minuten van Uw finishtijd in");
				document.form.txtFinishtijd_min.focus();
				return false;
			}
		}
		
	}	
	
	
}	

function popUp(url) 
	{
		window.open(url, "popup",  'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=150,height=150,left = 300,top = 300');
	}
	


//_____ Function ShowAmount()__________________________________________________________________________
//Functie wordt gebruikt om de bedragen van de fotoos te vermenigvuldigen met de aantallen fotoos
//Wordt aangeroepen in de template: WinkelmandOverzicht_regel.tpl
//______________________________________________________________________________________________________
var intAantal
var intPrijs
var intTotaal
function showAmount(strFormaat, nr)
	{
		switch (strFormaat)
			{
				case "digitaal":
					intAantal = parseFloat(document.form.elements["txtAantalDigitaal#"+nr].value);	
					intPrijs = parseFloat('6.95')
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted(parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaalDigitaal#"+nr].value = intTotaalNew
					break;
				case "13x19":
					intAantal = parseFloat(document.form.elements["txtAantal13x19#"+nr].value);	
					intPrijs = parseFloat('6.95')
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted(parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaal13x19#"+nr].value = intTotaalNew
					break;
				case "20x30":
					intAantal = parseFloat(document.form.elements["txtAantal20x30#"+nr].value);	
					intPrijs = parseFloat('12.95') 
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted(parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaal20x30#"+nr].value = intTotaalNew					
					break;
				case "30x45":
					intAantal = parseFloat(document.form.elements["txtAantal30x45#"+nr].value);	
					intPrijs = parseFloat('29.95')  
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted(parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaal30x45#"+nr].value = intTotaalNew						
					break;
				case "certificaat":
					intAantal = parseFloat(document.form.elements["txtAantalCertificaat#"+nr].value);	
					intPrijs = parseFloat('18.95')  
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted( parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaalCertificaat#"+nr].value = intTotaalNew					
					break;	
				case "Canvas20x30":
					intAantal = parseFloat(document.form.elements["txtAantalCanvas20x30#"+nr].value);	
					intPrijs = parseFloat('19.95')  
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted( parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaalCanvas20x30#"+nr].value = intTotaalNew					
					break;
				case "Canvas30x45":
					intAantal = parseFloat(document.form.elements["txtAantalCanvas30x45#"+nr].value);	
					intPrijs = parseFloat('29.95')  
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted( parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaalCanvas30x45#"+nr].value = intTotaalNew					
					break;	
				case "Canvas40x60":
					intAantal = parseFloat(document.form.elements["txtAantalCanvas40x60#"+nr].value);	
					intPrijs = parseFloat('49.95')  
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted( parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaalCanvas40x60#"+nr].value = intTotaalNew					
					break;	
				case "Canvas60x90":
					intAantal = parseFloat(document.form.elements["txtAantalCanvas60x90#"+nr].value);	
					intPrijs = parseFloat('69.95')  
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted( parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaalCanvas60x90#"+nr].value = intTotaalNew					
					break;		
				case "Canvas80x120":
					intAantal = parseFloat(document.form.elements["txtAantalCanvas80x120#"+nr].value);	
					intPrijs = parseFloat('89.95')  
					intTotaal = intAantal * intPrijs
					intTotaalNew = CurrencyFormatted( parseFloat(intTotaal))
					document.form.elements["txtPrijsTotaalCanvas80x120#"+nr].value = intTotaalNew					
					break;		
	
				default:
					break;
			}
				
	}

function CurrencyFormatted(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}
// end of function CurrencyFormatted()


function CommaFormatted(amount)
{
	var delimiter = ","; // replace comma if desired
	var a = amount.split('.',2)
	var d = a[1];
	var i = parseInt(a[0]);
	if(isNaN(i)) { return ''; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	var n = new String(i);
	var a = [];
	while(n.length > 3)
	{
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	n = a.join(delimiter);
	if(d.length < 1) { amount = n; }
	else { amount = n + '.' + d; }
	amount = minus + amount;
	return amount;
}

	
function verwijder(strEvenement, strFoto)
{
 
 input_box=confirm("Weet U zeker dat U deze foto uit Uw winkelmandje wilt verwijderen?");
 if (input_box==true)
 	{
		location.href='indexWinkelmand.asp?evenement=' +strEvenement+ '&foto=' +strFoto+ '&contentId=3';
		return true;
 	}
 	
}


//____________________________________________________________________________________________________________________________________
//___________________________________________________________________________________________Validatie voor het bestelformulier
function isEmail(str) {
	  // are regular expressions supported?
	  var supported = 0;
	  if (window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	  }
	  if (!supported) 
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
		return (!r1.test(str) && r2.test(str));
	}



function checkSearchFieldsClient()
{
	if (document.form.elements["txtRugnummer"].value == "")
	{
		alert("Vul svp een startnummer in ");
		document.form.txtRugnummer.focus();
		return false;
	}
	else
	{
			return true;	
	}
}




function checkFields()
	{
		
		var strMessage = '';
		
		if (document.formulier.elements["Naam"].value == ""){
			strMessage += '   - Uw Naam \n';
		}
		
		if (document.formulier.elements["Adres"].value == ""){
			strMessage += '   - Uw Adres \n';
		}
		if (document.formulier.elements["Postcode"].value == ""){
			strMessage += '   - Uw Postcode \n';
		}
		if (document.formulier.elements["Woonplaats"].value == ""){
			strMessage += '   - Uw Woonplaats \n';
		}
		if (document.formulier.elements["email"].value == ""){
			strMessage += '   - Uw e-mailadres \n';
		}
		if (document.formulier.elements["email"].value != ""){
		
			var strEmail = document.formulier.elements["email"].value
			var strEmailTest = isEmail(strEmail);
			if (strEmailTest == false )
			{
				strMessage += '   - Uw e-mailadres (deze is niet correct) \n';
			}
		}
	
		
		if (document.formulier.elements["Rekeningnummer"].value == ""){
			strMessage += '   - Uw Rekeningnummer \n';
		}
		else
		{
				if (IsNumeric(document.formulier.elements["Rekeningnummer"].value) == false)
				{
					strMessage += '   - Uw Bankrekeningnummer \n';	
				}
				else
				{
					if (document.formulier.elements["Rekeningnummer"].value != ""){
						
						if (document.formulier.elements["Rekeningnummer"].value.length == 9){
							if (controle(document.formulier.elements["Rekeningnummer"]) == false)
							{
								strMessage += '   - Uw Bankrekeningnummer \n';	
							}
						}
					}
				}
		}
		
		
		// Weergeven resultaat controles
		if (strMessage != ''){
			strMessage = 'U heeft de volgende verplichte velden niet (goed) ingevuld \n' 
						+ '_______________________________________________________\n\n'
						+ strMessage
						+ '\n_______________________________________________________';
			alert(strMessage);
			return false;
		}
		
		return true;
	}
	
	//Elf proef
	var frm;
	var doc;
	function controle(veld)
	{
	var input=veld.value;
	var tot=0;
	var deel=0;
	var rest =0;
	if (input.length>9){
	//alert("u moet 9 cijfers ingeven");
	veld.focus();
	} 
	else{
	for (i=0;i<input.length;i++){
	getal=input.substr(i,1);
	tot +=getal * (9 - i);
	} 
	deel =tot/11;
	//alert("dit is de waarde gedeeld door 11: " + deel);
	rest=tot%11;
	if (rest!=0)
	{
	//alert("dit is géén juist banknummer");
	return false;
	}
	else {
	//alert("dit banknummer is juist");
	return true;
	}
	} 
	} 
	
	
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;
   
   }



