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 errorFieldChecker(textFieldName, errorFieldName){
		
	if (document.getElementById(textFieldName).value =='') {				
		document.getElementById(errorFieldName).style.display = '';
		sendForm = 1;
		return (sendForm);
	} else	{ 
		if(textFieldName != "email"){
			document.getElementById(errorFieldName).style.display = 'none';
			sendForm = 0;
			return (sendForm);
		}else if(checkEmail(document.getElementById("email").value)){
			document.getElementById(errorFieldName).style.display = 'none';
			sendForm = 0;
			return (sendForm);
		}else{
			document.getElementById(errorFieldName).style.display = '';
			sendForm = 1;
			return (sendForm);
			}
			
	}
}

function checkForm(){
	tel = 0;
	
	tel = 
	errorFieldChecker("bedrijf","errorBedrijfsnaam") +
	errorFieldChecker("naam","errorNaam") +
	errorFieldChecker("telefoon","errorTelefoon") +
	errorFieldChecker("adres","errorAdres") +
	errorFieldChecker("postcode","errorPostcode") +
	errorFieldChecker("plaats","errorPlaats") +
	errorFieldChecker("email","errorEmail");
		
	if(tel==0){					
		return true;
		
		} else {
			if(tel>1){
				document.getElementById("formMelding").innerHTML = '<b>* Vul aub alle velden goed in: Er zijn ' + tel + ' fouten gevonden!</b>';
			}else{
				document.getElementById("formMelding").innerHTML = '<b>* Vul aub alle velden goed in: Er is ' + tel + ' fout gevonden!</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 setPageSize(){
	var yScroll;	
	if (window.innerHeight && window.scrollMaxY) {	
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
	}
	var windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	// 72 is de hoogte van de footer
	if((yScroll+35) < windowHeight){
		pageHeight = windowHeight-35;
	} else { 
		pageHeight = yScroll;
	}
	//alert(windowHeight + " en " + pageHeight);
	//alert(document.getElementById("wrapFt").style.height);
	document.getElementById("contentContainer").style.height = pageHeight + 'px';
	//document.getElementById("wrapFt").style.position = 'absolute';
	//document.getElementById("wrapFt").style.display = '';
}
