function checkTextField (strng, errormsg) {
 var error = "";
 if (strng == "") {
    error = errormsg;
 }
 return error;
}

function checkEmail (strng, errormsg) {
	var error = "";
	var emailFilter=/^[\w\.\-]+@([\w\-]+\.)+[a-zA-Z]+$/;
	if (!(emailFilter.test(strng))) {
	       error = errormsg;
	}
	return error;
}

function checkPhone (strng, errormsg) {
	var error = "";
	var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
	//strip out acceptable non-numeric characters
	if (isNaN(parseInt(stripped))) {
	       error = errormsg;
	}
	return error;
}


//THIS IS WHERE YOU CAN EDIT FIELDS
function checkForm(theForm) {
	var why = "";
	var why_errors = "";
	
	why_errors += checkTextField(theForm.name.value, "- your full name\n");
	why_errors += checkPhone(theForm.tel.value, "- a valid phone number (digits only)\n");
	why_errors += checkEmail(theForm.mail.value, "- a valid email address\n");
	why_errors += checkTextField(theForm.number.value, "- the security code\n");

    if (why_errors != "") {
       why = "Please fill in:\n"+why_errors;
       alert(why);
       return false;
    }
}



