  /////////////////////////////////////////////////////
  //
  // nsmhere() - No Spam Mail function - provides email
  //            link without exposure to harvesters.
  //
  function nsmhere(sUsername, sSubject, sHide, sImage)
    {
    // get domain
    var sDomain = window.location.hostname;
    if (sDomain.substring(0, 4) == "www.")
      sDomain = sDomain.substring(4);  
    document.write('<a');
    if (typeof(cls) != "undefined" && cls != "")
      document.write(' class="' + cls + '"');
    document.write(' href="' + 'mailto:' + sUsername + '@' + sDomain);
    if (typeof(sSubject) != "undefined" && sSubject != "")
      document.write('?subject=' + sSubject);
    if (typeof(sHide) != "undefined" && sHide != "")
      {
      if (sHide == "image" && typeof(sImage) != "undefined" && sImage != "")
        document.write('"><img alt="' + sUsername + '" src="' + sImage + '" /></a>');
      else  
        document.write('">' + sHide + '</a>');
      }
    else
      document.write('">' + sUsername + '@' + sDomain + '</a>');
    }
  //
  /////////////////////////////////////////////////////
  //
  // nsm() - No Spam Mail function - provides email
  //            link without exposure to harvesters.
  //
  // deprecated - use nsmhere where possible
  //
  function nsm(user, domain, suffixCode, subject, hide, img)
    {
    var suffix = "co.uk";
    switch (suffixCode)
      {
      case "b":
        suffix = "biz";
        break;
      case "c":
        suffix = "com";
        break;
      case "n":
        suffix = "net";
        break;
      case "o":
        suffix = "org";
        break;
      case "cu":
        suffix = "co.uk";
        break;
      case "gu":
        suffix = "gov.uk";
        break;
      case "mu":
        suffix = "me.uk";
        break;
      case "pu":
        suffix = "police.uk";
        break;
      case "ou":
        suffix = "org.uk";
        break;
      }
    document.write('<a');
    if (typeof(cls) != "undefined" && cls != "")
      document.write(' class="' + cls + '"');
    document.write(' href="' + 'mailto:' + user + '@' + domain + '.' + suffix);
    if (typeof(subject) != "undefined" && subject != "")
      document.write('?subject=' + subject);
    if (typeof(hide) != "undefined" && hide != "")
      {
      if (hide == "image" && typeof(img) != "undefined" && img != "")
        document.write('"><img alt="' + user + '" src="' + img + '" /></a>');
      else  
        document.write('">' + hide + '</a>');
      }
    else
      document.write('">' + user + '@' + domain + '.' + suffix + '</a>');
    }
  //
  //
  /////////////////////////////////////////////////////
  //
  // 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!
  //
  function bValidateForm(form)
    {
    // alert("Validating form...");
    var sMsg = "Please fill in at least the boxes shown coloured.";
    var bValid = true;
    var elCaption;

    // Message text...
    elCaption = document.getElementById("lblMessage");
    if (bIsEmpty(form.sMessage))
      {
      elCaption.className = "lblErr";
      form.sMessage.focus();
      sMsg = "Please fill in the message box.";
      bValid = false;
      }
    else
      elCaption.className = "lblReq";

    // Email address & phone no...
    elCaption = document.getElementById("lblEmail");
    var elCapPhone = document.getElementById("lblPhone");
    if (bIsEmpty(form.sEmail) && bIsEmpty(form.sPhone))
      {
      elCaption.className = "lblErr";
      elCapPhone.className = "lblErr";
      form.sEmail.focus();
      sMsg = "Please give an email address or a phone number, or both.";
      bValid = false;
      }
    else
      {
      elCaption.className = "lblReq";
      elCapPhone.className = "lblReq";
      }
    
    // Name...
    var elCaption = document.getElementById("lblName");
    if (bIsEmpty(form.sName))
      {
      elCaption.className = "lblErr";
      form.sName.focus();
      sMsg = "Please tell us your name.";
      bValid = false;
      }
    else
      elCaption.className = "lblReq";

    // 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 //////////////////////////////////////

