  /////////////////////////////////////////////////////
  //
  // bValidateForm() - validate fields in enquiry form
  //                   highlight captions 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!
  //
  function bValidateForm(form)
    {
    var bValid = true;
    var caption;
    
    // message...
    var caption = document.getElementById("legend_message");
    if (bIsEmpty(form.sMessage))
      {
      caption.style.color = "#FF0000";
      form.sMessage.focus();
      bValid = false;
      }
    else
      caption.style.color = "#000000"; 
      
    // email/phone...
    caption = document.getElementById("legend_phone");
    if (bIsEmpty(form.sPhone) && bIsEmpty(form.sEmail))
      {
      caption.style.color = "#FF0000";
      form.sPhone.focus();
      bValid = false;
      }
    else
      caption.style.color = "#000000"; 

    // name...
    caption = document.getElementById("legend_client");
    if (bIsEmpty(form.sName))
      {
      caption.style.color = "#FF0000";
      form.sName.focus();
      bValid = false;
      }
    else
      caption.style.color = "#000000"; 

    // tell Sir if he goofed...             
    if (!bValid)
      alert("Please fill in the boxes marked in red.");
    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 //////////////////////////////////////
