PageSourceSearch

http://vernonia.com/wp-content/plugins/wp-google-maps-pro/js/core.js?ver=5.73p

js vernonia.com collected 2026-10-02 00:59:00 UTC 153,385 bytes, 3,001 lines download raw bytes

1var MYMAP = new Array();
2var wpgmzaTable = new Array();
3
4var directionsDisplay = new Array();
5var directionsService = new Array();
6var infoWindow = new Array();
7var store_locator_marker = new Array();
8var cityCircle = new Array();
9var infoWindow_poly = new Array();
10var polygon_center = new Array();
11var WPGM_Path_Polygon = new Array();
12var WPGM_Path = new Array();
13var marker_array = new Array();
14var marker_array2 = new Array();
15var marker_sl_array = new Array();
16var wpgmza_controls_active = new Array();
17var wpgmza_adv_styling_json = new Array();
18var lazyload;
19var autoplay;
20var items;
21var default_items;
22var pagination;
23var navigation;
24var modern_iw_open = new Array();
25var markerClusterer = new Array();
26var original_iw;
27
28var wpgmza_iw_Div = new Array();
29
30var autocomplete = new Array();
31
32
33var retina = window.devicePixelRatio > 1;
34
35
36var click_from_list = false;
37
38var wpgmza_user_marker = null; //Prevent multiple drops of the user location pin
39            
40autoheight = true;
41autoplay = 6000;
42lazyload = true;
43pagination = false;
44navigation = true;
45items = 6;
46
47 if (typeof Array.prototype.forEach != 'function') {
48    Array.prototype.forEach = function(callback){
49      for (var i = 0; i < this.length; i++){
50        callback.apply(this, [this[i], i, this]);
51      }
52    };
53}
54
55for (var entry in wpgmaps_localize) {
56    modern_iw_open[entry] = false;
57    if ('undefined' === typeof window.jQuery) {
58        setTimeout(function(){ document.getElementById('wpgmza_map_'+wpgmaps_localize[entry]['id']).innerHTML = 'Error: In order for WP Google Maps to work, jQuery must be installed. A check was done and jQuery was not present. Please see the <a href="http://www.wpgmaps.com/documentation/troubleshooting/jquery-troubleshooting/" title="WP Google Maps - jQuery Troubleshooting">jQuery troubleshooting section of our site</a> for more information.'; }, 5000);
59    }
60    
61    
62}
63
64
65var wpgmza_retina_width;
66var wpgmza_retina_height;
67
68if ("undefined" !== typeof wpgmaps_localize_global_settings['wpgmza_settings_retina_width']) { wpgmza_retina_width = parseInt(wpgmaps_localize_global_settings['wpgmza_settings_retina_width']); } else { wpgmza_retina_width = 31; }
69if ("undefined" !== typeof wpgmaps_localize_global_settings['wpgmza_settings_retina_height']) { wpgmza_retina_height = parseInt(wpgmaps_localize_global_settings['wpgmza_settings_retina_height']); } else { wpgmza_retina_height = 45; }
70
71
72var user_location;
73
74function InitMap(map_id,cat_id,reinit) {
75    modern_iw_open[map_id] = false /* set modern infowindow open boolean to false to reset the creation of it considering the map has been reinitialized */
76    
77    if ('undefined' !== typeof wpgmaps_localize_shortcode_data) {
78        if (wpgmaps_localize_shortcode_data[map_id]['lat'] !== false && wpgmaps_localize_shortcode_data[map_id]['lng'] !== false) {
79            wpgmaps_localize[map_id]['map_start_lat'] = wpgmaps_localize_shortcode_data[map_id]['lat'];
80            wpgmaps_localize[map_id]['map_start_lng'] = wpgmaps_localize_shortcode_data[map_id]['lng'];
81
82        }
83    }
84    
85    
86    if ('undefined' === cat_id || cat_id === '' || !cat_id || cat_id === 0 || cat_id === "0") { cat_id = 'all'; }
87    
88    var myLatLng = new window.google.maps.LatLng(wpgmaps_localize[map_id]['map_start_lat'],wpgmaps_localize[map_id]['map_start_lng']);
89    google = window.google;
90    if (reinit === false) {
91        MYMAP[map_id].init("#wpgmza_map_"+map_id, myLatLng, parseInt(wpgmaps_localize[map_id]['map_start_zoom']), wpgmaps_localize[map_id]['type'],map_id);
92    }
93   
94    
95   
96
97    
98    
99
100    UniqueCode=Math.round(Math.random()*10000);
101    if ('undefined' !== typeof wpgmaps_localize_shortcode_data) {
102        if (wpgmaps_localize_shortcode_data[map_id]['lat'] !== false && wpgmaps_localize_shortcode_data[map_id]['lng'] !== false) {
103            /* we're using custom fields to create, only show the one marker */
104            var point = new google.maps.LatLng(parseFloat(wpgmaps_localize_shortcode_data[map_id]['lat']),parseFloat(wpgmaps_localize_shortcode_data[map_id]['lng']));
105            var marker = new google.maps.Marker({
106                position: point,
107                map: MYMAP[map_id].map
108            });
109
110        }
111    } else {
112        if (typeof wpgmaps_map_mashup[map_id] !== "undefined" && wpgmaps_map_mashup[map_id] === true) {
113            wpgmaps_localize_mashup_ids[map_id].forEach(function(entry_mashup) {
114                if (typeof wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] !== "undefined" && wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] === 1) { 
115                    /* dont show markers */
116                    MYMAP[map_id].placeMarkers(wpgmaps_markerurl+entry_mashup+'markers.xml?u='+UniqueCode,map_id,cat_id,null,null,null,null,false);
117                } else if (typeof wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] !== "undefined" && wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] === 2) { 
118                    MYMAP[map_id].placeMarkers(wpgmaps_markerurl+entry_mashup+'markers.xml?u='+UniqueCode,map_id,cat_id,null,null,null,null,true);
119                } else if (typeof wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] === "undefined") { 
120                    MYMAP[map_id].placeMarkers(wpgmaps_markerurl+entry_mashup+'markers.xml?u='+UniqueCode,map_id,cat_id,null,null,null,null,true);
121                } else {
122                    MYMAP[map_id].placeMarkers(wpgmaps_markerurl+entry_mashup+'markers.xml?u='+UniqueCode,map_id,cat_id,null,null,null,null,true);
123                }
124                
125            });
126        } else {
127            if (typeof wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] !== "undefined" && wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] === 1) { 
128                /* dont show markers */
129                MYMAP[map_id].placeMarkers(wpgmaps_markerurl+map_id+'markers.xml?u='+UniqueCode,map_id,cat_id,null,null,null,null,false);
130            } else if (typeof wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] !== "undefined" && wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] === 2) { 
131                MYMAP[map_id].placeMarkers(wpgmaps_markerurl+map_id+'markers.xml?u='+UniqueCode,map_id,cat_id,null,null,null,null,true);
132            } else if (typeof wpgmaps_localize[map_id]['other_settings']['store_locator_hide_before_search'] === "undefined") { 
133                MYMAP[map_id].placeMarkers(wpgmaps_markerurl+map_id+'markers.xml?u='+UniqueCode,map_id,cat_id,null,null,null,null,true);
134            } else {
135                MYMAP[map_id].placeMarkers(wpgmaps_markerurl+map_id+'markers.xml?u='+UniqueCode,map_id,cat_id,null,null,null,null,true);
136            }
137            
138        }
139    }
140};
141
142function resetLocations(map_id) {
143  if (typeof jQuery("#addressInput_"+map_id) === "object") { jQuery("#addressInput_"+map_id).val(''); }
144  if (typeof jQuery("#nameInput_"+map_id) === "object") { jQuery("#nameInput_"+map_id).val(''); }
145  reset_marker_lists(map_id);
146  InitMap(map_id,'all',true);
147  MYMAP[map_id].map.setZoom(parseInt(wpgmaps_localize[map_id]['map_start_zoom']));
148
149}
150
151function fillInAddress(mid) {
152  // Get the place details from the autocomplete object.
153  var place = autocomplete[mid].getPlace();
154}
155
156for (var entry in wpgmaps_localize) {
157    
158    var curmid = wpgmaps_localize[entry]['id'];
159    
160    var elementExists = document.getElementById('addressInput_'+curmid);
161
162    var wpgmza_input_to_exists = document.getElementById('wpgmza_input_to_'+curmid);
163    var wpgmza_input_from_exists = document.getElementById('wpgmza_input_from_'+curmid);
164
165    if (typeof google === 'object' && typeof google.maps === 'object' && typeof google.maps.places === 'object' && typeof google.maps.places.Autocomplete === 'function') {
166
167        if (elementExists !== null) {
168            if (typeof wpgmaps_localize[curmid]['other_settings']['wpgmza_store_locator_restrict'] !== "undefined" && wpgmaps_localize[curmid]['other_settings']['wpgmza_store_locator_restrict'] != "") {
169                autocomplete[curmid] = new google.maps.places.Autocomplete(
170                (document.getElementById('addressInput_'+curmid)),
171                {types: ['geocode'], componentRestrictions: {country: wpgmaps_localize[curmid]['other_settings']['wpgmza_store_locator_restrict']} });
172                google.maps.event.addListener(autocomplete[curmid], 'place_changed', function() {
173                    fillInAddress(curmid);
174                });
175            } else {
176                autocomplete[curmid] = new google.maps.places.Autocomplete(
177                (document.getElementById('addressInput_'+curmid)),
178                {types: ['geocode']});
179                google.maps.event.addListener(autocomplete[curmid], 'place_changed', function() {
180                    fillInAddress(curmid);
181                });
182            }
183        }
184
185        if (wpgmza_input_to_exists !== null) {
186            autocomplete[curmid] = new google.maps.places.Autocomplete(
187            (document.getElementById('wpgmza_input_to_'+curmid)),
188            {types: ['geocode']});
189            google.maps.event.addListener(autocomplete[curmid], 'place_changed', function() {
190                fillInAddress(curmid);
191            });
192        }
193
194        if (wpgmza_input_from_exists !== null) {
195            autocomplete[curmid] = new google.maps.places.Autocomplete(
196            (document.getElementById('wpgmza_input_from_'+curmid)),
197            {types: ['geocode']});
198            google.maps.event.addListener(autocomplete[curmid], 'place_changed', function() {
199                fillInAddress(curmid);
200            });
201        }
202
203        
204        
205    }
206    document.getElementById('wpgmza_map_'+wpgmaps_localize[entry]['id']).innerHTML = 'Error: In order for WP Google Maps to work, jQuery must be installed. A check was done and jQuery was not present. Please see the <a href="http://www.wpgmaps.com/documentation/troubleshooting/jquery-troubleshooting/" title="WP Google Maps - jQuery Troubleshooting">jQuery troubleshooting section of our site</a> for more information.';
207}
208
209  
210
211function searchLocations(map_id) {
212    if (document.getElementById("addressInput_"+map_id) === null) { var address = null; } else { var address = document.getElementById("addressInput_"+map_id).value; }
213    if (document.getElementById("nameInput_"+map_id) === null) { var search_title = null; } else { var search_title = document.getElementById("nameInput_"+map_id).value; }
214    
215    var checkedCatValues = jQuery('.wpgmza_checkbox:checked').map(function() {
216        return this.value;
217    }).get();
218    if (checkedCatValues === "" || checkedCatValues.length < 1 || checkedCatValues === 0 || checkedCatValues === "0") { checkedCatValues = 'all'; }
219
220    if (address === null || address === "") {
221         var map_center = MYMAP[map_id].map.getCenter();
222        searchLocationsNear(map_id,checkedCatValues,map_center,search_title);
223    } else {
224
225        checker = address.split(",");
226        var wpgm_lat = "";
227        var wpgm_lng = "";
228        wpgm_lat = checker[0];
229        wpgm_lng = checker[1];
230        checker1 = parseFloat(checker[0]);
231        checker2 = parseFloat(checker[1]);
232
233        var geocoder = new google.maps.Geocoder();
234
235        if (typeof wpgmaps_localize[map_id]['other_settings']['wpgmza_store_locator_restrict'] !== "undefined" && wpgmaps_localize[map_id]['other_settings']['wpgmza_store_locator_restrict'] != "") {
236            if ((wpgm_lat.match(/[a-zA-Z]/g) === null && wpgm_lng.match(/[a-zA-Z]/g) === null) && checker.length === 2 && (checker1 != NaN && (checker1 <= 90 || checker1 >
236= -90)) && (checker2 != NaN && (checker2 <= 90 || checker2 >= -90))) {
237                var point = new google.maps.LatLng(parseFloat(wpgm_lat),parseFloat(wpgm_lng));
238                searchLocationsNear(map_id,checkedCatValues,point,search_title);
239            }
240            else {
241                /* is an address, must geocode */
242                geocoder.geocode({address: address,componentRestrictions: {country: wpgmaps_localize[map_id]['other_settings']['wpgmza_store_locator_restrict']}}, function(results, status) {
243                    if (status == google.maps.GeocoderStatus.OK) {
244                        searchLocationsNear(map_id,checkedCatValues,results[0].geometry.location,search_title);
245                    } else {
246                        alert(address + ' not found');
247                    }
248                });
249
250            }
251        } else {
252
253            if ((typeof wpgm_lng !== "undefined" && wpgm_lat.match(/[a-zA-Z]/g) === null && wpgm_lng.match(/[a-zA-Z]/g) === null) && checker.length === 2 && (checker1 != NaN && (checker1 <= 90 || checker1 >= -90)) && (checker2 != NaN && (checker2 <= 90 || checker2 >= -90))) {
254                var point = new google.maps.LatLng(parseFloat(wpgm_lat),parseFloat(wpgm_lng));
255                searchLocationsNear(map_id,checkedCatValues,point,search_title);
256            }
257            else {
258                /* is an address, must geocode */
259            geocoder.geocode({address: address}, function(results, status) {
260                    if (status == google.maps.GeocoderStatus.OK) {
261                        searchLocationsNear(map_id,checkedCatValues,results[0].geometry.location,search_title);
262                    } else {
263                        alert(address + ' not found');
264                    }
265                });
266
267            }
268
269        } 
270                
271
272          
273    }
274  }
275
276
277function clearLocations() {
278    infoWindow.forEach(function(entry,index) {
279        infoWindow[index].close();
280    });
281}
282
283
284
285
286function searchLocationsNear(mapid,category,center_searched,search_title) {
287    clearLocations();
288    var distance_type = document.getElementById("wpgmza_distance_type_"+mapid).value;
289    var radius = document.getElementById('radiusSelect_'+mapid).value;
290    if (parseInt(category) === 0) { category = 'all'; }
291    if (category === "0") { category = 'all'; }
292    if (category === "Not found") { category = 'all'; }
293    if (category === null) { category = 'all'; }
294    if (category.length < 1) { category = 'all'; }
295
296    if (distance_type === "1") {
297        if (radius === "1") { zoomie = 14; }
298        else if (radius === "5") { zoomie = 12; }
299        else if (radius === "10") { zoomie = 11; }
300        else if (radius === "25") { zoomie = 9; }
301        else if (radius === "50") { zoomie = 8; }
302        else if (radius === "75") { zoomie = 8; }
303        else if (radius === "100") { zoomie = 7; }
304        else if (radius === "150") { zoomie = 7; }
305        else if (radius === "200") { zoomie = 6; }
306        else if (radius === "300") { zoomie = 6; }
307        else { zoomie = 14; }
308    } else {
309        if (radius === "1") { zoomie = 14; }
310        else if (radius === "5") { zoomie = 12; }
311        else if (radius === "10") { zoomie = 11; }
312        else if (radius === "25") { zoomie = 10; }
313        else if (radius === "50") { zoomie = 9; }
314        else if (radius === "75") { zoomie = 9; }
315        else if (radius === "100") { zoomie = 8; }
316        else if (radius === "150") { zoomie = 8; }
317        else if (radius === "200") { zoomie = 7; }
318        else if (radius === "300") { zoomie = 7; }
319        else { zoomie = 14; }
320    }
321    
322
323    MYMAP[mapid].map.setCenter(center_searched);
324    MYMAP[mapid].map.setZoom(zoomie);
325    
326
327
328    
329    
330    if (typeof wpgmaps_map_mashup[mapid] !== "undefined" && wpgmaps_map_mashup[mapid] === true) {
331        wpgmaps_localize_mashup_ids[mapid].forEach(function(entry_mashup) {
332
333            MYMAP[mapid].placeMarkers(wpgmaps_markerurl+entry_mashup+'markers.xml?u='+UniqueCode,mapid,category,radius,center_searched,distance_type,search_title,true);
334        });
335    } else {
336        MYMAP[mapid].placeMarkers(wpgmaps_markerurl+mapid+'markers.xml?u='+UniqueCode,mapid,category,radius,center_searched,distance_type,search_title,true);
337    }
338    if (jQuery("#wpgmza_marker_holder_"+mapid).length > 0) {
339        /* ensure that the marker list is showing (this is if the admin has chosen to hide the markers until a store locator search is done */
340        jQuery("#wpgmza_marker_holder_"+mapid).show();
341    }
342    if( jQuery('#wpgmza_marker_list_container_'+wpgmaps_localize[entry]['id']).length > 0 ){
343        jQuery('#wpgmza_marker_list_container_'+wpgmaps_localize[entry]['id']).show();                         
344    }
345    
346}
347
348function toRad(Value) {
349    /** Converts numeric degrees to radians */
350    return Value * Math.PI / 180;
351}   
352
353function wpgmza_getUrlVars() {
354    var vars = {};
355    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
356        vars[key] = value;
357    });
358    return vars;
359}
360var wpgmza_open_marker = wpgmza_getUrlVars()["markerid"];
361var wpgmza_open_marker_zoom = wpgmza_getUrlVars()["mzoom"];
362
363
364            
365function wpgmza_reinitialisetbl(map_id) {
366    jQuery('#wpgmza_marker_holder_'+map_id).show();
367    if (wpgmaps_localize[map_id]['order_markers_by'] === "1") { wpgmaps_order_by = parseInt(0); } 
368    else if (wpgmaps_localize[map_id]['order_markers_by'] === "2") { wpgmaps_order_by = parseInt(2); } 
369    else if (wpgmaps_localize[map_id]['order_markers_by'] === "3") { wpgmaps_order_by = parseInt(4); } 
370    else if (wpgmaps_localize[map_id]['order_markers_by'] === "4") { wpgmaps_order_by = parseInt(5); } 
371    else if (wpgmaps_localize[map_id]['order_markers_by'] === "5") { wpgmaps_order_by = parseInt(3); } 
372    else { wpgmaps_order_by = 0; }
373    if (wpgmaps_localize[map_id]['order_markers_choice'] === "1") { wpgmaps_order_by_choice = "asc"; } 
374    else { wpgmaps_order_by_choice = "desc"; }
375    wpgmzaTable[map_id].fnClearTable( 0 );
376    wpgmzaTable[map_id] = jQuery('#wpgmza_table_'+map_id).DataTable({
377        "bProcessing": true,"aaSorting" : [],
378        responsive: true,
379        "iDisplayLength": wpgmza_settings_default_items,
380        "oLanguage": {
381                "sLengthMenu": wpgm_dt_sLengthMenu,
382                "sZeroRecords": wpgm_dt_sZeroRecords,
383                "sInfo": wpgm_dt_sInfo,
384                "sInfoEmpty": wpgm_dt_sInfoEmpty,
385                "sInfoFiltered": wpgm_dt_sInfoFiltered,
386                "sSearch": wpgm_dt_sSearch,
387                "oPaginate" : {
388                    "sFirst": wpgm_dt_sFirst,
389                    "sLast": wpgm_dt_sLast,
390                    "sNext": wpgm_dt_sNext,
391                    "sPrevious": wpgm_dt_sPrevious,
392                   "sSearch": wpgm_dt_sSearch
393                }
394        }
395
396    });
397
398
399}
400
401 function wpgmza_filter_marker_lists_by_array(map_id,marker_sl_array) {
402    /* update datatables (only if using datatables) */
403    if (typeof jQuery("#wpgmza_table_"+map_id) === "object") { 
404        var data = {
405                action: 'wpgmza_datatables_sl',
406                security: wpgmaps_pro_nonce,
407                map_id: map_id,
408                marker_array: marker_sl_array
409        };
410        jQuery.post(ajaxurl, data, function(response) {
411                jQuery("#wpgmza_marker_holder_"+map_id+"").html(response);
412                wpgmzaTable[map_id] = jQuery('#wpgmza_table_'+map_id).DataTable({
413                        "bDestroy":true,
414                        responsive: true,
415                        "iDisplayLength": wpgmza_settings_default_items,
416                        "bProcessing": true,"aaSorting" : [],
417                        "oLanguage": {
418                                "sLengthMenu": wpgm_dt_sLengthMenu,
419                                "sZeroRecords": wpgm_dt_sZeroRecords,
420                                "sInfo": wpgm_dt_sInfo,
421                                "sInfoEmpty": wpgm_dt_sInfoEmpty,
422                                "sInfoFiltered": wpgm_dt_sInfoFiltered,
423                                "sSearch": wpgm_dt_sSearch,
424                                "oPaginate" : {
425                                    "sFirst": wpgm_dt_sFirst,
426                                    "sLast": wpgm_dt_sLast,
427                                    "sNext": wpgm_dt_sNext,
428                                    "sPrevious": wpgm_dt_sPrevious,
429                                   "sSearch": wpgm_dt_sSearch
430                                }
431                        }
432
433                    });
434
435        });
436    }
437    if (typeof jQuery("#wpgmza_marker_list_container_"+map_id) === "object" && jQuery("#wpgmza_marker_list_container_"+map_id).length > 0) {
438        if (jQuery("#wpgmza_marker_list_container_"+map_id).hasClass('wpgmza_marker_carousel')) {
439            /* carousel listing */
440            var data = {
441                    action: 'wpgmza_sl_carousel',
442                    security: wpgmaps_pro_nonce,
443                    map_id: map_id,
444                    marker_array: marker_sl_array
445            };
446            jQuery.post(ajaxurl, data, function(response) {
447                    items = default_items;
448                    jQuery("#wpgmza_marker_list_container_"+map_id+"").html(response);
449                    if (marker_sl_array.length < items) { items = marker_sl_array.length; } else { items = default_items; }
450                    if (items < 1) { items = 1; }
451
452                    jQuery("#wpgmza_marker_list_"+map_id+"").owlCarousel({
453                        autoPlay: autoplay,
454                        lazyLoad : lazyload,
455                        autoHeight : autoheight,
456                        pagination : pagination,
457                        navigation : navigation,
458                        items : items
459                    });
460
461            });
462        }
463    }
464    else if (typeof jQuery("#wpgmza_marker_list_"+map_id) === "object") {
465        if (jQuery("#wpgmza_marker_list_"+map_id).hasClass('wpgmza_basic_list')) { 
466            /* we're using the basic list marker listing */
467            var data = {
468                    action: 'wpgmza_sl_basiclist',
469                    security: wpgmaps_pro_nonce,
470                    map_id: map_id,
471                    marker_array: marker_sl_array
472            };
473            jQuery.post(ajaxurl, data, function(response) {
474                    items = default_items;
475                    jQuery("#wpgmza_marker_list_"+map_id+"").html(response);
476
477            });
478        } else  { 
479            /* we must be using the basic table listing */
480            var data = {
481                    action: 'wpgmza_sl_basictable',
482                    security: wpgmaps_pro_nonce,
483                    map_id: map_id,
484                    marker_array: marker_sl_array
485            };
486            /* basic marker listing listing */
487            jQuery.post(ajaxurl, data, function(response) {
488                    jQuery("#wpgmza_marker_list_"+map_id+"").html(response);
489                    
490
491            });    
492
493        }
494
495
496
497
498
499    }
500
501
502
503
504
505
506
507}
508
509
510function wpgmza_filter_marker_lists(wpgmza_map_id,selectedValue) {
511    if (typeof jQuery("#wpgmza_table_"+wpgmza_map_id) === "object") { 
512        if (selectedValue === 0 || selectedValue === "All" || selectedValue === "0") {
513            
514            /* update datatables */
515            var data = {
516                    action: 'wpgmza_datatables',
517                    security: wpgmaps_pro_nonce,
518                    map_id: wpgmza_map_id,
519                    category_data: 'all'
520            };
521            jQuery.post(ajaxurl, data, function(response) {
522                    wpgmzaTable[wpgmza_map_id].destroy();
523                    jQuery("#wpgmza_table_"+wpgmza_map_id+"").html(response);
524
525                    
526
527                    wpgmzaTable[wpgmza_map_id] = jQuery('#wpgmza_table_'+wpgmza_map_id).DataTable({
528                        "bDestroy":true,
529                        responsive: true,
530                        "iDisplayLength": wpgmza_settings_default_items,
531                        "bProcessing": true,"aaSorting" : [],
532                        "oLanguage": {
533                                "sLengthMenu": wpgm_dt_sLengthMenu,
534                                "sZeroRecords": wpgm_dt_sZeroRecords,
535                                "sInfo": wpgm_dt_sInfo,
536                                "sInfoEmpty": wpgm_dt_sInfoEmpty,
537                                "sInfoFiltered": wpgm_dt_sInfoFiltered,
538                                "sSearch": wpgm_dt_sSearch,
539                                "oPaginate" : {
540                                    "sFirst": wpgm_dt_sFirst,
541                                    "sLast": wpgm_dt_sLast,
542                                    "sNext": wpgm_dt_sNext,
543                                    "sPrevious": wpgm_dt_sPrevious,
544                                   "sSearch": wpgm_dt_sSearch
545                                }
546                        }
547
548                    });
549
550            });
551        } else { 
552            
553            /* update datatables */
554            var data = {
555                    action: 'wpgmza_datatables',
556                    security: wpgmaps_pro_nonce,
557                    map_id: wpgmza_map_id,
558                    category_data: selectedValue
559            };
560            jQuery.post(ajaxurl, data, function(response) {
561                wpgmzaTable[wpgmza_map_id].destroy();
562                
563                jQuery("#wpgmza_table_"+wpgmza_map_id+"").html(response);
564
565                /* deprecated in 5.64 as it apparently is not required to do this anymore. */
566                wpgmzaTable[wpgmza_map_id] = jQuery('#wpgmza_table_'+wpgmza_map_id).DataTable({
567                    "bDestroy":true,
568                    responsive: true,
569                    "iDisplayLength": wpgmza_settings_default_items,
570                    "bProcessing": true,"aaSorting" : [],
571                    "oLanguage": {
572                            "sLengthMenu": wpgm_dt_sLengthMenu,
573                            "sZeroRecords": wpgm_dt_sZeroRecords,
574                            "sInfo": wpgm_dt_sInfo,
575                            "sInfoEmpty": wpgm_dt_sInfoEmpty,
576                            "sInfoFiltered": wpgm_dt_sInfoFiltered,
577                            "sSearch": wpgm_dt_sSearch,
578                            "oPaginate" : {
579                                "sFirst": wpgm_dt_sFirst,
580                                "sLast": wpgm_dt_sLast,
581                                "sNext": wpgm_dt_sNext,
582                                "sPrevious": wpgm_dt_sPrevious,
583                               "sSearch": wpgm_dt_sSearch
584                            }
585                    }
586
587                });
588
589            });
590            
591        }
592
593    } 
594    if (jQuery("#wpgmza_marker_list_"+wpgmza_map_id).length > 0) {
595       
596        /* check whether we are using carousel or normal marker listing */
597
598        if (jQuery("#wpgmza_marker_list_"+wpgmza_map_id).hasClass('wpgmza_marker_carousel')) {
599
600            if (selectedValue === 0 || selectedValue === "All" || selectedValue === "0") {
601                
602                var data = {
603                        action: 'wpgmza_carousel_update',
604                        security: wpgmaps_pro_nonce,
605                        map_id: wpgmza_map_id,
606                        category_data: 'all'
607                };
608            } else {
609                
610                var data = {
611                        action: 'wpgmza_carousel_update',
612                        security: wpgmaps_pro_nonce,
613                        map_id: wpgmza_map_id,
614                        category_data: selectedValue
615                };
616            }
617             /* carousel listing */
618            jQuery.post(ajaxurl, data, function(response) {
619                    jQuery("#wpgmza_marker_list_container_"+wpgmza_map_id+"").html(response);
620                    jQuery("#wpgmza_marker_list_"+wpgmza_map_id+"").owlCarousel({
621                        autoPlay: autoplay,
622                        lazyLoad : lazyload,
623                        autoHeight : autoheight,
624                        pagination : pagination,
625                        navigation : navigation,
626                        items : items
627                    });
628
629            });
630        } else if (jQuery("#wpgmza_marker_list_"+wpgmza_map_id).hasClass('wpgmza_basic_list')) { 
631            /* we're using the basic list marker listing */
632            if (selectedValue === 0 || selectedValue === "All" || selectedValue === "0") {
633                var data = {
634                        action: 'wpgmza_basiclist_update',
635                        security: wpgmaps_pro_nonce,
636                        map_id: wpgmza_map_id,
637                        category_data: 'all'
638                };
639            } else {
640                var data = {
641                        action: 'wpgmza_basiclist_update',
642                        security: wpgmaps_pro_nonce,
643                        map_id: wpgmza_map_id,
644                        category_data: selectedValue
645                };
646            }
647             /* basic marker listing listing */
648            jQuery.post(ajaxurl, data, function(response) {
649                    jQuery("#wpgmza_marker_list_"+wpgmza_map_id+"").html(response);
650                    
651
652            });    
653
654        } else { 
655            /* we must be using the basic table listing */
656            if (selectedValue === 0 || selectedValue === "All" || selectedValue === "0") {
657                var data = {
658                        action: 'wpgmza_basictable_update',
659                        security: wpgmaps_pro_nonce,
660                        map_id: wpgmza_map_id,
661                        category_data: 'all'
662                };
663            } else {
664                var data = {
665                        action: 'wpgmza_basictable_update',
666                        security: wpgmaps_pro_nonce,
667                        map_id: wpgmza_map_id,
668                        category_data: selectedValue
669                };
670            }
671             /* basic marker listing listing */
672            jQuery.post(ajaxurl, data, function(response) {
673                    jQuery("#wpgmza_marker_list_"+wpgmza_map_id+"").html(response);
674                    
675
676            });                        
677        }
678
679
680       
681    }
682
683
684}
685
686
687
688
689function reset_marker_lists(wpgmza_map_id) {
690
691    if (typeof jQuery("#wpgmza_table_"+wpgmza_map_id) === "object" && jQuery("#wpgmza_table_"+wpgmza_map_id).length > 0) {
692            /* update datatables */
693            var data = {
694                    action: 'wpgmza_datatables',
695                    security: wpgmaps_pro_nonce,
696                    map_id: wpgmza_map_id,
697                    category_data: 'all'
698            };
699            jQuery.post(ajaxurl, data, function(response) {
700                    jQuery("#wpgmza_table_"+wpgmza_map_id+"").html(response);
701                    wpgmzaTable[wpgmza_map_id] = jQuery('#wpgmza_table_'+wpgmza_map_id).DataTable({
702                        "bDestroy":true,
703                        responsive: true,
704                        "iDisplayLength": wpgmza_settings_default_items,
705                        "bProcessing": true,"aaSorting" : [],
706                        "oLanguage": {
707                                "sLengthMenu": wpgm_dt_sLengthMenu,
708                                "sZeroRecords": wpgm_dt_sZeroRecords,
709                                "sInfo": wpgm_dt_sInfo,
710                                "sInfoEmpty": wpgm_dt_sInfoEmpty,
711                                "sInfoFiltered": wpgm_dt_sInfoFiltered,
712                                "sSearch": wpgm_dt_sSearch,
713                                "oPaginate" : {
714                                    "sFirst": wpgm_dt_sFirst,
715                                    "sLast": wpgm_dt_sLast,
716                                    "sNext": wpgm_dt_sNext,
717                                    "sPrevious": wpgm_dt_sPrevious,
718                                   "sSearch": wpgm_dt_sSearch
719                                }
720                        }
721
722                    });
723
724            });
725
726    } 
727
728    if (jQuery("#wpgmza_marker_list_"+wpgmza_map_id).length > 0) {
729       
730        /* check whether we are using carousel or normal marker listing */
731
732        if (jQuery("#wpgmza_marker_list_"+wpgmza_map_id).hasClass('wpgmza_marker_carousel')) {
733
734            var data = {
735                    action: 'wpgmza_carousel_update',
736                    security: wpgmaps_pro_nonce,
737                    map_id: wpgmza_map_id,
738                    category_data: 'all'
739            };
740        
741             /* carousel listing */
742            jQuery.post(ajaxurl, data, function(response) {
743                    jQuery("#wpgmza_marker_list_container_"+wpgmza_map_id+"").html(response);
744                    jQuery("#wpgmza_marker_list_"+wpgmza_map_id+"").owlCarousel({
745                        autoPlay: autoplay,
746                        lazyLoad : lazyload,
747                        autoHeight : autoheight,
748                        pagination : pagination,
749                        navigation : navigation,
750                        items : default_items
751                    });
752
753            });
754        } else if (jQuery("#wpgmza_marker_list_"+wpgmza_map_id).hasClass('wpgmza_basic_list')) { 
755            /* we're using the basic list marker listing */
756            
757            
758            
759            var data = {
760                    action: 'wpgmza_basiclist_update',
761                    security: wpgmaps_pro_nonce,
762                    map_id: wpgmza_map_id,
763                    category_data: 'all'
764            };
765        
766             /* basic marker listing listing */
767            jQuery.post(ajaxurl, data, function(response) {
768                    jQuery("#wpgmza_marker_list_"+wpgmza_map_id+"").html(response);
769                    
770
771            });    
772
773        } else { 
774            /* we must be using the basic table listing */
775            
776            var data = {
777                    action: 'wpgmza_basictable_update',
778                    security: wpgmaps_pro_nonce,
779                    map_id: wpgmza_map_id,
780                    category_data: 'all'
781            };
782             /* basic marker listing listing */
783            jQuery.post(ajaxurl, data, function(response) {
784                    jQuery("#wpgmza_marker_list_"+wpgmza_map_id+"").html(response);
785                    
786
787            });                        
788        }
789
790
791       
792    }
793
794
795}
796
797jQuery(function() {
798
799    jQuery(document).ready(function(){
800
801
802
803        for (var entry in wpgmaps_localize) {
804
805           if ("undefined" !== typeof wpgmaps_localize[entry]['other_settings'] && "undefined" !== typeof wpgmaps_localize[entry]['other_settings']['list_markers_by'] && wpgmaps_localize[entry]['other_settings']['list_markers_by'] === "3") {
806                if ("undefined" !== typeof wpgmaps_localize_global_settings['carousel_lazyload'] && wpgmaps_localize_global_settings['carousel_lazyload'] === "yes") { lazyload = true; } else { lazyload = false; }
807                if ("undefined" === typeof wpgmaps_localize_global_settings['carousel_lazyload']) { lazyload = true; }
808
809                if ("undefined" !== typeof wpgmaps_localize_global_settings['carousel_autoplay']) { autoplay = parseInt(wpgmaps_localize_global_settings['carousel_autoplay']); } else { autoplay = false; }
810                if ("undefined" === typeof wpgmaps_localize_global_settings['carousel_autoplay']) { autoplay = 6000; }
811
812                if ("undefined" !== typeof wpgmaps_localize_global_settings['carousel_autoheight'] && wpgmaps_localize_global_settings['carousel_autoheight'] === "yes") { autoheight = true; } else { autoheight = false; }
813                if ("undefined" === typeof wpgmaps_localize_global_settings['carousel_autoheight']) { autoheight = true; }
814
815                if ("undefined" !== typeof wpgmaps_localize_global_settings['carousel_pagination'] && wpgmaps_localize_global_settings['carousel_pagination'] === "yes") { pagination = true; } else { pagination = false; }
816                if ("undefined" === typeof wpgmaps_localize_global_settings['carousel_pagination']) { pagination = false; }
817
818                if ("undefined" !== typeof wpgmaps_localize_global_settings['carousel_navigation'] && wpgmaps_localize_global_settings['carousel_navigation'] === "yes") { navigation = true; } else { navigation = false; }
819                if ("undefined" === typeof wpgmaps_localize_global_settings['carousel_navigation']) { navigation = true; }
820
821                if ("undefined" !== typeof wpgmaps_localize_global_settings['carousel_items']) { items = parseInt(wpgmaps_localize_global_settings['carousel_items']); } else { items = 5; }
822                if ("undefined" === typeof wpgmaps_localize_global_settings['carousel_items']) { items = 6; }
823                default_items = items;
824
825                if (wpgmaps_localize[entry]['total_markers'] < items) { items = wpgmaps_localize[entry]['total_markers']; }
826                jQuery("#wpgmza_marker_list_"+wpgmaps_localize[entry]['id']).owlCarousel({
827                    autoPlay: autoplay,
828                    lazyLoad : lazyload,
829                    autoHeight : autoheight,
830                    pagination : pagination,
831                    navigation : navigation,
832                    items : items
833                });
834                    
835            } 
836        }
837        
838        
839        
840        if (/1\.(0|1|2|3|4|5|6|7)\.(0|1|2|3|4|5|6|7|8|9)/.test(jQuery.fn.jquery)) {
841            for(var entry in wpgmaps_localize) {
842                document.getElementById('wpgmza_map_'+wpgmaps_localize[entry]['id']).innerHTML = 'Error: Your version of jQuery is outdated. WP Google Maps requires jQuery version 1.7+ to function correctly. Go to Maps->Settings and check the box that allows you to over-ride your current jQuery to try eliminate this problem.';
843            }
844        } else {
845
846
847            jQuery("body").on("click", ".wpgmaps_mlist_row", function() {
848                var wpgmza_markerid = jQuery(this).attr("mid");
849                var wpgmza_mapid = jQuery(this).attr("mapid");
850                openInfoWindow(wpgmza_markerid,wpgmza_mapid,true);
851                location.hash = "#marker" + wpgmza_markerid;
852            });
853            jQuery("body").on("click", ".wpgmaps_blist_row", function() {
854                var wpgmza_markerid = jQuery(this).attr("mid");
855                var wpgmza_mapid = jQuery(this).attr("mapid");
856                openInfoWindow(wpgmza_markerid,wpgmza_mapid,true);
857                
858            });
859            jQuery("body").on("change", "#wpgmza_filter_select", function() {
860                
861                var selectedValue = jQuery(this).find(":selected").val();
862                var wpgmza_map_id = jQuery(this).attr("mid");
863                InitMap(wpgmza_map_id,selectedValue);
864                wpgmza_filter_marker_lists(wpgmza_map_id,selectedValue);
865                
866
867            });      
868            jQuery("body").on("click", ".wpgmza_checkbox", function() {
869                /* do nothing if user has enabled store locator */
870                var wpgmza_map_id = jQuery(this).attr("mid");
871                if (jQuery("#addressInput_"+wpgmza_map_id).length > 0) { } else {
872                     var checkedCatValues = jQuery('.wpgmza_checkbox:checked').map(function() {
873                        return this.value;
874                    }).get();
875                    if (checkedCatValues[0] === "0" || typeof checkedCatValues === 'undefined' || checkedCatValues.length < 1) {
876                        InitMap(wpgmza_map_id,'all');
877                        wpgmza_filter_marker_lists(wpgmza_map_id,'all');
878                    } else {
879                        InitMap(wpgmza_map_id,checkedCatValues);
880                        wpgmza_filter_marker_lists(wpgmza_map_id,checkedCatValues);
881                    }
882
883                }
884            });                
885            
886        
887
888            jQuery("body").on("click", ".sl_use_loc", function() {
889                var wpgmza_map_id = jQuery(this).attr("mid");
890                jQuery('#addressInput_'+wpgmza_map_id).val(wpgmaps_lang_getting_location);
891
892                var geocoder = new google.maps.Geocoder();
893                geocoder.geocode({'latLng': user_location}, function(results, status) {
894                  if (status === google.maps.GeocoderStatus.OK) {
895                    if (results[0]) {
896                      jQuery('#addressInput_'+wpgmza_map_id).val(results[0].formatted_address);
897                    }
898                  }
899                });
900            });       
901            jQuery("body").on("click", "#wpgmza_use_my_location_from", function() {
902                var wpgmza_map_id = jQuery(this).attr("mid");
903                jQuery('#wpgmza_input_from_'+wpgmza_map_id).val(wpgmaps_lang_getting_location);
904
905                var geocoder = new google.maps.Geocoder();
906                geocoder.geocode({'latLng': user_location}, function(results, status) {
907                  if (status === google.maps.GeocoderStatus.OK) {
908                    if (results[0]) {
909                      jQuery('#wpgmza_input_from_'+wpgmza_map_id).val(results[0].formatted_address);
910                    }
911                  }
912                });
913            });              
914            jQuery("body").on("click", "#wpgmza_use_my_location_to", function() {
915                var wpgmza_map_id = jQuery(this).attr("mid");
916                jQuery('#wpgmza_input_to_'+wpgmza_map_id).val(wpgmaps_lang_getting_location);
917                var geocoder = new google.maps.Geocoder();
918                geocoder.geocode({'latLng': user_location}, function(results, status) {
919                  if (status === google.maps.GeocoderStatus.OK) {
920                    if (results[0]) {
921                      jQuery('#wpgmza_input_to_'+wpgmza_map_id).val(results[0].formatted_address);
922                    }
923                  }
924                });
925            });
926            
927            jQuery('body').on('tabsactivate', function(event, ui) {
928                for(var entry in wpgmaps_localize) {
929                    InitMap(wpgmaps_localize[entry]['id'],'all',false);
930                }
931            });
932            jQuery('body').on('tabsshow', function(event, ui) {
933                for(var entry in wpgmaps_localize) {
934                    InitMap(wpgmaps_localize[entry]['id'],'all',false);
935                }
936            });
937            jQuery('body').on('accordionactivate', function(event, ui) {
938                for(var entry in wpgmaps_localize) {
939                    InitMap(wpgmaps_localize[entry]['id'],'all',false);
940                }
941            });
942            
943            /* tab compatibility */
944            jQuery('body').on('click', '.wpb_tabs_nav li', function(event, ui) {
945                for(var entry in wpgmaps_localize) {
946                    InitMap(wpgmaps_localize[entry]['id'],'all',false);
947                }
948            });
949
950            jQuery('body').on('click', '.ui-tabs-nav li', function(event, ui) {
951                for(var entry in wpgmaps_localize) {
952                    InitMap(wpgmaps_localize[entry]['id'],'all',false);
953                }
954            });
955            jQuery('body').on('click', '.tp-tabs li a', function(event, ui) {
956                for(var entry in wpgmaps_localize) {
957                    InitMap(wpgmaps_localize[entry]['id'],'all',false);
958                }
959            });
960            jQuery('body').on('click', '.nav-tabs li a', function(event, ui) {
961                for(var entry in wpgmaps_localize) {
962                    InitMap(wpgmaps_localize[entry]['id'],'all',false);
963                }
964            });
965
966            jQuery('body').on('click', '.x-accordion-heading', function(){ setTimeout(function(){ for(var entry in wpgmaps_localize) { InitMap(wpgmaps_localize[entry]['id'],'all',false); jQuery( jQuery.fn.dataTable.tables(true) ).DataTable().responsive.recalc(); }}, 100); });
967            jQuery('body').on('click', '.x-nav-tabs li', function (event, ui) { setTimeout(function () { for (var entry in wpgmaps_localize) { InitMap(wpgmaps_localize[entry]['id'], 'all', false); } }, 200); });  
968            jQuery('body').on('click', '.tab-title', function (event, ui) { setTimeout(function () { for (var entry in wpgmaps_localize) { InitMap(wpgmaps_localize[entry]['id'], 'all', false); } }, 200); });  
969            jQuery('body').on('click', '.tab-link', function (event, ui) { setTimeout(function () { for (var entry in wpgmaps_localize) { InitMap(wpgmaps_localize[entry]['id'], 'all', false); } }, 200); });  
970            jQuery('body').on('click', '.et_pb_tabs_controls li', function (event, ui) { setTimeout(function () { for (var entry in wpgmaps_localize) { InitMap(wpgmaps_localize[entry]['id'], 'all', false); } }, 200); });  
971            jQuery('body').on('click', '.fusion-tab-heading', function (event, ui) { setTimeout(function () { for (var entry in wpgmaps_localize) { InitMap(wpgmaps_localize[entry]['id'], 'all', false); } }, 200); });  
972            jQuery('body').on('click', '.et_pb_tab', function (event, ui) { setTimeout(function () { for (var entry in wpgmaps_localize) { InitMap(wpgmaps_localize[entry]['id'], 'all', false); } }, 200); });  
973            
974            
975            /* compatibility for GDL tabs */
976            jQuery('body').on('click', '.gdl-tabs li', function(event, ui) {
977                for(var entry in wpgmaps_localize) {
978                    InitMap(wpgmaps_localize[entry]['id'],'all',false);
979                }
980            });      
981
982            jQuery('body').on('click', '#tabnav  li', function(event, ui) {
983                for(var entry in wpgmaps_localize) {
984                    InitMap(wpgmaps_localize[entry]['id'],'all',false);
985                }
986            });
987            
988            for(var entry in wpgmaps_localize) {
989                jQuery("#wpgmza_map_"+wpgmaps_localize[entry]['id']).css({
990                    height:wpgmaps_localize[entry]['map_height']+''+wpgmaps_localize[entry]['map_height_type'],
991                    width:wpgmaps_localize[entry]['map_width']+''+wpgmaps_localize[entry]['map_width_type']
992
993                });            
994            }
995            
996    
997            for(var entry in wpgmaps_localize) {
998                InitMap(wpgmaps_localize[entry]['id'],wpgmaps_localize_cat_ids[wpgmaps_localize[entry]['id']],false);
999            }
1000
1001            for(var entry in wpgmaps_localize) {
1002
1003                /*
1004                removed in 5.54 as we are sorting via PHP first
1005                 */
1006                /*
1007                if (wpgmaps_localize[entry]['order_markers_by'] === "1") { wpgmaps_order_by = parseInt(0); } 
1008                else if (wpgmaps_localize[entry]['order_markers_by'] === "2") { wpgmaps_order_by = parseInt(2); } 
1009                else if (wpgmaps_localize[entry]['order_markers_by'] === "3") { wpgmaps_order_by = parseInt(4); } 
1010                else if (wpgmaps_localize[entry]['order_markers_by'] === "4") { wpgmaps_order_by = parseInt(5); } 
1011                else if (wpgmaps_localize[entry]['order_markers_by'] === "5") { wpgmaps_order_by = parseInt(3); } 
1012                else { wpgmaps_order_by = 0; }
1013                if (wpgmaps_localize[entry]['order_markers_choice'] === "1") { wpgmaps_order_by_choice = "asc"; } 
1014                else { wpgmaps_order_by_choice = "desc"; }
1015                */
1016                if (wpgmaps_localize_global_settings['wpgmza_default_items'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_default_items']) { wpgmza_settings_default_items = 10; } else { wpgmza_settings_default_items = parseInt(wpgmaps_localize_global_settings['wpgmza_default_items']);  }
1017                
1018                if (jQuery('#wpgmza_table_'+wpgmaps_localize[entry]['id']).length === 0) { } else { 
1019                    
1020                    wpgmzaTable[wpgmaps_localize[entry]['id']] = jQuery('#wpgmza_table_'+wpgmaps_localize[entry]['id']).DataTable({
1021                        "bProcessing": true,"aaSorting" : [],
1022                        "iDisplayLength": wpgmza_settings_default_items,
1023                        responsive: true,
1024                        "oLanguage": {
1025                            "sLengthMenu": wpgm_dt_sLengthMenu,
1026                            "sZeroRecords": wpgm_dt_sZeroRecords,
1027                            "sInfo": wpgm_dt_sInfo,
1028                            "sInfoEmpty": wpgm_dt_sInfoEmpty,
1029                            "sInfoFiltered": wpgm_dt_sInfoFiltered,
1030                            "sSearch": wpgm_dt_sSearch,
1031                            "oPaginate" : {
1032                                "sFirst": wpgm_dt_sFirst,
1033                                "sLast": wpgm_dt_sLast,
1034                                "sNext": wpgm_dt_sNext,
1035                                "sPrevious": wpgm_dt_sPrevious,
1036                               "sSearch": wpgm_dt_sSearch
1037                            }
1038                        }
1039                     });
1040
1041                    
1042                    if (typeof wpgmza_controls_active[entry] !== 'undefined' && wpgmza_controls_active[entry]) {
1043                        /* hide certain elements */
1044                        jQuery("#wpgmza_table_"+[entry]+"_length").hide();
1045                    }
1046                     
1047                     if (typeof wpgmaps_localize[entry]['other_settings']['store_locator_hide_before_search'] !== "undefined" && wpgmaps_localize[entry]['other_settings']['store_locator_hide_before_search'] === 1) { 
1048                        jQuery('#wpgmza_marker_holder_'+wpgmaps_localize[entry]['id']).hide();
1049                     }
1050                }
1051                if (typeof wpgmaps_localize[entry]['other_settings']['store_locator_hide_before_search'] !== "undefined" && wpgmaps_localize[entry]['other_settings']['store_locator_hide_before_search'] === 1) { 
1052                    if( jQuery('#wpgmza_marker_list_container_'+wpgmaps_localize[entry]['id']).length > 0 ){
1053                        jQuery('#wpgmza_marker_list_container_'+wpgmaps_localize[entry]['id']).hide();                         
1054                    }
1055                }
1056            }
1057
1058        
1059        }
1060        
1061        
1062
1063    
1064    
1065         
1066        
1067
1068    });
1069    
1070    
1071    
1072    
1073    
1074    
1075    
1076    
1077    for(var entry in wpgmaps_localize) {
1078
1079    /* general directions settings and variables */
1080    directionsDisplay[wpgmaps_localize[entry]['id']];
1081    directionsService[wpgmaps_localize[entry]['id']] = new google.maps.DirectionsService();
1082    var currentDirections = null;
1083    var oldDirections = [];
1084    var new_gps;
1085
1086    if (wpgmaps_localize[entry]['styling_json'] !== '' && wpgmaps_localize[entry]['styling_enabled'] 
1086=== "1") {
1087        wpgmza_adv_styling_json[wpgmaps_localize[entry]['id']] = jQuery.parseJSON(wpgmaps_localize[entry]['styling_json']);
1088    } else {
1089        wpgmza_adv_styling_json[wpgmaps_localize[entry]['id']] = "";
1090    }
1091
1092
1093    MYMAP[wpgmaps_localize[entry]['id']] = {
1094        map: null,
1095        bounds: null,
1096        mc: null
1097    };
1098
1099    
1100    if (wpgmaps_localize_global_settings['wpgmza_settings_map_draggable'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_draggable']) { wpgmza_settings_map_draggable = true; } else { wpgmza_settings_map_draggable = false;  }
1101    if (wpgmaps_localize_global_settings['wpgmza_settings_map_clickzoom'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_clickzoom']) { wpgmza_settings_map_clickzoom = false; } else { wpgmza_settings_map_clickzoom = true; }
1102    if (wpgmaps_localize_global_settings['wpgmza_settings_map_scroll'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_scroll']) { wpgmza_settings_map_scroll = true; } else { wpgmza_settings_map_scroll = false; }
1103    if (wpgmaps_localize_global_settings['wpgmza_settings_map_zoom'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_zoom']) { wpgmza_settings_map_zoom = true; } else { wpgmza_settings_map_zoom = false; }
1104    if (wpgmaps_localize_global_settings['wpgmza_settings_map_pan'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_pan']) { wpgmza_settings_map_pan = true; } else { wpgmza_settings_map_pan = false; }
1105    if (wpgmaps_localize_global_settings['wpgmza_settings_map_type'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_type']) { wpgmza_settings_map_type = true; } else { wpgmza_settings_map_type = false; }
1106    if (wpgmaps_localize_global_settings['wpgmza_settings_map_streetview'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_streetview']) { wpgmza_settings_map_streetview = true; } else { wpgmza_settings_map_streetview = false; }
1107
1108
1109    if ('undefined' === typeof wpgmaps_localize[entry]['other_settings']['map_max_zoom'] || wpgmaps_localize[entry]['other_settings']['map_max_zoom'] === "") { wpgmza_max_zoom = 0; } else { wpgmza_max_zoom = parseInt(wpgmaps_localize[entry]['other_settings']['map_max_zoom']); }
1110    if ('undefined' === typeof wpgmaps_localize[entry]['other_settings']['map_min_zoom'] || wpgmaps_localize[entry]['other_settings']['map_min_zoom'] === "") { wpgmza_min_zoom = 21; } else { wpgmza_min_zoom = parseInt(wpgmaps_localize[entry]['other_settings']['map_min_zoom']); }
1111
1112
1113    
1114    MYMAP[wpgmaps_localize[entry]['id']].init = function(selector, latLng, zoom, maptype, mapid) {
1115        if (typeof wpgmaps_localize_map_types !== "undefined") {
1116            var override_type = wpgmaps_localize_map_types[mapid];
1117        } else {
1118            var override_type = "";
1119        }
1120        
1121        if (override_type !== "") {
1122            if (override_type === "ROADMAP") { 
1123                
1124                var myOptions = {
1125                        zoom:zoom,
1126                        minZoom: wpgmza_max_zoom,
1127                        maxZoom: wpgmza_min_zoom,
1128                        center: latLng,
1129                        draggable: wpgmza_settings_map_draggable,
1130                        disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1131                        scrollwheel: wpgmza_settings_map_scroll,
1132                        zoomControl: wpgmza_settings_map_zoom,
1133                        panControl: wpgmza_settings_map_pan,
1134                        mapTypeControl: wpgmza_settings_map_type,
1135                        streetViewControl: wpgmza_settings_map_streetview,
1136                        mapTypeId: google.maps.MapTypeId.ROADMAP
1137                };
1138            }
1139            if (override_type === "SATELLITE") { 
1140                var myOptions = {
1141                        zoom:zoom,
1142                        minZoom: wpgmza_max_zoom,
1143                        maxZoom: wpgmza_min_zoom,
1144                        center: latLng,
1145                        draggable: wpgmza_settings_map_draggable,
1146                        disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1147                        scrollwheel: wpgmza_settings_map_scroll,
1148                        zoomControl: wpgmza_settings_map_zoom,
1149                        panControl: wpgmza_settings_map_pan,
1150                        mapTypeControl: wpgmza_settings_map_type,
1151                        streetViewControl: wpgmza_settings_map_streetview,
1152                        mapTypeId: google.maps.MapTypeId.SATELLITE
1153                };
1154            }
1155            if (override_type === "HYBRID") { 
1156                var myOptions = {
1157                        zoom:zoom,
1158                        minZoom: wpgmza_max_zoom,
1159                        maxZoom: wpgmza_min_zoom,
1160                        center: latLng,
1161                        draggable: wpgmza_settings_map_draggable,
1162                        disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1163                        scrollwheel: wpgmza_settings_map_scroll,
1164                        zoomControl: wpgmza_settings_map_zoom,
1165                        panControl: wpgmza_settings_map_pan,
1166                        mapTypeControl: wpgmza_settings_map_type,
1167                        streetViewControl: wpgmza_settings_map_streetview,
1168                        mapTypeId: google.maps.MapTypeId.HYBRID
1169                };
1170            }
1171            if (override_type === "TERRAIN") { 
1172                var myOptions = {
1173                        zoom:zoom,
1174                        minZoom: wpgmza_max_zoom,
1175                        maxZoom: wpgmza_min_zoom,
1176                        center: latLng,
1177                        draggable: wpgmza_settings_map_draggable,
1178                        disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1179                        scrollwheel: wpgmza_settings_map_scroll,
1180                        zoomControl: wpgmza_settings_map_zoom,
1181                        panControl: wpgmza_settings_map_pan,
1182                        mapTypeControl: wpgmza_settings_map_type,
1183                        streetViewControl: wpgmza_settings_map_streetview,
1184                        mapTypeId: google.maps.MapTypeId.TERRAIN
1185                };
1186            } else {
1187                if (override_type === "ROADMAP") { 
1188
1189                var myOptions = {
1190                        zoom:zoom,
1191                        minZoom: wpgmza_max_zoom,
1192                        maxZoom: wpgmza_min_zoom,
1193                        center: latLng,
1194                        draggable: wpgmza_settings_map_draggable,
1195                        disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1196                        scrollwheel: wpgmza_settings_map_scroll,
1197                        zoomControl: wpgmza_settings_map_zoom,
1198                        panControl: wpgmza_settings_map_pan,
1199                        mapTypeControl: wpgmza_settings_map_type,
1200                        streetViewControl: wpgmza_settings_map_streetview,
1201                        mapTypeId: google.maps.MapTypeId.ROADMAP
1202                };
1203            }
1204
1205            }
1206        } else {
1207            if (maptype === "1") { 
1208                var myOptions = {
1209                    zoom:zoom,
1210                    minZoom: wpgmza_max_zoom,
1211                    maxZoom: wpgmza_min_zoom,
1212                    center: latLng,
1213                    draggable: wpgmza_settings_map_draggable,
1214                    disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1215                    scrollwheel: wpgmza_settings_map_scroll,
1216                    zoomControl: wpgmza_settings_map_zoom,
1217                    panControl: wpgmza_settings_map_pan,
1218                    mapTypeControl: wpgmza_settings_map_type,
1219                    streetViewControl: wpgmza_settings_map_streetview,
1220                    mapTypeId: google.maps.MapTypeId.ROADMAP
1221                  };
1222            }
1223            else if (maptype === "2") { 
1224                var myOptions = {
1225                    zoom:zoom,
1226                    minZoom: wpgmza_max_zoom,
1227                    maxZoom: wpgmza_min_zoom,
1228                    center: latLng,
1229                    draggable: wpgmza_settings_map_draggable,
1230                    disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1231                    scrollwheel: wpgmza_settings_map_scroll,
1232                    zoomControl: wpgmza_settings_map_zoom,
1233                    panControl: wpgmza_settings_map_pan,
1234                    mapTypeControl: wpgmza_settings_map_type,
1235                    streetViewControl: wpgmza_settings_map_streetview,
1236                    mapTypeId: google.maps.MapTypeId.SATELLITE
1237                  };
1238
1239            }
1240            else if (maptype === "3") { 
1241                var myOptions = {
1242                    zoom:zoom,
1243                    minZoom: wpgmza_max_zoom,
1244                    maxZoom: wpgmza_min_zoom,
1245                    center: latLng,
1246                    draggable: wpgmza_settings_map_draggable,
1247                    disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1248                    scrollwheel: wpgmza_settings_map_scroll,
1249                    zoomControl: wpgmza_settings_map_zoom,
1250                    panControl: wpgmza_settings_map_pan,
1251                    mapTypeControl: wpgmza_settings_map_type,
1252                    streetViewControl: wpgmza_settings_map_streetview,
1253                    mapTypeId: google.maps.MapTypeId.HYBRID
1254                  };
1255
1256
1257            }
1258            else if (maptype === "4") { 
1259                var myOptions = {
1260                    zoom:zoom,
1261                    minZoom: wpgmza_max_zoom,
1262                    maxZoom: wpgmza_min_zoom,
1263                    center: latLng,
1264                    draggable: wpgmza_settings_map_draggable,
1265                    disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1266                    scrollwheel: wpgmza_settings_map_scroll,
1267                    zoomControl: wpgmza_settings_map_zoom,
1268                    panControl: wpgmza_settings_map_pan,
1269                    mapTypeControl: wpgmza_settings_map_type,
1270                    streetViewControl: wpgmza_settings_map_streetview,
1271                    mapTypeId: google.maps.MapTypeId.TERRAIN
1272                  };
1273
1274            }
1275            else { 
1276                var myOptions = {
1277                    zoom:zoom,
1278                    minZoom: wpgmza_max_zoom,
1279                    maxZoom: wpgmza_min_zoom,
1280                    center: latLng,
1281                    draggable: wpgmza_settings_map_draggable,
1282                    disableDoubleClickZoom: wpgmza_settings_map_clickzoom,
1283                    scrollwheel: wpgmza_settings_map_scroll,
1284                    zoomControl: wpgmza_settings_map_zoom,
1285                    panControl: wpgmza_settings_map_pan,
1286                    mapTypeControl: wpgmza_settings_map_type,
1287                    streetViewControl: wpgmza_settings_map_streetview,
1288                    mapTypeId: google.maps.MapTypeId.ROADMAP
1289                  };
1290
1291
1292            }
1293        }
1294        
1295        
1296
1297
1298        this.map = new google.maps.Map(jQuery(selector)[0], myOptions);            
1299        if ("undefined" !== typeof wpgmaps_localize[mapid]['other_settings']['wpgmza_theme_data'] && wpgmaps_localize[mapid]['other_settings']['wpgmza_theme_data'] !== false && wpgmaps_localize[mapid]['other_settings']['wpgmza_theme_data'] !== '') {
1300            wpgmza_theme_data = jQuery.parseJSON(wpgmaps_localize[mapid]['other_settings']['wpgmza_theme_data']);
1301            this.map.setOptions({styles: jQuery.parseJSON(wpgmaps_localize[mapid]['other_settings']['wpgmza_theme_data'])});
1302        } 
1303
1304        if (override_type === "STREETVIEW") {
1305            var panoramaOptions = {
1306                position: latLng
1307              };
1308            var panorama = new google.maps.StreetViewPanorama(jQuery(selector)[0], panoramaOptions);
1309            this.map.setStreetView(panorama);
1310        }
1311
1312        
1313
1314        this.bounds = new google.maps.LatLngBounds();
1315        jQuery( "#wpgmza_map_"+mapid).trigger( 'wpgooglemaps_loaded' );
1316        
1317        
1318
1319                
1320                
1321        /* insert polygon and polyline functionality */
1322        if (wpgmaps_localize_heatmap_settings !== null) {
1323            if (typeof wpgmaps_localize_heatmap_settings[mapid] !== "undefined") {
1324                  for(var poly_entry in wpgmaps_localize_heatmap_settings[mapid]) {
1325                    add_heatmap(mapid,poly_entry);
1326                  }
1327            }
1328        }
1329        if (wpgmaps_localize_polygon_settings !== null) {
1330            if (typeof wpgmaps_localize_polygon_settings[mapid] !== "undefined") {
1331                  for(var poly_entry in wpgmaps_localize_polygon_settings[mapid]) {
1332                    add_polygon(mapid,poly_entry);
1333                  }
1334            }
1335        }
1336        if (wpgmaps_localize_polyline_settings !== null) {
1337            if (typeof wpgmaps_localize_polyline_settings[mapid] !== "undefined") {
1338                  for(var poly_entry in wpgmaps_localize_polyline_settings[mapid]) {
1339                    add_polyline(mapid,poly_entry);
1340                  }
1341            }
1342        }
1343    
1344        
1345        /*
1346        if (wpgmaps_localize_polyline_settings !== null) {
1347            if (wpgmaps_localize_polyline_settings[mapid] !== null) { 
1348                for(var poly_entry in wpgmaps_localize_polyline_settings[mapid]) {
1349                    var tmp_data = wpgmaps_localize_polyline_settings[mapid];
1350
1351                    var tmp_polydata = tmp_data[poly_entry]['polydata'];
1352                     var WPGM_PathData = new Array();
1353                     for (tmp_entry2 in tmp_polydata) {
1354                         WPGM_PathData.push(new google.maps.LatLng(tmp_polydata[tmp_entry2][0], tmp_polydata[tmp_entry2][1]));
1355
1356                     }
1357                    if (tmp_data[poly_entry]['lineopacity'] === null || tmp_data[poly_entry]['lineopacity'] === "") {
1358                        tmp_data[poly_entry]['lineopacity'] = 1;
1359                    }
1360                    
1361                    var WPGM_Path = new google.maps.Polyline({
1362                     path: WPGM_PathData,
1363                     strokeColor: "#"+tmp_data[poly_entry]['linecolor'],
1364                     strokeOpacity: tmp_data[poly_entry]['opacity'],
1365                     fillColor: "#"+tmp_data[poly_entry]['fillcolor'],
1366                     strokeWeight: tmp_data[poly_entry]['linethickness']
1367                   });
1368                   WPGM_Path.setMap(MYMAP[mapid].map);
1369
1370                }
1371             }
1372        }
1373        */
1374                
1375        if (wpgmaps_localize[entry]['bicycle'] === "1") {
1376            var bikeLayer = new google.maps.BicyclingLayer();
1377            bikeLayer.setMap(MYMAP[mapid].map);
1378        }        
1379        if (wpgmaps_localize[entry]['traffic'] === "1") {
1380            var trafficLayer = new google.maps.TrafficLayer();
1381            trafficLayer.setMap(MYMAP[mapid].map);
1382        }        
1383        if ("undefined" !== typeof wpgmaps_localize[mapid]['other_settings']['weather_layer'] && wpgmaps_localize[mapid]['other_settings']['weather_layer'] === 1) {
1384            if ("undefined" === typeof google.maps.weather) { } else {
1385                if ("undefined" !== typeof wpgmaps_localize[mapid]['other_settings']['weather_layer_temp_type'] && wpgmaps_localize[mapid]['other_settings']['weather_layer_temp_type'] === 2) {
1386                    var weatherLayer = new google.maps.weather.WeatherLayer({ 
1387                        temperatureUnits: google.maps.weather.TemperatureUnit.FAHRENHEIT
1388                    });
1389                    weatherLayer.setMap(MYMAP[mapid].map);
1390                } else {
1391                    var weatherLayer = new google.maps.weather.WeatherLayer({ 
1392                        temperatureUnits: google.maps.weather.TemperatureUnit.CELSIUS
1393                    });
1394                    weatherLayer.setMap(MYMAP[mapid].map);
1395                }
1396            }
1397        }        
1398        if ("undefined" !== typeof wpgmaps_localize[mapid]['other_settings']['cloud_layer'] && wpgmaps_localize[mapid]['other_settings']['cloud_layer'] === 1) {
1399            if ("undefined" === typeof google.maps.weather) { } else {
1400                var cloudLayer = new google.maps.weather.CloudLayer();
1401                cloudLayer.setMap(MYMAP[mapid].map);
1402            }
1403        }        
1404        if ("undefined" !== typeof wpgmaps_localize[mapid]['other_settings']['transport_layer'] && wpgmaps_localize[mapid]['other_settings']['transport_layer'] === 1) {
1405                var transitLayer = new google.maps.TransitLayer();
1406                transitLayer.setMap(MYMAP[mapid].map);
1407        }        
1408        if (wpgmaps_localize[entry]['kml'] !== "") {
1409            var wpgmaps_d = new Date();
1410            var wpgmaps_ms = wpgmaps_d.getTime();
1411            
1412            arr = wpgmaps_localize[mapid]['kml'].split(',');
1413            arr.forEach(function(entry) {
1414                var georssLayer = new google.maps.KmlLayer(entry+'?tstamp='+wpgmaps_ms,{preserveViewport: true});
1415                georssLayer.setMap(MYMAP[mapid].map);
1416            });
1417
1418
1419            
1420        }        
1421        if (wpgmaps_localize[mapid]['fusion'] !== "") {
1422            var fusionlayer = new google.maps.FusionTablesLayer(wpgmaps_localize[mapid]['fusion'], {
1423                  suppressInfoWindows: false
1424            });
1425            fusionlayer.setMap(MYMAP[mapid].map);
1426        }        
1427
1428        
1429
1430        if (typeof wpgmaps_localize[mapid]['other_settings']['push_in_map'] !== 'undefined' && wpgmaps_localize[mapid]['other_settings']['push_in_map'] === "1") {
1431
1432
1433            if (typeof wpgmaps_localize[mapid]['other_settings']['wpgmza_push_in_map_width'] !== 'undefined') {
1434                var wpgmza_con_width = wpgmaps_localize[mapid]['other_settings']['wpgmza_push_in_map_width'];
1435            } else {
1436                var wpgmza_con_width = "30%";
1437            }
1438            if (typeof wpgmaps_localize[mapid]['other_settings']['wpgmza_push_in_map_height'] !== 'undefined') {
1439                var wpgmza_con_height = wpgmaps_localize[mapid]['other_settings']['wpgmza_push_in_map_height'];
1440            } else {
1441                var wpgmza_con_height = "50%";
1442            }
1443
1444            if (jQuery('#wpgmza_marker_holder_'+mapid).length) {
1445                var legend = document.getElementById('wpgmza_marker_holder_'+mapid);
1446                jQuery(legend).width(wpgmza_con_width);
1447                jQuery(legend).css('margin','15px');
1448                jQuery(legend).addClass('wpgmza_innermap_holder');
1449                jQuery(legend).addClass('wpgmza-shadow');
1450                jQuery('#wpgmza_table_'+mapid).addClass('');
1451                wpgmza_controls_active[mapid] = true;
1452            } else if (jQuery('#wpgmza_marker_list_container_'+mapid).length) {
1453                var legend_tmp = document.getElementById('wpgmza_marker_list_container_'+mapid);
1454                
1455                jQuery('#wpgmza_marker_list_container_'+mapid).wrap("<div id='wpgmza_marker_list_parent_"+mapid+"'></div>");
1456                var legend = document.getElementById('wpgmza_marker_list_parent_'+mapid);
1457                jQuery(legend).width(wpgmza_con_width);
1458                jQuery(legend).height(wpgmza_con_height);
1459
1460                jQuery(legend).css('margin','15px');
1461                jQuery(legend).css('overflow','auto');
1462
1463                /* check if we're using the carousel option */
1464                if (jQuery(legend_tmp).hasClass("wpgmza_marker_carousel")) { } else {
1465                    jQuery(legend).addClass('wpgmza_innermap_holder');
1466                    jQuery(legend).addClass('wpgmza-shadow');
1467                }
1468
1469                jQuery('#wpgmza_marker_list_'+mapid).addClass('');
1470                wpgmza_controls_active[mapid] = true;
1471
1472            } else if (jQuery('#wpgmza_marker_list_'+mapid).length) {
1473                var legend_tmp = document.getElementById('wpgmza_marker_list_'+mapid);
1474                
1475                jQuery('#wpgmza_marker_list_'+mapid).wrap("<div id='wpgmza_marker_list_parent_"+mapid+"'></div>");
1476                var legend = document.getElementById('wpgmza_marker_list_parent_'+mapid);
1477                jQuery(legend).width(wpgmza_con_width);
1478                jQuery(legend).height(wpgmza_con_height);
1479
1480                jQuery(legend).css('margin','15px');
1481                jQuery(legend).css('overflow','auto');
1482
1483                /* check if we're using the carousel option */
1484                if (jQuery(legend_tmp).hasClass("wpgmza_marker_carousel")) { } else {
1485                    jQuery(legend).addClass('wpgmza_innermap_holder');
1486                    jQuery(legend).addClass('wpgmza-shadow');
1487                }
1488
1489                jQuery('#wpgmza_marker_list_'+mapid).addClass('');
1490                wpgmza_controls_active[mapid] = true;
1491            }
1492            /*
1493                beta - still to add options for this
1494
1495            
1496            if (jQuery('#wpgmza_filter_'+mapid).length) {
1497                var legend_tmp = document.getElementById('wpgmza_filter_'+mapid);
1498                
1499                jQuery('#wpgmza_filter_'+mapid).wrap("<div id='wpgmza_filter_parent_"+mapid+"'></div>");
1500                var legend = document.getElementById('wpgmza_filter_parent_'+mapid);
1501                jQuery(legend).width(wpgmza_con_width);
1502                jQuery(legend).height(wpgmza_con_height);
1503
1504                jQuery(legend).css('margin','15px');
1505                jQuery(legend).css('overflow','auto');
1506
1507                
1508                if (jQuery(legend_tmp).hasClass("wpgmza_marker_carousel")) { } else {
1509                    jQuery(legend).addClass('wpgmza_innermap_holder');
1510                    jQuery(legend).addClass('wpgmza-shadow');
1511                }
1512
1513                jQuery('#wpgmza_filter_'+mapid).addClass('');
1514                wpgmza_controls_active[mapid] = true;
1515            }
1516            */
1517            if (typeof legend !== 'undefined') { 
1518                if (typeof wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] !== 'undefined') {
1519                    if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "1") { MYMAP[mapid].map.controls[google.maps.ControlPosition.TOP_CENTER].push(legend); }
1520                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "2") { MYMAP[mapid].map.controls[google.maps.ControlPosition.TOP_LEFT].push(legend); }
1521                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "3") { MYMAP[mapid].map.controls[google.maps.ControlPosition.TOP_RIGHT].push(legend); }
1522                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "4") { MYMAP[mapid].map.controls[google.maps.ControlPosition.LEFT_TOP].push(legend); }
1523                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "5") { MYMAP[mapid].map.controls[google.maps.ControlPosition.RIGHT_TOP].push(legend); }
1524                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "6") { MYMAP[mapid].map.controls[google.maps.ControlPosition.LEFT_CENTER].push(legend); }
1525                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "7") { MYMAP[mapid].map.controls[google.maps.ControlPosition.RIGHT_CENTER].push(legend); }
1526                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "8") { MYMAP[mapid].map.controls[google.maps.ControlPosition.LEFT_BOTTOM].push(legend); }
1527                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "9") { MYMAP[mapid].map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(legend); }
1528                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "10") { MYMAP[mapid].map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(legend); }
1529                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "11") { MYMAP[mapid].map.controls[google.maps.ControlPosition.BOTTOM_LEFT].push(legend); }
1530                    else if (wpgmaps_localize[mapid]['other_settings']['push_in_map_placement'] === "12") { MYMAP[mapid].map.controls[google.maps.ControlPosition.BOTTOM_RIGHT].push(legend); }
1531                    else { MYMAP[mapid].map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(legend); }  
1532
1533                } else { MYMAP[mapid].map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(legend); }  
1534            } 
1535        
1536        }
1537    };    
1538
1539    
1540
1541
1542
1543
1544    google.maps.event.addDomListener(window, 'resize', function() {
1545        var myLatLng = MYMAP[wpgmaps_localize[entry]['id']].map.getCenter();
1546        
1547        if ('undefined' !== typeof MYMAP[wpgmaps_localize[entry]['id']].map) {
1548            MYMAP[wpgmaps_localize[entry]['id']].map.setCenter(myLatLng);
1549        }
1550    });
1551    
1552    
1553
1554
1555
1556    MYMAP[wpgmaps_localize[entry]['id']].placeMarkers = function(filename,map_id,cat_id,radius,searched_center,distance_type,search_title,show_markers) {
1557        
1558
1559
1560        if (typeof marker_array[map_id] !== "undefined") {
1561            for (var i = 0; i < marker_array[map_id].length; i++) {
1562                /* remove any instance of a marker first tio avoid using a full reinit which causes the map to flicker */
1563                if (typeof marker_array[map_id][i] !== 'undefined') { 
1564                    
1565                    marker_array[map_id][i].setMap(null);
1566                    /* Check which map we are working on, and only reset the correct markers. (Store locator, etc) */
1567                }
1568            }
1569        }
1570
1571        /* reset store locator circle */
1572        if (typeof cityCircle[map_id] !== "undefined") {
1573            cityCircle[map_id].setMap(null);
1574        }
1575
1576        /* reset store locator icons if any */
1577        if (typeof store_locator_marker[map_id] !== "undefined") {
1578            store_locator_marker[map_id].setMap(null);
1579        }
1580
1581        marker_array[map_id] = new Array(); 
1582        marker_sl_array[map_id] = new Array(); 
1583        marker_array2[map_id] = new Array(); 
1584        
1585
1586        if (show_markers || typeof show_markers === "undefined") { 
1587            
1588            if (typeof wpgm_g_e !== "undefined" && wpgm_g_e === true) {
1589                var mcOptions = {
1590                    gridSize: 20,
1591                    maxZoom: 15,
1592                    styles: [{
1593                        height: 53,
1594                        url: "//ccplugins.co/markerclusterer/images/m1.png",
1595                        width: 53
1596                    },
1597                    {
1598                        height: 56,
1599                        url: "//ccplugins.co/markerclusterer/images/m2.png",
1600                        width: 56
1601                    },
1602                    {
1603                        height: 66,
1604                        url: "//ccplugins.co/markerclusterer/images/m3.png",
1605                        width: 66
1606                    },
1607                    {
1608                        height: 78,
1609                        url: "//ccplugins.co/markerclusterer/images/m4.png",
1610                        width: 78
1611                    },
1612                    {
1613                        height: 90,
1614                        url: "//ccplugins.co/markerclusterer/images/m5.png",
1615                        width: 90
1616                    }] 
1617                };
1618                if (wpgmaps_localize[entry]['mass_marker_support'] === "1" || wpgmaps_localize[entry]['mass_marker_support'] === null) { 
1619                    if (typeof markerClusterer[map_id] !== "undefined") { markerClusterer[map_id].clearMarkers(); }
1620                    markerClusterer[map_id] = new MarkerClusterer(MYMAP[map_id].map, null, mcOptions);
1621                }
1622            }
1623
1624            var check1 = 0;
1625
1626            if (wpgmaps_localize_global_settings['wpgmza_settings_image_width'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_image_width']) { wpgmaps_localize_global_settings['wpgmza_settings_image_width'] = 'auto'; } else { wpgmaps_localize_global_settings['wpgmza_settings_image_width'] = wpgmaps_localize_global_settings['wpgmza_settings_image_width']+'px'; }
1627            if (wpgmaps_localize_global_settings['wpgmza_settings_image_height'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_image_height']) { wpgmaps_localize_global_settings['wpgmza_settings_image_height'] = 'auto'; } else { wpgmaps_localize_global_settings['wpgmza_settings_image_height'] = wpgmaps_localize_global_settings['wpgmza_settings_image_height']+'px'; }
1628
1629
1630            if (marker_pull === '1') {
1631
1632            
1633            
1634                jQuery.get(filename, function(xml){
1635
1636                    jQuery(xml).find("marker").each(function(){
1637                        var wpgmza_def_i
1637con = wpgmaps_localize[map_id]['default_marker'];
1638                        var wpmgza_map_id = jQuery(this).find('map_id').text();
1639                        var wpmgza_marker_id = jQuery(this).find('marker_id').text();
1640                        var wpmgza_title = jQuery(this).find('title').text();
1641                        var wpgmza_orig_title = wpmgza_title;
1642                        if (wpmgza_title !== "") {
1643                            var wpmgza_title = '<p class="wpgmza_infowindow_title">'+jQuery(this).find('title').text()+'</p>';
1644                        }
1645                        var wpmgza_address = jQuery(this).find('address').text();
1646                        if (wpmgza_address !== "") {
1647                            var wpmgza_show_address = '<p class="wpgmza_infowindow_address">'+wpmgza_address+'</p>';
1648                        } else {
1649                            var wpmgza_show_address = '';
1650                        }
1651
1652                        var wpmgza_mapicon = jQuery(this).find('icon').text();
1653                        var wpmgza_image = jQuery(this).find('pic').text();
1654                        var wpmgza_desc  = jQuery(this).find('desc').text();
1655                        var wpgmza_orig_desc = wpmgza_desc;
1656                        if (wpmgza_desc !== "") {
1657                            var wpmgza_desc = '<p class="wpgmza_infowindow_description">'+jQuery(this).find('desc').text()+'</p>';
1658                        }
1659                        var wpmgza_linkd = jQuery(this).find('linkd').text();
1660                        var wpmgza_linkd_orig = wpmgza_linkd;
1661                        var wpmgza_anim  = jQuery(this).find('anim').text();
1662                        var wpmgza_retina  = jQuery(this).find('retina').text();
1663                        var wpmgza_category  = jQuery(this).find('category').text();
1664                        var current_lat = jQuery(this).find('lat').text();
1665                        var current_lng = jQuery(this).find('lng').text();
1666                        var show_marker_radius = true;
1667                        var show_marker_title_string = true;
1668
1669
1670
1671                        if (radius !== null) {
1672
1673
1674                            if (check1 > 0 ) { } else { 
1675                                var sl_stroke_color = wpgmaps_localize[map_id]['other_settings']['sl_stroke_color'];
1676                                if (sl_stroke_color !== "" || sl_stroke_color !== null) { } else { sl_stroke_color = 'FF0000'; }
1677                                var sl_stroke_opacity = wpgmaps_localize[map_id]['other_settings']['sl_stroke_opacity'];
1678                                if (sl_stroke_opacity !== "" || sl_stroke_opacity !== null) { } else { sl_stroke_opacity = '0.25'; }
1679                                var sl_fill_opacity = wpgmaps_localize[map_id]['other_settings']['sl_fill_opacity'];
1680                                if (sl_fill_opacity !== "" || sl_fill_opacity !== null) { } else { sl_fill_opacity = '0.15'; }
1681                                var sl_fill_color = wpgmaps_localize[map_id]['other_settings']['sl_fill_color'];
1682                                if (sl_fill_color !== "" || sl_fill_color !== null) { } else { sl_fill_color = 'FF0000'; }
1683
1684                                var point = new google.maps.LatLng(parseFloat(searched_center.lat()),parseFloat(searched_center.lng()));
1685                                MYMAP[map_id].bounds.extend(point);
1686
1687                                if (wpgmaps_localize[map_id]['other_settings']['store_locator_bounce'] === 1) {
1688                                    if ("undefined" !== typeof wpgmaps_localize[map_id]['other_settings']['upload_default_sl_marker']) { 
1689                                        store_locator_marker[map_id] = new google.maps.Marker({
1690                                                position: point,
1691                                                map: MYMAP[map_id].map,
1692                                                icon: wpgmaps_localize[map_id]['other_settings']['upload_default_sl_marker'],
1693                                                animation: google.maps.Animation.BOUNCE
1694                                        });
1695
1696                                    } else {
1697                                        store_locator_marker[map_id] = new google.maps.Marker({
1698                                                position: point,
1699                                                map: MYMAP[map_id].map,
1700                                                animation: google.maps.Animation.BOUNCE
1701                                        });
1702                                    }
1703                                    
1704                                } else {
1705                                    /* do nothing */
1706                                }
1707                                if (distance_type === "1") {
1708                                    var populationOptions = {
1709                                            strokeColor: '#'+sl_stroke_color,
1710                                            strokeOpacity: sl_stroke_opacity,
1711                                            strokeWeight: 2,
1712                                            fillColor: '#'+sl_fill_color,
1713                                            fillOpacity: sl_fill_opacity,
1714                                            map: MYMAP[map_id].map,
1715                                            center: point,
1716                                            radius: parseInt(radius / 0.000621371)
1717                                          };
1718                                  } else {
1719                                      var populationOptions = {
1720                                            strokeColor: '#'+sl_stroke_color,
1721                                            strokeOpacity: sl_stroke_opacity,
1722                                            strokeWeight: 2,
1723                                            fillColor: '#'+sl_fill_color,
1724                                            fillOpacity: sl_fill_opacity,
1725                                            map: MYMAP[map_id].map,
1726                                            center: point,
1727                                            radius: parseInt(radius / 0.001)
1728                                          };
1729                                  }
1730                                /* Add the circle for this city to the map. */
1731                                cityCircle[map_id] = new google.maps.Circle(populationOptions);
1732                                check1 = check1 + 1;
1733                            }
1734
1735                            if (distance_type === "1") {
1736                                R = 3958.7558657440545; /* Radius of earth in Miles  */
1737                            } else {
1738                                R = 6378.16; /* Radius of earth in kilometers  */
1739                            }
1740                            var dLat = toRad(searched_center.lat()-current_lat);
1741                            var dLon = toRad(searched_center.lng()-current_lng); 
1742                            var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.
1742cos(toRad(current_lat)) * Math.cos(toRad(searched_center.lat())) * Math.sin(dLon/2) * Math.sin(dLon/2); 
1743                            var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
1744                            var d = R * c;
1745                            
1746                            if (d < radius) { show_marker_radius = true; } else { show_marker_radius = false; }
1747
1748
1749                            /* check if they have done a title search too */
1750                            if (search_title === null || search_title === "") { show_marker_title_string = true; }
1751                            else {
1752                                var x = wpgmza_orig_title.toLowerCase().search(search_title.toLowerCase());
1753                                var y = wpgmza_orig_desc.toLowerCase().search(search_title.toLowerCase());
1754                                if (x >= 0 || y >= 0) {
1755                                    show_marker_title_string = true;
1756                                } else {
1757                                    show_marker_title_string = false;
1758                                }
1759
1760                            }
1761
1762
1763
1764                        }
1765                        var cat_is_cat;
1766                        cat_is_cat = false;
1767                        if( Object.prototype.toString.call( cat_id ) === '[object Array]' ) {
1768                            /* work with category array */
1769                            if (cat_id[0] === '0') { cat_id === "all"; }
1770                            for (var tmp_val in cat_id) {
1771                                /* only one category sent through to show */
1772                                if(wpmgza_category.indexOf(',') === -1) {
1773                                    if (cat_id[tmp_val] === wpmgza_category) { 
1774                                        cat_is_cat = true;
1775                                    }
1776                                } else { 
1777                                    var array = JSON.parse("[" + wpmgza_category + "]");
1778                                    array.forEach(function(entry) {
1779                                        if (parseInt(cat_id[tmp_val]) === parseInt(entry)) {
1780                                            cat_is_cat = true;
1781                                        }
1782                                    });
1783                                } 
1784
1785
1786                            }
1787                        } else {
1788
1789                            /* only one category sent through to show */
1790                            if(wpmgza_category.indexOf(',') === -1) {
1791                                if (cat_id === wpmgza_category) {
1792                                    cat_is_cat = true;
1793                                }
1794                            } else { 
1795                                var array = JSON.parse("[" + wpmgza_category + "]");
1796                                array.forEach(function(entry) {
1797                                    if (parseInt(cat_id) === parseInt(entry)) {
1798                                        cat_is_cat = true;
1799                                    }
1800                                });
1801                            } 
1802                        }  
1803
1804                        if (cat_id === 'all' || cat_is_cat) {
1805
1806                            var wpmgza_infoopen  = jQuery(this).find('infoopen').text();
1807                            
1808
1809                            if (wpmgza_image !== "") {
1810                                
1811
1812
1813
1814                                /* timthumb completely removed in 5.54 */
1815                                /*if (wpgmaps_localize_global_settings['wpgmza_settings_use_timthumb'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_use_timthumb']) {
1816                                        wpmgza_image = "<img src=\""+wpgmaps_plugurl+"/timthumb.php?src="+wpmgza_image+"&h="+wpgmaps_localize_global_settings['wpgmza_settings_image_height']+"&w="+wpgmaps_localize_global_settings['wpgmza_settings_image_width']+"&zc=1\" title=\"\" class=\"wpgmza_infowindow_image\" width=\""+wpgmaps_localize_global_settings['wpgmza_settings_image_width']+"\" height=\""+wpgmaps_localize_global_settings['wpgmza_settings_image_height']+"\" style=\"float:right; width:"+wpgmaps_localize_global_settings['wpgmza_settings_image_width']+"px; height:"+wpgmaps_localize_global_settings['wpgmza_settings_image_height']+"px;\" />";
1817                                } else {*/
1818                                    if ('undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_image_resizing'] || wpgmaps_localize_global_settings['wpgmza_settings_image_resizing'] === "yes") {
1819
1820                                        wpmgza_image = "<img src=\""+wpmgza_image+"\" title=\"\" class=\"wpgmza_infowindow_image\" alt=\"\" style=\"float:right; width:"+wpgmaps_localize_global_settings['wpgmza_settings_image_width']+"; height:"+wpgmaps_localize_global_settings['wpgmza_settings_image_height']+"; max-width:"+wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']+"px !important;\" />";
1821
1822                                    } else {
1823                                        wpmgza_image = "<img src=\""+wpmgza_image+"\" class=\"wpgmza_infowindow_image wpgmza_map_image\" style=\"float:right; margin:5px; max-width:"+wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']+"px !important;\" />";
1824                                    }
1825                                /*}*/
1826
1827
1828                            } else { wpmgza_image = ""; }
1829
1830
1831                            if (wpmgza_linkd !== "") {
1832                                if (wpgmaps_localize_global_settings['wpgmza_settings_infowindow_links'] === "yes") { wpgmza_iw_links_target = "target='_BLANK'";  }
1833                                else { wpgmza_iw_links_target = ''; }
1834                                wpmgza_linkd = "<p class=\"wpgmza_infowindow_link\"><a class=\"wpgmza_infowindow_link\" href=\""+wpmgza_linkd+"\" "+wpgmza_iw_links_target+" title=\""+wpgmaps_lang_more_details+"\">"+wpgmaps_lang_more_details+"</a></p>";
1835                            } else {
1836                                wpgmza_iw_links_target = "";
1837                            }
1838
1839                            if (wpmgza_mapicon === "" || !wpmgza_mapicon) { if (wpgmza_def_icon !== "") { wpmgza_mapicon = wpgmaps_localize[map_id]['default_marker']; } }
1840
1841                            var wpgmza_optimized = true;
1842                            if (wpmgza_retina === "1" && wpmgza_mapicon !== "0") {
1843                                wpmgza_mapicon = new google.maps.MarkerImage(wpmgza_mapicon, null, null, null, new google.maps.Size(wpgmza_retina_width,wpgmza_retina_height));
1844                                wpgmza_optimized = false;
1845                            }
1846
1847
1848
1849                            var lat = jQuery(this).find('lat').text();
1850                            var lng = jQuery(this).find('lng').text();
1851                            var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng));
1852                            MYMAP[map_id].bounds.extend(point);
1853
1854                            
1855
1856
1857                            if (show_marker_radius === true && show_marker_title_string === true) {
1858                                if (wpmgza_anim === "1") {
1859                                    if (wpmgza_mapicon === null || wpmgza_mapicon === "" || wpmgza_mapicon === 0 || wpmgza_mapicon === "0") {
1860                                        var marker = new google.maps.Marker({
1861                                                position: point,
1862                                                map: MYMAP[map_id].map,
1863                                                animation: google.maps.Animation.BOUNCE
1864                                        });
1865                                    } else {
1866                                        var marker = new google.maps.Marker({
1867                                                position: point,
1868                                                map: MYMAP[map_id].map,
1869                                                icon: wpmgza_mapicon,
1870                                                animation: google.maps.Animation.BOUNCE,
1871                                                optimized: wpgmza_optimized
1872
1873                                        });
1874                                    }
1875                                }
1876                                else if (wpmgza_anim === "2") {
1877                                    if (wpmgza_mapicon === null || wpmgza_mapicon === "" || wpmgza_mapicon === 0 || wpmgza_mapicon === "0") {
1878                                        var marker = new google.maps.Marker({
1879                                                position: point,
1880                                                map: MYMAP[map_id].map,
1881                                                animation: google.maps.Animation.DROP
1882                                        });
1883
1884                                    } else {
1885
1886                                        var marker = new google.maps.Marker({
1887                                                position: point,
1888                                                map: MYMAP[map_id].map,
1889                                                icon: wpmgza_mapicon,
1890                                                animation: google.maps.Animation.DROP,
1891                                                optimized: wpgmza_optimized
1892                                        });
1893                                    }
1894                                }
1895                                else {
1896                                    if (wpmgza_mapicon === null || wpmgza_mapicon === "" || wpmgza_mapicon === 0 || wpmgza_mapicon === "0") {
1897                                        var marker = new google.maps.Marker({
1898                                                position: point,
1899                                                map: MYMAP[map_id].map,
1900                                                optimized: wpgmza_optimized
1901                                        });
1902
1903                                    } else {
1904                                        var marker = new google.maps.Marker({
1905                                                position: point,
1906                                                map: MYMAP[map_id].map,
1907                                                icon: wpmgza_mapicon,
1908                                                optimized: wpgmza_optimized
1909                                        });
1910                                    }
1911                                }
1912
1913                                
1914
1915                                if (wpgmaps_localize_global_settings['wpgmza_settings_infowindow_address'] === "yes") {
1916                                    wpmgza_show_address = "";
1917                                }
1918                                if (wpgmaps_localize[map_id]['directions_enabled'] 
1918=== "1") {
1919                                    wpmgza_dir_enabled = '<p><a href="javascript:void(0);" id="'+map_id+'" class="wpgmza_gd" wpgm_addr_field="'+wpmgza_address+'" gps="'+parseFloat(lat)+','+parseFloat(lng)+'">'+wpgmaps_lang_get_dir+'</a></p>';
1920                                } else {
1921                                    wpmgza_dir_enabled = '';
1922                                }
1923                                if (radius !== null) {                                 
1924                                    if (distance_type === "1") {
1925                                        d_string = "<p>"+Math.round(d,2)+' '+wpgmaps_lang_m_away+"</p>"; 
1926                                    } else {
1927                                        d_string = "<p>"+Math.round(d,2)+' '+wpgmaps_lang_km_away+"</p>"; 
1928                                    }
1929                                } else { d_string = ''; }
1930
1931                                if (wpmgza_image !== "") {
1932                                        var html='<div class="wpgmza_markerbox scrollFix">'+
1933                                        wpmgza_image+
1934                                        wpmgza_title+
1935                                        wpmgza_show_address+
1936                                        wpmgza_desc+
1937                                        wpmgza_linkd+
1938                                        d_string+
1939                                        wpmgza_dir_enabled+
1940                                        '</div>';
1941
1942                                } else {
1943                                        var html='<div class="wpgmza_markerbox scrollFix">'+                                
1944                                    
1945                                        wpmgza_image+
1946                                        wpmgza_title+
1947                                        wpmgza_show_address+
1948                                        wpmgza_desc+
1949                                        wpmgza_linkd+
1950                                        d_string+
1951                                        wpmgza_dir_enabled+
1952                                        '</div>';
1953
1954                                }
1955
1956                                var marker_data_object = {
1957                                    title: wpgmza_orig_title,
1958                                    address: wpmgza_address,
1959                                    image: jQuery(this).find('pic').text(),
1960                                    link: wpmgza_linkd_orig,
1961                                    directions: wpmgza_dir_enabled,
1962                                    distance: d_string,
1963                                    desc: wpgmza_orig_desc,
1964                                    gps: parseFloat(lat)+','+parseFloat(lng),
1965                                    link_target:wpgmza_iw_links_target
1966                                };
1967                                infoWindow[wpmgza_marker_id] = new google.maps.InfoWindow();
1968                                if (wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']) {
1969                                    wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width'] = false;
1970                                }
1971
1972                                if (wpmgza_infoopen === "1") {
1973                                    wpgmza_open_marker_func(map_id,marker,html,click_from_list,marker_data_object,wpmgza_marker_id);
1974                                }
1975
1976                                /* do they want to open a marker from a GET variable? */
1977                                if (typeof wpgmza_open_marker !== "underfined") {
1978                                    if (wpgmza_open_marker === wpmgza_marker_id) { 
1979
1980                                        
1981                                        if (wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']) { infoWindow[wpmgza_marker_id].setOptions({maxWidth:wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']}); }
1982                                        infoWindow[wpmgza_marker_id].setContent(html);
1983                                        infoWindow[wpmgza_marker_id].open(MYMAP[map_id].map, marker);
1984                                        MYMAP[map_id].map.setCenter(point);
1985                                        if (typeof wpgmza_open_marker_zoom !== "undefined") {
1986                                            MYMAP[map_id].map.setZoom(parseInt(wpgmza_open_marker_zoom));
1987                                        }
1988                                    }
1989                                }
1990
1991                                if (typeof wpgmaps_localize[map_id]['other_settings']['click_open_link'] !== "undefined" && wpgmaps_localize[map_id]['other_settings']['click_open_link'] 
1991=== 1 && typeof wpmgza_linkd_orig !== "undefined" && wpmgza_linkd_orig !== "") {
1992                                    google.maps.event.addListener(marker, 'click', function(evt) {
1993                                        location = wpmgza_linkd_orig;
1994                                   }); 
1995                                }
1996                                if (wpgmaps_localize_global_settings['wpgmza_settings_map_open_marker_by'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_open_marker_by'] || wpgmaps_localize_global_settings['wpgmza_settings_map_open_marker_by'] === '1') { 
1997                                    google.maps.event.addListener(marker, 'click', function(evt) {
1998                                        wpgmza_open_marker_func(map_id,marker,html,click_from_list,marker_data_object,wpmgza_marker_id);
1999                                    }); 
2000                                } else {
2001                                    google.maps.event.addListener(marker, 'mouseover', function(evt) {
2002                                        wpgmza_open_marker_func(map_id,marker,html,click_from_list,marker_data_object,wpmgza_marker_id);
2003                                        
2004                                    }); 
2005                                }
2006                                marker_array[map_id][wpmgza_marker_id] = marker;
2007                                marker_array2[map_id].push(marker);
2008                                marker_sl_array[map_id].push(wpmgza_marker_id);
2009
2010                            }
2011                        } 
2012
2013                    });
2014        
2015                    if (typeof wpgm_g_e !== "undefined" && wpgm_g_e === true) {
2016
2017                        if (wpgmaps_localize[map_id]['mass_marker_support'] === "1" || wpgmaps_localize[map_id]['mass_marker_support'] === null) { 
2018                            if (typeof markerClusterer[map_id] !== "undefined") { markerClusterer[map_id].addMarkers(marker_array2[map_id]); }
2019                        }
2020                    }
2021
2022
2023                    if (radius !== null) {
2024
2025                        wpgmza_filter_marker_lists_by_array(map_id,marker_sl_array[map_id]);
2026
2027                    }
2028
2029                });
2030            
2031            } else { 
2032                /* DB method */
2033                jQuery.each(wpgmaps_localize_marker_data[map_id], function(i, val) {
2034                    
2035                    
2036                    var wpgmza_def_icon = wpgmaps_localize[map_id]['default_marker'];
2037                    
2038
2039                    /*
2040                        removed due to mashup incompatibilities. If used, it tries to push the marker to the markers original ID instead of the MASHUP MAP ID.
2041                        var wpmgza_map_id = val.map_id;
2042                    
2043                    */ 
2044                    var wpmgza_map_id = map_id;
2045                    
2046
2047                    var wpmgza_marker_id = val.marker_id;
2048
2049                    var wpmgza_title = val.title;
2050                    var wpgmza_orig_title = wpmgza_title;
2051                    if (wpmgza_title !== "") {
2052                        var wpmgza_title = '<p class="wpgmza_infowindow_title">'+val.title+'</p>';
2053                    }
2054                    var wpmgza_address = val.address;
2055                    if (wpmgza_address !== "") {
2056                        var wpmgza_show_address = '<p class="wpgmza_infowindow_address">'+wpmgza_address+'</p>';
2057                    } else {
2058                        var wpmgza_show_address = '';
2059                    }
2060                    var wpmgza_mapicon = val.icon;
2061                    var wpmgza_image = val.pic;
2062                    var wpmgza_desc  = val.desc;
2063                    var wpgmza_orig_desc = wpmgza_desc;
2064                    if (wpmgza_desc !== "") {
2065                        var wpmgza_desc = '<p class="wpgmza_infowindow_description">'+val.desc;+'</p>';
2066                    }
2067                    var wpmgza_linkd = val.linkd;
2068                    var wpmgza_linkd_orig = wpmgza_linkd;
2069
2070                    var wpmgza_anim  = val.anim;
2071                    var wpmgza_retina  = val.retina;
2072                    var wpmgza_category  = val.category;
2073                    var current_lat = val.lat;
2074                    var current_lng = val.lng;
2075                    var show_marker_radius = true;
2076                    var show_marker_title_string = true;
2077
2078
2079                    if (radius !== null) {
2080
2081
2082                        if (check1 > 0 ) { } else { 
2083                            var sl_stroke_color = wpgmaps_localize[map_id]['other_settings']['sl_stroke_color'];
2084                            if (sl_stroke_color !== "" || sl_stroke_color !== null) { } else { sl_stroke_color = 'FF0000'; }
2085                            var sl_stroke_opacity = wpgmaps_localize[map_id]['other_settings']['sl_stroke_opacity'];
2086                            if (sl_stroke_opacity !== "" || sl_stroke_opacity !== null) { } else { sl_stroke_opacity = '0.25'; }
2087                            var sl_fill_opacity = wpgmaps_localize[map_id]['other_settings']['sl_fill_opacity'];
2088                            if (sl_fill_opacity !== "" || sl_fill_opacity !== null) { } else { sl_fill_opacity = '0.15'; }
2089                            var sl_fill_color = wpgmaps_localize[map_id]['other_settings']['sl_fill_color'];
2090                            if (sl_fill_color !== "" || sl_fill_color !== null) { } else { sl_fill_color = 'FF0000'; }
2091
2092                            var point = new google.maps.LatLng(parseFloat(searched_center.lat()),parseFloat(searched_center.lng()));
2093                            MYMAP[map_id].bounds.extend(point);
2094
2095                            if (wpgmaps_localize[map_id]['other_settings']['store_locator_bounce'] === 1) {
2096                                    if ("undefined" !== typeof wpgmaps_localize[map_id]['other_settings']['upload_default_sl_marker']) { 
2097                                        store_locator_marker[map_id] = new google.maps.Marker({
2098                                                position: point,
2099                                                map: MYMAP[map_id].map,
2100                                                icon: wpgmaps_localize[map_id]['other_settings']['upload_default_sl_marker'],
2101                                                animation: google.maps.Animation.BOUNCE
2102                                        });
2103
2104                                    } else {
2105                                        store_locator_marker[map_id] = new google.maps.Marker({
2106                                                position: point,
2107                                                map: MYMAP[map_id].map,
2108                                                animation: google.maps.Animation.BOUNCE
2109                                        });
2110                                    }
2111                                
2112                                
2113                            } else {
2114                                /* do nothing */
2115                            }
2116                            if (distance_type === "1") {
2117                                var populationOptions = {
2118                                        strokeColor: '#'+sl_stroke_color,
2119                                        strokeOpacity: sl_stroke_opacity,
2120                                        strokeWeight: 2,
2121                                        fillColor: '#'+sl_fill_color,
2122                                        fillOpacity: sl_fill_opacity,
2123                                        map: MYMAP[map_id].map,
2124                                        center: point,
2125                                        radius: parseInt(radius / 0.000621371)
2126                                      };
2127                              } else {
2128                                  var populationOptions = {
2129                                        strokeColor: '#'+sl_stroke_color,
2130                                        strokeOpacity: sl_stroke_opacity,
2131                                        strokeWeight: 2,
2132                                        fillColor: '#'+sl_fill_color,
2133                                        fillOpacity: sl_fill_opacity,
2134                                        map: MYMAP[map_id].map,
2135                                        center: point,
2136                                        radius: parseInt(radius / 0.001)
2137                                      };
2138                              }
2139                            cityCircle[map_id] = new google.maps.Circle(populationOptions);
2140                            check1 = check1 + 1;
2141                        }
2142
2143                        if (distance_type === "1") {
2144                            R = 3958.7558657440545;
2145                        } else {
2146                            R = 6378.16;
2147                        }
2148                        var dLat = toRad(searched_center.lat()-current_lat);
2149                        var dLon = toRad(searched_center.lng()-current_lng); 
2150                        var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.
2150cos(toRad(current_lat)) * Math.cos(toRad(searched_center.lat())) * Math.sin(dLon/2) * Math.sin(dLon/2); 
2151                        var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
2152                        var d = R * c;
2153                        
2154                        if (d < radius) { show_marker_radius = true; } else { show_marker_radius = false; }
2155
2156
2157                        /* check if they have done a title search too */
2158                        if (search_title === null || search_title === "") { show_marker_title_string = true; }
2159                        else {
2160                            var x = wpgmza_orig_title.toLowerCase().search(search_title.toLowerCase());
2161                            var y = wpgmza_orig_desc.toLowerCase().search(search_title.toLowerCase());
2162                            if (x >= 0 || y >= 0) {
2163                                show_marker_title_string = true;
2164                            } else {
2165                                show_marker_title_string = false;
2166                            }
2167
2168                        }
2169
2170
2171
2172                    }
2173
2174                    var cat_is_cat;
2175                    cat_is_cat = false;
2176                    if( Object.prototype.toString.call( cat_id ) === '[object Array]' ) {
2177
2178                        /* work with category array */
2179                        if (cat_id[0] === '0') { cat_id === "all"; }
2180                        for (var tmp_val in cat_id) {
2181                            /* only one category sent through to show */
2182                            if(wpmgza_category.indexOf(',') === -1) {
2183                                if (cat_id[tmp_val] === wpmgza_category) { 
2184                                    cat_is_cat = true;
2185                                }
2186                            } else { 
2187                                var array = JSON.parse("[" + wpmgza_category + "]");
2188                                array.forEach(function(entry) {
2189                                    if (parseInt(cat_id[tmp_val]) === parseInt(entry)) {
2190                                        cat_is_cat = true;
2191                                    }
2192                                });
2193                            } 
2194
2195
2196                        }
2197                    } else {
2198
2199                        /* only one category sent through to show */
2200                       if(typeof wpmgza_category !== 'undefined') {
2201                           if (wpmgza_category.indexOf(',') === -1) {
2202                                if (cat_id === wpmgza_category) {
2203                                    cat_is_cat = true;
2204                                }
2205                            } else { 
2206                                var array = JSON.parse("[" + wpmgza_category + "]");
2207                                array.forEach(function(entry) {
2208                                    if (parseInt(cat_id) === parseInt(entry)) {
2209                                        cat_is_cat = true;
2210                                    }
2211                                });
2212                            } 
2213                        } else {
2214
2215                            
2216                        }
2217                    }  
2218                    if (cat_id === 'all' || cat_is_cat) {
2219                        
2220                        var wpmgza_infoopen  = val.infoopen;
2221                        if (wpmgza_image !== "") {
2222
2223                            /* timthumb completely removed in 5.54 */
2224                            /*if (wpgmaps_localize_global_settings['wpgmza_settings_use_timthumb'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_use_timthumb']) {
2225                                    wpmgza_image = "<img src=\""+wpgmaps_plugurl+"/timthumb.php?src="+wpmgza_image+"&h="+wpgmaps_localize_global_settings['wpgmza_settings_image_height']+"&w="+wpgmaps_localize_global_settings['wpgmza_settings_image_width']+"&zc=1\" title=\"\" class=\"wpgmza_infowindow_image\" width=\""+wpgmaps_localize_global_settings['wpgmza_settings_image_width']+"\" height=\""+wpgmaps_localize_global_settings['wpgmza_settings_image_height']+"\" style=\"float:right; width:"+wpgmaps_localize_global_settings['wpgmza_settings_image_width']+"px; height:"+wpgmaps_localize_global_settings['wpgmza_settings_image_height']+"px;\" />";
2226                            } else {*/
2227                                if ('undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_image_resizing'] || wpgmaps_localize_global_settings['wpgmza_settings_image_resizing'] === "yes") {
2228                                        wpmgza_image = "<img src=\""+wpmgza_image+"\" title=\"\" class=\"wpgmza_infowindow_image\" alt=\"\" style=\"float:right; width:"+wpgmaps_localize_global_settings['wpgmza_settings_image_width']+"; height:"+wpgmaps_localize_global_settings['wpgmza_settings_image_height']+"; max-width:"+wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']+"px !important;\" />";
2229
2230                                    } else {
2231                                        wpmgza_image = "<img src=\""+wpmgza_image+"\" class=\"wpgmza_infowindow_image wpgmza_map_image\" style=\"float:right; margin:5px; max-width:"+wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']+"px !important;\" />";
2232                                }
2233                            /*}*/
2234                        }
2235
2236                        if (wpmgza_linkd !== "") {
2237                            if (wpgmaps_localize_global_settings['wpgmza_settings_infowindow_links'] === "yes") { wpgmza_iw_links_target = "target='_BLANK'";  }
2238                            else { wpgmza_iw_links_target = ''; }
2239                            wpmgza_linkd = "<p class=\"wpgmza_infowindow_link\"><a class=\"wpgmza_infowindow_link\" href=\""+wpmgza_linkd+"\" "+wpgmza_iw_links_target+" title=\""+wpgmaps_lang_more_details+"\">"+wpgmaps_lang_more_details+"</a></p>";
2240                        } else {
2241                            wpgmza_iw_links_target = "";
2242                        }
2243
2244                        if (wpmgza_mapicon === "" || !wpmgza_mapicon) { if (wpgmza_def_icon !== "") { wpmgza_mapicon = wpgmaps_localize[map_id]['default_marker']; } }
2245                        var wpgmza_optimized = true;
2246                        if (wpmgza_retina === "1" && wpmgza_mapicon !== "0") {
2247                            wpmgza_mapicon = new google.maps.MarkerImage(wpmgza_mapicon, null, null, null, new google.maps.Size(wpgmza_retina_width,wpgmza_retina_height));
2248                            wpgmza_optimized = false;
2249                        }
2250
2251
2252                        var lat = val.lat;
2253                        var lng = val.lng;
2254                        var point = new google.maps.LatLng(parseFloat(lat),parseFloat(lng));
2255                        MYMAP[map_id].bounds.extend(point);
2256
2257                        
2258                        
2259
2260                        if (show_marker_radius === true && show_marker_title_string === true) {
2261                            if (wpmgza_anim === "1") {
2262                                if (wpmgza_mapicon === null || wpmgza_mapicon === "" || wpmgza_mapicon === 0 || wpmgza_mapicon === "0") {
2263                                    var marker = new google.maps.Marker({
2264                                            position: point,
2265                                            map: MYMAP[map_id].map,
2266                                            animation: google.maps.Animation.BOUNCE
2267                                    });
2268                                } else {
2269                                    var marker = new google.maps.Marker({
2270                                            position: point,
2271                                            map: MYMAP[map_id].map,
2272                                            icon: wpmgza_mapicon,
2273                                            animation: google.maps.Animation.BOUNCE,
2274                                            optimized: wpgmza_optimized
2275
2276                                    });
2277                                }
2278                            }
2279                            else if (wpmgza_anim === "2") {
2280                                if (wpmgza_mapicon === null || wpmgza_mapicon === "" || wpmgza_mapicon === 0 || wpmgza_mapicon === "0") {
2281                                    var marker = new google.maps.Marker({
2282                                            position: point,
2283                                            map: MYMAP[map_id].map,
2284                                            animation: google.maps.Animation.DROP
2285                                    });
2286
2287                                } else {
2288
2289                                    var marker = new google.maps.Marker({
2290                                            position: point,
2291                                            map: MYMAP[map_id].map,
2292                                            icon: wpmgza_mapicon,
2293                                            animation: google.maps.Animation.DROP,
2294                                            optimized: wpgmza_optimized
2295                                    });
2296                                }
2297                            }
2298                            else {
2299                                if (wpmgza_mapicon === null || wpmgza_mapicon === "" || wpmgza_mapicon === 0 || wpmgza_mapicon === "0") {
2300                                    var marker = new google.maps.Marker({
2301                                            position: point,
2302                                            map: MYMAP[map_id].map,
2303                                            optimized: wpgmza_optimized
2304                                    });
2305
2306                                } else {
2307                                    var marker = new google.maps.Marker({
2308                                            position: point,
2309                                            map: MYMAP[map_id].map,
2310                                            icon: wpmgza_mapicon,
2311                                            optimized: wpgmza_optimized
2312                                    });
2313                                }
2314                            }
2315                            
2316
2317                            if (wpgmaps_localize_global_settings['wpgmza_settings_infowindow_address'] === "yes") {
2318                                wpmgza_show_address = "";
2319                            }
2320                            if (wpgmaps_localize[entry]['directions_enabled'] === "1") {
2321                                wpmgza_dir_enabled = '<p><a href="javascript:void(0);" id="'+map_id+'" class="wpgmza_gd" wpgm_addr_field="'+wpmgza_address+'" gps="'+parseFloat(lat)+','+parseFloat(lng)+'">
2321'+wpgmaps_lang_get_dir+'</a></p>';
2322                            } else {
2323                                wpmgza_dir_enabled = '';
2324                            }
2325                            if (radius !== null) {                                 
2326                                if (distance_type === "1") {
2327                                    d_string = "<p>"+Math.round(d,2)+' '+wpgmaps_lang_m_away+"</p>"; 
2328                                } else {
2329                                    d_string = "<p>"+Math.round(d,2)+' '+wpgmaps_lang_km_away+"</p>"; 
2330                                }
2331                            } else { d_string = ''; }
2332                            if (wpmgza_image !== "") {
2333                                var html='<div class="wpgmza_markerbox scrollFix">'+
2334                                    wpmgza_image+
2335                                    wpmgza_title+
2336                                    wpmgza_show_address+
2337                                    wpmgza_desc+
2338                                    wpmgza_linkd+
2339                                    d_string+
2340                                    wpmgza_dir_enabled+
2341                                    '</div>';
2342
2343                            } else {
2344                                var html='<div class="wpgmza_markerbox scrollFix">'+
2345                                    wpmgza_image+
2346                                    wpmgza_title+
2347                                    wpmgza_show_address+
2348                                    wpmgza_desc+
2349                                    wpmgza_linkd+
2350                                    d_string+
2351                                    wpmgza_dir_enabled+
2352                                    '</div>';
2353
2354                            }
2355
2356                            var marker_data_object = {
2357                                title: wpgmza_orig_title,
2358                                address: wpmgza_address,
2359                                image: val.pic,
2360                                link: wpmgza_linkd_orig,
2361                                directions: wpmgza_dir_enabled,
2362                                distance: d_string,
2363                                desc: wpgmza_orig_desc,
2364                                gps: parseFloat(lat)+','+parseFloat(lng),
2365                                link_target:wpgmza_iw_links_target
2366                            };
2367
2368
2369                            infoWindow[wpmgza_marker_id] = new google.maps.InfoWindow();
2370                            if (wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']) {
2371                                wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width'] = false;
2372                            }
2373                            if (wpmgza_infoopen === "1") {
2374                                
2375                                infoWindow[wpmgza_marker_id].setContent(html);
2376                                infoWindow[wpmgza_marker_id].open(MYMAP[map_id].map, marker);
2377                            }
2378                            /* do they want to open a marker from a GET variable? */
2379                            if (typeof wpgmza_open_marker !== "underfined") {
2380                                if (wpgmza_open_marker === wpmgza_marker_id) { 
2381
2382                                    infoWindow[wpmgza_marker_id].setOptions({maxWidth:wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']});
2383                                    infoWindow[wpmgza_marker_id].setContent(html);
2384                                    infoWindow[wpmgza_marker_id].open(MYMAP[map_id].map, marker);
2385                                    MYMAP[map_id].map.setCenter(point);
2386                                    if (typeof wpgmza_open_marker_zoom !== "undefined") {
2387                                        MYMAP[map_id].map.setZoom(parseInt(wpgmza_open_marker_zoom));
2388                                    }
2389                                }
2390                            }
2391                            if (typeof wpgmaps_localize[map_id]['other_settings']['click_open_link'] !== "undefined" && wpgmaps_localize[map_id]['other_settings']['click_open_link'] 
2391=== 1 && typeof wpmgza_linkd_orig !== "undefined" && wpmgza_linkd_orig !== "") {
2392                                google.maps.event.addListener(marker, 'click', function(evt) {
2393                                    location = wpmgza_linkd_orig;
2394                                }); 
2395                            }
2396                            
2397
2398                            if (wpgmaps_localize_global_settings['wpgmza_settings_map_open_marker_by'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_open_marker_by'] || wpgmaps_localize_global_settings['wpgmza_settings_map_open_marker_by'] === '1') { 
2399                                google.maps.event.addListener(marker, 'click', function(evt) {
2400                                    wpgmza_open_marker_func(map_id,marker,html,click_from_list,marker_data_object,wpmgza_marker_id);
2401                                }); 
2402                            } else {
2403                                google.maps.event.addListener(marker, 'mouseover', function(evt) {
2404                                    wpgmza_open_marker_func(map_id,marker,html,click_from_list,marker_data_object,wpmgza_marker_id);
2405                                }); 
2406                            }
2407                            
2408                            marker_array[map_id][wpmgza_marker_id] = marker;
2409                            marker_array2[map_id].push(marker);
2410                            marker_sl_array[map_id].push(wpmgza_marker_id);
2411
2412                            
2413
2414                        }
2415                    } 
2416
2417                    
2418                });
2419
2420                if (typeof wpgm_g_e !== "undefined" && wpgm_g_e === true) {
2421
2422                    if (wpgmaps_localize[map_id]['mass_marker_support'] === "1" || wpgmaps_localize[map_id]['mass_marker_support'] === null) { 
2423                        if (typeof markerClusterer[map_id] !== "undefined") { markerClusterer[map_id].addMarkers(marker_array2[map_id]); }
2424                    }
2425                }
2426
2427                if (radius !== null) {
2428                    wpgmza_filter_marker_lists_by_array(map_id,marker_sl_array[map_id]);
2429                }
2430            }
2431        }
2432        if (wpgmaps_localize[entry]['show_user_location'] === "1") {
2433            if(navigator.geolocation) {
2434                navigator.geolocation.getCurrentPosition(function(position) {
2435                    user_location = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
2436
2437                    if ("undefined" !== typeof wpgmaps_localize[map_id]['other_settings']['upload_default_ul_marker']) { 
2438                        var marker = new google.maps.Marker({
2439                              position: user_location,
2440                              map: MYMAP[map_id].map,
2441                              icon: wpgmaps_localize[map_id]['other_settings']['upload_default_ul_marker'],
2442                              animation: google.maps.Animation.DROP
2443                        });    
2444                    } else {
2445                        var marker = new google.maps.Marker({
2446                              position: user_location,
2447                              map: MYMAP[map_id].map,
2448                              animation: google.maps.Animation.DROP
2449                        });    
2450                    } 
2451                    var wpmgza_marker_id = marker_array[map_id].length + 1;
2452                    infoWindow[wpmgza_marker_id] = new google.maps.InfoWindow();
2453                    google.maps.event.addListener(marker, 'click', function(evt) {
2454                          clearLocations();
2455                          
2456                          infoWindow[wpmgza_marker_id].setContent(wpgmaps_lang_my_location);
2457                          infoWindow[wpmgza_marker_id].open(MYMAP[wpgmaps_localize[entry]['id']].map, marker);
2458                      });
2459
2460                    marker_array[map_id][wpmgza_marker_id] = marker;
2461
2462                });
2463             } else {
2464              /* Browser doesn't support Geolocation */
2465            }       
2466        }
2467
2468    };
2469    
2470    function wpgmza_open_marker_func(map_id,marker,html,click_from_list,marker_data,wpmgza_marker_id) {
2471
2472        jQuery('.wpgmza_modern_infowindow').show();
2473        jQuery('.wpgmza_modern_infowindow').css('display', 'block');
2474
2475
2476        if ((typeof wpgmaps_localize_global_settings['wpgmza_iw_type'] !== 'undefined' && parseInt(wpgmaps_localize_global_settings['wpgmza_iw_type']) >= 1) || (typeof wpgmaps_localize[map_id]['other_settings']['wpgmza_iw_type'] !== "undefined" && parseInt(wpgmaps_localize[map_id]['other_settings']['wpgmza_iw_type']) >= 1)) {
2477
2478            wpgmza_create_new_iw_window(map_id);
2479            /* set the variable to "open" */
2480            modern_iw_open[map_id] = true;
2481            
2482
2483            /* see if the DOM element is there */
2484            if (modern_iw_open[map_id]) {
2485               
2486            } else {
2487
2488            }
2489
2490            /* reset the elements */
2491            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_marker_image").attr("src",""); 
2492            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_title").html(""); 
2493            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_description").html(""); 
2494            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_address_p").html(""); 
2495
2496
2497            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_more_info_button").attr("href","#"); 
2498            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_more_info_button").attr("target",""); 
2499            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").attr("gps",""); 
2500            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").attr("href","#"); 
2501            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").attr("id",""); 
2502            jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").attr("wpgm_addr_field",""); 
2503
2504            
2505            
2506            if (marker_data.image === "" && marker_data.title === "") {  
2507                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_image").css("display","none"); 
2508            } else {
2509                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_image").css("display","block"); 
2510            }
2511
2512
2513            if (marker_data.image !== "") { 
2514                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_marker_image").css("display","block"); 
2515                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_marker_image").attr("src",marker_data.image); 
2516                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_title").attr("style","position: absolute !important"); 
2517                if (marker_data.title !== "") { jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_title").html(marker_data.title); }
2518
2519            } else {
2520                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_marker_image").css("display","none"); 
2521                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_title").attr("style","position: relative !important"); 
2522                if (marker_data.title !== "") { jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_title").html(marker_data.title); }
2523            }
2524
2525            if (marker_data.desc !== "") { 
2526                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_description").css("display","block"); 
2527                if (typeof marker_data.desc !== "undefined" && marker_data.desc !== "") { jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_description").html(marker_data.desc); }
2528            } else {
2529                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_description").css("display","none"); 
2530
2531            }
2532
2533            
2534            if (typeof wpgmaps_localize_global_settings['wpgmza_settings_infowindow_address'] !== 'undefined' && wpgmaps_localize_global_settings['wpgmza_settings_infowindow_address'] 
2534=== "yes") {
2535            } else {
2536                if (typeof marker_data.address !== "undefined" && marker_data.address !== "") { jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_iw_address_p").html(marker_data.address); }
2537            }
2538            
2539
2540            if (typeof marker_data.link !== "undefined" && marker_data.link !== "") { 
2541                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_more_info_button").show();
2542                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_more_info_button").attr("href",marker_data.link);
2543                if (marker_data.link_target !== "") {
2544                    jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_more_info_button").attr("target","_BLANK"); 
2545                }  
2546            } else {
2547                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_more_info_button").hide();
2548            }
2549            if (typeof marker_data.directions !== "undefined" && marker_data.directions !== "") { 
2550                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").show();
2551                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").attr("href","javascript:void(0);"); 
2552                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").attr("gps",marker_data.gps); 
2553                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").attr("wpgm_addr_field",marker_data.address); 
2554                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").attr("id",map_id); 
2555                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").addClass("wpgmza_gd"); 
2556
2557            } else {
2558                jQuery("#wpgmza_iw_holder_"+map_id+" .wpgmza_directions_button").hide();
2559            }
2560
2561            if (click_from_list) {
2562                MYMAP[map_id].map.panTo(marker.position);
2563                MYMAP[map_id].map.setZoom(13);
2564            }
2565            click_from_list = false;
2566
2567        } else {
2568            clearLocations();
2569            if (wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']) { 
2570                infoWindow[wpmgza_marker_id].setOptions({maxWidth:wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']});
2571            }
2572            infoWindow[wpmgza_marker_id].setContent(html);
2573            if (click_from_list) {
2574                MYMAP[map_id].map.panTo(marker.position);
2575                MYMAP[map_id].map.setZoom(13);
2576            }
2577            click_from_list = false;
2578
2579            infoWindow[wpmgza_marker_id].open(MYMAP[map_id].map, marker);
2580        }
2581
2582        
2583        
2584    }
2585    
2586    function wpgmza_create_new_iw_window(mapid) {
2587        /* handle new modern infowindow */
2588        if ((typeof wpgmaps_localize_global_settings['wpgmza_iw_type'] !== 'undefined' && parseInt(wpgmaps_localize_global_settings['wpgmza_iw_type']) >= 1) || (typeof wpgmaps_localize[mapid]['other_settings']['wpgmza_iw_type'] !== "undefined" && parseInt(wpgmaps_localize[mapid]['other_settings']['wpgmza_iw_type']) >= 1)) {
2589                if (typeof document.getElementById('wpgmza_iw_holder_'+mapid) !== "undefined") {
2590                    
2591                    if (wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']) {
2592                        wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width'] = false;
2593                    }
2594                    
2595                    var legend = document.getElementById('wpgmza_iw_holder_'+mapid);
2596                    if (legend !== null) {
2597                        jQuery(legend).remove();
2598                    }
2599
2600                    wpgmza_iw_Div[mapid] = document.createElement('div');
2601                    wpgmza_iw_Div[mapid].id = 'wpgmza_iw_holder_'+mapid;
2602                    wpgmza_iw_Div[mapid].style = 'display:block;';
2603                    document.getElementsByTagName('body')[0].appendChild(wpgmza_iw_Div[mapid]);
2604
2605                    wpgmza_iw_Div_inner = document.createElement('div');
2606                    wpgmza_iw_Div_inner.className = 'wpgmza_modern_infowindow_inner wpgmza_modern_infowindow_inner_'+mapid;
2607                    wpgmza_iw_Div[mapid].appendChild(wpgmza_iw_Div_inner);
2608
2609                    wpgmza_iw_Div_close = document.createElement('div');
2610                    wpgmza_iw_Div_close.className = 'wpgmza_modern_infowindow_close';
2611                    wpgmza_iw_Div_close.setAttribute('mid',mapid);
2612
2613                    var t = document.createTextNode("x");
2614                    wpgmza_iw_Div_close.appendChild(t); 
2615                    wpgmza_iw_Div_inner.appendChild(wpgmza_iw_Div_close);
2616
2617                    wpgmza_iw_Div_img = document.createElement('div');
2618                    wpgmza_iw_Div_img.className = 'wpgmza_iw_image';
2619                    wpgmza_iw_Div_inner.appendChild(wpgmza_iw_Div_img);
2620
2621                    wpgmza_iw_img = document.createElement('img');
2622                    wpgmza_iw_img.className = 'wpgmza_iw_marker_image';
2623                    wpgmza_iw_img.src = '';
2624                    wpgmza_iw_img.style = 'max-width:100%;';
2625                    wpgmza_iw_Div_img.appendChild(wpgmza_iw_img);
2626
2627                    wpgmza_iw_img_div = document.createElement('div');
2628                    wpgmza_iw_img_div.className = 'wpgmza_iw_title';
2629                    wpgmza_iw_Div_inner.appendChild(wpgmza_iw_img_div);
2630
2631                    wpgmza_iw_img_div_p = document.createElement('p');
2632                    wpgmza_iw_img_div_p.className = 'wpgmza_iw_title_p';
2633                    wpgmza_iw_img_div.appendChild(wpgmza_iw_img_div_p);
2634
2635                    wpgmza_iw_address_div = document.createElement('div');
2636                    wpgmza_iw_address_div.className = 'wpgmza_iw_address';
2637                    wpgmza_iw_Div_inner.appendChild(wpgmza_iw_address_div);
2638
2639                    wpgmza_iw_address_p = document.createElement('p');
2640                    wpgmza_iw_address_p.className = 'wpgmza_iw_address_p';
2641                    wpgmza_iw_address_div.appendChild(wpgmza_iw_address_p);
2642
2643                    wpgmza_iw_description = document.createElement('div');
2644                    wpgmza_iw_description.className = 'wpgmza_iw_description';
2645                    wpgmza_iw_Div_inner.appendChild(wpgmza_iw_description);
2646
2647                    wpgmza_iw_description_p = document.createElement('p');
2648                    wpgmza_iw_description_p.className = 'wpgmza_iw_description_p';
2649                    wpgmza_iw_description.appendChild(wpgmza_iw_description_p);
2650
2651
2652                    wpgmza_iw_buttons = document.createElement('div');
2653                    wpgmza_iw_buttons.className = 'wpgmza_iw_buttons';
2654                    wpgmza_iw_Div_inner.appendChild(wpgmza_iw_buttons);
2655
2656                    wpgmza_directions_button = document.createElement('a');
2657                    wpgmza_directions_button.className = 'wpgmza_button wpgmza_left wpgmza_directions_button';
2658                    wpgmza_directions_button.src = '#';
2659                    var t = document.createTextNode(wpgmaps_lang_directions);
2660                    wpgmza_directions_button.appendChild(t); 
2661
2662                    wpgmza_iw_buttons.appendChild(wpgmza_directions_button);
2663
2664
2665                    wpgmza_more_info_button = document.createElement('a');
2666                    wpgmza_more_info_button.className = 'wpgmza_button wpgmza_right wpgmza_more_info_button';
2667                    wpgmza_more_info_button.src = '#';
2668                    var t = document.createTextNode(wpgmaps_lang_more_info);
2669                    wpgmza_more_info_button.appendChild(t); 
2670
2671                    wpgmza_iw_buttons.appendChild(wpgmza_more_info_button);
2672
2673
2674                    var legend = document.getElementById('wpgmza_iw_holder_'+mapid);
2675
2676                    jQuery(legend).css('display','block');
2677                    jQuery(legend).addClass('wpgmza_modern_infowindow');
2678                    /* jQuery(legend).css('width',wpgmaps_localize_global_settings['wpgmza_settings_infowindow_width']+'px'); */
2679                    jQuery(legend).addClass('wpgmza-shadow');
2680                    MYMAP[mapid].map.controls[google.maps.ControlPosition.RIGHT_TOP].push(legend);
2681                }
2682                
2683        }
2684    }
2685    
2686function add_heatmap(mapid,datasetid) {
2687
2688        var tmp_data = wpgmaps_localize_heatmap_settings[mapid][datasetid];
2689        var current_poly_id = datasetid;
2690        var tmp_polydata = tmp_data['polydata'];
2691        var WPGM_PathData = new Array();
2692        for (tmp_entry2 in tmp_polydata) {
2693             if (typeof tmp_polydata[tmp_entry2][0] !== "undefined") {
2694                
2695                WPGM_PathData.push(new google.maps.LatLng(tmp_polydata[tmp_entry2][0], tmp_polydata[tmp_entry2][1]));
2696            }
2697         }
2698         if (tmp_data['radius'] === null || tmp_data['radius'] === "") { tmp_data['radius'] = 20; }
2699         if (tmp_data['gradient'] === null || tmp_data['gradient'] === "") { tmp_data['gradient'] = null; }
2700         if (tmp_data['opacity'] === null || tmp_data['opacity'] === "") { tmp_data['opacity'] = 0.6; }
2701         
2702         var bounds = new google.maps.LatLngBounds();
2703         for (i = 0; i < WPGM_PathData.length; i++) {
2704           bounds.extend(WPGM_PathData[i]);
2705         }
2706
2707        WPGM_Path_Polygon[datasetid] = new google.maps.visualization.HeatmapLayer({
2708             data: WPGM_PathData,
2709             map: MYMAP[mapid].map
2710        });
2711
2712       WPGM_Path_Polygon[datasetid].setMap(MYMAP[mapid].map);
2713       var gradient = JSON.parse(tmp_data['gradient']);
2714       WPGM_Path_Polygon[datasetid].set('radius', tmp_data['radius']);
2715       WPGM_Path_Polygon[datasetid].set('opacity', tmp_data['opacity']);
2716       WPGM_Path_Polygon[datasetid].set('gradient', gradient);
2717
2718
2719       polygon_center = bounds.getCenter();
2720
2721
2722
2723}
2724
2725    function add_polygon(mapid,polygonid) {
2726        var tmp_data = wpgmaps_localize_polygon_settings[mapid][polygonid];
2727         var current_poly_id = polygonid;
2728         var tmp_polydata = tmp_data['polydata'];
2729         var WPGM_PathData = new Array();
2730         for (tmp_entry2 in tmp_polydata) {
2731             if (typeof tmp_polydata[tmp_entry2][0] !== "undefined") {
2732                
2733                WPGM_PathData.push(new google.maps.LatLng(tmp_polydata[tmp_entry2][0], tmp_polydata[tmp_entry2][1]));
2734            }
2735         }
2736         if (tmp_data['lineopacity'] === null || tmp_data['lineopacity'] === "") {
2737             tmp_data['lineopacity'] = 1;
2738         }
2739         
2740         var bounds = new google.maps.LatLngBounds();
2741         for (i = 0; i < WPGM_PathData.length; i++) {
2742           bounds.extend(WPGM_PathData[i]);
2743         }
2744
2745        WPGM_Path_Polygon[polygonid] = new google.maps.Polygon({
2746             path: WPGM_PathData,
2747             clickable: true, /* must add option for this */ 
2748             strokeColor: "#"+tmp_data['linecolor'],
2749             fillOpacity: tmp_data['opacity'],
2750             strokeOpacity: tmp_data['lineopacity'],
2751             fillColor: "#"+tmp_data['fillcolor'],
2752             strokeWeight: 2,
2753             map: MYMAP[mapid].map
2754       });
2755       WPGM_Path_Polygon[polygonid].setMap(MYMAP[mapid].map);
2756
2757        polygon_center = bounds.getCenter();
2758
2759        if (tmp_data['title'] !== "") {
2760         infoWindow_poly[polygonid] = new google.maps.InfoWindow();
2761         google.maps.event.addListener(WPGM_Path_Polygon[polygonid], 'click', function(event) {
2762             infoWindow_poly[polygonid].setPosition(event.latLng);
2763             content = "";
2764             if (tmp_data['link'] !== "") {
2765                 var content = "<a href='"+tmp_data['link']+"'>"+tmp_data['title']+"</a>";
2766             } else {
2767                 var content = tmp_data['title'];
2768             }
2769             infoWindow_poly[polygonid].setContent(content);
2770             infoWindow_poly[polygonid].open(MYMAP[mapid].map,this.position);
2771         }); 
2772        }
2773
2774
2775       google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "mouseover", function(event) {
2776             this.setOptions({fillColor: "#"+tmp_data['ohfillcolor']});
2777             this.setOptions({fillOpacity: tmp_data['ohopacity']});
2778             this.setOptions({strokeColor: "#"+tmp_data['ohlinecolor']});
2779             this.setOptions({strokeWeight: 2});
2780             this.setOptions({strokeOpacity: 0.9});
2781       });
2782       google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "click", function(event) {
2783
2784             this.setOptions({fillColor: "#"+tmp_data['ohfillcolor']});
2785             this.setOptions({fillOpacity: tmp_data['ohopacity']});
2786             this.setOptions({strokeColor: "#"+tmp_data['ohlinecolor']});
2787             this.setOptions({strokeWeight: 2});
2788             this.setOptions({strokeOpacity: 0.9});
2789       });
2790       google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "mouseout", function(event) {
2791             this.setOptions({fillColor: "#"+tmp_data['fillcolor']});
2792             this.setOptions({fillOpacity: tmp_data['opacity']}
2792);
2793             this.setOptions({strokeColor: "#"+tmp_data['linecolor']});
2794             this.setOptions({strokeWeight: 2});
2795             this.setOptions({strokeOpacity: tmp_data['lineopacity']});
2796       });
2797
2798
2799           
2800        
2801        
2802    }
2803    function add_polyline(mapid,polyline) {
2804        
2805        
2806        var tmp_data = wpgmaps_localize_polyline_settings[mapid][polyline];
2807
2808        var current_poly_id = polyline;
2809        var tmp_polydata = tmp_data['polydata'];
2810        var WPGM_Polyline_PathData = new Array();
2811        for (tmp_entry2 in tmp_polydata) {
2812            if (typeof tmp_polydata[tmp_entry2][0] !== "undefined" && typeof tmp_polydata[tmp_entry2][1] !== "undefined") {
2813                var lat = tmp_polydata[tmp_entry2][0].replace(')', '');
2814                lat = lat.replace('(','');
2815                var lng = tmp_polydata[tmp_entry2][1].replace(')', '');
2816                lng = lng.replace('(','');
2817                WPGM_Polyline_PathData.push(new google.maps.LatLng(lat, lng));
2818            }
2819             
2820             
2821        }
2822         if (tmp_data['lineopacity'] === null || tmp_data['lineopacity'] === "") {
2823             tmp_data['lineopacity'] = 1;
2824         }
2825
2826        WPGM_Path[polyline] = new google.maps.Polyline({
2827             path: WPGM_Polyline_PathData,
2828             strokeColor: "#"+tmp_data['linecolor'],
2829             strokeOpacity: tmp_data['opacity'],
2830             strokeWeight: tmp_data['linethickness'],
2831             map: MYMAP[mapid].map
2832       });
2833       WPGM_Path[polyline].setMap(MYMAP[mapid].map);
2834        
2835        
2836    }
2837    
2838  
2839    
2840
2841}
2842
2843
2844
2845
2846
2847
2848});
2849
2850
2851
2852
2853function openInfoWindow(marker_id,map_id,by_list) {
2854    if (by_list) {
2855        click_from_list = true;
2856    } else {
2857        click_from_list = false;
2858    }
2859
2860    if (wpgmaps_localize_global_settings['wpgmza_settings_map_open_marker_by'] === "" || 'undefined' === typeof wpgmaps_localize_global_settings['wpgmza_settings_map_open_marker_by'] || wpgmaps_localize_global_settings['wpgmza_settings_map_open_marker_by'] === '1') { 
2861        google.maps.event.trigger(marker_array[map_id][marker_id], 'click');
2862    } else {
2863        google.maps.event.trigger(marker_array[map_id][marker_id], 'mouseover');
2864    }
2865    click_from_list = false;
2866}
2867
2868
2869
2870
2871
2872
2873function calcRoute(start,end,mapid,travelmode,avoidtolls,avoidhighways) {
2874    var request = {
2875        origin:start,
2876        destination:end,
2877        travelMode: google.maps.DirectionsTravelMode[travelmode],
2878        avoidHighways: avoidhighways,
2879        avoidTolls: avoidtolls
2880    };
2881
2882    dirflg = "c";
2883
2884    if (travelmode === "DRIVING") { dirflg = "d"; }
2885    else if (travelmode === "WALKING") { dirflg = "w"; }
2886    else if (travelmode === "BICYCLING") { dirflg = "b"; }
2887    else { dirflg = "c"; }
2888
2889
2890    directionsDisplay[mapid];
2891    directionsService[mapid] = new google.maps.DirectionsService();
2892    var currentDirections = null;
2893    var oldDirections = [];
2894
2895
2896    directionsDisplay[mapid] = new google.maps.DirectionsRenderer({
2897         'map': MYMAP[mapid].map,
2898         'preserveViewport': true,
2899         'draggable': true
2900     });
2901    directionsDisplay[mapid].setPanel(document.getElementById("directions_panel_"+mapid));
2902    
2903    
2904    google.maps.event.addListener(directionsDisplay[mapid], 'directions_changed',
2905      function() {
2906          if (currentDirections) {
2907              oldDirections.push(currentDirections);
2908          }
2909          currentDirections = directionsDisplay[mapid].getDirections();
2910          jQuery("#directions_panel_"+mapid).show();
2911          jQuery("#wpgmaps_directions_notification_"+mapid).hide();
2912          jQuery("#wpgmaps_directions_reset_"+mapid).show();
2913      });
2914
2915
2916    directionsService[mapid].route(request, function(response, status) {
2917        if (status === google.maps.DirectionsStatus.OK) {
2918        directionsDisplay[mapid].setDirections(response);
2919    }
2920});
2921
2922    jQuery("#wpgmaps_print_directions_"+mapid).attr('href','https://maps.google.com/maps?saddr='+encodeURIComponent(start)+'&daddr='+encodeURIComponent(end)+'&dirflg='+dirflg+'&om=1');
2923
2924}
2925
2926function wpgmza_show_options(wpgmzamid) {
2927
2928      jQuery("#wpgmza_options_box_"+wpgmzamid).show();
2929      jQuery("#wpgmza_show_options_"+wpgmzamid).hide();
2930      jQuery("#wpgmza_hide_options_"+wpgmzamid).show();
2931  }
2932function wpgmza_hide_options(wpgmzamid) {
2933      jQuery("#wpgmza_options_box_"+wpgmzamid).hide();
2934      jQuery("#wpgmza_show_options_"+wpgmzamid).show();
2935      jQuery("#wpgmza_hide_options_"+wpgmzamid).hide();
2936  }
2937function wpgmza_reset_directions(wpgmzamid) {
2938
2939    jQuery("#wpgmaps_directions_editbox_"+wpgmzamid).show();
2940    jQuery("#directions_panel_"+wpgmzamid).hide();
2941    jQuery("#wpgmaps_directions_notification_"+wpgmzamid).hide();
2942    jQuery("#wpgmaps_directions_reset_"+wpgmzamid).hide();
2943  }
2944
2945jQuery("body").on("click", ".wpgmza_gd", function() {
2946
2947    var wpgmzamid = jQuery(this).attr("id");
2948    var end = jQuery(this).attr("wpgm_addr_field");
2949    var latLong = jQuery(this).attr("gps");
2950    /* pelicanpaul updates for mobile */
2951    if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
2952        
2953        if( (navigator.platform.indexOf("iPhone") != -1)
2954        || (navigator.platform.indexOf("iPod") != -1)
2955        || (navigator.platform.indexOf("iPad") != -1))
2956        window.open("maps://maps.google.com/maps?daddr="+latLong+"&ll=");
2957        else
2958        window.open("http://maps.google.com/maps?daddr="+latLong+"&ll=");
2959    } else {
2960
2961        jQuery("#wpgmaps_directions_edit_"+wpgmzamid).show();
2962        jQuery("#wpgmaps_directions_editbox_"+wpgmzamid).show();
2963        jQuery("#wpgmza_input_to_"+wpgmzamid).val(end.length > 0 ? end : latLong);
2964        jQuery("#wpgmza_input_from_"+wpgmzamid).focus().select();
2965    }
2966
2967
2968});
2969
2970jQuery("body").on("click", ".wpgmaps_get_directions", function() {
2971
2972     var wpgmzamid = jQuery(this).attr("id");
2973
2974     var avoidtolls = jQuery('#wpgmza_tolls_'+wpgmzamid).is(':checked');
2975     var avoidhighways = jQuery('#wpgmza_highways_'+wpgmzamid).is(':checked');
2976
2977
2978     var wpgmza_dir_type = jQuery("#wpgmza_dir_type_"+wpgmzamid).val();
2979     var wpgmaps_from = jQuery("#wpgmza_input_from_"+wpgmzamid).val();
2980     var wpgmaps_to = jQuery("#wpgmza_input_to_"+wpgmzamid).val();
2981     if (wpgmaps_from === "" || wpgmaps_to === "") { alert(wpgmaps_lang_error1); }
2982     else { calcRoute(wpgmaps_from,wpgmaps_to,wpgmzamid,wpgmza_dir_type,avoidtolls,avoidhighways); jQuery("#wpgmaps_directions_editbox_"+wpgmzamid).hide("slow"); jQuery("#wpgmaps_directions_notification_"+wpgmzamid).show("slow");  }
2983});
2984
2985
2986
2987jQuery("body").on("keypress",".addressInput", function(event) {
2988  if ( event.which == 13 ) {
2989    var mid = jQuery(this).attr("mid");
2990     jQuery('.wpgmza_sl_search_button_'+mid).trigger('click');
2991  }
2992});
2993
2994jQuery('body').on('click', '.wpgmza_modern_infowindow_close', function(){
2995    var mid = jQuery(this).attr('mid');
2996    jQuery("#wpgmza_iw_holder_"+mid).remove();
2997//    jQuery('.wpgmza_modern_infowindow').hide();
2998//    jQuery('.wpgmza_modern_infowindow').css('display', 'none');
2999
3000
3001});

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.