// JavaScript Document

// validate keyword search form
function checkKeyword(form) {
  var error;
  var cont = true;

  if (form.elements["keyword"].value == "keyword search" ||
      form.elements["keyword"].value == "") {
    error = "Please enter a keyword you want to search for.";
	alert(error);
	cont = false;
  }
  
  return cont;
}

// check if email address is valid
function checkEmail(field) {
  var error;
  var emailFilter = /^.+@.+\..{2,4}$/;
  var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]\s]/;
  var cont = true;
  
  if (!emailFilter.test(field.value)) {
    error = 'Please enter a valid email address.';
	alert(error);
	cont = false;
  }
  else if (field.value.match(illegalChars)) {
    error = 'Email address contains one or more illegal characters.';
	alert(error);
	cont = false;
  }
  return cont;
}
