function wachtwoord_controle(){
	if($('wachtwoord').value == $('wachtwoord_herhalen').value){
		if($('wachtwoord').value.length > 5){

			// WACHTWOORD JUIST INGEVOERD
			$('wachtwoord_status').innerHTML = "";
			$('wachtwoord_status').style.display = "none";
		}else{
			$('wachtwoord_status').style.display = "block";
			$('wachtwoord_status').innerHTML = "Wachtwoord moet miminmaal 6 tekens bevatten.";
		}
	}else{
		$('wachtwoord_status').innerHTML = "Wachtwoorden komen niet overeen.";
	}
}

function email_controle(){
	if($('email').value == $('email2').value){

		// Email adressen komen overereen :
		$('email_status').innerHTML = "";
		$('email_status').style.display = "none";
	} else {
		$('email_status').style.display = "block";
		$('email_status').innerHTML = "Email adressen komen niet overeen.";
	}
}

function regControle(){
	var error = "";
	var foutColor = "yellow";
	$('gebruikersnaam').style.backgroundColor = "";
	$('wachtwoord').style.backgroundColor = "";
	$('wachtwoord_herhalen').style.backgroundColor = "";
	$('voorletters').style.backgroundColor = "";
	$('naam').style.backgroundColor = "";
	$('adres').style.backgroundColor = "";
	$('postcode').style.backgroundColor = "";
	$('plaats').style.backgroundColor = "";
	$('kvk').style.backgroundColor = "";
	$('btw').style.backgroundColor = "";
	$('land').style.backgroundColor = "";
	$('email').style.backgroundColor = "";
	$('email2').style.backgroundColor = "";

	// KVK CONTROLE
	if(($('kvk').value.length < 2)){
		$('kvk').style.backgroundColor = foutColor;
		error += "Het kvk nummer dat u heeft ingevuld is onjuist, controleer uw kvk nummer.<br />";
	}
	// BTW CONTROLE
	if(($('btw').value.length < 2)){
		$('btw').style.backgroundColor = foutColor;
		error += "Het BTW nummer dat u heeft ingevuld is onjuist.<br />";
	}

	// GEBRUIKERSNAAM CONTROLE
	if($('gebruikersnaam').value.length < 6){
		error += "De gebruikersnaam moet minimaal 6 tekens bevatten<br />";
		$('gebruikersnaam').style.backgroundColor = foutColor;
	}else if($('gebruikersnaam').value.length > 15){
		error += "De gebruikersnaam mag maximaal 15 tekens bevatten<br />";
		$('gebruikersnaam').style.backgroundColor = foutColor;
	}

	// WACHTWOORD CONTROLE
	if($('wachtwoord').value != $('wachtwoord_herhalen').value){
		error += "Wachtwoorden komen niet overeen !<br />";
		$('wachtwoord').style.backgroundColor = foutColor;
		$('wachtwoord_herhalen').style.backgroundColor = foutColor;
	}else if($('wachtwoord').value.length < 6)
	{
		error += "Wachtwoorden moet minimaal 6 tekens lang zijn !<br />";
		$('wachtwoord').style.backgroundColor = foutColor;
		$('wachtwoord_herhalen').style.backgroundColor = foutColor;
	}

	// VOORLETTERS CONTROLE
	if(!$('voorletters').value.length > 0)
	{
		error += "U heeft geen voorletter(s) ingevuld, vul uw voorletters in.<br />";
		$('voorletters').style.backgroundColor = foutColor;
	}

	// NAAM
	if($('naam').value.length < 2){
		error += "Uw naam moet minimaal 2 tekens bevatten.<br />";
		$('naam').style.backgroundColor = foutColor;
	}

	// ADRES
	if($('adres').value.length < 5)
	{
		error += "Uw adres moet minimaal 5 tekens bevatten.<br />";
		$('adres').style.backgroundColor = foutColor;
	}

	// POSTCODE
	if($('postcode').value.length < 6){
		error += "Uw postcode moet is niet correct, schrijf de 4 getallen en 2 letters van uw postcode achter elkaar.<br />";
		$('postcode').style.backgroundColor = foutColor;
	}

	// PLAATS
	if($('plaats').value.length < 3){
		error += "Uw plaatsnaam moet uit minimaal 3 tekens bestaan.<br />";
		$('plaats').style.backgroundColor = foutColor;
	}

	// LAND
	if($('land').value.length < 2)
	{
		error += "U heeft geen of geen geldig land ingevuld.<br />";
		$('land').style.backgroundColor = foutColor;

	}

	// EMAIL
	if($('email').value != $('email2').value){
		error += "U heeft 2 verschillende emailadressen ingevuld.<br />";
		$('email').style.backgroundColor = foutColor;
		$('email2').style.backgroundColor = foutColor;
	}else if($('email').value.length < 6){
		error += "U heeft geen geldig emailadres ingevuld.<br />";
		$('email').style.backgroundColor = foutColor;
		$('email2').style.backgroundColor = foutColor;
	}

	$('form_errors').innerHTML = error;
	if(error == "")
	{
		return true;
	}else{
		return false;
	}
}
