/**
 * Globale JavaScript functies
 */

function setExtLinks(){
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
		}
	}
}
/*Form validatie*/
function checkContactForm()
		{
			reset();
			if (document.getElementById('naam').value == '') {
				errorExists('Naam is een verplicht veld');
				return false;
			} else if (!isValidEmail(document.getElementById('email').value)) {
				errorExists('Email is een verplicht veld');
				return false;
			}
		}
function isValidEmail(str) {
	Email1 = /^\w+([\.\-]\w+)*\@\w+([\.\-]\w+)*\.\w+$/;
	Email2 = /^.*@[^_]*$/;
	return (Email1.test(str) && Email2.test(str));
}
function errorExists(error)
{
	document.getElementById('error').innerHTML = '- '+error;
	document.getElementById("error").className="show";
}
function reset()
{
	document.getElementById('error').innerHTML = '';
	document.getElementById("error").className="hide";
}
