  /////////////////////////////////////////////////////
  //
  // bValidateForm() - validate fields in enquiry form
  //                   highlight elCaptions for invalid/missing
  //                   fields, and move focus to first one.
  //
  // NB. Moving the focus to the first invalid field BEFORE
  //     displaying the alert gets round the IE timing bug!
  //
  var rgbLolite = "#cccfd4";
  var rgbHilite = "#a35afe";

  function bValidateForm(form)
    {
    //alert("Validating form...");
    var sMsg = "Please fill in at least the boxes shown coloured.";
    var bValid = true;
    var elCaption;

    // Enquiry text...
    elCaption = document.getElementById("cap_message");
    if (bIsEmpty(form.sMessage))
      {
      elCaption.style.color = rgbHilite;
      form.sMessage.focus();
      sMsg = "Please tell us what your enquiry is about.";
      bValid = false;
      }
    else
      elCaption.style.color = rgbLolite;

    // Email address & phone no...
    elCaption = document.getElementById("cap_email");
    var elCapPhone = document.getElementById("cap_phone");
    if (bIsEmpty(form.sEmail) && bIsEmpty(form.sPhone))
      {
      elCaption.style.color = rgbHilite;
      elCapPhone.style.color = rgbHilite;
      form.sEmail.focus();
      sMsg = "Please give an email address or a phone number, or both.";
      bValid = false;
      }
    else
      {
      elCaption.style.color = rgbLolite;
      elCapPhone.style.color = rgbLolite;
      }
    
    // Name...
    var elCaption = document.getElementById("cap_name");
    if (bIsEmpty(form.sName))
      {
      elCaption.style.color = rgbHilite;
      form.sName.focus();
      sMsg = "Please tell us your name.";
      bValid = false;
      }
    else
      elCaption.style.color = rgbLolite;

    // tell Sir if he goofed...
    if (!bValid)
      alert(sMsg);
    return bValid;
    }

  function bIsEmpty(elem)
    {
    var str = elem.value;
    if (str == null || str.length == 0)
      return true;
    else
      return false;
    }

  function bIsValidRadio(elem)
    {
    for (var i = 0; i < elem.length; i++)
      {
      if (elem[i].checked)
        return true;
      }
    return false;
    }
  //
  // End of File //////////////////////////////////////

