function validateForm(type)
{	
	var valid = 0;
	switch(type)
	{
		case "klachten":
			var fields = new Array("achternaam","voorletters","email","adres","postcode","woonplaats","telefoon","patientnummer","klacht");
			for(var i=0; i<(fields.length); i++)
			{
				var field = eval("document.form."+fields[i]);
				if(field.value == "")
				{
					valid++;
					alert("U dient nog '"+fields[i]+"' in te vullen.");
					field.focus();
					break;
				}
			}
			
			var email = document.form.email;
			AtPos = email.value.indexOf("@");
			StopPos = email.value.lastIndexOf(".");
					
			if ( StopPos == -1 || StopPos < AtPos)
			{
				valid++;
				alert("U dient een correct e-mailadres in te vullen");
				email.focus();
				break;
			}
			
			if(valid==0)
			{
				document.form.action = "/custom/includes/form.inc.php";
				document.form.submit();
			}
			break;
	}
}