<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
// Default infoBox Rating Type
var infoBox_ratingType = 'star-rating';

(function($){
    "use strict";




    function mainMap() {

      console.log("init map");

      // Locations
      // ----------------------------------------------- //
      var ib = new InfoBox();

      // find average hemisphere of all coordinates
      function averageHemisphere(locations) {

        var northern = 0;
        var southern = 0;
        var eastern  = 0;
        var western  = 0;

        for (var i=0;i&lt;locations.length;i++) {
          // check latitude first
          if (parseFloat(locations[i][1]) &gt; 0) {
            northern++;
          } else {
            southern++;
          }

          // then check longitude
          if (parseFloat(locations[i][2]) &gt; 0) {
            eastern++;
          } else {
            western++;
          }
        }

        return {
          lat: northern &gt; southern ? 'northern' : 'southern',
          lng: eastern &gt; western ? 'eastern' : 'western'
        };
      }

      // Infobox Output
      function locationData(locationURL,locationImg,locationPrice, locationAddress, featured) {
          return(''+
            '&lt;a href="'+ locationURL +'" class="listing-img-container"&gt;'+
               '&lt;div class="infoBox-close"&gt;&lt;i class="fa fa-times"&gt;&lt;/i&gt;&lt;/div&gt;'+
               '&lt;img src="'+locationImg+'" alt=""&gt;'+

               '&lt;div class="listing-item-content"&gt;'+
                  '&lt;h3&gt;'+locationPrice+'&lt;/h3&gt;'+
                  '&lt;span&gt;'+locationAddress+'&lt;/span&gt;'+
               '&lt;/div&gt;'+

            '&lt;/a&gt;'/*+

            '&lt;div class="listing-content"&gt;'+
               '&lt;div class="listing-title"&gt;'+
                  '&lt;div class="'+infoBox_ratingType+'" data-rating="'+locationRating+'"&gt;&lt;div class="rating-counter"&gt;('+locationRatingCounter+' reviews)&lt;/div&gt;&lt;/div&gt;'+
               '&lt;/div&gt;'+
            '&lt;/div&gt;'*/)
      }

      //Pin array
      var locations = [];

      $(".listing_details_obj").each(function() {
          var ele = $.parseJSON($(this).val());

                //Make a pin and add it into array of pins
                var icon = '&lt;i class="im im-icon-Home-2"&gt;&lt;/i&gt;';
                var location = [locationData(ele.url, ele.photo, ele.price, ele.address), ele.lat, ele.lng, ele.id, icon, ele.featured];
                locations.push(location);
      });


      // Chosen Rating Type
      google.maps.event.addListener(ib,'domready',function(){
         if (infoBox_ratingType = 'numerical-rating') {
            numericalRating('.infoBox .'+infoBox_ratingType+'');
         }
         if (infoBox_ratingType = 'star-rating') {
            starRating('.infoBox .'+infoBox_ratingType+'');
         }
      });



      // Map Attributes
      // ----------------------------------------------- //

      var mapZoomAttr = $('#map').attr('data-map-zoom');
      var mapScrollAttr = $('#map').attr('data-map-scroll');

      var north = $('#map').attr('data-north');
      var south = $('#map').attr('data-south');
      var east =  $('#map').attr('data-east');
      var west =  $('#map').attr('data-west');

      if(north &amp;&amp; south &amp;&amp; east &amp;&amp; west) {
        var max_bounds = new google.maps.LatLngBounds(
            new google.maps.LatLng(south, west),
            new google.maps.LatLng(north, east)
        );
      }

      if (typeof mapZoomAttr !== typeof undefined &amp;&amp; mapZoomAttr !== false) {
          var zoomLevel = parseInt(mapZoomAttr);
      } else {
          var zoomLevel = 5;
      }

      if (typeof mapScrollAttr !== typeof undefined &amp;&amp; mapScrollAttr !== false) {
         var scrollEnabled = parseInt(mapScrollAttr);
      } else {
        var scrollEnabled = false;
      }




      // Main Map
      map = new google.maps.Map(document.getElementById('map'), {
        scrollwheel: scrollEnabled,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        zoomControl: false,
        mapTypeControl: false,
        scaleControl: false,
        panControl: false,
        navigationControl: false,
        streetViewControl: false,
        gestureHandling: 'cooperative',

        // Google Map Style
        styles: [{"featureType":"poi","elementType":"labels.text.fill","stylers":[{"color":"#747474"},{"lightness":"23"}]},{"featureType":"poi.attraction","elementType":"geometry.fill","stylers":[{"color":"#f38eb0"}]},{"featureType":"poi.government","elementType":"geometry.fill","stylers":[{"color":"#ced7db"}]},{"featureType":"poi.medical","elementType":"geometry.fill","stylers":[{"color":"#ffa5a8"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#c7e5c8"}]},{"featureType":"poi.place_of_worship","elementType":"geometry.fill","stylers":[{"color":"#d6cbc7"}]},{"featureType":"poi.school","elementType":"geometry.fill","stylers":[{"color":"#c4c9e8"}]},{"featureType":"poi.sports_complex","elementType":"geometry.fill","stylers":[{"color":"#b1eaf1"}]},{"featureType":"road","elementType":"geometry","stylers":[{"lightness":"100"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"},{"lightness":"100"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffd4a5"}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#ffe9d2"}]},{"featureType":"road.local","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"weight":"3.00"}]},{"featureType":"road.local","elementType":"geometry.stroke","stylers":[{"weight":"0.30"}]},{"featureType":"road.local","elementType":"labels.text","stylers":[{"visibility":"on"}]},{"featureType":"road.local","elementType":"labels.text.fill","stylers":[{"color":"#747474"},{"lightness":"36"}]},{"featureType":"road.local","elementType":"labels.text.stroke","stylers":[{"color":"#e9e5dc"},{"lightness":"30"}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"visibility":"on"},{"lightness":"100"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#d2e7f7"}]}]

      });





      // Marker highlighting when hovering listing item
      $('.listing-item-container').on('mouseover', function(){

        var listingAttr = $(this).data('marker-id');

        if(listingAttr !== undefined) {
          var listing_id = $(this).data('marker-id');// - 1;
          if (allMarkers[listing_id] &amp;&amp; allMarkers[listing_id].hasOwnProperty('div')){
            var marker_div = allMarkers[listing_id].div;

            $(marker_div).addClass('clicked');

            $(this).on('mouseout', function(){
                if ($(marker_div).is(":not(.infoBox-opened)")) {
                   $(marker_div).removeClass('clicked');
                }
             });
          }
        }

      });  //$('.listing-item-container').on('mouseover', function(){


      // Infobox
      // ----------------------------------------------- //

      var boxText = document.createElement("div");
      boxText.className = 'map-box';

      var currentInfobox;

      var boxOptions = {
              content: boxText,
              disableAutoPan: false,
              alignBottom : true,
              maxWidth: 0,
              pixelOffset: new google.maps.Size(-134, -55),
              zIndex: null,
              boxStyle: {
                width: "270px"
              },
              closeBoxMargin: "0",
              closeBoxURL: "",
              infoBoxClearance: new google.maps.Size(25, 25),
              isHidden: false,
              pane: "floatPane",
              enableEventPropagation: false,
      };


      var markerCluster, overlay, i;
      var allMarkers = [];

      var clusterStyles = [
        {
          textColor: 'white',
          url: '',
          height: 50,
          width: 50
        }
      ];

      var bounds = new google.maps.LatLngBounds();

      var averagePosition = averageHemisphere(locations);

      // filter locations by average hemisphere
      // if location is in a totally different hemisphere, it's probably not accurate
      locations = locations.filter(function(location) {
        return (
            parseFloat(location[1]) &gt;= 0 &amp;&amp; averagePosition.lat === 'northern' ||
            parseFloat(location[1]) &lt;= 0 &amp;&amp; averagePosition.lat === 'southern' ||
            parseFloat(location[2]) &gt;= 0 &amp;&amp; averagePosition.lng === 'eastern' ||
            parseFloat(location[2]) &lt;= 0 &amp;&amp; averagePosition.lng === 'western' );
      });

      var markerIco;
      for (i = 0; i &lt; locations.length; i++) {

        markerIco = locations[i][4];

        var latlng = new google.maps.LatLng(locations[i][1], locations[i][2]);

        if (!max_bounds || max_bounds.contains(latlng)){
          bounds.extend(latlng);
        }

        var overlay = new CustomMarker(
          latlng,
          map,
          {
            marker_id: locations[i][3]
          },
          markerIco,
          locations[i][5]
        );

        allMarkers.push(overlay);

        google.maps.event.addDomListener(overlay, 'click', (function(overlay, i) {

          return function() {
             ib.setOptions(boxOptions);
             boxText.innerHTML = locations[i][0];
             ib.open(map, overlay);

             currentInfobox = locations[i][3];
             // var latLng = new google.maps.LatLng(locations[i][1], locations[i][2]);
              //map.panTo(latLng);
              //map.panBy(0,-90);


            google.maps.event.addListener(ib,'domready',function(){
              $('.infoBox-close').click(function(e) {
                  e.preventDefault();
                  ib.close();
                  $('.map-marker-container').removeClass('clicked infoBox-opened');
              });

            });

          }
        })(overlay, i));

      }


      // Marker Clusterer Init
      // ----------------------------------------------- //

      var options = {
          imagePath: 'images/',
          styles : clusterStyles,
          minimumClusterSize : 5
      };

      //markerCluster = new MarkerClusterer(map, allMarkers, options);


      // If none of the listings showed up in the geographical area (all bad data) zoom to boundaries
      if(max_bounds &amp;&amp; !max_bounds.intersects(bounds)) {
        bounds = max_bounds;
      }

      google.maps.event.addListenerOnce(map, 'zoom_changed', function() {
        var zoom = map.getZoom();
        map.setZoom(zoom &gt; 15 ? 15 : zoom);
      });
      map.fitBounds(bounds, 0);






      google.maps.event.addDomListener(window, "resize", function() {
          var center = map.getCenter();
          google.maps.event.trigger(map, "resize");
          map.setCenter(center);
      });



      // Custom User Interface Elements
      // ----------------------------------------------- //

      // Custom Zoom-In and Zoom-Out Buttons
        var zoomControlDiv = document.createElement('div');
        var zoomControl = new ZoomControl(zoomControlDiv, map);

        function ZoomControl(controlDiv, map) {

          zoomControlDiv.index = 1;
          map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(zoomControlDiv);
          // Creating divs &amp; styles for custom zoom control
          controlDiv.style.padding = '5px';
          controlDiv.className = "zoomControlWrapper";

          // Set CSS for the control wrapper
          var controlWrapper = document.createElement('div');
          controlDiv.appendChild(controlWrapper);

          // Set CSS for the zoomIn
          var zoomInButton = document.createElement('div');
          zoomInButton.className = "custom-zoom-in";
          controlWrapper.appendChild(zoomInButton);

          // Set CSS for the zoomOut
          var zoomOutButton = document.createElement('div');
          zoomOutButton.className = "custom-zoom-out";
          controlWrapper.appendChild(zoomOutButton);

          // Setup the click event listener - zoomIn
          google.maps.event.addDomListener(zoomInButton, 'click', function() {
            map.setZoom(map.getZoom() + 1);
          });

          // Setup the click event listener - zoomOut
          google.maps.event.addDomListener(zoomOutButton, 'click', function() {
            map.setZoom(map.getZoom() - 1);
          });

      }


      // Scroll enabling button
      var scrollEnabling = $('#scrollEnabling');

      $(scrollEnabling).click(function(e){
          e.preventDefault();
          $(this).toggleClass("enabled");

          if ( $(this).is(".enabled") ) {
             map.setOptions({'scrollwheel': true});
          } else {
             map.setOptions({'scrollwheel': false});
          }
      })


      // Geo Location Button
      $("#geoLocation, .input-with-icon.location a").click(function(e){
          e.preventDefault();
          geolocate();
      });

      //view on map button
      $('.map-pin').click(function(e){
        e.preventDefault();
        e.stopPropagation();
        e.stopImmediatePropagation();

        var id =$(this).attr('data-map-id');

        for (var i = 0; i &lt; allMarkers.length; i++) {
          if (allMarkers[i].args.marker_id == id) {
              google.maps.event.trigger(allMarkers[i], 'click');
              return;
          }
        }

      });


      function geolocate() {

          if (navigator.geolocation) {
              navigator.geolocation.getCurrentPosition(function (position) {
                  var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
                  map.setCenter(pos);
                  map.setZoom(12);
              });
          }
      }

    }




















    // Map Init
    var map =  document.getElementById('map');
    if (typeof(map) != 'undefined' &amp;&amp; map != null) {
      google.maps.event.addDomListener(window, 'load',  mainMap);
    }














    function cacheCoordinates(guid, lat, lng)
    {
      $.ajax({
        url: '/cache-coordinates',
        method: 'POST',
        data: {
            "_token": $('meta[name="csrf-token"]').attr('content'),
            "GUID" : guid,
            "lat": lat,
            "lng": lng
         },
         success: function(data){
            //console.log('response', data);
        }
      });
    }





    // ---------------- Main Map / End ---------------- //


    // Single Listing Map
    // ----------------------------------------------- //

          // Check for a given geocode
          var myLatlng;
          var single_map;
    function singleListingMap() {


      // Marker
       var singleMapIco =  "&lt;i class='"+$('#singleListingMap').data('map-icon')+"'&gt;&lt;/i&gt;";




      if (!$( '#singleListingMap' ).data('longitude')) {

        var geocoder = new google.maps.Geocoder();
        var address = document.getElementById('addressforgeo').value;
        var featuredListing = document.getElementById('listing-featured').value;
        // if (featuredListing == 1)
        // {
          geocoder.geocode( { 'address': address}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
              var guid = document.getElementById('listing-guid').value;
              cacheCoordinates(guid, results[0].geometry.location.lat(), results[0].geometry.location.lng());
              // console.log(results[0].geometry.location.lat())
              // console.log(results[0].geometry.location.lng())
              myLatlng = new google.maps.LatLng({lng: parseFloat(results[0].geometry.location.lng()), lat: parseFloat(results[0].geometry.location.lat()), });
              //myLatlng = new google.maps.LatLng({lng: results[0].geometry.location.lng(), lat: results[0].geometry.location.lat() });
              buildMap(myLatlng);
            } else {
              //alert('Geocode was not successful for the following reason: ' + status);
            }
          });
        //}

      } else {
        myLatlng = new google.maps.LatLng({lng: parseFloat($( '#singleListingMap' ).data('longitude')),lat: parseFloat($( '#singleListingMap' ).data('latitude')), });
        buildMap(myLatlng);
      }


      function buildMap(myLatlng) {
        single_map = new google.maps.Map(document.getElementById('singleListingMap'), {
          zoom: 15,
          center: myLatlng,
          scrollwheel: false,
          zoomControl: true,
          mapTypeControl: false,
          scaleControl: false,
          panControl: false,
          navigationControl: false,
          streetViewControl: false,
          styles:  [{"featureType":"poi","elementType":"labels.text.fill","stylers":[{"color":"#747474"},{"lightness":"23"}]},{"featureType":"poi.attraction","elementType":"geometry.fill","stylers":[{"color":"#f38eb0"}]},{"featureType":"poi.government","elementType":"geometry.fill","stylers":[{"color":"#ced7db"}]},{"featureType":"poi.medical","elementType":"geometry.fill","stylers":[{"color":"#ffa5a8"}]},{"featureType":"poi.park","elementType":"geometry.fill","stylers":[{"color":"#c7e5c8"}]},{"featureType":"poi.place_of_worship","elementType":"geometry.fill","stylers":[{"color":"#d6cbc7"}]},{"featureType":"poi.school","elementType":"geometry.fill","stylers":[{"color":"#c4c9e8"}]},{"featureType":"poi.sports_complex","elementType":"geometry.fill","stylers":[{"color":"#b1eaf1"}]},{"featureType":"road","elementType":"geometry","stylers":[{"lightness":"100"}]},{"featureType":"road","elementType":"labels","stylers":[{"visibility":"off"},{"lightness":"100"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"color":"#ffd4a5"}]},{"featureType":"road.arterial","elementType":"geometry.fill","stylers":[{"color":"#ffe9d2"}]},{"featureType":"road.local","elementType":"all","stylers":[{"visibility":"simplified"}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"weight":"3.00"}]},{"featureType":"road.local","elementType":"geometry.stroke","stylers":[{"weight":"0.30"}]},{"featureType":"road.local","elementType":"labels.text","stylers":[{"visibility":"on"}]},{"featureType":"road.local","elementType":"labels.text.fill","stylers":[{"color":"#747474"},{"lightness":"36"}]},{"featureType":"road.local","elementType":"labels.text.stroke","stylers":[{"color":"#e9e5dc"},{"lightness":"30"}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"visibility":"on"},{"lightness":"100"}]},{"featureType":"water","elementType":"all","stylers":[{"color":"#d2e7f7"}]}]
        });

        new CustomMarker(
          myLatlng,
          single_map,
          {
            marker_id: '1'
          },
          singleMapIco
        );
      }




      // Steet View Button
      $('#streetView').click(function(e){
         e.preventDefault();
         single_map.getStreetView().setOptions({visible:true,position:myLatlng});
         // $(this).css('display', 'none')
      });


      // Custom zoom buttons
      var zoomControlDiv = document.createElement('div');
      var zoomControl = new ZoomControl(zoomControlDiv, single_map);

      function ZoomControl(controlDiv, single_map) {

        zoomControlDiv.index = 1;
        single_map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(zoomControlDiv);

        controlDiv.style.padding = '5px';

        var controlWrapper = document.createElement('div');
        controlDiv.appendChild(controlWrapper);

        var zoomInButton = document.createElement('div');
        zoomInButton.className = "custom-zoom-in";
        controlWrapper.appendChild(zoomInButton);

        var zoomOutButton = document.createElement('div');
        zoomOutButton.className = "custom-zoom-out";
        controlWrapper.appendChild(zoomOutButton);

        google.maps.event.addDomListener(zoomInButton, 'click', function() {
          single_map.setZoom(single_map.getZoom() + 1);
        });

        google.maps.event.addDomListener(zoomOutButton, 'click', function() {
          single_map.setZoom(single_map.getZoom() - 1);
        });

      }





    }


















    // Single Listing Map Init
    var single_map =  document.getElementById('singleListingMap');
    if (typeof(single_map) != 'undefined' &amp;&amp; single_map != null) {
      google.maps.event.addDomListener(window, 'load',  singleListingMap);
    }

    // -------------- Single Listing Map / End -------------- //

    //==== MEET OUR COMPANIES ====//
    $(".meetLocalComp h5").click(function() {
        $(this).children('i.fa').toggleClass("fa-angle-down");
        $(".localComp").slideToggle(300);
    });


    // Custom Map Marker
    // ----------------------------------------------- //

    function CustomMarker(latlng, map, args, markerIco, featured) {
      this.latlng = latlng;
      this.args = args;
      this.markerIco = markerIco;
      this.setMap(map);
      this.featured = featured;
    }

    CustomMarker.prototype = new google.maps.OverlayView();

    CustomMarker.prototype.draw = function() {

      var self = this;

      var div = this.div;

      if (!div) {

        var featured_class = '';
        if(this.featured == 1) {
          featured_class = 'marker-featured';
        }

        div = this.div = document.createElement('div');
        div.className = 'map-marker-container ' + featured_class;

        div.innerHTML = '&lt;div class="marker-container"&gt;'+
                            '&lt;div class="marker-card"&gt;'+
                               '&lt;div class="front face"&gt;' + self.markerIco + '&lt;/div&gt;'+
                               '&lt;div class="back face"&gt;' + self.markerIco + '&lt;/div&gt;'+
                               '&lt;div class="marker-arrow"&gt;&lt;/div&gt;'+
                            '&lt;/div&gt;'+
                          '&lt;/div&gt;'
        // Clicked marker highlight
        google.maps.event.addDomListener(div, "click", function(event) {
            $('.map-marker-container').removeClass('clicked infoBox-opened');
            google.maps.event.trigger(self, "click");
            $(this).addClass('clicked infoBox-opened');
        });


        if (typeof(self.args.marker_id) !== 'undefined') {
          div.dataset.marker_id = self.args.marker_id;
        }

        var panes = this.getPanes();
        panes.overlayImage.appendChild(div);
      }

      var point = this.getProjection().fromLatLngToDivPixel(this.latlng);

      if (point) {
        div.style.left = (point.x) + 'px';
        div.style.top = (point.y) + 'px';
      }
    };

    CustomMarker.prototype.remove = function() {
      if (this.div) {
        this.div.parentNode.removeChild(this.div);
        this.div = null; $(this).removeClass('clicked');
      }
    };

    CustomMarker.prototype.getPosition = function() { return this.latlng; };

    // -------------- Custom Map Marker / End -------------- //

    	/*
      |--------------------------------------------------------------------------
      | Search Related
      |--------------------------------------------------------------------------
      */


      function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {
        var R = 6371; // Radius of the earth in km
        var dLat = deg2rad(lat2-lat1);  // deg2rad below
        var dLon = deg2rad(lon2-lon1);
        var a =
          Math.sin(dLat/2) * Math.sin(dLat/2) +
          Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) *
          Math.sin(dLon/2) * Math.sin(dLon/2)
          ;
        var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
        var d = R * c; // Distance in km
        return d;
      }

      function deg2rad(deg) {
        return deg * (Math.PI/180)
      }



})(this.jQuery);
</pre></body></html>