// JavaScript Document

function validate()
{
var el = document.getElementById('form');
var sn = document.getElementById('achternaam');
var fn = document.getElementById('voornaam');
var st = document.getElementById('straat_nr');
var pc = document.getElementById('postcode');
var pl = document.getElementById('plaats');
var em = document.getElementById('email');
var ph = document.getElementById('telefoon');

if(sn.value =="")
	{
		alert('Vul je naam in aub.');
		sn.focus();
		sn.style.backgroundColor = "#dafdfc";
		return false;		
	}
	else
	{
		sn.style.backgroundColor = "#ffffff";
		true;
	}

if(fn.value =="")
	{
		alert('Vul je voornaam in aub.');
		fn.focus();
		fn.style.backgroundColor = "#dafdfc";
		return false;		
	}
	else
	{
		fn.style.backgroundColor = "#ffffff";
		true;
	}

if(st.value =="")
	{
		alert('Vul je straat en nummer in aub.');
		st.focus();
		st.style.backgroundColor = "#dafdfc";
		return false;		
	}
	else
	{
		st.style.backgroundColor = "#ffffff";
		true;
	}

if(pc.value =="")
	{
		alert('Vul je postcode in aub.');
		pc.focus();
		pc.style.backgroundColor = "#dafdfc";
		return false;		
	}
	else
	{
		pc.style.backgroundColor = "#ffffff";
		true;
	}

if(pl.value =="")
	{
		alert('Vul je plaatsnaam in aub.');
		pl.focus();
		pl.style.backgroundColor = "#dafdfc";
		return false;		
	}
	else
	{
		pl.style.backgroundColor = "#ffffff";
		true;
	}

if(em.value.match(/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/))
	{
		em.style.backgroundColor = "#ffffff";
		true;
	}
	else
	{
		alert('Vul je e-mail adres in aub.'); 
		em.focus();
		em.style.backgroundColor = "#dafdfc";
		return false;
	}

if(ph.value =="")
	{
		alert('Vul je telefoonnummer in aub.');
		ph.focus();
		ph.style.backgroundColor = "#dafdfc";
		return false;		
	}
	else
	{
		ph.style.backgroundColor = "#ffffff";
		true;
	}
}

