function applyOnSubmitToForms()
{
	var cform = document.getElementById("commentform"); 
	
	if (cform) {
	cform.onsubmit = function ()
		{
			  var blnvalidate = true;
      var oElement = document.getElementById("author");
    	if ( oElement.value == "" )
    			{
					  alert("Vul je naam in");
     				return false;     				
    			}
    	var oElement2 = document.getElementById("email");
    	var emailFilter=/^.+@.+\..{2,3}$/;
    	if (!emailFilter.test(oElement2.value)) 
    			{
     				alert("Vul een geldig e-mail adres in");
						return false;
    			}
    	var oElement3 = document.getElementById("spamq");
    	if ( oElement3.value == "" )
    			{
     				alert("Beantwoordt de anti-spam vraag alsjeblieft");
						return false;
    			}		
    	var oElement4 = document.getElementById("comment");
    	var formcontent = oElement4.value;
    	if ( formcontent.length < 1 )
    			{
     				alert("Vul je reactie in");
						return false;
    			}			
    	return true;
		}	
	}
	return true;	
}		

function addLoadEvent(func) 
{
 	var oldonload = window.onload;
	if (typeof window.onload != 'function') 
	{
		window.onload = func;
	} 
	else 
	{
		window.onload = function() 
		{
	      		oldonload();
	      		func();
	    	}
	}
}
addLoadEvent(applyOnSubmitToForms);
