function checkWholeForm(theForm) {
    var why = "";  
    var checkvalue = "";  
   
   	why += checkText(theForm.first_name.value, "your first name.");
   	why += checkText(theForm.last_name.value, "your last name.");
   	why += checkEmail(theForm.email.value);
   	why += checkText(theForm.zip.value, "your zip code.");
    
   	if (why != "") {
       alert(why);
       return false;
    }
   	
 
   
  

return true;
}


 function checkcheckBox(checkvalue, fields) {
	var error = "";
	
	   if (!(checkvalue)) {
		   error = "Pick at least one " + fields + "\n";
		}
		
	return error;    
}


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;
 }