<!--<script>-->
  function favoritar(id)
  {
    var url_template = '/templates/Imobisis-08';
    var acao = "excluir";
    var urlData = "&id=" + id + "&acao=" + acao;

    /* Ajax */
    $.ajax({
      type: "POST",
      url: url_template + "/includes/favoritar.php", /* endereço do script PHP */
      async: true,
      data: urlData, /* informa Url */
      success: function (data)
      { /* sucesso */
//$('#div_bairros').html(data);

        if (acao === "excluir")
        {
          $('#item' + id).fadeOut(400, function ()
          {
            tr.remove();
          });
          $('#countFavoritos').html(data);
          $('#countFavoritos2').html(data);
        }
      },
      beforeSend: function ()
      { /* antes de enviar */

      },
      complete: function ()
      { /* completo */
      }
    });
  }

  function removeSpaces(string)
  {
    return string.split(' ').join('');
  }

  function ValidCaptcha()
  {

    var retorno = true;
    $("#txtNome").removeClass('error');
    $("#txtEmail").removeClass('error');
    $("#txtTelefone").removeClass('error');
    $("#txtMensagem").removeClass('error');
    $("#txtInput").removeClass('error');
    if ($('#txtNome').val() == "")
    {
      $("#txtNome").addClass('error');
      retorno = false;
    }
    if ($('#txtEmail').val() == "")
    {
      $("#txtEmail").addClass('error');
      retorno = false;
    }
    if ($('#txtTelefone').val() == "")
    {
      $("#txtTelefone").addClass('error');
      retorno = false;
    }
    if ($('#txtMensagem').val() == "")
    {
      $("#txtMensagem").addClass('error');
      retorno = false;
    }
    if (grecaptcha.getResponse() == "")
    {
      alert("Você não clicou no reCAPTCHA, por favor, faça!");
      retorno = false;
    }
    return retorno;
  }

  function DrawCaptcha()
  {
    var a = Math.ceil(Math.random() * 9) + '';
    var b = Math.ceil(Math.random() * 9) + '';
    var c = Math.ceil(Math.random() * 9) + '';
    var d = Math.ceil(Math.random() * 9) + '';
    var e = Math.ceil(Math.random() * 9) + '';
    var f = Math.ceil(Math.random() * 9) + '';
    var g = Math.ceil(Math.random() * 9) + '';
    var code = a + ' ' + b + ' ' + ' ' + c + ' ' + d;
    document.getElementById("txtCaptcha").value = code
  }

  (function ($)
  {
    "use strict";
    $(document).ready(function ()
    {

      DrawCaptcha();
    });
  })(jQuery);