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

//Please enter your First Name
//Please enter your Last Name
//Please enter a proper email address (e.g. somebody@isp.com) and click the “Send Message” button
//Please enter your Post Code
//Please enter your age. If you are under the age of 16, please do not send us an e-mail, as we cannot reply.

function validateForm() {
		
		if (!document.getElementsByTagName) return false;
		if (!document.getElementById) return false;
		var btnConfig = document.getElementById('frm-submit');
		
		var age = document.getElementById('age');	
		var firstname = document.getElementById('firstname');
		var surname = document.getElementById('surname');
		var email = document.getElementById('email');		
		var postcode = document.getElementById('postcode');	

		

		btnConfig.onclick = function() {
			if(age.value == ""){
				alert("Please enter your age. If you are under the age of 16, please do not send us an e-mail, as we cannot reply.");
				return false;
			}	
			
			if(firstname.value == ""){
				alert("Please enter your First Name");
				return false;
			}
			
			if(surname.value == ""){
				alert("Please enter your Last Name");
				return false;
			}
			
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
			if (!filter.test(email.value)){
				alert("Please enter a proper email address (e.g. somebody@isp.com) and click the \"Send Message\" button");
				return false;
			}
		
			if(postcode.value == ""){
				alert("Please enter your Post Code");
				return false;
			}	
		
		}
}

addLoadEvent(validateForm);