function checkWholeForm() {
  
    var why = "";  
    why += checkText(theForm.firstname.value, "your first name.");
    why += checkText(theForm.lastname.value, "your last name.");
    why += checkEmail(theForm.email.value);
    
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "Please enter a valid email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}

function checkPhone (strng) {
 	
 	var error = "";
 
	if (strng == "") {
	   error = "Please enter a daytime phone number (xxx-xxx-xxxx).\n";
	   return error;
	}

 
	var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
	//strip out acceptable non-numeric characters
	
	if (isNaN(parseInt(stripped))) {
	 	error = "The phone number contains illegal characters.";
	}
	
	if (!(stripped.length == 10)) {
		error = "The daytime phone number is the wrong length. (xxx-xxx-xxxx)\n";
	}
 
 	return error;
 }


function checkText (strng, formfield) {
 var error = "";
 if (strng == "") {
    error = "Please enter " + formfield + "\n";
 }
 return error;
 }
 
 
 
function checkcheckBox(checkvalue) {
var error = "";
   if (!(checkvalue)) {
       error = "Please pick at least one event.\n";
    }
return error;    
}
