// Reset input field color when changed
function fldReset() { this.style.backgroundColor=''; this.style.borderColor='#bbbbbb'; }

// display error message, color error field, set 
function setErm(f,m) {
  alert(m);
  f.onchange = fldReset;
  f.style.backgroundColor="#ff9";
  f.style.borderColor="#f00"; 
  f.focus();
  return false;
}

// Check mailto form field(s) for required input, When a field is found with missing input,
// alert user, set field pink, and set focus to it.
function chkContact(s) {
  if (s.firstname.value=='')	return setErm(s['firstname'],	'You must enter your first name to continue.')
  if (s.lastname.value=='')	return setErm(s['lastname'],	'You must enter your last name to continue.')
  if (s.street.value=='')	return setErm(s['street'],	'You must enter your street address to continue.')
  if (s.city.value=='')		return setErm(s['city'],	'You must enter your city to continue.')
  if (s.state.value=='')	return setErm(s['state'],	'You must enter your state to continue.')
  if (s.zipcode.value=='')	return setErm(s['zipcode'],	'You must enter your zipcode to continue.')
  if (s.dayphone.value=='')	return setErm(s['dayphone'],	'You must enter your day time phone number to continue.')
  if (s.email.value=='')	return setErm(s['email'],	'You must enter your email address to continue.')
  return true;
}

// Check mailto form field(s) for required input, When a field is found with missing input,
// alert user, set field pink, and set focus to it.
function chkBooking(s) {
  if (chkContact(s)) {
    if (s.evdate.value=='')		return setErm(s['evdate'],		'You must enter the event date to continue.')
    if (s.location.value=="")		return setErm(s['location'],		'You must indicate the event location to continue.')
    if (s.evtime.value=='')		return setErm(s['evtime'],		'You must enter the event starting and ending times to continue.')
    return true;
  }
  return false;
}
