function checkEmail (strng) {
  var error="";
  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 isEmpty(field, strng) {
  var error = "";
    if (strng.length == 0) {
      error = field + " is required.\n"
    }
  return error;	  
}

function checkWholeFormRR(theForm) {
  var why = "";
  why += isEmpty("Title", theForm.title.value);
  why += isEmpty("Ingredients", theForm.craft1.value);
  why += isEmpty("Instructions", theForm.craft2.value);
  why += checkEmail(theForm.email.value);
  if (why != "") {
    alert(why);
    return false;
  } else {
    theForm.action = "http://www.surfnetkids.com/cgi-bin/mt/plugins/MT-GetPublished/mt-getpublished.cgi";
  }
 
}
