// 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 field(s) for required input, When a field is found with missing input,
// alert user, set field pink, and set focus to it.
function chkRqrd(s) {
  if (arguments.length<2) return true
  for ( var i = 1; i < arguments.length; i++ ) {
    fptr = s[arguments[i]];								// Get form field pointer
    if ( fptr.value=='' ) return setErm(fptr,'You must enter your name to continue.')	// Check field for content
  }
  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 chkReg(s) {
   if (s.Name.value=='')		return setErm(s['Name'],		'You must enter your name to continue.')
   if (s.Street1.value=='')		return setErm(s['Street1'],		'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 zip code to continue.')
   if (s.Telephone.value=='')		return setErm(s['Telephone'],		'You must enter your 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 chkEditorial(s) {
   if (s.Name.value=='')		return setErm(s['Name'],		'You must enter your name to continue.')
   if (s['MM_EMAILTO[]'][1].value=='')	return setErm(s['MM_EMAILTO[]'][1],	'You must enter your email address to continue.')
   s.Email.value = s['MM_EMAILTO[]'][1].value;
   return false;
}

function chkContact(s) {
   if (s.Contact.value=='')		return setErm(s['Contact'],		'You must enter your name to continue.')
   if (s.Phone.value=='')		return setErm(s['Phone'],		'You must enter your daytime phone number to continue.')
   if (s['MM_EMAILTO[]'][1].value=='')	return setErm(s['MM_EMAILTO[]'][1],	'You must enter your email address to continue.')
   s.Email.value = s['MM_EMAILTO[]'][1].value;
   return true;
}

