/* 
function: 	validateEmail(sElement)
description:	checks if an input has a valid emailformat
vars:		sElement - id of the input field that will be validated
*/
function validateEmail(sElement) {
	
	var email = document.getElementById(sElement).value;
	
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) {
		return true;
	} else {
		alert("Het ingevulde e-mailadres is niet in het juiste formaat. Voorbeeld: klaas@elburg.nl");
		return false;
	}
}

/* 
function: 	displaySwitch(sElement, oLink, sTextHidden, sTextVisible) {
description:	toggles the display of an HTML element on or off
vars:		sElement - id of the element that will be shown
		sLink - if of the element which triggered the function
		sTextHidden - innerhtml text of the oLink when sElement is hidden
		sTextVisible - innerhtml text of the oLink when sElement is shown
*/
function displaySwitch(sElement, sLink, sTextHidden, sTextVisible) {
	
	var elToSwitch = document.getElementById(sElement)
	var elLink = document.getElementById(sLink)
  	 	
	if (elToSwitch.style.display != "block") {
		elLink.innerHTML = sTextVisible;
		elToSwitch.style.display = "block";		
	} else {
		elLink.innerHTML = sTextHidden;
		elToSwitch.style.display = "none";
	}
}