window.onload = function() {
	var ajax = new sack();
	document.getElementById("Naam").onfocus = function() {
		if (document.getElementById("Naam").value == "Uw Naam:")
			document.getElementById("Naam").value = ""
	}
	document.getElementById("Naam").onblur = function() {
		if (document.getElementById("Naam").value == "")
			document.getElementById("Naam").value = "Uw Naam:"
	}
	document.getElementById("Email").onfocus = function() {
		if (document.getElementById("Email").value == "Uw E-mail:")
			document.getElementById("Email").value = ""
	}
	document.getElementById("Email").onblur = function() {
		if (document.getElementById("Email").value == "")
			document.getElementById("Email").value = "Uw E-mail:"
	}
	document.getElementById("Bericht").onfocus = function() {
		if (document.getElementById("Bericht").value == "Bericht:")
			document.getElementById("Bericht").value = ""
	}
	document.getElementById("Bericht").onblur = function() {
		if (document.getElementById("Bericht").value == "")
			document.getElementById("Bericht").value = "Bericht:"
	}
	document.getElementById("Wissen").onclick = function(e) {
		document.getElementById("Naam").value = "Uw Naam:"
		document.getElementById("Email").value = "Uw E-mail:"
		document.getElementById("Bericht").value = "Bericht:"
		if (e && e.preventDefault)
			e.preventDefault();
		return false;
	}
	document.getElementById("contactForm").onsubmit = function(e) {
		var strError = "";
		if (document.getElementById("Naam").value == "Uw Naam:")
			strError += "\n- Naam";
		var emailFilter = /^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
		var emailOK = emailFilter.test(document.getElementById("Email").value);
		if ((document.getElementById("Email").value == "Uw E-mail:") || (!emailOK))
			strError += "\n- E-mail adres";
		if (document.getElementById("Bericht").value == "Bericht:")
			strError += "\n- Bericht";
		if (strError != "")
			alert("U heeft de volgende velden nog niet of incorrect ingevuld:" + strError);
		else {
			ajax.setVar("Naam", document.getElementById("Naam").value);
			ajax.setVar("Email", document.getElementById("Email").value);
			ajax.setVar("Bericht", document.getElementById("Bericht").value);
			ajax.requestFile = "sendMail.asp"
			ajax.onCompletion = function() {
				alert(ajax.response);
				document.getElementById("Naam").value = "Uw Naam:"
				document.getElementById("Email").value = "Uw E-mail:"
				document.getElementById("Bericht").value = "Bericht:"
			}
			ajax.runAJAX();
		}
		if (e && e.preventDefault)
			e.preventDefault();
		return false;
	}
}
