//***************************************/
//| VALIDATION OF FORM FIELDS            |
//***************************************/


		
// inschrijving controle

		function valideerForm(theForm) {
			
			var reason = "";
		
		  reason += validateEmpty(theForm.voornaam ,  "Uw voornaam" ,"", "#ffffff");
		  reason += validateEmpty(theForm.naam ,  "Uw naam" ,"", "#ffffff");
		  reason += validateEmpty(theForm.straatnr ,  "Uw straat" ,"", "#ffffff");
		  reason += validateEmpty(theForm.postcode ,  "Uw postcode" ,"", "#ffffff");
		  reason += validateEmpty(theForm.gemeente ,  "Uw gemeente" ,"", "#ffffff");
		  reason += emailCheck(theForm.email, "#ffffff");
		  
		  if (reason != "") {
			  alert("Enkele velden werden niet ingevuld :\n\n" + reason);
		    return false;
		  }
		  
		  // PAYPAL OPENEN IN APART VENSTER //
		  var w = window.open('about:blank','Popup_Window');
		  document.getElementById('paypalform').target = 'Popup_Window';
		  document.getElementById('paypalform').submit();
		 // document.getElementById('paypalform').submit();
		  return true;
		}
		
function valideerFormNew(theForm) {
			
		var reason = "";
		
		  reason += validateEmpty(theForm.voornaam ,  "Uw voornaam" ,"", "#ffffff");
		  reason += validateEmpty(theForm.naam ,  "Uw naam" ,"", "#ffffff");
		  reason += validateEmpty(theForm.straatnr ,  "Uw straat" ,"", "#ffffff");
		  reason += validateEmpty(theForm.postcode ,  "Uw postcode" ,"", "#ffffff");
		  reason += validateEmpty(theForm.gemeente ,  "Uw gemeente" ,"", "#ffffff");
		  reason += emailCheck(theForm.email_p, "#ffffff");
		  
		  theForm.first_name.value = theForm.voornaam.value;
		  theForm.last_name.value =theForm.naam.value;
		  theForm.address1.value =theForm.straatnr.value;
		  theForm.zip.value =theForm.postcode.value;
		  theForm.city.value =theForm.gemeente.value;
		 // theForm.email.value =theForm.email_p.value;
		  
		  if (reason != "") {
			  alert("Enkele velden werden niet ingevuld :\n\n" + reason);
			  	
		    return false;
		  }
		  return true;
		}
		

		
		
		function validateEmpty(fld, fieldname,standard, color) {
		    var error = "";
		 
		    if (fld.value.length == 0 ) {
		        fld.style.backgroundColor = '#b4b4b4'; 
		        error = fieldname+ " is niet ingevuld.\n"
		    } 
		   else {
		        fld.style.backgroundColor = color;
		    }
		    return error;  
		} 
		
		function validateEmptyMultiple(fld1, fld2, fld3, fieldname,standard, color) {
		    var error = "";
		 
		    if (fld1.value.length == 0 || fld2.value.length  ==0) {
		        error += "1";
		    } 
		    var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		    var address = fld3.value;
		    if(reg.test(address) == false) {
			   error += "2";
		    }
		  
		    
		   if(error == "12"){
		    	error ="fill out cell number or e-mail.\n";
		    }else{
		    	error ="";
		    }
		    return error;  
		} 
		
		function validateSelected(fld, fieldname,standard, color) {
		    var error = "";
		 
		    if (fld.selectedIndex == 0) {
		        fld.style.backgroundColor = '#b4b4b4'; 
		        error = fieldname+ " is not selected.\n"
		    } 
		   else {
		        fld.style.backgroundColor = color;
		    }
		    return error;  
		} 
		function validateSelectedExtra(fld, fieldname,standard, color) {
		    var error = "";
		 
		    if (fld.selectedIndex == 0 && fld.options[0].text == "Choose Event") {
		        fld.style.backgroundColor = '#b4b4b4'; 
		        error = fieldname+ " is not selected.\n"
		    } 
		   else {
		        fld.style.backgroundColor = color;
		    }
		    return error;  
		} 
		
		function validateChecked(fld, fieldname,standard, color) {
		    var error = "";
		 
		    if (fld.checked  == false) {
		        fld.style.borderColor = '#b4b4b4'; 
		        error = fieldname+ " is not checked.\n"
		    } 
		   else {
		        fld.style.backgroundColor = color;
		    }
		    return error;  
		} 
		
		function validateEmpty2(fld, fieldname,standard, color) {
		    var error = "";
		 
		    if (fld.value.length != 0 ) {
		        error ="full";
		    }
		    return error;  
		}
		
		
		function emailCheck(email, color) {
			
		   var error = "";
		   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		   var address = email.value;
		   if(reg.test(address) == false) {
		     error="Uw e-mailadres is niet geldig.";
		     email.style.backgroundColor = '#b4b4b4'; 
		   }
		   else{
		   	 email.style.backgroundColor = color;
		   }
		   return error
		}

	function sendValue(theForm, aantal, navigatieid, filmid ){
		
		var reason = "";
		 reason += emailCheck(theForm.email, "#ffffff");
		 if (reason != "") {
			  alert(reason);
		    return false;
		  }
		 else{
			theForm.ster.value= aantal; 
			//document.write(document.getElementById('ster').value = aantal );
			return true;
		 }
		
		
	}
	
