
  $(function ()
  {
    $("#slider_range").slider({
      range: true,
      min: 0,
      max: 2200000000.00,
      step: 50000,
      values: [0, 1100000000],
      slide: function (event, ui)
      {
        $("#valor").html("Valor de " + numberToReal(ui.values[ 0 ]) + " até " + numberToReal(ui.values[ 1 ]));
        $("#val_min").val(ui.values[ 0 ]);
        $("#val_max").val(ui.values[ 1 ]);
      }
    });

    $("#valor").html("Valor de " + numberToReal($("#slider_range").slider("values", 0)) + " até " + numberToReal($("#slider_range").slider("values", 1)));
    $("#val_min").val("0");
    $("#val_max").val("1000000");

  });

  function numberToReal(numero)
  {
    var numero = numero.toFixed(0).split('.');
    numero[0] = "R$ " + numero[0].split(/(?=(?:...)*$)/).join('.');
    return numero.join(',');
  }

  function carregarBairros()
  {
    var url_template = $('#url_template').val();
    /* Quando clicar em #btn */
    /* Coletando dados */
    var cidade = $('#select_cidades').val();
    /* construindo url */
    var urlData = "&cidade=" + cidade;
    /* Ajax */
    $.ajax({
      type: "POST",
      url: url_template + "/includes/carregar-bairros-busca-simples.php", /* endereço do script PHP */
      async: true,
      data: urlData, /* informa Url */
      success: function (data)
      { /* sucesso */
        $('#div_bairros').html(data);
      },
      beforeSend: function ()
      { /* antes de enviar */
        $('#div_bairros').html("<div><center><img src=\"https://www.darleicorretor.com.br/templates/modelo1/images/preloader.gif\"/></center></div>");
      },
      complete: function ()
      { /* completo */
      }
    });
  }
  function carregarBairros2()
  {
    var url_template = $('#url_template').val();
    /* Quando clicar em #btn */
    /* Coletando dados */
    var cidade = $('#select_cidades2').val();
    /* construindo url */
    var urlData = "&cidade=" + cidade;
    /* Ajax */
    $.ajax({
      type: "POST",
      url: url_template + "/includes/carregar-bairros-busca-simples2.php", /* endereço do script PHP */
      async: true,
      data: urlData, /* informa Url */
      success: function (data)
      { /* sucesso */
        $('#div_bairros2').html(data);
      },
      beforeSend: function ()
      { /* antes de enviar */
        $('#div_bairros2').html("<div><center><img src=\"https://www.darleicorretor.com.br/templates/modelo1/images/preloader.gif\"/></center></div>");
      },
      complete: function ()
      { /* completo */
      }
    });
  }
  
  /*!
                     * jQuery UI Touch Punch 0.2.3
                     *
                     * Copyright 2011–2014, Dave Furfero
                     * Dual licensed under the MIT or GPL Version 2 licenses.
                     *
                     * Depends:
                     *  jquery.ui.widget.js
                     *  jquery.ui.mouse.js
                     */
                    !function (a)
                    {
                      function f(a, b)
                      {
                        if (!(a.originalEvent.touches.length > 1))
                        {
                          a.preventDefault();
                          var c = a.originalEvent.changedTouches[0], d = document.createEvent("MouseEvents");
                          d.initMouseEvent(b, !0, !0, window, 1, c.screenX, c.screenY, c.clientX, c.clientY, !1, !1, !1, !1, 0, null), a.target.dispatchEvent(d)
                        }
                      }
                      if (a.support.touch = "ontouchend"in document, a.support.touch)
                      {
                        var e, b = a.ui.mouse.prototype, c = b._mouseInit, d = b._mouseDestroy;
                        b._touchStart = function (a)
                        {
                          var b = this;
                          !e && b._mouseCapture(a.originalEvent.changedTouches[0]) && (e = !0, b._touchMoved = !1, f(a, "mouseover"), f(a, "mousemove"), f(a, "mousedown"))
                        }, b._touchMove = function (a)
                        {
                          e && (this._touchMoved = !0, f(a, "mousemove"))
                        }, b._touchEnd = function (a)
                        {
                          e && (f(a, "mouseup"), f(a, "mouseout"), this._touchMoved || f(a, "click"), e = !1)
                        }, b._mouseInit = function ()
                        {
                          var b = this;
                          b.element.bind({touchstart: a.proxy(b, "_touchStart"), touchmove: a.proxy(b, "_touchMove"), touchend: a.proxy(b, "_touchEnd")}), c.call(b)
                        }, b._mouseDestroy = function ()
                        {
                          var b = this;
                          b.element.unbind({touchstart: a.proxy(b, "_touchStart"), touchmove: a.proxy(b, "_touchMove"), touchend: a.proxy(b, "_touchEnd")}), d.call(b)
                        };
                      }
                    }(jQuery);


  