// JavaScript Document
var emailcheck = new RegExp(/[a-z0-9_-]+(\.[a-z0-9_-]+)*@[a-z0-9_-]+(\.[a-z0-9_-]+)+/);

function checkForm(id) {
	forgot = false;
	email = false;
	$('#'+id+' input.required').each(function() {
		if ($(this).val().length == 0) {
			forgot = true;
		}
	});	
	$('#'+id+' input.email').each(function() {
		if (!emailcheck.test($(this).val())) {
			email = true;
		}
	});	
	
	if (forgot) {
		alert("Vul aub alle velden in alvorens door te gaan.");
	} else if (email) {
		alert("Dit e-mail adres is niet geldig.");
	} else {
		$('#'+id).submit();	
	}
}
