function showLayer(whichdiv){
	if (document.getElementById(whichdiv.id+"_ov").style.display == ''){
		document.getElementById(whichdiv.id+"_ov").style.display = 'none';
	}else {
		document.getElementById(whichdiv.id+"_ov").style.display = '';
	}
	
}
function checkNieuwsbriefInschr(){
	tel=0;
	if (document.getElementById("voornaam").value =='') {				
		tel++;		
		document.getElementById("voornaam").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("voornaam").className = 'txtInputLarge';
	}
	if (document.getElementById("achternaam").value =='') {				
		tel++;		
		document.getElementById("achternaam").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("achternaam").className = 'txtInputLarge';
	}
	if (document.getElementById("email").value =='' || !checkEmail(document.getElementById("email").value)) {
		tel++;		
		document.getElementById("email").className = 'txtInputLarge txtInputLargeWrong';		
	} else	{ 
		document.getElementById("email").className = 'txtInputLarge';
	}
	if(tel==0){					
		return true;
	} else {
		document.getElementById("formMelding").innerHTML = '<b>* Vul aub. alle verplichte velden in [' + tel + ']</b>';
		return false;
	}	
}
function checkFormAnnulering(){
	tel=0;
	if (document.getElementById("achternaam").value =='') {				
		tel++;		
		document.getElementById("achternaam").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("achternaam").className = 'txtInputLarge';
	}
	if (document.getElementById("geboortedatum").value =='') {				
		tel++;		
		document.getElementById("geboortedatum").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("geboortedatum").className = 'txtInputLarge';
	}
	if (document.getElementById("email").value =='' || !checkEmail(document.getElementById("email").value)) {
		tel++;		
		document.getElementById("email").className = 'txtInputLarge txtInputLargeWrong';		
	} else	{ 
		document.getElementById("email").className = 'txtInputLarge';
	}
	if (document.getElementById("telefoon").value =='') {				
		tel++;		
		document.getElementById("telefoon").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("telefoon").className = 'txtInputLarge';
	}
	if(tel==0){					
		return true;
	} else {
		document.getElementById("formMelding").innerHTML = '<b>* Vul aub. alle verplichte velden in [' + tel + ']</b>';
		return false;
	}	
}
function checkFormInschrijven(){
	tel=0;
	if (document.getElementById("voorletters").value =='') {				
		tel++;		
		document.getElementById("voorletters").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("voorletters").className = 'txtInputLarge';
	}
	if (document.getElementById("achternaam").value =='') {				
		tel++;		
		document.getElementById("achternaam").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("achternaam").className = 'txtInputLarge';
	}
	if (document.getElementById("geboortedatum").value =='') {				
		tel++;		
		document.getElementById("geboortedatum").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("geboortedatum").className = 'txtInputLarge';
	}
	if (document.getElementById("adres").value =='') {				
		tel++;		
		document.getElementById("adres").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("adres").className = 'txtInputLarge';
	}
	if (document.getElementById("postcode").value =='') {				
		tel++;		
		document.getElementById("postcode").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("postcode").className = 'txtInputLarge';
	}
	if (document.getElementById("plaats").value =='') {				
		tel++;		
		document.getElementById("plaats").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("plaats").className = 'txtInputLarge';
	}
	if (document.getElementById("email").value =='' || !checkEmail(document.getElementById("email").value)) {
		tel++;		
		document.getElementById("email").className = 'txtInputLarge txtInputLargeWrong';		
	} else	{ 
		document.getElementById("email").className = 'txtInputLarge';
	}
	if (document.getElementById("telefoon").value =='') {				
		tel++;		
		document.getElementById("telefoon").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("telefoon").className = 'txtInputLarge';
	}
	if (document.getElementById("huisarts").value =='') {				
		tel++;		
		document.getElementById("huisarts").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("huisarts").className = 'txtInputLarge';
	}
	if (document.getElementById("maatschappij").value =='') {	
		tel++;	
		document.getElementById("maatschappij").className = 'txtInputLarge txtInputLargeWrong';
	} else if (document.getElementById("maatschappij").value =='anders' && document.getElementById("maat-anders").value =='') {	
		tel++;			
		document.getElementById("maat-anders").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("maatschappij").className = 'txtInputLarge';
		document.getElementById("maat-anders").className = 'txtInputLarge';
	}
	if (document.getElementById("polisnr").value =='') {				
		tel++;		
		document.getElementById("polisnr").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("polisnr").className = 'txtInputLarge';
	}
	if(tel==0){					
		return true;
	} else {
		document.getElementById("formMelding").innerHTML = '<b>* Vul aub. alle verplichte velden in [' + tel + ']</b>';
		return false;
	}	
}
function checkFormVervolgafspraak(){
	tel=0;
	if (document.getElementById("achternaam").value =='') {				
		tel++;		
		document.getElementById("achternaam").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("achternaam").className = 'txtInputLarge';
	}
	if (document.getElementById("geboortedatum").value =='') {				
		tel++;		
		document.getElementById("geboortedatum").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("geboortedatum").className = 'txtInputLarge';
	}
	if (document.getElementById("email").value =='' || !checkEmail(document.getElementById("email").value)) {
		tel++;		
		document.getElementById("email").className = 'txtInputLarge txtInputLargeWrong';		
	} else	{ 
		document.getElementById("email").className = 'txtInputLarge';
	}
	if (document.getElementById("telefoon").value =='') {				
		tel++;		
		document.getElementById("telefoon").className = 'txtInputLarge txtInputLargeWrong';
	} else	{ 
		document.getElementById("telefoon").className = 'txtInputLarge';
	}
	if(tel==0){					
		return true;
	} else {
		document.getElementById("formMelding").innerHTML = '<b>* Vul aub. alle verplichte velden in [' + tel + ']</b>';
		return false;
	}	
}

function checkEmail(str){
	var testresults = false;
	//uitleg filter: minimaal 1 letter voor @ ; min 1 max 66 letters na @ ; min 2 max 6 letters na punt.
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(str)){
		testresults=true;
	}else{
		testresults=false;
	}
	return (testresults);
}	
function switchIt(what){
	document.getElementById('digital').style.display='none';
	document.getElementById('solTable').style.display='none';
	document.getElementById(what).style.display='';
}
function checkInput(input, was, wordt){
	if(input.value==was){
		input.value=wordt;
	}
}
function openMenu(divId) {
		cancelClose();
		closeAll();
		document.getElementById(divId).style.display='';	
}

function closeAll(){
		document.getElementById('organisatie').style.display='none';
		document.getElementById('producten').style.display='none';
		document.getElementById('acties').style.display='none';
		document.getElementById('nieuws').style.display='none';
		document.getElementById('trainingen').style.display='none';
}
function closeMenu(divId){
	t = setTimeout(function(){closeAll()},600);
}

function cancelClose(){
	if(typeof(t) != "undefined") {
	clearTimeout(t);
	}
}
function openInfo(){
	document.getElementById('infosmall').style.display = 'none';
	document.getElementById('infolarge').style.display = '';
}
function closeInfo(){
	document.getElementById('infolarge').style.display = 'none';
	document.getElementById('infosmall').style.display = '';
}

function startSearch(variable){
	if(typeof(variable) != "undefined") {
		select = document.getElementById('selectsearch');
		window.location= siteurl + "zoeken/" + URLEncode(document.getElementById(variable).value) + "/" + select.options[select.selectedIndex].value +"/";
	} else {
		window.location= siteurl + "zoeken/" + URLEncode(document.getElementById("search").value) + "/";
	}

}

function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '-';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        tmp= '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
		if (tmp == '%20'){
		output += '-';
		}
      }
      x++;
    }
  }
  return output;
}
function aanmeldSubmit(){ // Voor nieuwsbrief aanmeldform naar MuskitoMail
	tel=0;
	if (document.getElementById("dhr").value =='' && document.getElementById("mvr").value =='') {				
		tel++;
	}
	if (document.getElementById("first_name").value =='') {				
		tel++;		
		document.getElementById("first_name").className = 'txtInputLargeWrong';
	} else	{ 
		document.getElementById("first_name").className = 'txtInputLarge';
	}
	if (document.getElementById("last_name").value =='') {				
		tel++;		
		document.getElementById("last_name").className = 'txtInputLargeWrong';
	} else	{ 
		document.getElementById("last_name").className = 'txtInputLarge';
	}
	if (document.getElementById("email").value =='' || !checkEmail(document.getElementById("email").value)) {
		tel++;		
		document.getElementById("email").className = 'txtInputLargeWrong';		
	} else	{ 
		document.getElementById("email").className = 'txtInputLarge';
	}
	if(tel==0){
		return true;
	} else {
		return false;
	}	
}
function changeTimeList(naam){
	if (naam=="brui"){
		document.getElementById("dagbrui").style.display = 'block';
		document.getElementById("dagroos").style.display = 'none';
		document.getElementById("dagraes").style.display = 'none';
		document.getElementById("dagnorm").style.display = 'none';
	} else if (naam=="roos"){
		document.getElementById("dagbrui").style.display = 'none';
		document.getElementById("dagroos").style.display = 'block';
		document.getElementById("dagraes").style.display = 'none';
		document.getElementById("dagnorm").style.display = 'none';
	} else if (naam=="raes"){
		document.getElementById("dagbrui").style.display = 'none';
		document.getElementById("dagroos").style.display = 'none';
		document.getElementById("dagraes").style.display = 'block';
		document.getElementById("dagnorm").style.display = 'none';
	} else {
		document.getElementById("dagbrui").style.display = 'none';
		document.getElementById("dagroos").style.display = 'none';
		document.getElementById("dagraes").style.display = 'none';
		document.getElementById("dagnorm").style.display = 'block';
	}
}
