<!--  Script for IM eSearch Website Feedback Form


// Validate the feedback form entry fields
function validateForm()
{
  var msg;
  var blnCorrectSyntax = true; 

	msg = "_________________________________________________\n\n"
	msg += "The following field(s) are missing or incorrect.\n";
	msg += "Please correct these fields and re-submit.\n";
	msg += "________________________________________________\n\n"


  if (document.fbform.txtFirstname.value == "")
  {
      blnCorrectSyntax = false;
      msg += "*  Please enter your first name\n";
      document.fbform.txtFirstname.select()
      document.fbform.txtFirstname.focus()
  }

  if (document.fbform.txtLastname.value == "")
  {
      blnCorrectSyntax = false;
      msg += "*  Please enter your last name\n";
      document.fbform.txtLastname.select()
      document.fbform.txtLastname.focus()
  }

  if (document.fbform.txtCompany.value == "")
  {
      blnCorrectSyntax = false;
      msg += "*  Please identify your company\n";
      document.fbform.txtCompany.select()
      document.fbform.txtCompany.focus()
  }

  // email address must be in the form a@b.c
  // email address is invalid if it does NOT contain both @ and . (but they cannot be the first character) 
  // also invalid if it DOES contain =, <, >, ;, *, : characters
  // These checks are to prevent people attempting to hack into the system using this form
  if ((document.fbform.txtEmail.value.indexOf('@')<1) ||
      (document.fbform.txtEmail.value.indexOf('.')<3) ||
      (document.fbform.txtEmail.value.indexOf('=')!=-1) ||
      (document.fbform.txtEmail.value.indexOf('>')!=-1) ||
      (document.fbform.txtEmail.value.indexOf('<')!=-1) ||
      (document.fbform.txtEmail.value.indexOf('*')!=-1) ||
      (document.fbform.txtEmail.value.indexOf(';')!=-1) ||
      (document.fbform.txtEmail.value.indexOf(':')!=-1))
   {
      blnCorrectSyntax = false;
      msg += "*  Please enter a valid email address\n";
      document.fbform.txtEmail.select()
      document.fbform.txtEmail.focus()
   }
	// Ensure that only existing users of eSearch ask for FAQ or download access //
  if ((!document.fbform.rchUserBackground[2].checked) &&
  		(document.fbform.bGuestAccess.checked == true))
  {
      blnCorrectSyntax = false;
      msg += "*  You asked for access to search the FAQs, but you must be an existing eSearch user to do so\n";
  }


	// Ensure that only existing users of eSearch ask for FAQ or download access //
  if ((!document.fbform.rchUserBackground[2].checked) &&
  		(document.fbform.bLoginRequest.checked == true))
  {
      blnCorrectSyntax = false;
      msg += "*  You asked for download access, but you must be an existing eSearch user to do so\n";
  }
  
  if (!blnCorrectSyntax)
  {
     alert(msg);
     return false;
  }
}

// Validate the feedback form entry fields
function checkOptions()
{
  if (document.fbform.rchUserBackground[2].checked)
  {
   		document.fbform.bGuestAccess.disabled = false;
   		document.fbform.bLoginRequest.disabled = false;
  }
  else 
  {
   		document.fbform.bGuestAccess.checked = false;
   		document.fbform.bGuestAccess.disabled = true;
   		document.fbform.bLoginRequest.checked = false;
   		document.fbform.bLoginRequest.disabled = true;
  }

}



// end of Script for IM eSearch Website Feedback Form  -->