function sendForm() {
	var aanhef = Ext.get('aanhef').dom.value;
	var voornaam = Ext.get('voornaam').dom.value;
	var achternaam = Ext.get('achternaam').dom.value;
	var email = Ext.get('email').dom.value;
	var adres = Ext.get('adres').dom.value;
	var postcode = Ext.get('postcode').dom.value;
	var plaats = Ext.get('plaats').dom.value;
	var telefoon = Ext.get('telefoon').dom.value;
	var bericht = Ext.get('bericht').dom.value;
	
	var nieuwsbrief = '0';
	if(Ext.get('nieuwsbrief').dom.checked == true) nieuwsbrief = '1';
	
	var fout = false;
	
	// Data controleren
	if(aanhef == 0) {
		showFormError('Aanhef is verplicht','select_aanhef');
		fout = true;
	}
	
	if(voornaam == '' || voornaam == 'Voornaam *') {
		showFormError('Voornaam is verplicht','voornaam');
		fout = true;
	}
	
	if(email == '' || email == 'E-mailadres *') {
		showFormError('E-mailadres is verplicht','email');
		fout = true;
	}
	
	if(bericht == '' || bericht == 'Bericht *') {
		showFormError('Bericht is verplicht','bericht');
		fout = true;
	}
	
	if(!fout) {
		// Als alles goed is, verzenden
		var conn = new Ext.data.Connection();
		conn.request({
			url: '/XML/contact.php',
			method: 'POST',
			params: {"aanhef": aanhef, 'voornaam': voornaam, 'achternaam': achternaam, 'email': email, 'nieuwsbrief': nieuwsbrief, 'adres': adres, 'postcode': postcode, 'plaats': plaats, 'telefoon': telefoon, 'bericht': bericht},
			success: function(responseObject) {
				var response = responseObject.responseXML;
				var code = getSingleData(response,'code');
				var bericht = getSingleData(response,'bericht');

				if(code != 0) {
					// Fout bij het verzenden
					var id = getSingleData(response,'id');
					showFormError(bericht,id);
				}
				else {
					// Bericht is verzonden
					formOk();
				}
			}
		});
	}
}

function showFormError(e,f) {
	Ext.get(f).addClass('error');
}

function formOk() {
	Ext.get('overlay').fadeIn({endOpacity: .75,duration: 0.8});
	Ext.get('formOk').fadeIn({duration: 0.8});
	
	window.setTimeout(removeFormOk, 4000);
}

function removeFormOk() {
	// Velden weer op de originele waarde
	Ext.get('aanhef').dom.value = 0;
	Ext.get('voornaam').dom.value = 'Voornaam *';
	Ext.get('achternaam').dom.value = 'Achternaam';
	Ext.get('email').dom.value = 'E-mailadres *';
	Ext.get('adres').dom.value = 'Straat + nr';
	Ext.get('postcode').dom.value = 'Postcode';
	Ext.get('plaats').dom.value = 'Plaats';
	Ext.get('telefoon').dom.value = 'Telefoon';
	Ext.get('bericht').dom.value = 'Bericht *';
	Ext.get('nieuwsbrief').dom.checked = false;

	Ext.get('formOk').fadeOut({duration: 2});
	Ext.get('overlay').fadeOut({duration: 2});
}

function getNodeValue(obj,tag) { /* XML uitlezen */
    return obj.getElementsByTagName(tag)[0].firstChild.nodeValue;
}

function getSingleData(response,tag) { /* XML uitlezen */
	return response.getElementsByTagName(tag)[0].firstChild.data;
}
