PageSourceSearch

https://www.estate.cz/wp-content/themes/wpresidence/js/google_js/mapfunctions.js?ver=1.0.0

js estate.cz collected 2026-10-09 17:08:52 UTC 93,562 bytes, 3,094 lines download raw bytes

1/*global $,oms,WpstateMarker,wpestate_start_filtering_ajax,control_vars,googlecode_regular_vars,wpestate_custom_search_start_filtering_ajax,ajaxcalls_vars,MarkerClusterer,map,google,OverlappingMarkerSpiderfier,gmarkers, Modernizr , InfoBox,google_map_submit_vars ,mapfunctions_vars, googlecode_home_vars,jQuery,googlecode_property_vars*/
2var pin_images=mapfunctions_vars.pin_images;
3var images = jQuery.parseJSON(pin_images);
4var ipad_time=0;
5var infobox_id=0;
6var shape = {
7        coord: [1, 1, 1, 38, 38, 59, 59 , 1],
8        type: 'poly'
9    };
10
11var mcOptions;
12var mcluster;
13var clusterStyles;
14var pin_hover_storage;
15var first_time_wpestate_show_inpage_ajax_half=0;
16var panorama;
17var infoBox_sh=null;
18var poi_marker_array=[];
19var poi_type='';
20var placeCircle='';
21var initialGeop=0;
22var heading=0;
23var width_browser=null;
24var infobox_width=null;
25var wraper_height=null;
26var info_image=null;
27var vertical_pan=-190;
28var vertical_off=150;
29var curent_gview_lat = jQuery('#gmap_wrapper').attr('data-cur_lat');
30var curent_gview_long = jQuery('#gmap_wrapper').attr('data-cur_long');
31var bounds_list;
32var circleLayer='';
33
34function wpestate_agency_map_function(){
35    "use strict";
36    var curent_gview_lat    =   jQuery('#agency_map').attr('data-cur_lat');
37    var curent_gview_long   =   jQuery('#agency_map').attr('data-cur_long');
38
39
40
41    if(mapfunctions_vars.geolocation_type==1){
42
43
44        var mapOptions_intern = {
45            flat:false,
46            noClear:false,
47            zoom:  15,
48            scrollwheel: false,
49            draggable: true,
50            center: new google.maps.LatLng(curent_gview_lat,curent_gview_long ),
51            streetViewControl:false,
52            disableDefaultUI: true,
53            mapTypeId: mapfunctions_vars.type.toLowerCase(),
54            gestureHandling: 'cooperative'
55        };
56
57
58        var    map_agency= new google.maps.Map(document.getElementById('agency_map'), mapOptions_intern);
59        if(mapfunctions_vars.map_style !==''){
60           var styles = JSON.parse ( mapfunctions_vars.map_style );
61           map_agency.setOptions({styles: styles});
62        }
63
64        google.maps.visualRefresh = true;
65        google.maps.event.trigger(map_agency, 'resize');
66
67
68
69        var myLatLng = new google.maps.LatLng(curent_gview_lat, curent_gview_long);
70        var marker = new google.maps.Marker({
71            position: myLatLng,
72            map: map_agency,
73            icon: wpesate_custompin_agency(),
74            shape: shape,
75            title: 'we are here',
76            zIndex: 1,
77            infoWindowIndex : 0
78         });
79
80    }else{
81        wpresidence_agency_dev_map(curent_gview_lat,curent_gview_long,'agency_map');
82    }
83
84
85
86}
87
88
89
90function wpresidence_agency_dev_map(latitude,longitude,map_name){
91    "use strict";
92
93    var mapCenter = L.latLng(latitude, longitude );
94var    map =  L.map( map_name,{
95        center: mapCenter,
96        zoom:7,
97    });
98
99    var tileLayer =  wpresidence_open_stret_tile_details();
100    map.addLayer( tileLayer );
101
102
103    var markerCenter    =   L.latLng( latitude, longitude );
104    var markerImage     = {
105        iconUrl:  images['single_pin'],
106        iconSize: [44, 50],
107        iconAnchor: [20, 50],
108        popupAnchor: [1, -50]
109    };
110    var markerOptions = {
111        riseOnHover: true
112    };
113
114
115    markerOptions.icon  = L.icon( markerImage );
116    var propertyMarker      = L.marker( markerCenter, markerOptions );
117
118    propertyMarker.addTo( map );
119
120
121}
122
123
124
125
126
127
128function wpesate_custompin_agency(){
129    "use strict";
130    var image = {
131        url:  images['single_pin'],
132        size: new google.maps.Size(59, 59),
133        origin: new google.maps.Point(0,0),
134        anchor: new google.maps.Point(16,59 )
135    };
136
137    return image;
138}
139
140
141function wpestate_map_shortcode_function(){
142    "use strict";
143
144
145    var selected_id         =   parseInt( jQuery('#googleMap_shortcode').attr('data-post_id'),10 );
146    var curent_gview_lat    =   jQuery('#googleMap_shortcode').attr('data-cur_lat');
147    var curent_gview_long   =   jQuery('#googleMap_shortcode').attr('data-cur_long');
148    var zoom;
149    var map2='';
150    var gmarkers_sh = [];
151
152    if (typeof googlecode_property_vars === 'undefined') {
153        zoom=5;
154        heading=0;
155    }else{
156        zoom    =   googlecode_property_vars.page_custom_zoom;
157        heading =   parseInt(googlecode_property_vars.camera_angle);
158    }
159
160     var i = 1;
161
162    var id                          =   selected_id;
163    var lat                         =   curent_gview_lat;
164    var lng                         =   curent_gview_long;
165    var title                       =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-title') );
166    var pin                         =   jQuery('#googleMap_shortcode').attr('data-pin');
167    var counter                     =   1;
168    var image                       =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-thumb' ));
169    var price                       =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-price' ));
170    var single_first_type           =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-single-first-type') );
171    var single_first_action         =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-single-first-action') );
172    var link                        =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-prop_url' ));
173    var city                        =   '';
174    var area                        =   '';
175    var rooms                       =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-rooms')) ;
176    var baths                       =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-bathrooms')) ;
177    var size                        =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-size') );
178    var single_first_type_name      =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-single-first-type') );
179    var single_first_action_name    =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-single-first-action') );
180    var agent_id                    =   '' ;
181    var county_state                =   '' ;
182    var price_pin                   =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-pin_price' ));
183    var cleanprice                 =   decodeURIComponent ( jQuery('#googleMap_shortcode').attr('data-clean_price' ));
184
185
186    if (wp_estate_kind_of_map==2){
187
188        var mapCenter = L.latLng( curent_gview_lat,curent_gview_long );
189
190
191        map2 =  L.map( 'googleMap_shortcode',{
192            center: mapCenter,
193            zoom: zoom
194        }).on('load', function(e) {
195            jQuery('#gmap-loading').remove();
196        });
197
198
199        wpresidence_leaflet_initialize_map_common(map2);
200
201
202        wpestate_createMarker_sh_leaflet (price_pin,infoBox_sh,gmarkers_sh,map2,county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,single_first_type_name, single_first_action_name );
203
204
205
206    }else{
207
208        if( jQuery('#googleMap_shortcode').length > 0){
209
210
211
212            var mapOptions_intern = {
213                flat:false,
214                noClear:false,
215                zoom:  parseInt(zoom),
216                scrollwheel: false,
217                draggable: true,
218                center: new google.maps.LatLng(curent_gview_lat,curent_gview_long ),
219                streetViewControl:false,
220                disableDefaultUI: true,
221                mapTypeId: mapfunctions_vars.type.toLowerCase(),
222                gestureHandling: 'cooperative'
223            };
224
225            map2= new google.maps.Map(document.getElementById('googleMap_shortcode'), mapOptions_intern);
226
227
228            google.maps.visualRefresh = true;
229            google.maps.event.trigger(map2, 'resize');
230
231
232            width_browser       =   jQuery(window).width();
233
234            infobox_width=700;
235            vertical_pan=-215;
236            if (width_browser<900){
237              infobox_width=500;
238            }
239            if (width_browser<600){
240              infobox_width=400;
241            }
242            if (width_browser<400){
243              infobox_width=200;
244            }
245           var boxText         =   document.createElement("div");
246
247            var myOptions = {
248                content: boxText,
249                disableAutoPan: true,
250                maxWidth: infobox_width,
251                boxClass:"mybox",
252                zIndex: null,
253                closeBoxMargin: "-13px 0px 0px 0px",
254                closeBoxURL: "",
255                infoBoxClearance: new google.maps.Size(1, 1),
256                isHidden: false,
257                pane: "floatPane",
258                enableEventPropagation: true
259            };
260            infoBox_sh = new InfoBox(myOptions);
261
262
263            if(mapfunctions_vars.map_style !==''){
264               var styles = JSON.parse ( mapfunctions_vars.map_style );
265               map2.setOptions({styles: styles});
266            }
267
268
269            wpestate_createMarker_sh (price_pin,infoBox_sh,gmarkers_sh,map2,county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,single_first_type_name, single_first_action_name );
270
271
272            var viewPlace   =   new google.maps.LatLng(curent_gview_lat,curent_gview_long);
273            if(typeof (panorama_sh)==='undefined'){
274                var panorama_sh;
275            }
276            panorama_sh        =   map2.getStreetView();
277            panorama_sh.setPosition(viewPlace);
278
279
280            panorama_sh.setPov(/** @type {google.maps.StreetViewPov} */({
281                heading: heading,
282                pitch: 0
283            }));
284
285            jQuery('#slider_enable_street_sh').on( 'click', function() {
286                var cur_lat     =   jQuery('#googleMap_shortcode').attr('data-cur_lat');
287                var cur_long    =   jQuery('#googleMap_shortcode').attr('data-cur_long');
288                var myLatLng    =   new google.maps.LatLng(cur_lat,cur_long);
289
290                panorama_sh.setPosition(myLatLng);
291                panorama_sh.setVisible(true);
292                jQuery('#gmapzoomminus_sh,#gmapzoomplus_sh,#slider_enable_street_sh').hide();
293
294            });
295
296            google.maps.event.addListener(panorama_sh, "closeclick", function() {
297                jQuery('#gmapzoomminus_sh,#gmapzoomplus_sh,#slider_enable_street_sh').show();
298            });
299
300
301
302
303
304
305
306
307            google.maps.event.trigger(gmarkers_sh[0], 'click');
308            setTimeout(function(){
309                google.maps.event.trigger(map2, "resize");
310                map2.setCenter(gmarkers_sh[0].position);
311//                    switch (infobox_width){
312//                        case 700:
313//                            map2.panBy(100,-150);
314//                            vertical_off=0;
315//                            break;
316//                        case 500:
317//                            map2.panBy(50,-120);
318//                            break;
319//                        case 400:
320//                            map2.panBy(100,-220);
321//                            break;
322//                        case 200:
323//                            map2.panBy(20,-170);
324//                            break;
325//                    }
326            }, 300);
327
328
329
330            wpestate_initialize_poi(map2,2);
331        }
332    }
333
334
335    if(  document.getElementById('gmapzoomplus_sh') ){
336        jQuery('#gmapzoomplus_sh').on('click',function(){
337            "use strict";
338
339            var current= parseInt( map2.getZoom(),10);
340            current++;
341            if(current>20){
342                current=20;
343            }
344            map2.setZoom(current);
345        });
346    }
347
348    if(  document.getElementById('gmapzoomminus_sh') ){
349        jQuery('#gmapzoomminus_sh').on('click',function(){
350            "use strict";
351            var current= parseInt( map2.getZoom(),10);
352            current--;
353            if(current<0){
354                current=0;
355            }
356            map2.setZoom(current);
357        });
358    }
359
360    if (wp_estate_kind_of_map==2){
361        setTimeout(function(){ map2.invalidateSize(); }, 1000);
362    }else{
363        setTimeout(function(){ google.maps.event.trigger(map2, "resize"); }, 1000);
364
365    }
366
367    jQuery('.shtabmap,.shacctab').on( 'click', function(event) {
368
369        if (wp_estate_kind_of_map==2){
370
371            setTimeout(function(){ map2.invalidateSize(); }, 100);
372        }else{
373            setTimeout(function(){ google.maps.event.trigger(map2, "resize"); }, 100);
374
375        }
376    });
377}
378
379
380
381
382function wpestate_createMarker_sh_leaflet (pin_price,infoBox_sh,gmarkers_sh,map2,county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,single_first_type_name, single_first_action_name ){
383    "use strict";
384
385    var infoboxWrapper = document.createElement( "div" );
386    infoboxWrapper.className = 'leafinfobox-wrapper';
387    var infobox = "";
388
389    var poss=0;
390    var infobox_class=" price_infobox ";
391
392
393
394
395
396
397    if( mapfunctions_vars.useprice === 'yes' ){
398        infobox_class =' openstreet_map_price_infobox ';
399    }
400
401
402    var info_image='';
403    if (image === '') {
404        info_image =  mapfunctions_vars.path + '/idxdefault.jpg';
405    } else {
406        info_image = image;
407    }
408
409    var category        = decodeURIComponent(single_first_type.replace(/-/g, ' '));
410    var action          = decodeURIComponent(single_first_action.replace(/-/g, ' '));
411    var category_name   = decodeURIComponent(single_first_type_name.replace(/-/g, ' '));
412    var action_name     = decodeURIComponent(single_first_action_name.replace(/-/g, ' '));
413
414    var in_type = mapfunctions_vars.in_text;
415    if (category === '' || action === '') {
416        in_type = " ";
417    }
418    in_type = " / ";
419    var  infoguest,inforooms;
420
421    var infobaths;
422    if(baths!='' && baths!=0 ){
423        infobaths ='<span id="infobath">'+baths+' '+mapfunctions_vars.ba+'</span>';
424    }else{
425        infobaths ='';
426    }
427
428
429    var inforooms;
430    if(rooms!='' && rooms!=0 ){
431        inforooms='<span id="inforoom">'+rooms+' '+mapfunctions_vars.bd+'</span>';
432    }else{
433        inforooms='';
434    }
435
436    var infosize;
437    if(size!=''){
438        infosize ='<span id="infosize">'+size+'</span>';
439    }else{
440        infosize='';
441    }
442
443    var title=  title.substr(0, 30);
444    if(title.length > 30){
445        title=title+"...";
446    }
447
448
449
450   infobox +=  wpestate_generate_infobox_leaflet(infobox_class,title,link,info_image,price,cleanprice,infosize,infobaths,inforooms);
451
452    var  markerOptions = {
453        riseOnHover: true
454    };
455
456    var markerCenter    =   L.latLng( lat, lng );
457    var propertyMarker  =   '';
458
459
460
461    if( mapfunctions_vars.useprice === 'yes' ){
462        var price_pin_class= 'wpestate_marker openstreet_price_marker '+wpestate_makeSafeForCSS(single_first_type_name.trim() )+' '+wpestate_makeSafeForCSS(single_first_action_name.trim());
463
464        var pin_price_marker = '<div class="'+price_pin_class+'">';
465        if (typeof(price) !== 'undefined') {
466            if( mapfunctions_vars.use_price_pins_full_price==='no'){
467                pin_price_marker +='<div class="interior_pin_price">'+pin_price+'</div>';
468            }else{
469                pin_price_marker +='<div class="interior_pin_price">'+price+'</div>';
470            }
471        }
472        pin_price_marker += '</div>';
473
474
475
476        var myIcon = L.divIcon({
477            className:'someclass',
478            iconSize: new L.Point(0, 0),
479            html: pin_price_marker
480        });
481        propertyMarker  = L.marker( markerCenter, {icon: myIcon} );
482
483    }else{
484       var markerImage     = {
485            iconUrl: wprentals_custompin_leaflet(pin),
486            iconSize: [44, 50],
487            iconAnchor: [20, 50],
488            popupAnchor: [1, -50]
489        };
490        markerOptions.icon  = L.icon( markerImage );
491        propertyMarker      = L.marker( markerCenter, markerOptions );
492    }
493
494    propertyMarker.idul =   id;
495    propertyMarker.pin  =   pin;
496
497
498    propertyMarker.addTo( map2 );
499
500
501    gmarkers_sh.push(propertyMarker);
502
503    if (typeof (bounds_list) !== "undefined") {
504        bounds_list.extend(propertyMarker.getLatLng());
505    }else{
506
507        bounds_list = L.latLngBounds( propertyMarker.getLatLng(),propertyMarker.getLatLng() );
508    }
509
510    infoboxWrapper.innerHTML = infobox;
511    propertyMarker.bindPopup( infobox );
512
513
514
515    propertyMarker.fire('click').openPopup();
516
517}
518
519
520
521
522
523
524function wpestate_createMarker_sh (pin_price,infoBox_sh,gmarkers_sh,map2,county_state, size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,city,area,rooms,baths,cleanprice,single_first_type_name, single_first_action_name ){
525    "use strict";
526    var new_title   =   '';
527    var myLatLng    =   new google.maps.LatLng(lat,lng);
528    var poss=0;
529    var infobox_class=" price_infobox ";
530    if(mapfunctions_vars.useprice === 'yes'){
531
532
533        myLatLng        =   new google.maps.LatLng(lat,lng);
534        var Titlex          =   jQuery('<textarea />').html(title).text();
535
536        var infoWindowIndex =   999;
537        poss=11;
538
539        var price2=price;
540        var my_custom_curr_pos     =   parseFloat( wpestate_getCookie_map('my_custom_curr_pos'));
541        if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) {
542
543            var converted_price= wpestate_get_price_currency(cleanprice,cleanprice);
544            var testRE = price.match('</span>(.*)<span class=');
545            if (testRE !== null ){
546                price2=price.replace(testRE[1],converted_price);
547            }
548        }
549
550
551        marker= new WpstateMarker(
552            poss,
553            myLatLng,
554            map2,
555            Titlex,
556            counter,
557            image,
558            id,
559
560            price2,
561            pin_price,
562            single_first_type,
563            single_first_action,
564            link,
565            i,
566            rooms,
567            baths,
568            cleanprice,
569            size,
570            single_first_type_name,
571            single_first_action_name,
572            pin,
573            infoWindowIndex
574        );
575
576
577    }else{
578        infobox_class=" classic_info ";
579        var marker = new google.maps.Marker({
580               position: myLatLng,
581               map: map2,
582               icon: wpestate_custompin(pin),
583               shape: shape,
584               title: title,
585               zIndex: counter,
586               image:image,
587               idul:id,
588               price:price,
589               category:single_first_type,
590               action:single_first_action,
591               link:link,
592               city:city,
593               area:area,
594               infoWindowIndex : i,
595               rooms:rooms,
596               baths:baths,
597               cleanprice:cleanprice,
598               size:size,
599               county_state:county_state,
600               category_name:single_first_type_name,
601               action_name:single_first_action_name
602              });
603    }
604
605    gmarkers_sh.push(marker);
606
607    google.maps.event.addListener(marker, 'click', function() {
608
609            if(this.image===''){
610                info_image='<img src="' + mapfunctions_vars.path + '/idxdefault.jpg"  />';
611            }else{
612                info_image=this.image;
613            }
614
615            var category         =   decodeURIComponent ( this.category.replace(/-/g,' ') );
616            var action           =   decodeURIComponent ( this.action.replace(/-/g,' ') );
617            var category_name    =   decodeURIComponent ( this.category_name.replace(/-/g,' ') );
618            var action_name      =   decodeURIComponent ( this.action_name.replace(/-/g,' ') );
619            var in_type          =   mapfunctions_vars.in_text;
620            if(category==='' || action===''){
621                in_type=" ";
622            }
623
624           var infobaths;
625            if(this.baths!='' && this.baths!=0){
626                infobaths ='<span id="infobath">'+this.baths+' '+mapfunctions_vars.ba+'</span>';
627            }else{
628                infobaths ='';
629            }
630
631            var inforooms;
632            if(this.rooms!='' && this.rooms!=0){
633                inforooms='<span id="inforoom">'+this.rooms+' '+mapfunctions_vars.bd+'</span>';
634            }else{
635                inforooms='';
636            }
637
638            var infosize;
639            if(this.size!=''){
640                 infosize ='<span id="infosize">'+this.size;
641                 infosize =infosize+'</span>';
642            }else{
643                infosize='';
644            }
645
646
647            var title=  this.title.substr(0, 30);
648            if(this.title.length > 30){
649                title=title+"...";
650            }
651
652            infoBox_sh.setContent( wpestate_generate_infobox_sh(infobox_class,title,link,info_image,price,cleanprice,infosize,infobaths,inforooms));
653            infoBox_sh.open(map2, this);
654            map2.setCenter(this.position);
655
656
657
658
659            if (control_vars.show_adv_search_map_close === 'no') {
660                $('.search_wrapper').addClass('adv1_close');
661                wpestate_adv_search_click();
662            }
663
664             wpestate_close_adv_search();
665            });/////////////////////////////////// end event listener
666
667
668
669}
670
671
672
673/////////////////////////////////////////////////////////////////////////////////////////////////
674// change map
675/////////////////////////////////////////////////////////////////////////////////////////////////
676
677function  wpestate_change_map_type(map_type){
678    "use strict";
679    if(map_type==='map-view-roadmap'){
680         map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
681    }else if(map_type==='map-view-satellite'){
682         map.setMapTypeId(google.maps.MapTypeId.SATELLITE);
683    }else if(map_type==='map-view-hybrid'){
684         map.setMapTypeId(google.maps.MapTypeId.HYBRID);
685    }else if(map_type==='map-view-terrain'){
686         map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
687    }
688
689}
690
691/////////////////////////////////////////////////////////////////////////////////////////////////
692//  set markers... loading pins over map
693/////////////////////////////////////////////////////////////////////////////////////////////////
694
695function wpestate_setMarkers(map, locations, with_bound) {
696    "use strict";
697    var map_open;
698
699    var myLatLng;
700    var selected_id     =   parseInt( jQuery('#gmap_wrapper').attr('data-post_id') );
701    if( isNaN(selected_id) ){
702        selected_id     =   parseInt( jQuery('#googleMapSlider').attr('data-post_id'),10 );
703    }
704
705    var open_height     =   parseInt(mapfunctions_vars.open_height,10);
706    var closed_height   =   parseInt(mapfunctions_vars.closed_height,10);
707
708    width_browser       =   jQuery(window).width();
709
710    infobox_width=700;
711    vertical_pan=-215;
712    if (width_browser<900){
713      infobox_width=500;
714    }
715    if (width_browser<600){
716      infobox_width=400;
717    }
718    if (width_browser<400){
719      infobox_width=200;
720    }
721
722
723
724
725    bounds = new google.maps.LatLngBounds();
726
727    for (var i = 0; i < locations.length; i++) {
728        var beach                       =   locations[i];
729        var id                          =   beach[10];
730        var lat                         =   beach[1];
731        var lng                         =   beach[2];
732        var title                       =   decodeURIComponent ( beach[0] );
733        var pin                         =   beach[8];
734        var counter                     =   beach[3];
735        var image                       =   decodeURIComponent ( beach[4] );
736        var price                       =   decodeURIComponent ( beach[5] );
737        var single_first_type           =   decodeURIComponent ( beach[6] );
738        var single_first_action         =   decodeURIComponent ( beach[7] );
739        var link                        =   decodeURIComponent ( beach[9] );
740        var cleanprice                  =   beach[11];
741        var rooms                       =   beach[12];
742        var baths                       =   beach[13];
743        var size                        =   beach[14];
744        var single_first_type_name      =   decodeURIComponent ( beach[15] );
745        var single_first_action_name    =   decodeURIComponent ( beach[16] );
746        var pin_price                   =   decodeURIComponent ( beach[17] );
747
748
749        wpestate_createMarker ( pin_price,size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,rooms,baths,cleanprice,single_first_type_name, single_first_action_name);
750
751        // found the property
752        if(selected_id===id){
753            found_id=i;
754        }
755
756
757    }//end for
758
759
760    wpestate_map_cluster();
761    if( !jQuery('body').hasClass('single-estate_property') ){
762        oms = new OverlappingMarkerSpiderfier(map, {markersWontMove: true, markersWontHide: true,keepSpiderfied :true,legWeight:2});
763        wpestate_setOms(gmarkers);
764    }
765
766    if(with_bound===1){
767        if (!bounds.isEmpty()) {
768
769            wpestate_fit_bounds(bounds);
770        }else{
771            wpestate_fit_bounds_nolsit();
772        }
773    }
774
775    // pan to the latest pin for taxonmy and adv search
776    if(mapfunctions_vars.generated_pins!=='0'){
777        myLatLng  = new google.maps.LatLng(lat, lng);
778    }
779
780
781
782
783}// end wpestate_setMarkers
784
785
786/////////////////////////////////////////////////////////////////////////////////////////////////
787//  create marker
788/////////////////////////////////////////////////////////////////////////////////////////////////
789
790
791function   wpestate_createMarker ( pin_price,size, i,id,lat,lng,pin,title,counter,image,price,single_first_type,single_first_action,link,rooms,baths,cleanprice,single_first_type_name, single_first_action_name){
792
793    "use strict";
794    var myLatLng        =   new google.maps.LatLng(lat,lng);
795    var Titlex          =   jQuery('<textarea />').html(title).text();
796    var poss            =   0;
797    var infobox_class   =   " price_infobox ";
798    var boxText         =   document.createElement("div");
799
800    var myOptions = {
801        content: boxText,
802        disableAutoPan: true,
803        maxWidth: infobox_width,
804        boxClass:"mybox",
805        zIndex: null,
806        closeBoxMargin: "-13px 0px 0px 0px",
807        closeBoxURL: "",
808        infoBoxClearance: new google.maps.Size(1, 1),
809        isHidden: false,
810        pane: "floatPane",
811        enableEventPropagation: true
812    };
813    infoBox = new InfoBox(myOptions);
814
815
816
817    if(mapfunctions_vars.useprice === 'yes'){
818
819
820
821        var price2=price;
822        var my_custom_curr_pos     =   parseFloat( wpestate_getCookie_map('my_custom_curr_pos'));
823        if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) {
824            var converted_price= wpestate_get_price_currency(cleanprice,cleanprice);
825            var testRE = price.match('</span>(.*)<span class=');
826            if (testRE !== null ){
827                price2=price.replace(testRE[1],converted_price);
828            }
829        }
830
831
832	var myLatlng = new google.maps.LatLng(lat,lng);
833        marker= new WpstateMarker(
834            poss,
835            myLatlng,
836            map,
837            Titlex,
838            counter,
839            image,
840            id,
841
842            price2,
843            pin_price,
844            single_first_type,
845            single_first_action,
846            link,
847            i,
848            rooms,
849            baths,
850            cleanprice,
851            size,
852            single_first_type_name,
853            single_first_action_name,
854            pin,
855            i
856        );
857    }else{
858        infobox_class=" classic_info ";
859        var marker = new google.maps.Marker({
860            position:           myLatLng,
861            map:                map,
862            icon:               wpestate_custompin(pin),
863            shape:              shape,
864            title:              Titlex,
865            zIndex:             counter,
866            image:              image,
867            idul:               id,
868            price:              price,
869            category:           single_first_type,
870            action:             single_first_action,
871            link:               link,
872            infoWindowIndex :   i,
873            rooms:              rooms,
874            baths:              baths,
875            cleanprice:         cleanprice,
876            size:               size,
877            category_name:      single_first_type_name,
878            action_name:        single_first_action_name
879        });
880
881    }
882
883
884    gmarkers.push(marker);
885    bounds.extend(marker.getPosition());
886    google.maps.event.addListener(marker, 'click', function(event) {
887
888        //  wpestate_new_open_close_map(1);
889
890        if( typeof(is_map_shortcode) ==="undefined" ){
891            wpestate_map_callback( wpestate_new_open_close_map );
892            google.maps.event.trigger(map, 'resize');
893        }
894
895        if(this.image===''){
896            info_image='<img src="' + mapfunctions_vars.path + '/idxdefault.jpg" />';
897        }else{
898            info_image=this.image;
899        }
900
901        var category         =   decodeURIComponent ( this.category.replace(/-/g,' ') );
902        var action           =   decodeURIComponent ( this.action.replace(/-/g,' ') );
903        var category_name    =   decodeURIComponent ( this.category_name.replace(/-/g,' ') );
904        var action_name      =   decodeURIComponent ( this.action_name.replace(/-/g,' ') );
905        var in_type          =   mapfunctions_vars.in_text;
906        if(category==='' || action===''){
907            in_type=" ";
908        }
909
910        var infobaths;
911        if(this.baths!='' && this.baths!=0){
912            infobaths ='<span id="infobath">'+this.baths+' '+mapfunctions_vars.ba+'</span>';
913        }else{
914            infobaths ='';
915        }
916
917        var inforooms;
918        if(this.rooms!='' && this.rooms!=0){
919            inforooms='<span id="inforoom">'+this.rooms+' '+mapfunctions_vars.bd+'</span>';
920        }else{
921            inforooms='';
922        }
923
924        var infosize;
925        if(this.size!=''){
926            infosize ='<span id="infosize">'+this.size;
927
928            infosize =infosize+'</span>';
929        }else{
930            infosize='';
931        }
932
933
934        var title=  this.title.substr(0, 30);
935        if(this.title.length > 30){
936            title=title+"...";
937        }
938
939
940        infoBox.setContent( wpestate_generate_infobox(infobox_class,title,link,info_image,price,cleanprice,infosize,infobaths,inforooms));
941        infoBox.open(map, this);
942        map.setCenter(this.position);
943
944            if (control_vars.show_adv_search_map_close === 'no') {
945                $('.search_wrapper').addClass('adv1_close');
946                wpestate_adv_search_click();
947            }
948
949            wpestate_close_adv_search();
950    });/////////////////////////////////// end event listener
951
952
953
954}
955
956function  wpestate_pan_to_last_pin(myLatLng){
957    "use strict";
958    map.setCenter(myLatLng);
959}
960
961
962function wpestate_generate_infobox(infobox_class,title,link,info_image,price,cleanprice,infosize,infobaths,inforooms){
963
964    var infobox= '<div class="info_details '+infobox_class+'"><span id="infocloser" onClick=\'javascript:infoBox.close();\' ></span>';
965    infobox = infobox+ '<div class="infobox_wrapper_image"> <a href="'+link+'">'+info_image+'</a></div>';
966    infobox = infobox+ '<div class="infobox_title"><a href="'+link+'" id="infobox_title">'+title+'</a></div>';
967    infobox = infobox+ '<div class="prop_pricex">'+price+'</div>';
968    infobox = infobox+ '<div class="infobox_details">'+inforooms+' '+infobaths+' '+infosize+'</div></div>';
969
970    return infobox;
971
972}
973
974function wpestate_generate_infobox_sh(infobox_class,title,link,info_image,price,cleanprice,infosize,infobaths,inforooms){
975
976    var infobox= '<div class="info_details '+infobox_class+'"><span id="infocloser" onClick=\'javascript:infoBox_sh.close();\' ></span>';
977    infobox = infobox+ '<div class="infobox_wrapper_image"> <a href="'+link+'">'+info_image+'</a></div>';
978    infobox = infobox+ '<div class="infobox_title"><a href="'+link+'" id="infobox_title">'+title+'</a></div>';
979    infobox = infobox+ '<div class="prop_pricex">'+price+'</div>';
980    infobox = infobox+ '<div class="infobox_details">'+inforooms+' '+infobaths+' '+infosize+'</div></div>';
981
982    return infobox;
983
984}
985
986
987function wpestate_generate_infobox_leaflet(infobox_class,title,link,info_image,price,cleanprice,infosize,infobaths,inforooms){
988    var title=  title.substr(0, 32);
989    if(title.length > 32){
990        title=title+"...";
991    }
992    var infobox= '<div class="info_details '+infobox_class+'"><span id="infocloser" onClick=\'javascript:jQuery(".leaflet-popup-close-button")[0].click();\' ></span>';
993    infobox = infobox+ '<div class="infobox_wrapper_image"> <a href="'+link+'">'+info_image+'</a></div>';
994    infobox = infobox+ '<div class="infobox_title"><a href="'+link+'" id="infobox_title">'+title+'</a></div>';
995    infobox = infobox+ '<div class="prop_pricex">'+price+'</div>';
996    infobox = infobox+ '<div class="infobox_details">'+inforooms+' '+infobaths+' '+infosize+'</div></div>';
997
998    return infobox;
999
1000}
1001
1002
1003/////////////////////////////////////////////////////////////////////////////////////////////////
1004//  map set search
1005/////////////////////////////////////////////////////////////////////////////////////////////////
1006function wpestate_setOms(gmarkers){
1007    "use strict";
1008    for (var i = 0; i < gmarkers.length; i++) {
1009        if(typeof oms !== 'undefined'){
1010           oms.addMarker(gmarkers[i]);
1011        }else{
1012
1013        }
1014    }
1015
1016}
1017
1018/////////////////////////////////////////////////////////////////////////////////////////////////
1019//  map set search
1020/////////////////////////////////////////////////////////////////////////////////////////////////
1021
1022function wpestate_set_google_search(map){
1023    "use strict";
1024    if( parseInt(mapbase_vars.wp_estate_kind_of_map) == 2 || jQuery('#google-default-search').length===0 ){
1025        return;
1026    }
1027
1028
1029    var input,searchBox,places,place;
1030
1031    input = (document.getElementById('google-default-search'));
1032    searchBox = new google.maps.places.SearchBox(input);
1033
1034
1035    google.maps.event.addListener(searchBox, 'places_changed', function() {
1036    places = searchBox.getPlaces();
1037
1038    if (places.length == 0) {
1039      return;
1040    }
1041
1042    var bounds = new google.maps.LatLngBounds();
1043    for (var i = 0; place = places[i]; i++) {
1044        var image = {
1045            url: place.icon,
1046            size: new google.maps.Size(71, 71),
1047            origin: new google.maps.Point(0, 0),
1048            anchor: new google.maps.Point(17, 34),
1049            scaledSize: new google.maps.Size(25, 25)
1050        };
1051
1052        // Create a marker for each place.
1053        var marker = new google.maps.Marker({
1054            map: map,
1055            icon: image,
1056            title: place.name,
1057            position: place.geometry.location
1058        });
1059
1060        gmarkers.push(marker);
1061        bounds.extend(place.geometry.location);
1062
1063    }
1064
1065    map.fitBounds(bounds);
1066    if (!bounds.isEmpty()) {
1067        wpestate_fit_bounds(bounds);
1068    }else{
1069        wpestate_fit_bounds_nolsit();
1070    }
1071    map.setZoom(15);
1072  });
1073
1074
1075    google.maps.event.addListener(map, 'bounds_changed', function() {
1076    var bounds = map.getBounds();
1077    searchBox.setBounds(bounds);
1078  });
1079
1080}
1081
1082function wpestate_fit_bounds_nolsit(){
1083    "use strict";
1084    map.setZoom(3);
1085}
1086
1087
1088
1089function wpestate_fit_bounds(bounds){
1090    "use strict";
1091    if(placeCircle!=''){
1092        map.fitBounds(placeCircle.getBounds());
1093    }else{
1094         map.fitBounds(bounds);
1095        google.maps.event.addListenerOnce(map, 'idle', function() {
1096            if( map.getZoom()>15 ) {
1097                map.setZoom(15);
1098            }
1099        });
1100    }
1101
1102
1103}
1104
1105
1106/////////////////////////////////////////////////////////////////////////////////////////////////
1107//  open close map
1108/////////////////////////////////////////////////////////////////////////////////////////////////
1109
1110function wpestate_new_open_close_map(type){
1111    "use strict";
1112    if( jQuery('#gmap_wrapper').hasClass('fullmap') ){
1113        return;
1114    }
1115
1116    if(mapfunctions_vars.open_close_status !== '1'){ // we can resize map
1117
1118        var current_height  =   jQuery('#googleMap').outerHeight();
1119        var closed_height   =   parseInt(mapfunctions_vars.closed_height,10);
1120        var open_height     =   parseInt(mapfunctions_vars.open_height,10);
1121        var googleMap_h     =   open_height;
1122        var gmapWrapper_h   =   open_height;
1123
1124        if( infoBox!== null){
1125            infoBox.close();
1126        }
1127
1128        if ( current_height === closed_height )  {
1129            googleMap_h = open_height;
1130            if (Modernizr.mq('only all and (max-width: 940px)')) {
1131               gmapWrapper_h = open_height;
1132            } else {
1133                jQuery('#gmap-menu').show();
1134                gmapWrapper_h = open_height;
1135            }
1136
1137            wpestate_new_show_advanced_search();
1138            vertical_off=0;
1139            jQuery('#openmap').empty().append('<i class="fas fa-angle-up"></i>'+mapfunctions_vars.close_map);
1140
1141        } else if(type===2) {
1142            jQuery('#gmap-menu').hide();
1143            jQuery('#advanced_search_map_form').hide();
1144            googleMap_h = gmapWrapper_h = closed_height;
1145
1146            // hide_advanced_search();
1147            wpestate_new_hide_advanced_search();
1148            vertical_off=150;
1149        }
1150        jQuery('#gmap_wrapper').css('height', gmapWrapper_h+'px');
1151        jQuery('#googleMap').css('height', googleMap_h+'px');
1152        jQuery('.tooltip').fadeOut("fast");
1153
1154        if(wp_estate_kind_of_map===1){
1155            setTimeout(function(){google.maps.event.trigger(map, "resize"); }, 300);
1156        }
1157    }
1158}
1159
1160
1161
1162
1163
1164/////////////////////////////////////////////////////////////////////////////////////////////////
1165//  build map cluter
1166/////////////////////////////////////////////////////////////////////////////////////////////////
1167function wpestate_map_cluster(){
1168    "use strict";
1169    if(mapfunctions_vars.user_cluster==='yes'){
1170        clusterStyles = [
1171            {
1172            textColor: '#ffffff',
1173            opt_textColor: '#ffffff',
1174            url: images['cloud_pin'],
1175            height: 72,
1176            width: 72,
1177            textSize:15,
1178
1179            }
1180        ];
1181        mcOptions = {gridSize: 50,
1182                    ignoreHidden:true,
1183                    maxZoom: parseInt( mapfunctions_vars.zoom_cluster,10),
1184                    styles: clusterStyles
1185                };
1186        mcluster = new MarkerClusterer(map, gmarkers, mcOptions);
1187        mcluster.setIgnoreHidden(true);
1188    }
1189
1190}
1191
1192
1193
1194/////////////////////////////////////////////////////////////////////////////////////////////////
1195/// zoom
1196/////////////////////////////////////////////////////////////////////////////////////////////////
1197
1198
1199if(  document.getElementById('gmapzoomplus') ){
1200    jQuery('#gmapzoomplus').on('click',function(){
1201        "use strict";
1202        var current= parseInt( map.getZoom(),10);
1203        current++;
1204        if(current>20){
1205            current=20;
1206        }
1207        map.setZoom(current);
1208    });
1209}
1210
1211
1212if(  document.getElementById('gmapzoomminus') ){
1213    jQuery('#gmapzoomminus').on('click',function(){
1214        "use strict";
1215        var current= parseInt( map.getZoom(),10);
1216        current--;
1217        if(current<0){
1218            current=0;
1219        }
1220        map.setZoom(current);
1221    });
1222}
1223
1224
1225
1226/////////////////////////////////////////////////////////////////////////////////////////////////
1227/// geolocation
1228/////////////////////////////////////////////////////////////////////////////////////////////////
1229
1230if(  document.getElementById('geolocation-button') ){
1231    jQuery('#geolocation-button').on('click',function(){
1232        "use strict";
1233        wpestate_myposition(map);
1234        wpestate_close_adv_search();
1235    });
1236}
1237
1238
1239if(  document.getElementById('mobile-geolocation-button') ){
1240    jQuery('#mobile-geolocation-button').on('click',function(){
1241        "use strict";
1242        wpestate_myposition(map);
1243        wpestate_close_adv_search();
1244    });
1245}
1246
1247
1248
1249
1250
1251function wpestate_myposition(map){
1252    "use strict";
1253    if(navigator.geolocation){
1254        var latLong;
1255        if (location.protocol === 'https:') {
1256            navigator.geolocation.getCurrentPosition(wpestate_showMyPosition_original,wpestate_errorCallback,{timeout:10000});
1257        }else{
1258            jQuery.getJSON("http://ipinfo.io", function(ipinfo){
1259                latLong = ipinfo.loc.split(",");
1260                wpestate_showMyPosition (latLong);
1261            });
1262        }
1263
1264    }else{
1265        alert(mapfunctions_vars.geo_no_brow);
1266    }
1267}
1268
1269
1270function wpestate_errorCallback(){
1271    "use strict";
1272    alert(mapfunctions_vars.geo_no_pos);
1273}
1274
1275
1276
1277
1278function wpestate_showMyPosition_original(pos){
1279    "use strict";
1280    if(wp_estate_kind_of_map===1){
1281        var shape = {
1282           coord: [1, 1, 1, 38, 38, 59, 59 , 1],
1283           type: 'poly'
1284        };
1285
1286        var MyPoint=  new google.maps.LatLng( pos.coords.latitude, pos.coords.longitude);
1287        map.setCenter(MyPoint);
1288
1289        var marker = new google.maps.Marker({
1290                 position: MyPoint,
1291                 map: map,
1292                 icon: wpestate_custompinchild(),
1293                 shape: shape,
1294                 title: '',
1295                 zIndex: 999999999,
1296                 image:'',
1297                 price:'',
1298                 category:'',
1299                 action:'',
1300                 link:'' ,
1301                 infoWindowIndex : 99 ,
1302                 radius: parseInt(mapfunctions_vars.geolocation_radius,10)+' '+mapfunctions_vars.geo_message
1303                });
1304
1305        var populationOptions = {
1306            strokeColor: '#67cfd8',
1307            strokeOpacity: 0.6,
1308            strokeWeight: 1,
1309            fillColor: '#67cfd8',
1310            fillOpacity: 0.2,
1311            map: map,
1312            center: MyPoint,
1313            radius: parseInt(mapfunctions_vars.geolocation_radius,10)
1314        };
1315
1316        var cityCircle = new google.maps.Circle(populationOptions);
1317
1318        var label = new Label({
1319            map: map
1320        });
1321        label.bindTo('position', marker);
1322        label.bindTo('text', marker, 'radius');
1323        label.bindTo('visible', marker);
1324        label.bindTo('clickable', marker);
1325        label.bindTo('zIndex', marker);
1326    }else{
1327
1328        var new_pos=[pos.coords.latitude, pos.coords.longitude];
1329        wprentals_draw_leaflet_circle(new_pos);
1330    }
1331
1332}
1333
1334
1335var geo_markers =   [];
1336var geo_circle  =   [];
1337var geo_label   =   [];
1338
1339function wpestate_showMyPosition(pos){
1340    "use strict";
1341
1342    if(wp_estate_kind_of_map===1){
1343        wpresidence_draw_google_circle(pos);
1344    }else if(wp_estate_kind_of_map===2){
1345       wprentals_draw_leaflet_circle(pos)
1346    }
1347
1348}
1349
1350
1351function wprentals_draw_leaflet_circle(pos){
1352
1353    L.circle( [pos[0],pos[1]], parseInt(mapfunctions_vars.geolocation_radius, 10)).addTo(map);
1354
1355    var markerImage = {
1356            iconUrl: wprentals_custompinchild_leaflet(),
1357            iconSize: [38, 59],
1358            iconAnchor: [20, 50],
1359            popupAnchor: [1, -50]
1360        };
1361    var  markerOptions = {
1362        riseOnHover: true
1363    };
1364
1365    var markerCenter    =   L.latLng( pos[0], pos[1] );
1366    markerOptions.icon = L.icon( markerImage );
1367    L.marker( markerCenter, markerOptions ).addTo( map );
1368
1369
1370    var wpresidence_leaflet_label = '<div class="wpresidence_leaflet_label">';
1371    wpresidence_leaflet_label+=parseInt(mapfunctions_vars.geolocation_radius, 10) + ' ' + mapfunctions_vars.geo_message
1372    wpresidence_leaflet_label += '</div>';
1373
1374    var myIcon = L.divIcon({
1375            className:'someclass',
1376            iconSize: new L.Point(0, 0),
1377            html: wpresidence_leaflet_label
1378        });
1379
1380    L.marker( markerCenter, {icon: myIcon} ).addTo( map );
1381
1382
1383    map.panTo(markerCenter);
1384    map.setZoom(10);
1385}
1386
1387
1388
1389
1390
1391
1392
1393function wpresidence_draw_google_circle(pos){
1394     "use strict";
1395    for (var i = 0; i < geo_markers.length; i++) {
1396        geo_markers[i].setMap(null);
1397        geo_circle[i].setMap(null);
1398        geo_label[i].setMap(null);
1399    }
1400
1401    geo_markers =   [];
1402    geo_circle  =   [];
1403    geo_label   =   [];
1404
1405
1406    var shape = {
1407        coord: [1, 1, 1, 38, 38, 59, 59 , 1],
1408        type: 'poly'
1409    };
1410
1411    // var MyPoint=  new google.maps.LatLng( pos.coords.latitude, pos.coords.longitude);
1412
1413    var MyPoint=  new google.maps.LatLng( pos[0], pos[1]);
1414    map.setCenter(MyPoint);
1415    map.setZoom(13);
1416    var marker = new google.maps.Marker({
1417            position: MyPoint,
1418            map: map,
1419            icon: wpestate_custompinchild(),
1420            shape: shape,
1421            title: '',
1422            zIndex: 999999999,
1423            image:'',
1424            price:'',
1425            category:'',
1426            action:'',
1427            link:'' ,
1428            infoWindowIndex : 99 ,
1429            radius: parseInt(mapfunctions_vars.geolocation_radius,10)+' '+mapfunctions_vars.geo_message
1430            });
1431    geo_markers.push(marker);
1432
1433
1434    var populationOptions = {
1435        strokeColor: '#67cfd8',
1436        strokeOpacity: 0.6,
1437        strokeWeight: 1,
1438        fillColor: '#67cfd8',
1439        fillOpacity: 0.2,
1440        map: map,
1441        center: MyPoint,
1442        radius: parseInt(mapfunctions_vars.geolocation_radius,10)
1443    };
1444
1445
1446
1447    var cityCircle = new google.maps.Circle(populationOptions);
1448    geo_circle.push(cityCircle);
1449
1450    var label = new Label({
1451        map: map
1452    });
1453
1454    label.bindTo('position', marker);
1455    label.bindTo('text', marker, 'radius');
1456    label.bindTo('visible', marker);
1457    label.bindTo('clickable', marker);
1458    label.bindTo('zIndex', marker);
1459    geo_label.push(cityCircle);
1460}
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470function wpestate_custompinchild(){
1471    "use strict";
1472
1473    var custom_img;
1474    var extension='';
1475    var ratio = jQuery(window).dense('devicePixelRatio');
1476
1477    if(ratio>1){
1478        extension='_2x';
1479    }
1480
1481
1482    if( typeof( images['userpin'] )=== 'undefined' ||  images['userpin']===''){
1483        custom_img= mapfunctions_vars.path+'/'+'userpin'+extension+'.png';
1484    }else{
1485        custom_img=images['userpin'];
1486        if(ratio>1){
1487            custom_img=wpestate_get_custom_retina_pin(custom_img);
1488        }
1489    }
1490
1491
1492
1493
1494    var   image;
1495    if(ratio>1){
1496        image = {
1497            url: custom_img,
1498            size: new google.maps.Size(88, 96),
1499            scaledSize   :  new google.maps.Size(44, 48),
1500            origin: new google.maps.Point(0,0),
1501            anchor: new google.maps.Point(16,59 )
1502        };
1503
1504    }else{
1505        image = {
1506            url: custom_img,
1507            size: new google.maps.Size(59, 59),
1508            origin: new google.maps.Point(0,0),
1509            anchor: new google.maps.Point(16,59 )
1510        };
1511    }
1512
1513
1514    return image;
1515
1516}
1517
1518
1519
1520
1521/////////////////////////////////////////////////////////////////////////////////////////////////
1522///
1523/////////////////////////////////////////////////////////////////////////////////////////////////
1524
1525if( document.getElementById('gmap') ){
1526    google.maps.event.addDomListener(document.getElementById('gmap'), 'mouseout', function () {
1527        google.maps.event.trigger(map, "resize");
1528    });
1529}
1530
1531
1532if(  document.getElementById('search_map_button') ){
1533    google.maps.event.addDomListener(document.getElementById('search_map_button'), 'click', function () {
1534        infoBox.close();
1535    });
1536}
1537
1538
1539
1540if(  document.getElementById('advanced_search_map_button') ){
1541    google.maps.event.addDomListener(document.getElementById('advanced_search_map_button'), 'click', function () {
1542       infoBox.close();
1543    });
1544}
1545
1546////////////////////////////////////////////////////////////////////////////////////////////////
1547/// navigate troguh pins
1548///////////////////////////////////////////////////////////////////////////////////////////////
1549
1550jQuery('#gmap-next').on( 'click', function(event) {
1551    "use strict";
1552    current_place++;
1553    external_action_ondemand=1;
1554    lealet_map_move_on_hover=1;
1555
1556    if (current_place>gmarkers.length){
1557        current_place=1;
1558    }
1559    while(gmarkers[current_place-1].visible===false){
1560        current_place++;
1561        if (current_place>gmarkers.length){
1562            current_place=1;
1563        }
1564    }
1565
1566    if( map.getZoom() <15 ){
1567        map.setZoom(15);
1568    }
1569
1570
1571
1572
1573    if(wp_estate_kind_of_map===1){
1574         google.maps.event.trigger(gmarkers[current_place-1], 'click');
1575    }else if(wp_estate_kind_of_map===2){
1576
1577        map.setView(gmarkers[current_place - 1].getLatLng());
1578        if (! gmarkers[current_place - 1]._icon) {
1579            gmarkers[current_place - 1].__parent.spiderfy();
1580        }
1581            lealet_map_move_on_hover=1;
1582
1583            map.setZoom(20);
1584
1585            if( (current_place - 1)==0 || (current_place - 1)==gmarkers.length ){
1586                setTimeout(function(){  gmarkers[current_place - 1].fire('click');  }, 1000);
1587            }else{
1588                gmarkers[current_place - 1].fire('click');
1589            }
1590
1591
1592        lealet_map_move_on_hover=1;
1593        wpestate_map_callback( wpestate_new_open_close_map );
1594    }
1595
1596});
1597
1598
1599jQuery('#gmap-prev').on( 'click', function(event) {
1600    "use strict";
1601    external_action_ondemand=1;
1602    lealet_map_move_on_hover=1;
1603    current_place--;
1604    if (current_place<1){
1605        current_place=gmarkers.length;
1606    }
1607    while(gmarkers[current_place-1].visible===false){
1608        current_place--;
1609        if (current_place>gmarkers.length){
1610            current_place=1;
1611        }
1612    }
1613    if( map.getZoom() <15 ){
1614        map.setZoom(15);
1615    }
1616
1617
1618    if(wp_estate_kind_of_map===1){
1619        google.maps.event.trigger(gmarkers[current_place-1], 'click');
1620    }else if(wp_estate_kind_of_map===2){
1621        map.setView(gmarkers[current_place - 1].getLatLng());
1622        if (! gmarkers[current_place - 1]._icon)  gmarkers[current_place - 1].__parent.spiderfy();
1623            lealet_map_move_on_hover=1;
1624
1625            map.setZoom(20);
1626
1627            if( (current_place - 1)==0 || (current_place )==gmarkers.length ){
1628                setTimeout(function(){  gmarkers[current_place - 1].fire('click');  }, 1000);
1629            }else{
1630                gmarkers[current_place - 1].fire('click');
1631            }
1632
1633        lealet_map_move_on_hover=1;
1634          wpestate_map_callback( wpestate_new_open_close_map );
1635    }
1636    current_place--;
1637});
1638
1639
1640
1641
1642
1643
1644
1645
1646///////////////////////////////////////////////////////////////////////////////////////////////////////////
1647/// filter pins
1648//////////////////////////////////////////////////////////////////////////////////////////////////////////
1649
1650jQuery('.advanced_action_div li').on( 'click', function(event) {
1651"use strict";
1652   var action = jQuery(this).val();
1653});
1654
1655
1656
1657
1658
1659if(  document.getElementById('gmap-menu') ){
1660    google.maps.event.addDomListener(document.getElementById('gmap-menu'), 'click', function (event) {
1661        "use strict";
1662        infoBox.close();
1663
1664        if (event.target.nodeName==='INPUT'){
1665            category=event.target.className;
1666
1667                if(event.target.name==="filter_action[]"){
1668                    if(actions.indexOf(category)!==-1){
1669                        actions.splice(actions.indexOf(category),1);
1670                    }else{
1671                        actions.push(category);
1672                    }
1673                }
1674
1675                if(event.target.name==="filter_type[]"){
1676                    if(categories.indexOf(category)!==-1){
1677                        categories.splice(categories.indexOf(category),1);
1678                    }else{
1679                        categories.push(category);
1680                    }
1681                }
1682
1683        show(actions,categories);
1684        }
1685
1686    });
1687}
1688
1689function wpestate_getCookieMap(cname) {
1690    "use strict";
1691    var name = cname + "=";
1692    var ca = document.cookie.split(';');
1693    for(var i=0; i<ca.length; i++) {
1694        var c = ca[i];
1695        while (c.charAt(0)==' ') c = c.substring(1);
1696        if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
1697    }
1698    return "";
1699}
1700
1701
1702
1703function wpestate_get_custom_value_tab_search(slug){
1704    "use strict";
1705    var value='';
1706    var is_drop=0;
1707
1708
1709
1710    if(slug === 'adv_categ' || slug === 'adv_actions' ||  slug === 'advanced_city' ||  slug === 'advanced_area'  ||  slug === 'county-state'){
1711        value = jQuery('.tab-pane.active #'+slug).attr('data-value');
1712    } else if(slug === 'property_price' && mapfunctions_vars.slider_price==='yes'){
1713        value = jQuery('.tab-pane.active #price_low').val();
1714    }else if(slug === 'property-country'){
1715        value = jQuery('.tab-pane.active #advanced_country').attr('data-value');
1716    }else if(slug === 'property_status'){
1717         value = jQuery('.tab-pane.active #adv_status').attr('data-value');
1718    }else if(slug === 'adv_location'){
1719         value = jQuery('.tab-pane.active .adv_locations_search').val();
1720    }else{
1721
1722        if(slug!==''){
1723            if( jQuery('.tab-pane.active #'+slug).hasClass('filter_menu_trigger') ){
1724                value = jQuery('.tab-pane.active #'+slug).attr('data-value');
1725                is_drop=1;
1726            }else{
1727                value = jQuery('.tab-pane.active #'+slug).val() ;
1728            }
1729        }
1730    }
1731
1732    return value;
1733
1734}
1735
1736
1737function wpestate_get_custom_value(slug){
1738    "use strict";
1739    var value;
1740    var is_drop=0;
1741    if(slug === 'adv_categ' || slug === 'adv_actions' ||  slug === 'advanced_city' ||  slug === 'advanced_area'  ||  slug === 'county-state'){
1742        value = jQuery('#'+slug).attr('data-value');
1743    } else if(slug === 'property_price' && mapfunctions_vars.slider_price==='yes'){
1744        value = jQuery('#price_low').val();
1745    }else if(slug === 'property_status'){
1746        value = jQuery('#adv_status').attr('data-value');
1747    }else if(slug === 'property-country'){
1748        value = jQuery('#advanced_country').attr('data-value');
1749    }else if(slug === 'adv_location'){
1750         value = jQuery('.adv_locations_search').val();
1751    }else{
1752
1753        if( jQuery('#'+slug).hasClass('filter_menu_trigger') ){
1754            value = jQuery('#'+slug).attr('data-value');
1755            is_drop=1;
1756        }else{
1757            value = jQuery('#'+slug).val() ;
1758
1759        }
1760    }
1761
1762
1763    if (typeof(value)!=='undefined'&& is_drop===0){
1764      //  value=  value .replace(" ","-");
1765    }
1766
1767    return value;
1768
1769}
1770
1771
1772
1773
1774 function wpestate_show_pins() {
1775    "use strict";
1776
1777    jQuery("#results").show();
1778    jQuery("#results_wrapper").empty().append('<div class="preview_results_loading">'+mapfunctions_vars.loading_results+'</div>').show();
1779
1780    var action, category, city, area, rooms, baths, min_price, price_max, ajaxurl,postid,halfmap, all_checkers,newpage;
1781
1782    if(  typeof infoBox!=='undefined' && infoBox!== null ){
1783        infoBox.close();
1784    }
1785
1786    jQuery('#gmap-loading').show();
1787    //- removed &&  googlecode_regular_vars.is_adv_search!=='1'
1788
1789    if( typeof(googlecode_regular_vars)!='undefined' ) {
1790        if( (mapfunctions_vars.adv_search_type==='8' || mapfunctions_vars.adv_search_type==='9') &&  mapfunctions_vars.is_half_map_list!=='1'   ){
1791            wpestate_show_pins_type2_tabs();
1792            return;
1793        }
1794
1795        if(mapfunctions_vars.adv_search_type==='2' && mapfunctions_vars.is_half_map_list!=='1' &&  mapfunctions_vars.is_adv_search!=='1' ){
1796            wpestate_show_pins_type2();
1797            return;
1798        }
1799    }else{
1800        if( (mapfunctions_vars.adv_search_type==='8' || mapfunctions_vars.adv_search_type==='9')   ){
1801            wpestate_show_pins_type2_tabs();
1802            return;
1803        }
1804
1805        if(mapfunctions_vars.adv_search_type==='2' && mapfunctions_vars.is_half_map_list!=='1'  ){
1806            wpestate_show_pins_type2();
1807            return;
1808        }
1809    }
1810
1811
1812
1813    if(mapfunctions_vars.custom_search==='yes'){
1814       wpestate_show_pins_custom_search();
1815       return;
1816    }
1817
1818
1819
1820    action      =   jQuery('#adv_actions').attr('data-value');
1821    category    =   jQuery('#adv_categ').attr('data-value');
1822    city        =   jQuery('#advanced_city').attr('data-value');
1823    area        =   jQuery('#advanced_area').attr('data-value');
1824    rooms       =   parseFloat(jQuery('#adv_rooms').val(), 10);
1825    baths       =   parseFloat(jQuery('#adv_bath').val(), 10);
1826    min_price   =   parseFloat(jQuery('#price_low').val(), 10);
1827    price_max   =   parseFloat(jQuery('#price_max').val(), 10);
1828    postid      =   parseFloat(jQuery('#adv-search-1').attr('data-postid'), 10);
1829    ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1830
1831
1832
1833    if ( parseInt(mapfunctions_vars.is_half)===1 ){
1834        if(first_time_wpestate_show_inpage_ajax_half===0){
1835            first_time_wpestate_show_inpage_ajax_half=1;
1836        }else{
1837            wpestate_show_inpage_ajax_half();
1838        }
1839
1840    }
1841
1842    all_checkers = '';
1843    jQuery('.search_wrapper .extended_search_check_wrapper  input[type="checkbox"]').each(function () {
1844        if (jQuery(this).is(":checked")) {
1845            all_checkers = all_checkers + "," + jQuery(this).attr("name-title");
1846        }
1847    });
1848
1849    halfmap     =   0;
1850    newpage     =   0;
1851    if( jQuery('#google_map_prop_list_sidebar').length ){
1852        halfmap    = 1;
1853    }
1854
1855    postid=1;
1856    if(  document.getElementById('search_wrapper') ){
1857        postid      =   parseInt(jQuery('#search_wrapper').attr('data-postid'), 10);
1858    }
1859
1860
1861    var geo_lat     =   '';
1862    var geo_long    =   '';
1863    var geo_rad     =   '';
1864
1865    if( jQuery("#geolocation_search").length > 0){
1866        geo_lat     =   jQuery('#geolocation_lat').val();
1867        geo_long    =   jQuery('#geolocation_long').val();
1868        geo_rad     =   jQuery('#geolocation_radius').val();
1869
1870    }
1871
1872    var nonce = jQuery('#wpestate_ajax_filtering').val();
1873    jQuery.ajax({
1874        type: 'POST',
1875        url: ajaxurl,
1876        dataType: 'json',
1877        data: {
1878            'action'            :   'wpestate_classic_ondemand_pin_load',
1879            'action_values'     :   action,
1880            'category_values'   :   category,
1881            'city'              :   city,
1882            'area'              :   area,
1883            'advanced_rooms'    :   rooms,
1884            'advanced_bath'     :   baths,
1885            'price_low'         :   min_price,
1886            'price_max'         :   price_max,
1887            'newpage'           :   newpage,
1888            'postid'            :   postid,
1889            'halfmap'           :   halfmap,
1890            'all_checkers'      :   all_checkers,
1891            'geo_lat'           :   geo_lat,
1892            'geo_long'          :   geo_long,
1893            'geo_rad'           :   geo_rad,
1894            'security'          :   nonce
1895        },
1896        success: function (data) {
1897            var no_results = parseInt(data.no_results);
1898
1899            if(no_results!==0){
1900                wpestate_load_on_demand_pins(data.markers,no_results,1);
1901            }else{
1902                wpestate_show_no_results();
1903            }
1904               jQuery('#gmap-loading').hide();
1905
1906        },
1907        error: function (errorThrown) {
1908
1909        }
1910    });//end ajax
1911
1912 }
1913
1914
1915
1916
1917
1918function wpestate_show_pins_type2(){
1919    "use strict";
1920    var action, category, location_search, ajaxurl,postid,halfmap, all_checkers,newpage;
1921    action      =   jQuery('#adv_actions').attr('data-value');
1922    category    =   jQuery('#adv_categ').attr('data-value');
1923    location_search    =   jQuery('#adv_location').val();
1924    postid      =   parseInt(jQuery('#adv-search-1').attr('data-postid'), 10);
1925    ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
1926
1927    halfmap     =   0;
1928    newpage     =   0;
1929
1930    if( jQuery('#google_map_prop_list_sidebar').length ){
1931        halfmap    = 1;
1932    }
1933
1934    postid=1;
1935
1936    if(  document.getElementById('search_wrapper') ){
1937        postid      =   parseInt(jQuery('#search_wrapper').attr('data-postid'), 10);
1938    }
1939    var nonce = jQuery('#wpestate_ajax_filtering').val();
1940    jQuery.ajax({
1941        type: 'POST',
1942        url: ajaxurl,
1943        dataType: 'json',
1944
1945        data: {
1946            'action'            :   'wpestate_classic_ondemand_pin_load_type2',
1947            'action_values'     :   action,
1948            'category_values'   :   category,
1949            'location'          :   location_search,
1950            'security'          :   nonce
1951        },
1952        success: function (data) {
1953            var no_results = parseInt(data.no_results);
1954
1955            if(no_results!==0){
1956                wpestate_load_on_demand_pins(data.markers,no_results,1);
1957            }else{
1958                wpestate_show_no_results();
1959            }
1960            jQuery('#gmap-loading').hide();
1961
1962        },
1963        error: function (errorThrown) {
1964        }
1965    });//end ajax
1966
1967
1968    if ( parseInt(mapfunctions_vars.is_half)===1 ){
1969        if(first_time_wpestate_show_inpage_ajax_half===0){
1970            first_time_wpestate_show_inpage_ajax_half=1;
1971        }else{
1972            wpestate_show_inpage_ajax_half();
1973        }
1974
1975    }
1976 }
1977
1978
1979
1980
1981
1982
1983function wpestate_show_pins_type2_tabs(){
1984    "use strict";
1985    var action, category, location_search, ajaxurl,postid,halfmap, all_checkers,newpage,picked_tax;
1986
1987    action              =   jQuery('.tab-pane.active #adv_actions').attr('data-value');
1988    if(typeof action === 'undefined'){
1989        action='';
1990    }
1991    category            =   jQuery('.tab-pane.active #adv_categ').attr('data-value');
1992    if(typeof category === 'undefined'){
1993        category='';
1994    }
1995    location_search     =   jQuery('.tab-pane.active #adv_location').val();
1996    picked_tax          =   jQuery('.tab-pane.active .picked_tax').val();
1997
1998
1999    postid      =   parseInt(jQuery('#adv-search-1').attr('data-postid'), 10);
2000    ajaxurl     =   ajaxcalls_vars.admin_url + 'admin-ajax.php';
2001    ajaxurl     =   ajaxcalls_vars.wpestate_ajax;
2002    halfmap     =   0;
2003    newpage     =   0;
2004
2005
2006    if( jQuery('#google_map_prop_list_sidebar').length ){
2007        halfmap    = 1;
2008    }
2009
2010    postid=1;
2011
2012    if(  document.getElementById('search_wrapper') ){
2013        postid      =   parseInt(jQuery('#search_wrapper').attr('data-postid'), 10);
2014    }
2015
2016    var term_id=jQuery('.tab-pane.active .term_id_class').val();
2017
2018    all_checkers = '';
2019    jQuery('.tab-pane.active .extended_search_check_wrapper input[type="checkbox"]').each(function () {
2020        if (jQuery(this).is(":checked")) {
2021            all_checkers = all_checkers + "," + jQuery(this).attr("name-title");
2022        }
2023    });
2024
2025    var nonce = jQuery('#wpestate_ajax_filtering').val();
2026
2027    jQuery.ajax({
2028        type: 'POST',
2029        url: ajaxurl,
2030        dataType: 'json',
2031
2032        data: {
2033            'action'            :   'wpestate_classic_ondemand_pin_load_type2_tabs',
2034            'action_values'     :   action,
2035            'category_values'   :   category,
2036            'location'          :   location_search,
2037            'picked_tax'        :   picked_tax,
2038            'all_checkers'      :   all_checkers,
2039            'security'          :   nonce
2040        },
2041        success: function (data) {
2042
2043            var no_results = parseInt(data.no_results);
2044
2045            if(no_results!==0){
2046                wpestate_load_on_demand_pins(data.markers,no_results,1);
2047            }else{
2048                wpestate_show_no_results();
2049            }
2050               jQuery('#gmap-loading').hide();
2051
2052        },
2053        error: function (errorThrown) {
2054
2055        }
2056    });//end ajax
2057
2058    if ( parseInt(mapfunctions_vars.is_half)===1 ){
2059        if(first_time_wpestate_show_inpage_ajax_half===0){
2060            first_time_wpestate_show_inpage_ajax_half=1;
2061        }else{
2062            wpestate_show_inpage_ajax_half();
2063        }
2064
2065    }
2066 }
2067
2068
2069function wpestate_show_pins_custom_search(){
2070    "use strict";
2071
2072
2073    var ajaxurl,initial_array_last_item,array_last_item,how_holder,slug_holder,val_holder,position, inserted_val,temp_val,term_id,halfmap,newpage,postid,slider_min,slider_max;
2074    ajaxurl             =   ajaxcalls_vars.wpestate_ajax;;
2075    inserted_val        =   0;
2076    array_last_item     =   parseInt( mapfunctions_vars.fields_no,10);
2077    initial_array_last_item =array_last_item;
2078    val_holder          =   [];
2079    slug_holder         =   [];
2080    how_holder          =   [];
2081
2082    //slug_holder         =   mapfunctions_vars.slugs;
2083    slug_holder = JSON.parse(JSON.stringify(mapfunctions_vars.slugs));
2084
2085   // how_holder          =   mapfunctions_vars.hows;
2086   how_holder= JSON.parse(JSON.stringify(mapfunctions_vars.hows));
2087
2088
2089
2090    var term_counter=0;
2091
2092
2093
2094    if( mapfunctions_vars.slider_price ==='yes' ){
2095        slider_min = jQuery('#price_low').val();
2096        slider_max = jQuery('#price_max').val();
2097
2098    }
2099
2100    var i;
2101    term_counter=parseInt( jQuery('.tab-pane.active').find('.term_counter').val(),10);
2102
2103
2104
2105
2106    if( (mapfunctions_vars.adv_search_type==='6' || mapfunctions_vars.adv_search_type==='7' ) ){ //&&  !jQuery('.halfsearch')[0]
2107        term_id=jQuery('.tab-pane.active .term_id_class').val();
2108
2109        if( mapfunctions_vars.slider_price ==='yes' ){
2110            slider_min = jQuery('#price_low_'+term_id).val();
2111            slider_max = jQuery('#price_max_'+term_id).val();
2112        }
2113
2114
2115        var start_counter = term_counter *mapfunctions_vars.fields_no;
2116
2117
2118
2119        if(term_counter>0){
2120            array_last_item=(array_last_item*term_counter)+array_last_item;
2121
2122        }
2123
2124
2125        for ( i=start_counter; i<array_last_item;i++){
2126
2127            if ( how_holder[i]=='date bigger' || how_holder[i]=='date smaller'){
2128                temp_val = wpestate_get_custom_value_tab_search (term_id+slug_holder[i]);
2129            }else{
2130                temp_val = wpestate_get_custom_value_tab_search (slug_holder[i]);
2131            }
2132
2133            if(typeof(temp_val)==='undefined'){
2134                temp_val='';
2135            }
2136            val_holder.push(  temp_val );
2137
2138        }
2139
2140
2141
2142    }else{
2143        for (i=0; i<array_last_item;i++){
2144            temp_val = wpestate_get_custom_value (slug_holder[i]);
2145            if(typeof(temp_val)==='undefined'){
2146                temp_val='';
2147            }
2148            val_holder.push(  temp_val );
2149        }
2150
2151    }
2152
2153
2154
2155    if( (mapfunctions_vars.adv_search_type==='6' || mapfunctions_vars.adv_search_type==='7' || mapfunctions_vars.adv_search_type==='8' || mapfunctions_vars.adv_search_type==='9' ) ){
2156        var tab_tax=jQuery('.adv_search_tab_item.active').attr('data-tax');
2157
2158
2159        if( jQuery('.halfsearch')[0] ){
2160            tab_tax=jQuery('.halfsearch').attr('data-tax');
2161        }
2162
2163
2164        if(tab_tax === 'property_category'){
2165            slug_holder[array_last_item]='adv_categ';
2166        }else if(tab_tax === 'property_action_category'){
2167            slug_holder[array_last_item]='adv_actions';
2168        }else if(tab_tax === 'property_city'){
2169            slug_holder[array_last_item]='advanced_city';
2170        }else if(tab_tax === 'property_area'){
2171            slug_holder[array_last_item]='advanced_area';
2172        }else if(tab_tax === 'property_county_state'){
2173            slug_holder[array_last_item]='county-state';
2174        }
2175
2176        how_holder[array_last_item]='like';
2177
2178
2179        val_holder[initial_array_last_item]=jQuery('.adv_search_tab_item.active').attr('data-term');
2180
2181
2182    }
2183
2184
2185    if ( parseInt(mapfunctions_vars.is_half)===1 ){
2186        if(first_time_wpestate_show_inpage_ajax_half===0){
2187            first_time_wpestate_show_inpage_ajax_half=1;
2188        }else{
2189            wpestate_show_inpage_ajax_half();
2190        }
2191
2192    }
2193    //was 2 times !
2194
2195    var   all_checkers = '';
2196
2197     if( mapfunctions_vars.adv_search_type==='6' ){
2198        jQuery('.tab-pane.active .extended_search_check_wrapper  input[type="checkbox"]').each(function () {
2199            if (jQuery(this).is(":checked")) {
2200                all_checkers = all_checkers + "," + jQuery(this).attr("name-title");
2201            }
2202        });
2203    }else{
2204
2205        jQuery('.search_wrapper .extended_search_check_wrapper  input[type="checkbox"]').each(function () {
2206            if (jQuery(this).is(":checked")) {
2207                all_checkers = all_checkers + "," + jQuery(this).attr("name-title");
2208            }
2209        });
2210    }
2211
2212
2213
2214
2215
2216    halfmap     =   0;
2217    newpage     =   0;
2218    if( jQuery('#google_map_prop_list_sidebar').length ){
2219        halfmap    = 1;
2220    }
2221
2222    postid=1;
2223    if(  document.getElementById('search_wrapper') ){
2224        postid      =   parseInt(jQuery('#search_wrapper').attr('data-postid'), 10);
2225    }
2226
2227    var filter_search_action10 ='';
2228    var adv_location10 ='';
2229
2230    if( mapfunctions_vars.adv_search_type==='10' ){
2231        filter_search_action10   = jQuery('#adv_actions').attr('data-value');
2232        adv_location10           = jQuery('#adv_location').val();
2233
2234    }
2235
2236
2237    var filter_search_action11  =   '';
2238    var filter_search_categ11   =   '';
2239    var keyword_search          =   '';
2240    keyword_search              = jQuery('#keyword').val();
2241    if( mapfunctions_vars.adv_search_type==='11' ){
2242        filter_search_action11      = jQuery('#adv_actions').attr('data-value');
2243        filter_search_categ11       = jQuery('#adv_categ').attr('data-value');
2244        keyword_search              = jQuery('#keyword_search').val();
2245    }
2246
2247
2248    var geo_lat     =   '';
2249    var geo_long    =   '';
2250    var geo_rad     =   '';
2251
2252    if( jQuery("#geolocation_search").length > 0){
2253        geo_lat     =   jQuery('#geolocation_lat').val();
2254        geo_long    =   jQuery('#geolocation_long').val();
2255        geo_rad     =   jQuery('#geolocation_radius').val();
2256
2257    }
2258
2259
2260    var nonce = jQuery('#wpestate_ajax_filtering').val();
2261    jQuery.ajax({
2262        type: 'POST',
2263        url: ajaxurl,
2264        dataType: 'json',
2265        data: {
2266            'action'                    :   'wpestate_custom_ondemand_pin_load',
2267            'search_type'               :   mapfunctions_vars.adv_search_type,
2268            'val_holder'                :   val_holder,
2269            'newpage'                   :   newpage,
2270            'postid'                    :   postid,
2271            'halfmap'                   :   halfmap,
2272            'slider_min'                :   slider_min,
2273            'slider_max'                :   slider_max,
2274            'all_checkers'              :   all_checkers,
2275            'filter_search_action10'    :   filter_search_action10,
2276            'adv_location10'            :   adv_location10,
2277            'filter_search_action11'    :   filter_search_action11,
2278            'filter_search_categ11'     :   filter_search_categ11,
2279            'keyword_search'            :   keyword_search,
2280            'geo_lat'                   :   geo_lat,
2281            'geo_long'                  :   geo_long,
2282            'geo_rad'                   :   geo_rad,
2283            'term_counter'              :   term_counter,
2284            'security'                  :   nonce
2285        },
2286        success: function (data) {
2287
2288
2289            var no_results = parseInt(data.no_results);
2290            if(no_results!==0){
2291                wpestate_load_on_demand_pins(data.markers,no_results,1);
2292            }else{
2293                wpestate_show_no_results();
2294            }
2295            jQuery('#gmap-loading').hide();
2296
2297        },
2298        error: function (errorThrown) {
2299
2300
2301        }
2302    });//end ajax
2303
2304
2305 }
2306
2307
2308
2309
2310function wpestate_empty_map(){
2311    "use strict";
2312    if (typeof gmarkers !== 'undefined') {
2313
2314        if(wp_estate_kind_of_map== 1 ){
2315            for (var i = 0; i < gmarkers.length; i++) {
2316                gmarkers[i].setVisible(false);
2317                gmarkers[i].setMap(null);
2318            }
2319            gmarkers = [];
2320
2321
2322            if( typeof (mcluster)!=='undefined'){
2323                mcluster.clearMarkers();
2324            }
2325        }  else if (wp_estate_kind_of_map==2){
2326            if(typeof map !='undefined'){
2327                if (mapfunctions_vars.user_cluster === 'yes') {
2328                    if(map.hasLayer(markers_cluster)){
2329                        map.removeLayer(markers_cluster);
2330                    }
2331                }else{
2332                    for (var i = 0; i < gmarkers.length; i++) {
2333                        map.removeLayer(gmarkers[i]);
2334                    }
2335                }
2336                gmarkers = [];
2337                markers_cluster=L.markerClusterGroup({
2338                    showCoverageOnHover: false,
2339                    iconCreateFunction: function(cluster) {
2340                        return L.divIcon({ html: '<div class="leaflet_cluster">' + cluster.getChildCount() + '</div>' });
2341                    },
2342                });
2343                map.addLayer(markers_cluster);
2344            }
2345        }
2346    }
2347}
2348
2349
2350
2351function wpestate_load_on_demand_pins(markers,no_results,show_results_bar){
2352    "use strict";
2353    jQuery('#gmap-noresult').hide();
2354
2355    wpestate_empty_map();
2356    if(  document.getElementById('googleMap') ){
2357        //wpestate_setMarkers(map, markers);
2358        bounds_list =undefined;
2359        wpresidence_map_general_set_markers(map, markers,1);
2360
2361        wpestate_preview_listings(markers);
2362
2363        //set map cluster
2364        wpresidence_map_general_cluster();
2365
2366        wpresidence_map_general_fit_to_bounds(1);
2367
2368    }else{
2369        wpestate_preview_listings(markers);
2370    }
2371
2372    if( jQuery("#geolocation_search").length > 0 && initialGeop === 0){
2373        var place_lat = jQuery('#geolocation_lat').val();
2374        var place_lng = jQuery('#geolocation_long').val();
2375
2376        if(place_lat!=='' && place_lng!=''){
2377            initialGeop=1;
2378            wpestate_geolocation_marker(place_lat,place_lng);
2379        }
2380    }
2381}
2382
2383
2384function  wpestate_preview_listings(markers){
2385    "use strict";
2386    var i           =   0;
2387    var to_append   =   '';
2388    var image       =   '';
2389    var title       =   '';
2390    var link        =   '';
2391    var clean_price =   '';
2392    var price       =   '';
2393    for (i = 0; i < markers.length; i++) {
2394        image       =   decodeURIComponent(markers[i][18]);
2395        title       =   decodeURIComponent(markers[i][0]);
2396        link        =   decodeURIComponent(markers[i][9]);
2397        clean_price =   decodeURIComponent(markers[i][11]);
2398        price       =   wpestate_get_price_currency ( decodeURIComponent(markers[i][5]),clean_price );
2399
2400        to_append=to_append+'<div class="preview_listing_unit" data-href="'+link+'">'+image+' <h4>'+title+'</h4><div class="preview_details">'+price+'</div></div>';
2401
2402
2403    }
2404
2405    jQuery('#results_wrapper').empty();
2406    jQuery('#results_no').show().text( markers.length);
2407
2408    jQuery('#results_wrapper').append(to_append);
2409
2410    jQuery('.preview_listing_unit').on( 'click', function(event) {
2411        event.preventDefault();
2412        var new_link;
2413        new_link =  jQuery(this).attr('data-href');
2414        window.open (new_link,'_self',false);
2415    });
2416
2417
2418}
2419
2420
2421function wpestate_get_price_currency(price,clean_price){
2422    "use strict";
2423    var new_price ='';
2424
2425    var my_custom_curr_symbol  =   decodeURIComponent ( wpestate_getCookie_map('my_custom_curr_symbol') );
2426    var my_custom_curr_coef    =   parseFloat( wpestate_getCookie_map('my_custom_curr_coef'));
2427    var my_custom_curr_pos     =   parseFloat( wpestate_getCookie_map('my_custom_curr_pos'));
2428    var my_custom_curr_cur_post=   wpestate_getCookie_map('my_custom_curr_cur_post');
2429    var slider_counter = 0;
2430
2431
2432    if (!isNaN(my_custom_curr_pos) && my_custom_curr_pos !== -1) {
2433        var temp_price =Number(clean_price*my_custom_curr_coef).toFixed(2);
2434        if (my_custom_curr_cur_post === 'before') {
2435            new_price = my_custom_curr_symbol+' '+temp_price;
2436        } else {
2437            new_price = temp_price+' '+my_custom_curr_symbol;
2438        }
2439
2440    } else {
2441        new_price=price;
2442    }
2443
2444    return new_price;
2445}
2446
2447function wpestate_getCookie_map(cname) {
2448    "use strict";
2449    var name = cname + "=";
2450    var ca = document.cookie.split(';');
2451    for(var i=0; i<ca.length; i++) {
2452        var c = ca[i];
2453        while (c.charAt(0)==' ') c = c.substring(1);
2454        if (c.indexOf(name) == 0) return c.substring(name.length,c.length);
2455    }
2456    return "";
2457   }
2458
2459
2460
2461function wpestate_show_no_results(){
2462    "use strict";
2463    jQuery('#results_no').show().text('0');
2464
2465    jQuery("#results_wrapper").empty().append('<div class="preview_results_loading">'+mapfunctions_vars.half_no_results+'</div>').show();
2466    jQuery('#gmap-noresult').show();
2467    if(  document.getElementById('google_map_prop_list_wrapper') ){
2468        jQuery('#listing_ajax_container').empty().append('<p class=" no_results_title ">'+mapfunctions_vars.half_no_results+'</p>');
2469    }
2470}
2471
2472
2473
2474function wpestate_show_inpage_ajax_tip2(){
2475    "use strict";
2476    if( jQuery('#gmap-full').hasClass('spanselected')){
2477        jQuery('#gmap-full').trigger('click');
2478    }
2479
2480
2481    if(mapfunctions_vars.custom_search==='yes'){
2482        wpestate_custom_search_start_filtering_ajax(1);
2483    }else{
2484        wpestate_start_filtering_ajax(1);
2485    }
2486}
2487
2488
2489
2490function wpestate_show_inpage_ajax_half(){
2491    "use strict";
2492    jQuery('.half-pagination').remove();
2493    if(mapfunctions_vars.custom_search==='yes'){
2494        wpestate_custom_search_start_filtering_ajax(1);
2495    }else{
2496        wpestate_start_filtering_ajax(1);
2497    }
2498}
2499
2500
2501function wpestate_enable_half_map_pin_action (){
2502    "use strict";
2503    jQuery('#google_map_prop_list_sidebar .listing_wrapper').on({
2504        mouseenter: function () {
2505            var listing_id = jQuery(this).attr('data-listid');
2506            wpestate_hover_action_pin(listing_id);
2507        },
2508        mouseleave: function () {
2509             var listing_id = jQuery(this).attr('data-listid');
2510            wpestate_return_hover_action_pin(listing_id);
2511        }
2512    });
2513}
2514
2515
2516/////////////////////////////////////////////////////////////////////////////////////////////////
2517/// get pin image
2518/////////////////////////////////////////////////////////////////////////////////////////////////
2519function wpestate_convertToSlug(Text){
2520    "use strict";
2521    return Text
2522        .toLowerCase()
2523        .replace(/ /g,'-')
2524        .replace(/[^\w-]+/g,'')
2525        ;
2526}
2527
2528
2529
2530
2531function wpestate_get_custom_retina_pin(custom_img){
2532    "use strict";
2533    var custom_img_retina;
2534    custom_img_retina=custom_img.replace(".png","_2x.png");
2535
2536    jQuery.get(custom_img_retina)
2537        .done(function() {
2538            custom_img = custom_img_retina;
2539        }).fail(function() {
2540        });
2541    return custom_img;
2542}
2543
2544
2545
2546
2547
2548function wpestate_custompin(image){
2549    "use strict";
2550
2551    var extension='';
2552    var ratio = jQuery(window).dense('devicePixelRatio');
2553    if(ratio>1){
2554        extension='_2x';
2555    }
2556    var custom_img;
2557
2558
2559
2560    if(mapfunctions_vars.use_single_image_pin==='no'){
2561        if(image!==''){
2562            if( typeof( images[image] )=== 'undefined' || images[image]===''){
2563                custom_img= mapfunctions_vars.path+'/'+image+extension+'.png';
2564            }else{
2565                custom_img=images[image];
2566
2567                if(ratio>1){
2568                    custom_img =wpestate_get_custom_retina_pin(custom_img);
2569                }
2570            }
2571        }else{
2572            custom_img= mapfunctions_vars.path+'/none.png';
2573        }
2574
2575        if(typeof (custom_img)=== 'undefined'){
2576            custom_img= mapfunctions_vars.path+'/none.png';
2577        }
2578    }else{
2579
2580        if(ratio>1){
2581            custom_img= wpestate_get_custom_retina_pin(  images['single_pin'] );
2582        }else{
2583            custom_img= images['single_pin'];
2584        }
2585    }
2586
2587
2588    if(ratio>1){
2589        image = {
2590            url: custom_img,
2591            size :  new google.maps.Size(118, 118),
2592            scaledSize   :  new google.maps.Size(44, 48),
2593            origin: new google.maps.Point(0,0),
2594            anchor: new google.maps.Point(16,49 ),
2595            optimized:false
2596        };
2597
2598    }else{
2599        image = {
2600            url: custom_img,
2601            size :  new google.maps.Size(59, 59),
2602            origin: new google.maps.Point(0,0),
2603            anchor: new google.maps.Point(16,49 )
2604        };
2605    }
2606    return image;
2607}
2608
2609
2610/////////////////////////////////////////////////////////////////////////////////////////////////
2611//// Circle label
2612/////////////////////////////////////////////////////////////////////////////////////////////////
2613
2614function Label(opt_options) {
2615    "use strict";
2616    // Initialization
2617    this.setValues(opt_options);
2618
2619
2620    // Label specific
2621    var span = this.span_ = document.createElement('span');
2622    span.style.cssText = 'position: relative; left: -50%; top: 8px; ' +
2623    'white-space: nowrap;  ' +
2624    'padding: 2px; background-color: white;opacity:0.7';
2625
2626
2627    var div = this.div_ = document.createElement('div');
2628    div.appendChild(span);
2629    div.style.cssText = 'position: absolute; display: none';
2630}
2631
2632
2633if (typeof google !== 'undefined') {
2634    Label.prototype = new google.maps.OverlayView;
2635}
2636
2637// Implement onAdd
2638Label.prototype.onAdd = function() {
2639    "use strict";
2640    var pane = this.getPanes().overlayImage;
2641    pane.appendChild(this.div_);
2642
2643
2644  // Ensures the label is redrawn if the text or position is changed.
2645    var me = this;
2646    this.listeners_ = [
2647        google.maps.event.addListener(this, 'position_changed', function() { me.draw(); }),
2648        google.maps.event.addListener(this, 'visible_changed', function() { me.draw(); }),
2649        google.maps.event.addListener(this, 'clickable_changed', function() { me.draw(); }),
2650        google.maps.event.addListener(this, 'text_changed', function() { me.draw(); }),
2651        google.maps.event.addListener(this, 'zindex_changed', function() { me.draw(); }),
2652        google.maps.event.addDomListener(this.div_, 'click', function() {
2653            if (me.get('clickable')) {
2654              google.maps.event.trigger(me, 'click');
2655            }
2656        })
2657    ];
2658};
2659
2660
2661// Implement onRemove
2662Label.prototype.onRemove = function() {
2663    "use strict";
2664    this.div_.parentNode.removeChild(this.div_);
2665
2666
2667    // Label is removed from the map, stop updating its position/text.
2668    for (var i = 0, I = this.listeners_.length; i < I; ++i) {
2669      google.maps.event.removeListener(this.listeners_[i]);
2670    }
2671};
2672
2673
2674// Implement draw
2675Label.prototype.draw = function() {
2676    "use strict";
2677    var projection = this.getProjection();
2678    var position = projection.fromLatLngToDivPixel(this.get('position'));
2679
2680
2681    var div = this.div_;
2682    div.style.left = position.x + 'px';
2683    div.style.top = position.y + 'px';
2684
2685
2686    var visible = this.get('visible');
2687    div.style.display = visible ? 'block' : 'none';
2688
2689
2690    var clickable = this.get('clickable');
2691    this.span_.style.cursor = clickable ? 'pointer' : '';
2692
2693
2694    var zIndex = this.get('zIndex');
2695    div.style.zIndex = zIndex;
2696
2697
2698    this.span_.innerHTML = this.get('text').toString();
2699};
2700
2701
2702
2703/////////////////////////////////////////////////////////////////////////////////////////////////
2704/// close advanced search
2705/////////////////////////////////////////////////////////////////////////////////////////////////
2706function wpestate_close_adv_search(){
2707    "use strict";
2708}
2709
2710//////////////////////////////////////////////////////////////////////
2711/// show advanced search
2712//////////////////////////////////////////////////////////////////////
2713
2714
2715function wpestate_new_show_advanced_search(){
2716    "use strict";
2717    jQuery("#search_wrapper").removeClass("hidden");
2718}
2719
2720function wpestate_new_hide_advanced_search(){
2721    "use strict";
2722    if( mapfunctions_vars.show_adv_search ==='no' ){
2723        jQuery("#search_wrapper").addClass("hidden");
2724    }
2725
2726}
2727
2728function wpestate_hover_action_pin(listing_id){
2729    "use strict";
2730    for (var i = 0; i < gmarkers.length; i++) {
2731        if ( parseInt( gmarkers[i].idul,10) === parseInt( listing_id,10) ){
2732            if(wp_estate_kind_of_map===1){
2733                google.maps.event.trigger(gmarkers[i], 'click');
2734
2735                if(mapfunctions_vars.useprice !== 'yes'){
2736                    pin_hover_storage=gmarkers[i].icon;
2737                    gmarkers[i].setIcon(wpestate_custompinhover());
2738                }else{
2739                    gmarkers[i].addHoverClass();
2740                }
2741            }else if(wp_estate_kind_of_map===2){
2742
2743                lealet_map_move_on_hover=1;
2744                if (! gmarkers[i]._icon)  gmarkers[i].__parent.spiderfy();
2745                map.panTo(  gmarkers[i].getLatLng());
2746                gmarkers[i].togglePopup();
2747
2748                if(mapfunctions_vars.useprice !== 'yes'){
2749                    gmarkers[i].setIcon(wpestate_custompinhover());
2750                }else{
2751                    L.DomUtil.addClass(gmarkers[i]._icon, 'openstreet_price_marker_on_click_parent');
2752                }
2753
2754
2755            }
2756
2757        }
2758    }
2759}
2760
2761function wpestate_return_hover_action_pin(listing_id){
2762    "use strict";
2763    for (var i = 0; i < gmarkers.length; i++) {
2764        if ( parseInt( gmarkers[i].idul,10) === parseInt( listing_id,10) ){
2765
2766            if(wp_estate_kind_of_map===1){
2767                if (parseInt(gmarkers[i].idul, 10) === parseInt(listing_id, 10)) {
2768                    infoBox.close();
2769                    if(mapfunctions_vars.useprice !== 'yes'){
2770                        gmarkers[i].setIcon(pin_hover_storage);
2771                    }else{
2772                          gmarkers[i].removeHoverClass();
2773                    }
2774                }
2775            }  else if(wp_estate_kind_of_map===2){
2776
2777                gmarkers[i].togglePopup();
2778                lealet_map_move_on_hover=0;
2779                if(mapfunctions_vars.useprice !== 'yes'){
2780                    var markerImage      = L.icon({
2781                        iconUrl: wprentals_custompin_leaflet(gmarkers[i].pin),
2782                        iconSize: [44, 50],
2783                        iconAnchor: [20, 50],
2784                        popupAnchor: [1, -50]
2785                    });
2786                    gmarkers[i].setIcon(markerImage);
2787                }else{
2788                    L.DomUtil.removeClass(gmarkers[i]._icon, 'openstreet_price_marker_on_click_parent');
2789                }
2790            }
2791
2792
2793        }
2794    }
2795
2796}
2797
2798
2799function wpestate_custompinhover(){
2800    "use strict";
2801
2802    var custom_img,image;
2803    var extension='';
2804    var ratio = jQuery(window).dense('devicePixelRatio');
2805
2806    if(ratio>1){
2807        extension='_2x';
2808    }
2809    custom_img= mapfunctions_vars.path+'/hover'+extension+'.png';
2810
2811    if(wp_estate_kind_of_map===2){
2812       if(ratio>1){
2813
2814            var markerImage    = L.icon({
2815                iconUrl: custom_img,
2816                iconSize: [90, 90],
2817                iconAnchor: [40, 90],
2818                popupAnchor: [1, -90]
2819            });
2820       }else{
2821            var markerImage    = L.icon({
2822                iconUrl: custom_img,
2823                iconSize: [44, 50],
2824                iconAnchor: [20, 50],
2825                popupAnchor: [1, -50]
2826            });
2827        }
2828        return markerImage;
2829
2830    }
2831
2832
2833    if(ratio>1){
2834
2835        image = {
2836            url: custom_img,
2837            size :  new google.maps.Size(132, 144),
2838            scaledSize   :  new google.maps.Size(66, 72),
2839            origin: new google.maps.Point(0,0),
2840            anchor: new google.maps.Point(25,72 )
2841          };
2842
2843    }else{
2844        image = {
2845            url: custom_img,
2846            size: new google.maps.Size(90, 90),
2847            origin: new google.maps.Point(0,0),
2848            anchor: new google.maps.Point(25,72 )
2849        };
2850    }
2851
2852
2853    return image;
2854}
2855
2856
2857
2858
2859function wpestate_map_callback(callback){
2860    "use strict";
2861    callback(1);
2862}
2863
2864
2865
2866
2867var wpestate_initialize_poi = function ( map_for_poi,what){
2868    "use strict";
2869
2870
2871    if( parseInt(mapbase_vars.wp_estate_kind_of_map) == 2 || typeof(google.maps.places)==='undefined'){
2872        return;
2873    }
2874    var poi_service         =   new google.maps.places.PlacesService( map_for_poi );
2875    var already_serviced    =   '';
2876    var show_poi            =   '';
2877    var map_bounds          =   map_for_poi.getBounds();
2878    var selector            =   '.google_poi';
2879    if(what==2){
2880        selector = '.google_poish';
2881    }
2882
2883
2884    jQuery(selector).on( 'click', function(event) {
2885        event.stopPropagation();
2886        poi_type        =   jQuery(this).attr('id');
2887        var position    =   map_for_poi.getCenter();
2888        var show_poi    =   wpestate_return_poi_values(poi_type);
2889
2890
2891        if( jQuery(this).hasClass('poi_active')){
2892            wpestate_show_hide_poi(poi_type,'hide');
2893        }else{
2894
2895            already_serviced = wpestate_show_hide_poi(poi_type,'show');
2896            if(already_serviced===1){
2897
2898                var request = {
2899                    location:   position,
2900                    types:      show_poi,
2901                    bounds:     map_bounds,
2902                    radius:     2500,
2903                };
2904                poi_service.nearbySearch( request,function (results, status){
2905                    wpestate_googlemap_display_poi(results, status,map_for_poi);
2906                });
2907            }
2908        }
2909        jQuery(this).toggleClass('poi_active');
2910    });
2911
2912
2913
2914
2915
2916    // return google poi types for selected poi
2917    var wpestate_return_poi_values = function (poi_type){
2918        var  show_poi;
2919        switch(poi_type) {
2920                case 'transport':
2921                    show_poi = ['bus_station', 'airport', 'train_station', 'subway_station'];
2922                    break;
2923                case 'supermarkets':
2924                    show_poi = ['grocery_or_supermarket', 'shopping_mall'];
2925                    break;
2926                case 'schools':
2927                    show_poi = ['school', 'university'];
2928                    break;
2929                case 'restaurant':
2930                    show_poi=['restaurant'];
2931                    break;
2932                case 'pharma':
2933                    show_poi = ['pharmacy'];
2934                    break;
2935                case 'hospitals':
2936                    show_poi = ['hospital'];
2937                    break;
2938            }
2939        return show_poi;
2940    };
2941
2942
2943    // add poi markers on the map
2944    var wpestate_googlemap_display_poi = function (results, status,map_for_poi) {
2945        var place, poi_marker;
2946        if ( google.maps.places.PlacesServiceStatus.OK == status  ) {
2947            for (var i = 0; i < results.length; i++) {
2948                poi_marker  =   wpestate_create_poi_marker(results[i],map_for_poi);
2949                poi_marker_array.push(poi_marker);
2950            }
2951        }
2952    };
2953
2954    // create the poi markers
2955    var wpestate_create_poi_marker = function (place,map_for_poi){
2956        var marker = new google.maps.Marker({
2957                map: map_for_poi,
2958                position: place.geometry.location,
2959                show_poi:poi_type,
2960                icon: mapfunctions_vars.path+'/poi/'+poi_type+'.png'
2961        });
2962
2963
2964        var boxText         =   document.createElement("div");
2965        var infobox_poi     =   new InfoBox({
2966                    content: boxText,
2967                    boxClass:"estate_poi_box",
2968                    pixelOffset: new google.maps.Size(-30, -70),
2969                    zIndex: null,
2970                    maxWidth: 275,
2971                    closeBoxMargin: "-13px 0px 0px 0px",
2972                    closeBoxURL: "",
2973                    infoBoxClearance: new google.maps.Size(1, 1),
2974                    pane: "floatPane",
2975                    enableEventPropagation: false
2976                });
2977
2978        google.maps.event.addListener(marker, 'mouseover', function(event) {
2979            infobox_poi.setContent(place.name);
2980            infobox_poi.open(map_for_poi, this);
2981        });
2982
2983        google.maps.event.addListener(marker, 'mouseout', function(event) {
2984            if( infobox_poi!== null){
2985                infobox_poi.close();
2986            }
2987        });
2988        return marker;
2989    };
2990
2991
2992
2993    // hide-show poi
2994    var wpestate_show_hide_poi = function (poi_type,showhide){
2995        var is_hiding=1;
2996
2997        for (var i = 0; i < poi_marker_array.length; i++) {
2998            if (poi_marker_array[i].show_poi === poi_type){
2999                if(showhide==='hide'){
3000                    poi_marker_array[i].setVisible(false);
3001                }else{
3002                    poi_marker_array[i].setVisible(true);
3003                    is_hiding=0;
3004                }
3005            }
3006        }
3007
3008        return is_hiding;
3009    };
3010};
3011
3012
3013
3014function wpestate_geolocation_marker (place_lat, place_lng){
3015    "use strict";
3016     var place_radius;
3017    if(control_vars.geo_radius_measure==='miles'){
3018        place_radius =parseInt( jQuery('#geolocation_radius').val(),10)*1609.34 ;
3019    }else{
3020        place_radius =parseInt( jQuery('#geolocation_radius').val(),10)*1000 ;
3021    }
3022
3023    if( wp_estate_kind_of_map===1){
3024        var place_position=new google.maps.LatLng(place_lat, place_lng);
3025        map.setCenter(place_position);
3026
3027        if(placeCircle!=''){
3028            placeCircle.setMap(null);
3029            placeCircle='';
3030        }
3031
3032        var marker = new google.maps.Marker({
3033            map: map,
3034            position:  place_position,
3035            icon: mapfunctions_vars.path+'/poi/location.png'
3036        });
3037
3038
3039        var populationOptions = {
3040            strokeColor: '#67cfd8',
3041            strokeOpacity: 0.6,
3042            strokeWeight: 1,
3043            fillColor: '#1CA8DD',
3044            fillOpacity: 0.2,
3045            map: map,
3046            center: place_position,
3047            radius: parseInt(place_radius,10)
3048        };
3049        placeCircle = new google.maps.Circle(populationOptions);
3050        map.fitBounds(placeCircle.getBounds());
3051    }else{
3052        var markerCenter    =   L.latLng(place_lat, place_lng );
3053        map.panTo(markerCenter);
3054        if(map.hasLayer(circleLayer)){
3055            map.removeLayer(circleLayer);
3056        }
3057
3058         var markerImage = {
3059                iconUrl:  mapfunctions_vars.path+'/poi/location.png',
3060                iconSize: [28, 38],
3061                iconAnchor: [10, 19],
3062                popupAnchor: [1, -18]
3063            };
3064        var  markerOptions = {
3065            riseOnHover: true
3066        };
3067        if(map.hasLayer(circleLayer)){
3068            map.removeLayer(circleLayer);
3069        }
3070        circleLayer=L.featureGroup();
3071        markerOptions.icon = L.icon( markerImage );
3072        L.marker( markerCenter, markerOptions ).addTo( map );
3073        placeCircle= L.circle( markerCenter, parseInt(place_radius,10) ).addTo(circleLayer);
3074
3075        map.addLayer(circleLayer);
3076        map.fitBounds(placeCircle.getBounds());
3077    }
3078
3079
3080
3081}
3082
3083
3084function wpestate_makeSafeForCSS(name) {
3085    return name.replace(/[^a-z0-9]/g, function(s) {
3086        var c = s.charCodeAt(0);
3087        if (c == 32) return '-';
3088        if (c >= 65 && c <= 90) return  s.toLowerCase();
3089        return  ('000' + c.toString(16)).slice(-4);
3090    });
3091}
3092
3093
3094

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.