<!-- Begin

// name 

function checkUsername (strng) {
var error = "";
if (strng == "") {
   error = "Please enter your name.\n";
}
 
return error;
}       


// non-empty msg box

function isEmpty(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please submit a message.\n"
  }
return error;	  
}



// exactly one radio button is chosen

function checkRadio(checkvalue) {
var error = "";
   if (!(checkvalue)) {
       error = "Please select to whom you would like your message sent.\n";
    }
return error;
}


  


function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an 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 checkWholeForm(theForm) {
    var why = "";


    why += checkUsername(theForm.name.value);
    why += checkEmail(theForm.from.value);
    why += isEmpty(theForm.body.value);
   
    for (i=0, n=theForm.to.length; i<n; i++) {
        if (theForm.to[i].checked) {
            var checkvalue = theForm.to[i].value;
            break;
        } 
    }
    why += checkRadio(checkvalue);
   
   if(why){
   alert(why);
   return false;

   } else { 
   
return true;

}

}

//  End -->
