function confirmEmail(emailField) {
	var x = emailField.value;
	var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(x)) {
		emailField.value = '';
		emailField.focus();
		return false;
	}
	return true; 
}

// Radio Button Validation
// copyright Stephen Chapman, 15th Nov 2004,14th Sep 2005
// you may copy this function but please keep the copyright notice with it
function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

function validateForm() {
	if (document.theform.name.value == '') {
		alert('Enter your Name');
		document.theform.name.focus();
		return false;
	}
	if (document.theform.email.value == '') {
		alert('Enter your Email address');
		document.theform.email.focus();
		return false;
	}
	if (!confirmEmail(document.theform.email)) {
		alert('Your email address was not valid. Please double-check it and try again');
		document.theform.email.focus();
		return false;
	}
	//if (document.theform.phone_no.value == '') {
	//	alert('Enter your Phone');
	//	document.theform.phone_no.focus();
	//	return false;
	//}
	if (valButton(theform.contact) == null) {
		alert('Select your preferred method of contact');
		return false;
	}
	if (document.theform.howHelp.value == '') {
		alert('Describe how we can help');
		document.theform.howHelp.focus();
		return false;
	}
	return true;
}
