PageSourceSearch

https://ezestate.net/wp-content/themes/wpresidence/js/google_js/mapfunctions.js?ver=1.0

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

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.