<!--<script>-->
  function favoritar(id){
    var url_template = '/templates/modelo1_v2';
    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);
        }
        if(data <= 0){
          $('#link-favoritos').fadeOut();
          $('#lista-favoritos').fadeOut();
          $('#bloco-preto').fadeOut();
          $('#nenhum-imovel').fadeIn();
          $('html, body').animate({
            scrollTop: 0
          }, 1000);
        }
      },
      beforeSend: function(){ /* antes de enviar */
      },
      complete: function(){ /* completo */
      }
    });
  }
  function removeSpaces(string){
    return string.split(' ').join('');
  }
  function ValidCaptcha(){
    if($('#txtNome').val() == ""){
      $('#txtNome').notify("Preencha o nome!", {position: "bottom left", className: 'error', autoHideDelay: 3000});
      $('#txtNome').focus();
      return false;
    }


    if($('#txtEmail').val() == ""){
      $('#txtEmail').notify("Preencha o email!", {position: "bottom left", className: 'error', autoHideDelay: 3000});
      $('#txtEmail').focus();
      return false;
    }
    var email = $('#txtEmail').val();
    var regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;

    if(!regex.test(email)){
      $('#txtEmail').notify("E-mail inválido!", {position: "bottom left", className: 'error', autoHideDelay: 3000});
      $('#txtEmail').focus();
      return false;
    }
    if($('#txtTelefone').val() == ""){
      $('#txtTelefone').notify("Preencha o telefone!", {position: "bottom left", className: 'error', autoHideDelay: 3000});
      $('#txtTelefone').focus();
      return false;
    }
    var telefone = $('#txtTelefone').val();
    var numeros = telefone.replace(/\D/g, "");
    var quant = numeros.length;
    if(quant < 11){
      $('#txtTelefone').notify("Telefone inválido!", {position: "bottom left", className: 'error', autoHideDelay: 3000});
      $('#txtTelefone').focus();
      return false;
    }
    if($('#txtMensagem').val() == ""){
      $('#txtMensagem').notify("Preencha a mensagem!", {position: "bottom left", className: 'error', autoHideDelay: 3000});
      $('#txtMensagem').focus();
      return;
    }
    if(hcaptcha.getResponse(0) == ""){
      $('#h-captcha').notify("Você não clicou no CAPTCHA, por favor, faça!", {position: "bottom left", className: 'error', autoHideDelay: 3000});
      return false;
    }
  }
 