function checkEmail (strng) {
	var error="";
    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
   	   error = "There seems to be a problem with your email address.\n Please enter a valid email address.";
    } else { //test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/ //"--
   	   if (strng.match(illegalChars)) {
       		error = "There seems to be a problem with your email address.\n Please enter a valid email address.";
       }
   	}
	return error;    
}

function validateForm(theForm){
    var naam = theForm.naam.value;
    var email = theForm.email.value;
    var email2 = theForm.emailconfirm.value;

    var why = "";
	if(naam  == "" || naam.length<3){
		alert("Please enter your name.");
		theForm.naam.focus();
		return false;
	} else if(email == ""){
		alert("Please enter a valid email address.");
		theForm.email.focus();	
		return false;
	} 
	
	why += checkEmail(email);
	
	if(why!=""){
		alert(why);
		theForm.email.focus();	
		return false;
	} else if(email2 == ""){
		alert("Please confirm your email address.");
		theForm.emailconfirm.focus();
		return false;
	} else {
		if(email!=email2){
			alert("The email addresses you filled in do not match.");
			theForm.emailconfirm.focus();	
			return false;
		}
	}
	theForm.submit();
	return true;
}
function validateForm2(theForm){
    var email = theForm.email.value;
    var why = "";
	if(email == ""){
		alert("Please enter an email address.");
		theForm.email.focus();	
		return false;
	} 
	
	why += checkEmail(email);
	
	if(why!=""){
		alert(why);
		theForm.email.focus();	
		return false;
	}
	theForm.submit();
	return true;
}
function init(){
	subscribeform.naam.focus();
}
