PageSourceSearch

https://jhdesignunlimited.com/wp-content/plugins/wp-google-maps-pro//js/core.js?ver=6.40p

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

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.