/* ------Library Items Request Form Validation ------*/


function validateLibraryItemsRequestForm(theForm)
{

  if (theForm.Name.value == "")
  {
    alert("Please enter a value for the \"Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.IDNumber.value == "")
  {
    alert("Please enter a value for the \"IDNumber\" field.");
    theForm.IDNumber.focus();
    return (false);
  }

  if (theForm.IDNumber.value.length < 9)
  {
    alert("Please enter at least 9 characters in the \"IDNumber\" field.");
    theForm.IDNumber.focus();
    return (false);
  }
  if (theForm.VerificationCode.value != "AUB98092")
  {
    alert("Please enter a valid verification code.");
    theForm.VerificationCode.focus();
    return (false);
  }
  if (theForm.RemoteType.selectedIndex < 0)
  {
    alert("Please select one of the \"RemoteType\" options.");
    theForm.RemoteType.focus();
    return (false);
  }

  if (theForm.RemoteType.selectedIndex == 0)
  {
    alert("The first \"RemoteType\" option is not a valid selection.  Please choose one of the other options.");
    theForm.RemoteType.focus();
    return (false);
  }

  if (theForm.Affiliation.selectedIndex < 0)
  {
    alert("Please select one of the \"Affiliation\" options.");
    theForm.Affiliation.focus();
    return (false);
  }

  if (theForm.Affiliation.selectedIndex == 0)
  {
    alert("The first \"Affiliation\" option is not a valid selection.  Please choose one of the other options.");
    theForm.Affiliation.focus();
    return (false);
  }

  var radioSelected = false;
  for (i = 0;  i < theForm.PreferredContact.length;  i++)
  {
    if (theForm.PreferredContact[i].checked)
        radioSelected = true;
  }
  if (!radioSelected)
  {
    alert("Please select one of the \"PreferredContact\" options.");
    return (false);
  }

  if (theForm.DateNeededBy.value == "")
  {
    alert("Please enter a value for the \"DateNeededBy\" field.");
    theForm.DateNeededBy.focus();
    return (false);
  }
  return (true);
}