PageSourceSearch

https://unitednews.sr/wp-content/plugins/w2dc/resources/js/google_maps.js?ver=2.9.12

js unitednews.sr collected 2026-10-02 13:58:03 UTC 102,867 bytes, 2,041 lines download raw bytes

1if (w2dc_js_objects.is_maps_used && !w2dc_maps_objects.notinclude_maps_api) {
2	var w2dc_3rd_party_maps_plugin = false;
3	var _warn = console.warn,
4	    _error = console.error;
5	console.error = function() {
6	    var err = arguments[0];
7	    if (typeof err == "string") {
8		    if (err.indexOf('InvalidKeyMapError') != -1 || err.indexOf('MissingKeyMapError') != -1) {
9		    	if (w2dc_3rd_party_maps_plugin)
10					alert('Web 2.0 Directory plugin: another plugin or your theme calls Google Maps library without keys. This may cause problems with Google Maps, Geocoding, addition/edition listings locations, autocomplete on addresses fields.\n\nTry to find which plugin calls Google Maps library without keys. Insert keys in its settings or disable this plugin.');
11				else
12					alert('Web 2.0 Directory plugin: your Google browser API key is invalid or missing. Log in to console https://code.google.com/apis/console and generate new key. Follow instructions https://www.salephpscripts.com/wordpress_directory/demo/documentation/#google_maps_keys Or you can disable Google Maps in listings levels settings.');
13		    }
14		    if (err.indexOf('RefererNotAllowedMapError') != -1) {
15		    	var hostname = window.location.hostname.replace('www.','');
16		    	var protocol = window.location.protocol;
17		    	alert('Web 2.0 Directory plugin: the current URL loading the Google Maps has not been added to the list of allowed referrers. Please check the "Accept requests from these HTTP referrers (web sites)" field in Google API console. Follow instructions https://www.salephpscripts.com/wordpress_directory/demo/documentation/#google_maps_keys \n\nTr
17y one of the following URLs: *.'+hostname+'/*, '+protocol+'//'+hostname+'/*, '+protocol+'//www.'+hostname+'/*');
18		    }
19		    if (err.indexOf('ApiNotActivatedMapError') != -1) {
20		    	alert('Web 2.0 Directory plugin: you have to enable following APIs in Google API console https://code.google.com/apis/console : Google Maps JavaScript API, Google Static Maps API, Google Places API Web Service, Google Maps Geocoding API and Google Maps Directions API. Follow instructions https://www.salephpscripts.com/wordpress_directory/demo/documentation/#google_maps_keys\n\nNote, that it requires some time for changes to take effect.');
21		    }
22		    if (err.indexOf('You have exceeded your request quota for this API.') != -1) {
23		    	alert('Google Maps is no longer free. You must enable billing with a credit card and have a valid API key for all of your projects. https://developers.google.com/maps/gmp-get-started');
24		    }
25	    }
26	    return _error.apply(console, arguments);
27	};
28	console.warn = function() {
29		var err = arguments[0];
30		if (typeof err == "string") {
31			if (err.indexOf('InvalidKey') != -1 || err.indexOf('NoApiKeys') != -1) {
32				if (w2dc_3rd_party_maps_plugin)
33					alert('Web 2.0 Directory plugin: another plugin or your theme calls Google Maps library without keys. This may cause problems with Google Maps, Geocoding, addition/edition listings locations, autocomplete on addresses fields.\n\nTry to find which plugin calls Google Maps library without keys. Insert keys in its settings or disable this plugin.');
34				else
35					alert('Web 2.0 Directory plugin: your Google browser API key is invalid or missing. Log in to console https://code.google.com/apis/console and generate new key. Follow instructions https://www.salephpscripts.com/wordpress_directory/demo/documentation/#google_maps_keys');
36			}
37		}
38		return _warn.apply(console, arguments);
39	};
40}
41
42// google_maps_edit.js -------------------------------------------------------------------------------------------------------------------------------------------
43(function($) {
44	"use strict";
45
46	var w2dc_load_maps_backend = function() {
47
48		w2dc_geocoder_backend = new google.maps.Geocoder();
49
50		if ($("#w2dc-map-canvas").length) {
51			var mapOptions = {
52					zoom: 1,
53					scrollwheel: true,
54					gestureHandling: 'greedy',
55					disableDoubleClickZoom: true,
56					mapTypeId: google.maps.MapTypeId.ROADMAP,
57					fullscreenControl: false
58			};
59			if (w2dc_maps_objects.map_style) {
60				mapOptions.styles = eval(w2dc_maps_objects.map_style);
61			}
62			w2dc_map_backend = new google.maps.Map(document.getElementById("w2dc-map-canvas"), mapOptions);
63
64			var w2dc_coords_array_1 = new Array();
65			var w2dc_coords_array_2 = new Array();
66
67			if (w2dc_isAnyLocation_backend())
68				w2dc_generateMap_backend();
69			else
70				w2dc_map_backend.setCenter(new google.maps.LatLng(w2dc_maps_objects.default_latitude, w2dc_maps_objects.default_longitude));
71
72			google.maps.event.addListener(w2dc_map_backend, 'zoom_changed', function() {
73				if (w2dc_allow_map_zoom_backend)
74					$(".w2dc-map-zoom").val(w2dc_map_backend.getZoom());
75			});
76		}
77	}
78
79	window.w2dc_load_maps_api_backend = function() {
80		$(document).trigger('w2dc_google_maps_api_loaded');
81
82		window.addEventListener('load', w2dc_load_maps_backend());
83		
84		w2dc_load_maps_api(); // Load frontend maps
85	}
86	
87	window.w2dc_setupAutocomplete = function() {
88		$(".w2dc-listing-field-autocomplete").each( function() {
89			var autocomplete_input = $(this);
90			var place_id_input = autocomplete_input.parent().find(".w2dc-place-id-input");
91			
92			autocomplete_input.on("change paste keyup blur", function() {
93				if ($(this).val() == '') {
94					place_id_input.val('');
95				}
96			});
97			
98			if (google.maps && google.maps.places) {
99				if (w2dc_maps_objects.address_autocomplete_code != '0')
100					var options = { componentRestrictions: {country: w2dc_maps_objects.address_autocomplete_code}};
101				else
102					var options = { };
103				var searchBox = new google.maps.places.Autocomplete(this, options);
104				
105				if ($("#w2dc-map-canvas").length) {
106					google.maps.event.addListener(searchBox, 'place_changed', function () {
107						var place = searchBox.getPlace();
108						place_id_input.val(place.place_id);
109						
110						w2dc_generateMap_backend();
111					});
112				}
113			}
114		});
115	}
116
117	function w2dc_setMapCenter_backend(w2dc_coords_array_1, w2dc_coords_array_2) {
118		var count = 0;
119		var bounds = new google.maps.LatLngBounds();
120		for (count == 0; count<w2dc_coords_array_1.length; count++)  {
121			bounds.extend(new google.maps.LatLng(w2dc_coords_array_1[count], w2dc_coords_array_2[count]));
122		}
123		if (count == 1) {
124			if ($(".w2dc-map-zoom").val() == '' || $(".w2dc-map-zoom").val() == 0)
125				var zoom_level = 1;
126			else
127				var zoom_level = parseInt($(".w2dc-map-zoom").val());
128		} else {
129			w2dc_map_backend.fitBounds(bounds);
130			var zoom_level = w2dc_map_backend.getZoom();
131		}
132		w2dc_map_backend.setCenter(bounds.getCenter());
133	
134		// allow/disallow map zoom in listener, this option needs because w2dc_map.setZoom() also calls this listener
135		w2dc_allow_map_zoom_backend = false;
136		w2dc_map_backend.setZoom(zoom_level);
137		w2dc_allow_map_zoom_backend = true;
138	}
139	
140	var w2dc_coords_array_1 = new Array();
141	var w2dc_coords_array_2 = new Array();
142	var w2dc_attempts = 0;
143	window.w2dc_generateMap_backend = function() {
144		w2dc_ajax_loader_target_show($("#w2dc-map-canvas"));
145		w2dc_coords_array_1 = new Array();
146		w2dc_coords_array_2 = new Array();
147		w2dc_attempts = 0;
148		w2dc_clearOverlays_backend();
149		w2dc_geocodeAddress_backend(0);
150		//w2dc_setupAutocomplete();
151	}
152	
153	function w2dc_setFoundPoint(results, location_obj, i) {
154		var point = results[0].geometry.location;
155		$(".w2dc-map-coords-1:eq("+i+")").val(point.lat());
156		$(".w2dc-map-coords-2:eq("+i+")").val(point.lng());
157		var map_coords_1 = point.lat();
158		var map_coords_2 = point.lng();
159		w2dc_coords_array_1.push(map_coords_1);
160		w2dc_coords_array_2.push(map_coords_2);
161		location_obj.setPoint(point);
162		location_obj.w2dc_placeMarker();
163		w2dc_geocodeAddress_backend(i+1);
164
165		if ((i+1) == $(".w2dc-location-in-metabox").length) {
166			w2dc_setMapCenter_backend(w2dc_coords_array_1, w2dc_coords_array_2);
167			w2dc_ajax_loader_target_hide("w2dc-map-canvas");
168		}
169	}
170
171	window.w2dc_geocodeAddress_backend = function(i) {
172		if ($(".w2dc-location-in-metabox:eq("+i+")").length) {
173			var locations_drop_boxes = [];
174			$(".w2dc-location-in-metabox:eq("+i+")").find("select").each(function(j, val) {
175				if ($(this).val())
176					locations_drop_boxes.push($(this).children(":selected").text());
177			});
178	
179			var location_string = locations_drop_boxes.reverse().join(', ');
180	
181			if ($(".w2dc-manual-coords:eq("+i+")").is(":checked") && $(".w2dc-map-coords-1:eq("+i+")").val()!='' && $(".w2dc-map-coords-2:eq("+i+")").val()!='' && ($(".w2dc-map-coords-1:eq("+i+")").val()!=0 || $(".w2dc-map-coords-2:eq("+i+")").val()!=0)) {
182				var map_coords_1 = $(".w2dc-map-coords-1:eq("+i+")").val();
183				var map_coords_2 = $(".w2dc-map-coords-2:eq("+i+")").val();
184				if ($.isNumeric(map_coords_1) && $.isNumeric(map_coords_2)) {
185					var point = new google.maps.LatLng(map_coords_1, map_coords_2);
186					w2dc_coords_array_1.push(map_coords_1);
187					w2dc_coords_array_2.push(map_coords_2);
188	
189					var location_obj = new w2dc_glocation_backend(i, point, 
190						location_string,
191						$(".w2dc-address-line-1:eq("+i+")").val(),
192						$(".w2dc-address-line-2:eq("+i+")").val(),
193						$(".w2dc-zip-or-postal-index:eq("+i+")").val(),
194						$(".w2dc-map-icon-file:eq("+i+")").val()
195					);
196					location_obj.w2dc_placeMarker();
197				}
198				w2dc_geocodeAddress_backend(i+1);
199				if ((i+1) == $(".w2dc-location-in-metabox").length) {
200					w2dc_setMapCenter_backend(w2dc_coords_array_1, w2dc_coords_array_2);
201					w2dc_ajax_loader_target_hide("w2dc-map-canvas");
202				}
203			} else if (location_string || $(".w2dc-address-line-1:eq("+i+")").val() || $(".w2dc-address-line-2:eq("+i+")").val() || $(".w2dc-zip-or-postal-index:eq("+i+")").val()) {
204				var location_obj = new w2dc_glocation_backend(i, null, 
205					location_string,
206					$(".w2dc-address-line-1:eq("+i+")").val(),
207					$(".w2dc-address-line-2:eq("+i+")").val(),
208					$(".w2dc-zip-or-postal-index:eq("+i+")").val(),
209					$(".w2dc-map-icon-file:eq("+i+")").val()
210				);
211
212				// Geocode by address
213				if (w2dc_maps_objects.address_autocomplete_code != '0')
214					var options = { 'address': location_obj.compileAddress(), componentRestrictions: {country: w2dc_maps_objects.address_autocomplete_code}};
215				else
216					var options = { 'address': location_obj.compileAddress() };
217
218				if (w2dc_geocoder_backend !== null) {
219					w2dc_geocoder_backend.geocode( options, function(results, status) {
220						if (status != google.maps.GeocoderStatus.OK) {
221							if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT && w2dc_attempts < 5) {
222								w2dc_attempts++;
223								setTimeout('w2dc_geocodeAddress_backend('+i+')', 2000);
224							} else if (status == google.maps.GeocoderStatus.ZERO_RESULTS) {
225								// last chance to find correct location with Places API
226								var service = new google.maps.places.PlacesService(w2dc_map_backend);
227								service.textSearch({
228									query: options.address
229								}, function(results, status) {
230									if (status == google.maps.places.PlacesServiceStatus.OK) {
231										w2dc_setFoundPoint(results, location_obj, i);
232									} else {
233										alert("Sorry, we are unable to geocode address (address line: "+options.address+" #"+(i)+") for the following reason: " + status);
234										w2dc_ajax_loader_target_hide("w2dc-map-canvas");
235									}
236								});
237							} else {
238								alert("Sorry, we are unable to geocode address (address line:"+options.address+" #"+(i)+") for the following reason: " + status);
239								w2dc_ajax_loader_target_hide("w2dc-map-canvas");
240							}
241						} else {
242							w2dc_setFoundPoint(results, location_obj, i);
243						}
244					});
245				} else {
246					alert("Google Geocoder was not loaded. Check Google API keys and enable Google Maps Geocoding API in Google APIs console.");
247					w2dc_ajax_loader_target_hide("w2dc-map-canvas");
248				}
249			} else
250				w2dc_ajax_loader_target_hide("w2dc-map-canvas");
251		} else
252			w2dc_attempts = 0;
253	}
254
255	window.w2dc_placeMarker_backend = function(w2dc_glocation) {
256		if (w2dc_maps_objects.map_markers_type != 'icons') {
257			if (w2dc_maps_objects.global_map_icons_path != '') {
258				var re = /(?:\.([^.]+))?$/;
259				if (w2dc_glocation.map_icon_file && typeof re.exec(w2dc_maps_objects.global_map_icons_path+'icons/'+w2dc_glocation.map_icon_file)[1] != "undefined")
260					var icon_file = w2dc_maps_objects.global_map_icons_path+'icons/'+w2dc_glocation.map_icon_file;
261				else
262					var icon_file = w2dc_maps_objects.global_map_icons_path+"blank.png";
263		
264				var customIcon = {
265						url: icon_file,
266						size: new google.maps.Size(parseInt(w2dc_maps_objects.marker_image_width), parseInt(w2dc_maps_objects.marker_image_height)),
267						origin: new google.maps.Point(0, 0),
268						anchor: new google.maps.Point(parseInt(w2dc_maps_objects.marker_image_anchor_x), parseInt(w2dc_maps_objects.marker_image_anchor_y))
269				};
270		
271				var marker = new google.maps.Marker({
272						position: w2dc_glocation.point,
273						map: w2dc_map_backend,
274						icon: customIcon,
275						draggable: true
276				});
277			} else 
278				var marker = new google.maps.Marker({
279						position: w2dc_glocation.point,
280						map: w2dc_map_backend,
281						draggable: true
282				});
283			
284			w2dc_markersArray_backend.push(marker);
285			google.maps.event.addListener(marker, 'click', function() {
286				w2dc_show_infoWindow_backend(w2dc_glocation, marker);
287			});
288		
289			google.maps.event.addListener(marker, 'dragend', function(event) {
290				var point = marker.getPosition();
291				if (point !== undefined) {
292					var selected_location_num = w2dc_glocation.index;
293					$(".w2dc-manual-coords:eq("+w2dc_glocation.index+")").prop("checked", true);
294					$(".w2dc-manual-coords:eq("+w2dc_glocation.index+")").parents(".w2dc-manual-coords-wrapper").find(".w2dc-manual-coords-block").show(200);
295					
296					$(".w2dc-map-coords-1:eq("+w2dc_glocation.index+")").val(point.lat());
297					$(".w2dc-map-coords-2:eq("+w2dc_glocation.index+")").val(point.lng());
298				}
299			});
300		} else {
301			w2dc_load_richtext();
302			
303			var icon = false;
304			var color = false;
305			if (!w2dc_glocation.map_icon_file || (typeof location.map_icon_file == 'string' && w2dc_glocation.map_icon_file.indexOf("w2dc-fa-") == -1)) {
306				if (!icon && w2dc_maps_objects.default_marker_icon) {
307					icon = w2dc_maps_objects.default_marker_icon;
308				}
309			} else {
310				icon = w2dc_glocation.map_icon_file;
311			}
312			if (!color) {
313				if (w2dc_maps_objects.default_marker_color) {
314					color = w2dc_maps_objects.default_marker_color;
315				} else {
316					color = '#428bca';
317				}
318			}
319			
320			if (icon) {
321				var map_marker_icon = '<span class="w2dc-map-marker-icon w2dc-fa '+icon+'" style="color: '+color+';"></span>';
322				var map_marker_class = 'w2dc-map-marker';
323			} else {
324				var map_marker_icon = '';
325				var map_marker_class = 'w2dc-map-marker-empty';
326			}
327
328			var marker = new RichMarker({
329				position: w2dc_glocation.point,
330				map: w2dc_map_backend,
331				flat: true,
332				draggable: true,
333				height: 40,
334				content: '<div class="'+map_marker_class+'" style="background: '+color+' none repeat scroll 0 0;">'+map_marker_icon+'</div>'
335			});
336			
337			w2dc_markersArray_backend.push(marker);
338			google.maps.event.addListener(marker, 'position_changed', function(event) {
339				var point = marker.getPosition();
340				if (point !== undefined) {
341					var selected_location_num = w2dc_glocation.index;
342					$(".w2dc-manual-coords:eq("+w2dc_glocation.index+")").prop("checked", true);
343					$(".w2dc-manual-coords:eq("+w2dc_glocation.index+")").parents(".w2dc-manual-coords-wrapper").find(".w2dc-manual-coords-block").show(200);
344					
345					$(".w2dc-map-coords-1:eq("+w2dc_glocation.index+")").val(point.lat());
346					$(".w2dc-map-coords-2:eq("+w2dc_glocation.index+")").val(point.lng());
347				}
348			});
349		}
350	}
351	
352	// This function builds info Window and shows it hiding another
353	function w2dc_show_infoWindow_backend(w2dc_glocation, marker) {
354		var address = w2dc_glocation.compileHtmlAddress();
355		var index = w2dc_glocation.index;
356	
357		// we use global w2dc_infoWindow_backend, not to close/open it - just to set new content (in order to prevent blinking)
358		if (!w2dc_infoWindow_backend)
359			w2dc_infoWindow_backend = new google.maps.InfoWindow();
360	
361		w2dc_infoWindow_backend.setContent(address);
362		w2dc_infoWindow_backend.open(w2dc_map_backend, marker);
363	}
364	
365	function w2dc_clearOverlays_backend() {
366		if (w2dc_markersArray_backend) {
367			for(var i = 0; i<w2dc_markersArray_backend.length; i++){
368				w2dc_markersArray_backend[i].setMap(null);
369			}
370		}
371	}
372	
373	function w2dc_isAnyLocation_backend() {
374		var is_location = false;
375		$(".w2dc-location-in-metabox").each(function(i, val) {
376			var locations_drop_boxes = [];
377			$(this).find("select").each(function(j, val) {
378				if ($(this).val()) {
379					is_location = true;
380					return false;
381				}
382			});
383	
384			if ($(".w2dc-manual-coords:eq("+i+")").is(":checked") && $(".w2dc-map-coords-1:eq("+i+")").val()!='' && $(".w2dc-map-coords-2:eq("+i+")").val()!='' && ($(".w2dc-map-coords-1:eq("+i+")").val()!=0 || $(".w2dc-map-coords-2:eq("+i+")").val()!=0)) {
385				is_location = true;
386				return false;
387			}
388		});
389		if (is_location)
390			return true;
391	
392		if ($(".w2dc-address-line-1[value!='']").length != 0)
393			return true;
394	
395		if ($(".w2dc-address-line-2[value!='']").length != 0)
396			return true;
397	
398		if ($(".w2dc-zip-or-postal-index[value!='']").length != 0)
399			return true;
400	}
401})(jQuery);
402
403// google_maps_view.js -------------------------------------------------------------------------------------------------------------------------------------------
404(function($) {
405	"use strict";
406	
407	window.w2dc_buildPoint = function(lat, lng) {
408		return new google.maps.LatLng(lat, lng);
409	}
410
411	window.w2dc_buildBounds = function() {
412		return new google.maps.LatLngBounds();
413	}
414
415	window.w2dc_extendBounds = function(bounds, point) {
416		bounds.extend(point);
417	}
418
419	window.w2dc_mapFitBounds = function(map_id, bounds) {
420		w2dc_maps[map_id].fitBounds(bounds);
421	}
422
423	window.w2dc_getMarkerPosition = function(marker) {
424		return marker.position;
425	}
426
427	window.w2dc_closeInfoWindow = function(map_id) {
428		if (typeof w2dc_infoWindows[map_id] != 'undefined') {
429			w2dc_infoWindows[map_id].close();
430		}
431	}
432	
433	window.w2dc_geocodeAddress = function(address, callback) {
434		if (typeof google.maps != 'undefined' && typeof google.maps.places != 'undefined') {
435			var geocoder = new google.maps.Geocoder();
436			geocoder.geocode({'address': address}, function(results, status) {
437				if (status == google.maps.GeocoderStatus.OK) {
438					var success = true;
439					var lat = results[0].geometry.location.lat();
440					var lng = results[0].geometry.location.lng();
441				} else {
442					var success = false;
443				}
444				callback(success, lat, lng);
445			    /*if (status == google.maps.GeocoderStatus.OK) {
446			    	post_params.start_latitude = results[0].geometry.location.lat();
447			    	post_params.start_longitude = results[0].geometry.location.lng();
448			    } else {
449					//alert('Sorry, we are unable to geocode entered address!');
450				}
451			    w2dc_startAJAXSearch(post_params, search_button_obj);*/
452			});
453		} else {
454			callback(false, 0, 0);
455			/*alert("Google Geocoder was not loaded. Check Google API keys and enable Google Maps Geocoding API in Google APIs console.");
456			w2dc_startAJAXSearch(post_params, search_button_obj);*/
457			
458		}
459	}
460	
461	window.w2dc_callMapResize = function(map_id) {
462		google.maps.event.trigger(w2dc_maps[map_id], 'resize');
463	}
464	
465	window.w2dc_setMapCenter = function(map_id, center) {
466		w2dc_maps[map_id].setCenter(center);
467	}
468	
469	window.w2dc_setMapZoom = function(map_id, zoom) {
470		var listener = google.maps.event.addListener(w2dc_maps[map_id], "idle", function() { 
471			w2dc_maps[map_id].setZoom(parseInt(zoom));
472			google.maps.event.removeListener(listener); 
473		});
474		
475	}
476	
477	window.w2dc_panTo = function(map_id, map_coords_1, map_coords_2) {
478		w2dc_maps[map_id].panTo(new google.maps.LatLng(map_coords_1, map_coords_2));
479	}
480
481	window.w2dc_autocompleteService = function(term, address_autocomplete_code, common_array, response, callback) {
482		if (address_autocomplete_code != '0')
483			var options = { input: term, componentRestrictions: {country: address_autocomplete_code}};
484		else
485			var options = { input: term };
486		
487		var autoCompleteService = new google.maps.places.AutocompleteService();
488		autoCompleteService.getPlacePredictions(options, function (predictions, status) {
489			var output_predictions = [];
490			$.map(predictions, function (prediction, i) {
491				var output_prediction = {
492						label: prediction.structured_formatting.main_text,
493						value: prediction.description,
494						name: prediction.structured_formatting.main_text,
495						sublabel: prediction.structured_formatting.secondary_text,
496						place_id: prediction.place_id
497				};
498				output_predictions.push(output_prediction);
499			});
500			
501			callback(output_predictions, common_array, response);
502		});
503	}
504
505	function w2dc_drawFreeHandPolygon(map_id) {
506		var poly = new google.maps.Polyline({
507			map: w2dc_maps[map_id],
508			clickable:false,
509			strokeColor: '#AA2143',
510			strokeWeight: 2,
511			zIndex: 1000,
512		});
513		
514		var move = google.maps.event.addListener(w2dc_maps[map_id], 'mousemove', function(e) {
515			poly.getPath().push(e.latLng);
516		});
517		
518		google.maps.event.addListenerOnce(w2dc_maps[map_id], 'mouseup', function(e) {
519			google.maps.event.removeListener(move);
520			var path = poly.getPath();
521			poly.setMap(null);
522		
523			// google likes to change letters-names of point property in the path,
524			// check them all
525			/*var letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','z','Mb'];
526			for (var i in letters) {
527				if (typeof path[letters[i]] != 'undefined' && path[letters[i]].length > 2) {
528					var theArrayofLatLng = path[letters[i]];
529				}
530			}*/
531			for (const [key, value] of Object.entries(path)) {
532				if (Array.isArray(value)) {
533					var theArrayofLatLng = path[key];
534				}
535			}
536			var ArrayforPolygontoUse = w2dc_GDouglasPeucker(theArrayofLatLng, 50);
537		
538			var geo_poly = [];
539			var lat_lng;
540			for (lat_lng in ArrayforPolygontoUse) {
541				geo_poly.push({'lat': ArrayforPolygontoUse[lat_lng].lat(), 'lng': ArrayforPolygontoUse[lat_lng].lng()});
542			}
543
544			if (geo_poly.length) {
545				w2dc_sendGeoPolyAJAX(map_id, geo_poly);
546			 
547				var polyOptions = {
548					map: w2dc_maps[map_id],
549					fillColor: '#0099FF',
550					fillOpacity: 0.3,
551					strokeColor: '#AA2143',
552					strokeWeight: 1,
553					clickable: false,
554					zIndex: 1,
555					path:ArrayforPolygontoUse,
556					editable: false
557				}
558	
559				w2dc_polygons[map_id] = new google.maps.Polygon(polyOptions);
560			}
561	
562			var drawButton = $(w2dc_maps[map_id].getDiv()).find('.w2dc-map-draw').get(0);
563			drawButton.drawing_state = 0;
564			//$('body').unbind('touchmove');
565			window.removeEventListener('touchmove', w2dc_stop_touchmove_listener, { passive: false });
566			w2dc_maps[map_id].setOptions({ draggableCursor: '' });
567			$(drawButton).removeClass('w2dc-btn-active');
568			w2dc_disableDrawingMode(map_id);
569			google.maps.event.clearListeners(w2dc_maps[map_id].getDiv(), 'mousedown');
570			
571			var editButton = $(w2dc_maps[map_id].getDiv()).find('.w2dc-map-edit').get(0);
572			$(editButton).removeAttr('disabled');
573		});
574	}
575	function w2dc_enableDrawingMode(map_id) {
576		$(w2dc_maps[map_id].getDiv()).find('.w2dc-map-custom-controls').hide();
577		// if sidebar was not opened - hide search field
578		/*if (!w2dc_isSidebarOpen(map_id) && $('#w2dc-map-search-wrapper-'+map_id).length) {
579			$('#w2dc-map-search-wrapper-'+map_id).hide();
580		}*/
581		w2dc_maps[map_id].setOptions({
582			draggable: false, 
583			scrollwheel: false,
584			streetViewControl: false
585		});
586	}
587	function w2dc_disableDrawingMode(map_id) {
588		$(w2dc_maps[map_id].getDiv()).find('.w2dc-map-custom-controls').show();
589		//if ($('#w2dc-map-search-wrapper-'+map_id).length) $('#w2dc-map-search-wrapper-'+map_id).show();
590		
591		var attrs_array = w2dc_get_map_markers_attrs_array(map_id);
592		
593		var enable_wheel_zoom = attrs_array.enable_wheel_zoom;
594		if (enable_wheel_zoom) {
595			var enable_wheel_zoom = true;
596		} else {
597			var enable_wheel_zoom = false;
598		}
599		
600		var enable_dragging_touchscreens = attrs_array.enable_dragging_touchscreens;
601		if (enable_dragging_touchscreens || !('ontouchstart' in document.documentElement)) {
602			var enable_dragging = true;
603		} else {
604			var enable_dragging = false;
605		}
606
607		w2dc_maps[map_id].setOptions({
608			draggable: enable_dragging, 
609			scrollwheel: enable_wheel_zoom,
610			streetViewControl: true
611		});
612	}
613	
614	window.w2dc_setMapZoomCenter = function(map_id, map_attrs, markers_array) {
615		if (
616				typeof map_attrs.start_zoom != 'undefined' &&
617				map_attrs.start_zoom > 0
618				
619				 //&& !map_attrs.geolocation // when commented - with enabled start zoom in the settings it zooms on initial page load
620		)
621			var zoom_level = map_attrs.start_zoom;
622	    else if (markers_array.length == 1)
623			var zoom_level = markers_array[0][5];
624		else if (markers_array.length > 1)
625			// fitbounds does not need zoom
626			var zoom_level = false;
627		else
628			var zoom_level = 2;
629	
630	    if (typeof map_attrs.start_latitude != 'undefined' && map_attrs.start_latitude && typeof map_attrs.start_longitude != 'undefined' && map_attrs.start_longitude) {
631	    	
632	    	if (wcsearch_get_uri_param('swLat')) {
633				var uri_bounds = new google.maps.LatLngBounds();
634				var sw_point = new google.maps.LatLng(wcsearch_get_uri_param('swLat'), wcsearch_get_uri_param('swLng'));
635				var ne_point = new google.maps.LatLng(wcsearch_get_uri_param('neLat'), wcsearch_get_uri_param('neLng'));
636				uri_bounds.extend(sw_point);
637				uri_bounds.extend(ne_point);
638				
639				w2dc_maps[map_id].fitBounds(uri_bounds, 0);
640			} else {
641				var start_latitude = map_attrs.start_latitude;
642				var start_longitude = map_attrs.start_longitude;
643				w2dc_setMapCenter(map_id, new google.maps.LatLng(start_latitude, start_longitude));
644				if (zoom_level == false) {
645					zoom_level = 12;
646				}
647				// especially set up setZoom on the map without "idle" listener, so it will not "fly" after load
648				w2dc_maps[map_id].setZoom(parseInt(zoom_level));
649			}
650
651			if (typeof map_attrs.ajax_loading != 'undefined' && map_attrs.ajax_loading == 1) {
652			    // use closures here
653			    w2dc_setMapAjaxListener(w2dc_maps[map_id], map_id);
654			}
655	    } else if (typeof map_attrs.start_address != 'undefined' && map_attrs.start_address) {
656	    	// use closures here
657	    	w2dc_geocodeStartAddress(map_attrs, map_id, zoom_level);
658	    } else if (markers_array.length == 1) {
659	    	w2dc_setMapZoom(map_id, zoom_level);
660		} else if (zoom_level) {
661			// no fitbounds here
662			w2dc_setMapCenter(map_id, new google.maps.LatLng(w2dc_maps_objects.default_latitude, w2dc_maps_objects.default_longitude));
663		    w2dc_setMapZoom(map_id, zoom_level);
664		}
665	}
666	
667	window.w2dc_show_on_map_links = function() {
668		$(".w2dc-show-on-map").each(function() {
669			var location_id = $(this).data("location-id");
670
671			var passed = false;
672			for (var map_id in w2dc_maps) {
673				if (typeof w2dc_global_locations_array[map_id] != 'undefined') {
674					for (var i=0; i<w2dc_global_locations_array[map_id].length; i++) {
675						if (typeof w2dc_global_locations_array[map_id][i] == 'object') {
676							if (location_id == w2dc_global_locations_array[map_id][i].id) {
677								passed = true;
678							}
679						}
680					}
681				}
682			}
683			if (passed) {
684				$(this).parent('.w2dc-listing-figcaption-option').show();
685			} else {
686				$(this).css({'cursor': 'auto'});
687				if ($(this).hasClass('w2dc-btn')) {
688					$(this).hide();
689				}
690			}
691		});
692	}
693
694	window.w2dc_load_maps = function() {
695		for (var i=0; i<w2dc_map_markers_attrs_array.length; i++)
696			if (typeof w2dc_maps[w2dc_map_markers_attrs_array[i].map_id] == 'undefined') // workaround for "tricky" themes and plugins to load maps twice
697				w2dc_load_map(i);
698
699		w2dc_show_on_map_links();
700		
701		w2dc_geolocatePosition();
702	}
703
704	window.w2dc_load_maps_api = function() {
705		$(document).trigger('w2dc_google_maps_api_loaded');
706
707		// are there any markers?
708		if (typeof w2dc_map_markers_attrs_array != 'undefined' && w2dc_map_markers_attrs_array.length) {
709			_w2dc_map_markers_attrs_array = JSON.parse(JSON.stringify(w2dc_map_markers_attrs_array));
710			window.addEventListener('load', w2dc_load_maps());
711		}
712
713		w2dc_load_ajax_initial_elements();
714		
715		w2dc_setupAutocomplete();
716
717		window.w2dc_getDirections = function(origin, destination, map_id) {
718			var directionsService = new google.maps.DirectionsService();
719			if (typeof w2dc_directions_display[map_id] == "undefined") {
720				w2dc_directions_display[map_id] = new google.maps.DirectionsRenderer(/*{map: w2dc_maps[map_id]}*/);
721			}
722
723			var request = {
724				origin: origin,
725				destination: destination,
726				travelMode: google.maps.DirectionsTravelMode.DRIVING
727			};
728
729			directionsService.route(request, function(response, status) {
730				if (status == google.maps.DirectionsStatus.OK) {
731					w2dc_directions_display[map_id].setMap(null);
732					w2dc_directions_display[map_id].setMap(w2dc_maps[map_id]);
733					w2dc_directions_display[map_id].set('directions', null);
734					$("#w2dc-route-container-"+map_id).html("");
735					w2dc_directions_display[map_id].setPanel($("#w2dc-route-container-"+map_id)[0]);
736					w2dc_directions_display[map_id].setDirections(response);
737				} else {
738					w2dc_handleDirectionsErrors(status);
739				}
740			});
741		}
742		
743		$('body').on('click', '.w2dc-get-directions-button', function() {
744			var map_id = $(this).data("id");
745			var origin = $("#w2dc-origin-address-"+map_id).val();
746			var destination = $(".w2dc-select-directions-"+map_id+":checked").val();
747			
748			w2dc_getDirections(origin, destination, map_id);
749		});
750		
751		google.maps.Map.prototype.panToWithOffset = function(latlng, offsetX, offsetY) {
752			var map = this;
753			var ov = new google.maps.OverlayView();
754			ov.onAdd = function() {
755				var proj = this.getProjection();
756				var aPoint = proj.fromLatLngToContainerPixel(latlng);
757				aPoint.x = aPoint.x+offsetX;
758				aPoint.y = aPoint.y+offsetY;
759				map.panTo(proj.fromContainerPixelToLatLng(aPoint));
760			}; 
761			ov.draw = function() {}; 
762			ov.setMap(this); 
763		};
764		
765		$('body').on('click', '.w2dc-show-on-map', function() {
766			var location_id = $(this).data("location-id");
767			var do_scroll_to_map = $(this).data("scroll-to-map");
768
769			for (var map_id in w2dc_maps) {
770				if (typeof w2dc_global_locations_array[map_id] != 'undefined') {
771					for (var i=0; i<w2dc_global_locations_array[map_id].length; i++) {
772						if (typeof w2dc_global_locations_array[map_id][i] == 'object') {
773							if (location_id == w2dc_global_locations_array[map_id][i].id) {
774								var location_obj = w2dc_global_locations_array[map_id][i];
775								if (!location_obj.is_ajax_markers) {
776									//var latitude = location_obj.marker.position.lat();
777									//var longitude = location_obj.marker.position.lng();
778									w2dc_showInfoWindow(location_obj, location_obj.marker, map_id);
779									google.maps.event.addListenerOnce(w2dc_maps[map_id], 'idle', function() {
780										w2dc_maps[map_id].panToWithOffset(location_obj.marker.position, 0, -150);
781									});
782								} else {
783									//w2dc_ajax_loader_target_show($('#w2dc-map-canvas-'+map_id));
784									
785									var post_data = {
786											'location_id': location_obj.id,
787											'action': 'w2dc_get_map_marker_info',
788											'map_id': map_id,
789											'show_summary_button': location_obj.show_summary_button,
790											'show_readmore_button': location_obj.show_readmore_button
791									};
792									$.ajax({
793							    		type: "POST",
794							    		url: w2dc_js_objects.ajaxurl,
795							    		data: eval(post_data),
796							    		map_id: map_id,
797							    		dataType: 'json',
798							    		success: function(response_from_the_action_function) {
799							    			var marker_array = response_from_the_action_function;
800							    			var map_coords_1 = marker_array[1];
801									    	var map_coords_2 = marker_array[2];
802									    	if ($.isNumeric(map_coords_1) && $.isNumeric(map_coords_2)) {
803								    			var point = new google.maps.LatLng(map_coords_1, map_coords_2);
804								    			//w2dc_maps[map_id].panTo(point);
805						
806								    			var new_location_obj = new w2dc_glocation(marker_array[0], point, 
807								    				marker_array[3],
808								    				marker_array[4],
809								    				marker_array[6],
810								    				marker_array[7],
811								    				marker_array[8],
812								    				marker_array[9],
813								    				marker_array[10],
814								    				marker_array[11],
815								    				location_obj.show_summary_button,
816								    				location_obj.show_readmore_button,
817								    				this.map_id,
818								    				true
819									    		);
820								    			w2dc_showInfoWindow(new_location_obj, location_obj.marker, this.map_id);
821								    			
822								    			google.maps.event.addListenerOnce(w2dc_maps[map_id], 'idle', function() {
823													w2dc_maps[map_id].panToWithOffset(point, 0, -150);
824												});
825									    	}
826							    		},
827							    		complete: function() {
828											//w2dc_ajax_loader_target_hide('w2dc-map-canvas-'+this.map_id);
829										}
830									});
831								}
832								
833								if (do_scroll_to_map) {
834									var offest_top = 100;
835									$('html,body').animate({scrollTop: $('#w2dc-map-canvas-'+map_id).offset().top - offest_top}, 'slow');
836								}
837							}
838						}
839					}
840				}
841			}
842		});
843	}
844
845	//$(function() {
846	document.addEventListener("DOMContentLoaded", function() {
847		if ((typeof google == 'undefined' || typeof google.maps == 'undefined') && !w2dc_maps_objects.notinclude_maps_api) {
848			var script = document.createElement("script");
849			script.type = "text/javascript";
850			var key = '';
851			var language = '';
852			if (w2dc_maps_objects.google_api_key)
853				key = "&key="+w2dc_maps_objects.google_api_key;
854			if (w2dc_js_objects.lang)
855				language = "&language="+w2dc_js_objects.lang;
856			script.src = "//maps.google.com/maps/api/js?libraries=places"+key+"&callback="+w2dc_maps_callback.callback+language;
857			document.body.appendChild(script);
858		} else {
859			w2dc_3rd_party_maps_plugin = true;
860			window[w2dc_maps_callback.callback]();
861		}
862	});
863
864	var w2dc_roadmap_name;
865    var w2dc_satellite_name;
866    window.w2dc_load_map = function(i) {
867		var map_id = w2dc_map_markers_attrs_array[i].map_id;
868		var markers_array = w2dc_map_markers_attrs_array[i].markers_array;
869		var enable_radius_circle = w2dc_map_markers_attrs_array[i].enable_radius_circle;
870		var enable_clusters = w2dc_map_markers_attrs_array[i].enable_clusters;
871		var show_summary_button = w2dc_map_markers_attrs_array[i].show_summary_button;
872		var map_style = w2dc_map_markers_attrs_array[i].map_style;
873		var draw_panel = w2dc_map_markers_attrs_array[i].draw_panel;
874		var show_readmore_button = w2dc_map_markers_attrs_array[i].show_readmore_button;
875		var enable_full_screen = w2dc_map_markers_attrs_array[i].enable_full_screen;
876		var enable_wheel_zoom = w2dc_map_markers_attrs_array[i].enable_wheel_zoom;
877		var enable_dragging_touchscreens = w2dc_map_markers_attrs_array[i].enable_dragging_touchscreens;
878		var show_directions = w2dc_map_markers_attrs_array[i].show_directions;
879		var map_attrs = w2dc_map_markers_attrs_array[i].map_attrs;
880		
881		if (document.getElementById("w2dc-map-canvas-"+map_id)) {
882			if (typeof w2dc_fullScreens[map_id] == "undefined" || !w2dc_fullScreens[map_id]) {
883				if (!w2dc_js_objects.is_rtl) {
884					var cposition = google.maps.ControlPosition.RIGHT_TOP;
885				} else {
886					var cposition = google.maps.ControlPosition.LEFT_TOP;
887				}
888				
889				if (enable_wheel_zoom) {
890					var enable_wheel_zoom = true;
891				} else {
892					var enable_wheel_zoom = false;
893				}
894				
895				if (enable_dragging_touchscreens || !('ontouchstart' in document.documentElement)) {
896					var enable_dragging = true;
897				} else {
898					var enable_dragging = false;
899				}
900
901				var mapOptions = {
902						zoom: 1,
903						draggable: enable_dragging,
904						scrollwheel: enable_wheel_zoom,
905						disableDoubleClickZoom: false,
906					    streetViewControl: true,
907					    streetViewControlOptions: {
908					        position: cposition
909					    },
910						mapTypeControl: false,
911						zoomControl: false,
912						panControl: false,
913						scaleControl: false,
914						fullscreenControl: false
915					  }
916				if (map_style) {
917					mapOptions.styles = eval(map_style);
918				}
919
920				w2dc_maps[map_id] = new google.maps.Map(document.getElementById("w2dc-map-canvas-"+map_id), mapOptions);
921				w2dc_maps_attrs[map_id] = map_attrs;
922
923				if ($("#w2dc-map-wrapper-"+map_id).hasClass("w2dc-sticky-scroll")) {
924					google.maps.event.addListenerOnce(w2dc_maps[map_id], 'idle', function(){
925						w2dc_sticky_scroll();
926					});
927				}
928				
929				google.maps.event.addListener(w2dc_maps[map_id], 'idle', function() {
930					if (typeof wcsearch_sticky_scroll != "undefined") {
931						wcsearch_sticky_scroll();
932					}
933				});
934
935			    var customControls;
936			    google.maps.event.addListenerOnce(w2dc_maps[map_id], 'idle', function() {
937			    	w2dc_maps[map_id].controls[cposition].clear();
938
939			    	customControls = document.createElement('div');
940				    customControls.index = -2;
941				    
942				    w2dc_maps[map_id].controls[cposition].push(customControls);
943				    $(customControls).addClass('w2dc-map-custom-controls');
944				    // required workaround, otherwise w2dc_maps[map_id].mapTypes.roadmap will be undefined on reload click
945				    if (!w2dc_roadmap_name) {
946				    	w2dc_roadmap_name = w2dc_maps[map_id].mapTypes.roadmap.name;
947				    }
948				    // required workaround, otherwise w2dc_maps[map_id].mapTypes.satellite will be undefined on reload click
949				    if (!w2dc_satellite_name) {
950				    	w2dc_satellite_name = w2dc_maps[map_id].mapTypes.satellite.name;
951				    }
952				    $(customControls).html('<div class="w2dc-btn-group"><button class="w2dc-btn w2dc-btn-primary w2dc-map-btn-zoom-in"><span class="w2dc-glyphicon w2dc-glyphicon-plus"></span></button><button class="w2dc-btn w2dc-btn-primary w2dc-map-btn-zoom-out"><span class="w2dc-glyphicon w2dc-glyphicon-minus"></span></button></div> <div class="w2dc-btn-group"><button class="w2dc-btn w2dc-btn-primary w2dc-map-btn-roadmap">
952'+w2dc_roadmap_name+'</button><button class="w2dc-btn w2dc-btn-primary w2dc-map-btn-satellite">'+w2dc_satellite_name+'</button>'+(enable_full_screen ? '<button class="w2dc-btn w2dc-btn-primary w2dc-map-btn-fullscreen"><span class="w2dc-glyphicon w2dc-glyphicon-fullscreen"></span></button>' : '')+'</div>');
953
954				    $(customControls).find('.w2dc-map-btn-zoom-in').get(0).addEventListener('click', function() {
955				    	w2dc_maps[map_id].setZoom(w2dc_maps[map_id].getZoom() + 1);
956				    });
957				    $(customControls).find('.w2dc-map-btn-zoom-out').get(0).addEventListener('click', function() {
958				    	w2dc_maps[map_id].setZoom(w2dc_maps[map_id].getZoom() - 1);
959				    });
960				    $(customControls).find('.w2dc-map-btn-roadmap').get(0).addEventListener('click', function() {
961				    	w2dc_maps[map_id].setMapTypeId(google.maps.MapTypeId.ROADMAP);
962				    });
963				    $(customControls).find('.w2dc-map-btn-satellite').get(0).addEventListener('click', function() {
964				    	w2dc_maps[map_id].setMapTypeId(google.maps.MapTypeId.HYBRID);
965				    });
966	
967				    var bodyStyle = document.body.style;
968				    if (document.body.runtimeStyle)
969				        bodyStyle = document.body.runtimeStyle;
970				    var originalOverflow = bodyStyle.overflow;
971				    var thePanoramaOpened = false;
972
973				    function openFullScreen() {
974				    	var center = w2dc_maps[map_id].getCenter();
975				    	
976				    	document.body.style.overflow = "hidden";
977				    	$(customControls).find('.w2dc-map-btn-fullscreen span').removeClass('w2dc-glyphicon-fullscreen');
978				    	$(customControls).find('.w2dc-map-btn-fullscreen span').addClass('w2dc-glyphicon-resize-small');
979				    	
980				    	w2dc_callMapResize(map_id);
981				        w2dc_setMapCenter(map_id, center);
982				    	
983				    	$("#w2dc-map-wrapper-"+map_id).addClass("w2dc-map-wrapper-full-screen");
984				        
985				        $(window).trigger('resize');
986				        
987				        $("body").addClass("w2dc-body-fullscreen-map");
988				    }
989				    function closeFullScreen() {
990				    	var center = w2dc_maps[map_id].getCenter();
991				    	
992				    	document.body.style.overflow = originalOverflow;
993			            $(customControls).find('.w2dc-map-btn-fullscreen span').removeClass('w2dc-glyphicon-resize-small');
994				        $(customControls).find('.w2dc-map-btn-fullscreen span').addClass('w2dc-glyphicon-fullscreen');
995	
996				        w2dc_callMapResize(map_id);
997				        w2dc_setMapCenter(map_id, center);
998				    	
999				    	$("#w2dc-map-wrapper-"+map_id).removeClass("w2dc-map-wrapper-full-screen");
1000				        
1001				        $(window).trigger('resize');
1002				        
1003				        $("body").removeClass("w2dc-body-fullscreen-map");
1004				    }
1005				    if (enable_full_screen) {
1006				    	$(customControls).find('.w2dc-map-btn-fullscreen').get(0).addEventListener('click', function() {
1007					    	if (typeof w2dc_fullScreens[map_id] == "undefined" || !w2dc_fullScreens[map_id]) {
1008					    		$("#w2dc-map-canvas-wrapper-"+map_id).addClass("w2dc-map-full-screen");
1009					    		w2dc_fullScreens[map_id] = true;
1010					    		openFullScreen();
1011					    	} else {
1012					    		$("#w2dc-map-canvas-wrapper-"+map_id).removeClass("w2dc-map-full-screen");
1013					    		w2dc_fullScreens[map_id] = false;
1014					    		closeFullScreen();
1015					    	}
1016					    });
1017					    var thePanorama = w2dc_maps[map_id].getStreetView();
1018					    google.maps.event.addListener(thePanorama, 'visible_changed', function() {
1019					    	thePanoramaOpened = (this.getVisible() ? true : false);
1020					    	if ($("#w2dc-map-sidebar-"+map_id).length) {
1021					    		if (thePanoramaOpened)
1022					    			$("#w2dc-map-sidebar-"+map_id).hide();
1023					    		else
1024					    			$("#w2dc-map-sidebar-"+map_id).show();
1025					    	}
1026					    });
1027					    $(document).on("keyup", function(e) {
1028					    	if (typeof w2dc_fullScreens[map_id] != "undefined" && w2dc_fullScreens[map_id] && e.keyCode == 27 && !thePanoramaOpened) {
1029					    		$("#w2dc-map-canvas-wrapper-"+map_id).removeClass("w2dc-map-full-screen");
1030					    		w2dc_fullScreens[map_id] = false;
1031					    		closeFullScreen();
1032					    	}
1033					    });
1034				    }
1035
1036				    if (draw_panel) {
1037				    	var drawPanel = document.createElement('div');
1038				    	drawPanel.index = -1;
1039				    	
1040					    w2dc_maps[map_id].controls[cposition].push(drawPanel);
1041					    $(drawPanel).addClass('w2dc-map-draw-panel');
1042	
1043					    var drawButton = document.createElement('button');
1044					    $(drawButton)
1045					    .addClass('w2dc-btn w2dc-btn-primary w2dc-map-draw')
1046					    .attr("title", w2dc_maps_objects.draw_area_button)
1047					    .html('<span class="w2dc-glyphicon w2dc-glyphicon-pencil"></span>');
1048	
1049					    drawPanel.appendChild(drawButton);
1050					    drawButton.map_id = map_id;
1051						drawButton.drawing_state = 0;
1052						$(drawButton).on("click", function(e) {
1053							var map_id = drawButton.map_id;
1054							if (this.drawing_state == 0) {
1055								this.drawing_state = 1;
1056								//$('body').bind('touchmove', function(e){e.preventDefault()});
1057								window.addEventListener('touchmove', w2dc_stop_touchmove_listener, { passive: false });
1058								w2dc_clearMarkers(map_id);
1059								w2dc_closeInfoWindow(map_id);
1060								w2dc_removeShapes(map_id);
1061								w2dc_removeCircles(map_id);
1062			
1063								w2dc_enableDrawingMode(map_id);
1064								
1065								var editButton = $(w2dc_maps[map_id].getDiv()).find('.w2dc-map-edit').get(0);
1066								$(editButton).attr('disabled', 'disabled');
1067			
1068								// remove ajax_loading and set drawing_state
1069								var map_attrs_array;
1070								if (map_attrs_array = w2dc_get_map_markers_attrs_array(map_id)) {
1071									map_attrs_array.map_attrs.drawing_state = 1;
1072									google.maps.event.clearListeners(w2dc_maps[map_id], 'idle');
1073									delete map_attrs_array.map_attrs.ajax_loading;
1074								}
1075				
1076								w2dc_maps[map_id].setOptions({ draggableCursor: 'crosshair' });
1077								$(this).toggleClass('w2dc-btn-active');
1078								
1079								w2dc_maps[map_id].getDiv().map_id = map_id;
1080								if ($('body').hasClass('w2dc-touch')) {
1081									w2dc_drawFreeHandPolygon(this.map_id);
1082								} else {
1083									google.maps.event.clearListeners(w2dc_maps[map_id].getDiv(), 'mousedown');
1084									w2dc_maps[map_id].getDiv().addEventListener('mousedown', function(e) {
1085										var el = e.target;
1086					                    do {
1087					                        if ($(el).hasClass('w2dc-map-draw-panel')) {
1088					                            return;
1089					                        }
1090					                    } while (el = el.parentNode);
1091										w2dc_drawFreeHandPolygon(this.map_id);
1092									});
1093								}
1094							} else if (this.drawing_state == 1) {
1095								this.drawing_state = 0;
1096								//$('body').unbind('touchmove');
1097								window.removeEventListener('touchmove', w2dc_stop_touchmove_listener, { passive: false });
1098								w2dc_disableDrawingMode(map_id);
1099								w2dc_maps[map_id].setOptions({ draggableCursor: '' });
1100								$(this).toggleClass('w2dc-btn-active');
1101								google.maps.event.clearListeners(w2dc_maps[map_id].getDiv(), 'mousedown');
1102								
1103								// repair ajax_loading and set drawing_state
1104								var map_attrs_array;
1105								if (map_attrs_array = w2dc_get_map_markers_attrs_array(map_id)) {
1106									map_attrs_array.map_attrs.drawing_state = 0;
1107									if (typeof w2dc_get_original_map_markers_attrs_array(map_id).map_attrs.ajax_loading != 'undefined' && w2dc_get_original_map_markers_attrs_array(map_id).map_attrs.ajax_loading == 1) {
1108										map_attrs_array.map_attrs.ajax_loading = 1;
1109										google.maps.event.addListener(w2dc_maps[map_id], 'idle', function() {
1110											w2dc_setAjaxMarkers(w2dc_maps[map_id], map_id); // draw button
1111										});
1112									}
1113								}
1114							}
1115						});
1116					    
1117					    var editButton = document.createElement('button');
1118					    $(editButton)
1119					    .addClass('w2dc-btn w2dc-btn-primary w2dc-map-edit')
1120					    .attr("title", w2dc_maps_objects.edit_area_button)
1121					    .html('<span class="w2dc-glyphicon w2dc-glyphicon-edit"></span>')
1122					    .attr('disabled', 'disabled');
1123					    
1124					    drawPanel.appendChild(editButton);
1125					    editButton.map_id = map_id;
1126					    editButton.editing_state = 0;
1127					    $(editButton).on("click", function(e) {
1128					    	var map_id = editButton.map_id;
1129							if (this.editing_state == 0) {
1130								this.editing_state = 1;
1131								$(this).toggleClass('w2dc-btn-active');
1132								$(this).attr("title", w2dc_maps_objects.apply_area_button);
1133								if (typeof w2dc_polygons[map_id] != 'undefined') {
1134									w2dc_polygons[map_id].setOptions({'editable': true});
1135								}
1136							} else if (this.editing_state == 1) {
1137								this.editing_state = 0;
1138								$(this).toggleClass('w2dc-btn-active');
1139								$(this).attr("title", w2dc_maps_objects.edit_area_button);
1140								if (typeof w2dc_polygons[map_id] != 'undefined') {
1141									w2dc_polygons[map_id].setOptions({'editable': false});
1142									
1143									var path = w2dc_polygons[map_id].getPath();
1144									var theArrayofLatLng = path.j;
1145									var geo_poly = [];
1146									var lat_lng;
1147									
1148									for (const [key, value] of Object.entries(path)) {
1149										if (Array.isArray(value)) {
1150											var theArrayofLatLng = path[key];
1151										}
1152									}
1153									var ArrayforPolygontoUse = w2dc_GDouglasPeucker(theArrayofLatLng, 50);
1154								
1155									for (lat_lng in ArrayforPolygontoUse) {
1156										geo_poly.push({'lat': ArrayforPolygontoUse[lat_lng].lat(), 'lng': ArrayforPolygontoUse[lat_lng].lng()});
1157									}
1158									
1159									w2dc_sendGeoPolyAJAX(map_id, geo_poly);
1160								}
1161							}
1162					    });
1163					    
1164					    var reloadButton = document.createElement('button');
1165					    $(reloadButton)
1166					    .addClass('w2dc-btn w2dc-btn-primary w2dc-map-reload')
1167					    .attr("title", w2dc_maps_objects.reload_map_button)
1168					    .html('<span class="w2dc-glyphicon w2dc-glyphicon-refresh"></span>');
1169					    
1170					    drawPanel.appendChild(reloadButton);
1171					    reloadButton.map_id = map_id;
1172					    $(reloadButton).on("click", function(e) {
1173							var map_id = reloadButton.map_id;
1174							for (var i=0; i<w2dc_map_markers_attrs_array.length; i++) {
1175								if (w2dc_map_markers_attrs_array[i].map_id == map_id) {
1176									w2dc_map_markers_attrs_array[i] = JSON.parse(JSON.stringify(_w2dc_map_markers_attrs_array[i]));
1177									
1178									//$('body').unbind('touchmove');
1179									window.removeEventListener('touchmove', w2dc_stop_touchmove_listener, { passive: false });
1180			
1181									var editButton = $(w2dc_maps[map_id].getDiv()).find('.w2dc-map-edit').get(0);
1182									$(editButton).removeClass('w2dc-btn-active');
1183									$(editButton).find('.w2dc-map-edit-label').text(w2dc_maps_objects.edit_area_button);
1184									$(editButton).attr('disabled', 'disabled');
1185			
1186									w2dc_clearMarkers(map_id);
1187									w2dc_closeInfoWindow(map_id);
1188									w2dc_removeShapes(map_id);
1189									w2dc_removeCircles(map_id);
1190									w2dc_load_map(i);
1191									google.maps.event.trigger(w2dc_maps[map_id], 'idle');
1192									if (w2dc_global_markers_array[map_id].length) {
1193							    		var bounds = new google.maps.LatLngBounds();
1194							    		for (var j=0; j<w2dc_global_markers_array[map_id].length; j++) {
1195							    			var marker = w2dc_global_markers_array[map_id][j];
1196										    w2dc_extendBounds(bounds, w2dc_getMarkerPosition(marker));
1197							    		}
1198							    		w2dc_mapFitBounds(map_id, bounds);
1199							    		
1200							    		var map_attrs = w2dc_map_markers_attrs_array[i].map_attrs;
1201							    		var markers_array = w2dc_map_markers_attrs_array[i].markers_array;
1202							    		w2dc_setMapZoomCenter(map_id, map_attrs, markers_array);
1203							    	}
1204									break;
1205								}
1206							}
1207						});
1208	
1209					    if (w2dc_maps_objects.enable_my_location_button) {
1210							google.maps.event.addListenerOnce(w2dc_maps[map_id], 'tilesloaded', function(){
1211								var locationButton = document.createElement('button');
1212								$(locationButton)
1213								.addClass('w2dc-btn w2dc-btn-primary w2dc-map-location')
1214								.attr("title", w2dc_maps_objects.my_location_button)
1215								.html('<span class="w2dc-glyphicon w2dc-glyphicon-screenshot"></span>');
1216	
1217								drawPanel.appendChild(locationButton);
1218								    
1219								locationButton.map_id = map_id;
1220								$(locationButton).on("click", function(e) {
1221									var map_id = locationButton.map_id;
1222									if (navigator.geolocation) {
1223									   	navigator.geolocation.getCurrentPosition(
1224									   		function(position) {
1225									    		var start_latitude = position.coords.latitude;
1226									    		var start_longitude = position.coords.longitude;
1227											    w2dc_maps[map_id].setCenter(new google.maps.LatLng(start_latitude, start_longitude));
1228									    	},
1229									    	function(e) {
1230										   		//alert(e.message);
1231										    },
1232										   	{timeout: 10000}
1233									    );
1234									}
1235								});
1236							});
1237					    }
1238				    }
1239			    });
1240			} // end of (!fullScreen)
1241
1242		    w2dc_global_markers_array[map_id] = [];
1243		    w2dc_global_locations_array[map_id] = [];
1244
1245			var bounds = new google.maps.LatLngBounds();
1246		    if (markers_array.length) {
1247		    	if (typeof map_attrs.ajax_markers_loading != 'undefined' && map_attrs.ajax_markers_loading == 1)
1248					var is_ajax_markers = true;
1249				else
1250					var is_ajax_markers = false;
1251	
1252		    	var markers = [];
1253		    	for (var j=0; j<markers_array.length; j++) {
1254	    			var map_coords_1 = markers_array[j][1];
1255			    	var map_coords_2 = markers_array[j][2];
1256			    	if ($.isNumeric(map_coords_1) && $.isNumeric(map_coords_2)) {
1257		    			var point = new google.maps.LatLng(map_coords_1, map_coords_2);
1258		    			bounds.extend(point);
1259	
1260		    			var location_obj = new w2dc_glocation(
1261		    				markers_array[j][0],  // location ID
1262		    				point, 
1263		    				markers_array[j][3],  // map icon file
1264		    				markers_array[j][4],  // map icon color
1265		    				markers_array[j][6],  // listing title
1266		    				markers_array[j][7],  // logo image
1267		    				markers_array[j][8],  // listing link
1268		    				markers_array[j][9],  // content fields output
1269		    				markers_array[j][10],  // listing link anchor
1270		    				markers_array[j][11], // is nofollow link
1271		    				show_summary_button,
1272		    				show_readmore_button,
1273		    				map_id,
1274		    				is_ajax_markers
1275			    		);
1276			    		var marker = location_obj.w2dc_placeMarker(map_id);
1277			    		markers.push(marker);
1278	
1279			    		w2dc_global_locations_array[map_id].push(location_obj);
1280			    	}
1281	    		}
1282		    	
1283		    	// do not fit bounds when there is starting address or coordinates, otherwise it will not center as expected,
1284		    	// but do it when starting zoom was not defined
1285		    	if (
1286		    		(
1287		    				!(typeof map_attrs.start_latitude != 'undefined' && map_attrs.start_latitude && typeof map_attrs.start_longitude != 'undefined' && map_attrs.start_longitude)
1288				    		&
1289				    		!(typeof map_attrs.start_address != 'undefined' && map_attrs.start_address)
1290				    )
1291		    		||
1292		    		!(typeof map_attrs.start_zoom != 'undefined' && map_attrs.start_zoom)
1293		    	) {
1294		    		//w2dc_mapFitBounds(map_id, bounds);
1295		    		
1296		    		// wait until tiles will be completely loaded
1297		    		google.maps.event.addListenerOnce(w2dc_maps[map_id], 'idle', function() {
1298		    			w2dc_maps[map_id].fitBounds(bounds);
1299		    		})
1300		    	}
1301	
1302		    	w2dc_setClusters(enable_clusters, map_id, markers);
1303		    	
1304		    	if (typeof window['radius_params'] != 'undefined') {
1305					var radius_params = window['radius_params'];
1306					
1307					w2dc_saveGeocodedCoordinates(radius_params, map_id);
1308		
1309					if (enable_radius_circle) {
1310						w2dc_drawRadius(radius_params, map_id);
1311					}
1312				}
1313		    }
1314		    w2dc_setMapZoomCenter(map_id, map_attrs, markers_array);
1315		}
1316	}
1317
1318	function w2dc_setMapAjaxListener(map, map_id) {
1319		
1320		google.maps.event.addListener(map, 'idle', function() {
1321			w2dc_setAjaxMarkers(map, map_id); // create listener
1322		});
1323	}
1324	function w2dc_geocodeStartAddress(map_attrs, map_id, zoom_level) {
1325		
1326		var start_address = map_attrs.start_address;
1327		function _geocodeStartAddress(status, start_latitude, start_longitude) {
1328			if (status == true) {
1329			    w2dc_setMapCenter(map_id, new google.maps.LatLng(start_latitude, start_longitude));
1330			    if (!zoom_level) {
1331			    	zoom_level = 13;
1332			    }
1333			    w2dc_setMapZoom(map_id, zoom_level);
1334			    
1335			    if (typeof map_attrs.geolocation != 'undefined' && map_attrs.geolocation == 1) {
1336			    	w2dc_geolocatePosition();
1337				}
1338			    
1339			    if (typeof map_attrs.ajax_loading != 'undefined' && map_attrs.ajax_loading == 1) {
1340				    	/*delete map_attrs.swLat;
1341				    	delete map_attrs.swLng;
1342						delete map_attrs.neLat;
1343						delete map_attrs.neLng;
1344						delete map_attrs.action;*/
1345				    // use closures here
1346				    w2dc_setMapAjaxListener(w2dc_maps[map_id], map_id);
1347			    }
1348			}
1349		}
1350		w2dc_geocodeAddress(start_address, _geocodeStartAddress);
1351	}
1352	function w2dc_geolocatePosition() {
1353		if (navigator.geolocation) {
1354			
1355			var geolocation_maps = [];
1356	    	for (var map_id in w2dc_maps_attrs) {
1357	    		if (typeof w2dc_maps_attrs[map_id].geolocation != 'undefined' && w2dc_maps_attrs[map_id].geolocation == 1) {
1358	    			geolocation_maps.push({ 'map': w2dc_maps[map_id], 'map_id': map_id});
1359	    		}
1360	    	}
1361	    	if (geolocation_maps.length) {
1362	    		navigator.geolocation.getCurrentPosition(
1363	    			function(position) {
1364		    			var start_latitude = position.coords.latitude;
1365		    			var start_longitude = position.coords.longitude;
1366		    			//start_latitude = 40.7143528;
1367		    			//start_longitude = -74.0059731;
1368		    			
1369				    	for (var i in geolocation_maps) {
1370				    		var map_id = geolocation_maps[i].map_id;
1371				    		
1372				    		w2dc_setMapCenter(map_id, new google.maps.LatLng(start_latitude, start_longitude));
1373
1374				    		if (typeof w2dc_maps_attrs[map_id].start_zoom != 'undefined' && w2dc_maps_attrs[map_id].start_zoom > 0) {
1375				    			w2dc_setMapZoom(map_id, w2dc_maps_attrs[map_id].start_zoom);
1376				    		}
1377
1378				    		for (var j=0; j<w2dc_map_markers_attrs_array.length; j++) {
1379								if (w2dc_map_markers_attrs_array[j].map_id == map_id) {
1380									w2dc_map_markers_attrs_array[j].map_attrs.start_latitude = start_latitude;
1381									w2dc_map_markers_attrs_array[j].map_attrs.start_longitude = start_longitude;
1382								}
1383				    		}
1384				    	}
1385		    		}, 
1386		    		function(e) {
1387		    			//alert(e.message);
1388			    	},
1389			    	{timeout: 10000}
1390		    	);
1391	    	}
1392		}
1393	}
1394	function w2dc_project(latLng) {
1395		var TILE_SIZE = 256;
1396		var siny = Math.sin(latLng.lat() * Math.PI / 180);
1397		siny = Math.min(Math.max(siny, -0.9999), 0.9999);
1398		return new google.maps.Point(
1399		   TILE_SIZE * (0.5 + latLng.lng() / 360),
1400		   TILE_SIZE * (0.5 - Math.log((1 + siny) / (1 - siny)) / (4 * Math.PI)));
1401	}
1402	window.w2dc_setAjaxMarkers = function(map, map_id) {
1403		var bounds_change_max_offset = 140;
1404		var attrs_array = w2dc_get_map_markers_attrs_array(map_id);
1405		var map_attrs = attrs_array.map_attrs;
1406		var enable_radius_circle = attrs_array.enable_radius_circle;
1407		var enable_clusters = attrs_array.enable_clusters;
1408		var show_summary_button = attrs_array.show_summary_button;
1409		var show_readmore_button = attrs_array.show_readmore_button;
1410		
1411		/*var address_string = '';
1412		if (address_string = wcsearch_get_query_string_param('address')) {
1413			if (typeof w2dc_searchAddresses[map_id] == "undefined" || w2dc_searchAddresses[map_id] != address_string) {
1414				var geocoder = new google.maps.Geocoder();
1415				geocoder.geocode({'address': address_string}, function(results, status) {
1416					if (status == google.maps.GeocoderStatus.OK) {
1417						var latitude = results[0].geometry.location.lat();
1418						var longitude = results[0].geometry.location.lng();
1419					}
1420					map.panTo(new google.maps.LatLng(latitude, longitude));
1421				    
1422					w2dc_setAjaxMarkers(map, map_id);
1423				});
1424				w2dc_searchAddresses[map_id] = address_string;
1425				
1426				return false;
1427			}
1428		}*/
1429	
1430		var bounds_new = map.getBounds();
1431		if (bounds_new) {
1432			var south_west = bounds_new.getSouthWest
1432();
1433			var north_east = bounds_new.getNorthEast();
1434		} else {
1435			return false;
1436		}
1437		
1438		wcsearch_insert_param_in_uri('swLat', south_west.lat());
1439		wcsearch_insert_param_in_uri('swLng', south_west.lng());
1440		wcsearch_insert_param_in_uri('neLat', north_east.lat());
1441		wcsearch_insert_param_in_uri('neLng', north_east.lng());
1442	
1443		if (typeof map_attrs.swLat != 'undefined' && typeof map_attrs.swLng != 'undefined' && typeof map_attrs.neLat != 'undefined' && typeof map_attrs.neLng != 'undefined') {
1444			var bounds_old = new google.maps.LatLngBounds();
1445		    var sw_point = new google.maps.LatLng(map_attrs.swLat, map_attrs.swLng);
1446		    var ne_point = new google.maps.LatLng(map_attrs.neLat, map_attrs.neLng);
1447		    bounds_old.extend(sw_point);
1448		    bounds_old.extend(ne_point);
1449	
1450		    var scale = 1 << map.getZoom();
1451		    var worldCoordinate_new = w2dc_project(sw_point);
1452		    var worldCoordinate_old = w2dc_project(south_west);
1453		    if (
1454		    	(bounds_old.contains(south_west) && bounds_old.contains(north_east))
1455		    	||
1456			    	(bounds_change_max_offset > Math.abs(Math.floor(worldCoordinate_new.x*scale) - Math.floor(worldCoordinate_old.x*scale))
1457			    	&&
1458			    	bounds_change_max_offset > Math.abs(Math.floor(worldCoordinate_new.y*scale) - Math.floor(worldCoordinate_old.y*scale)))
1459		    ) {
1460		    	return false;
1461		    }
1462		}
1463		
1464		// save bounds
1465		for (var i=0; i<w2dc_map_markers_attrs_array.length; i++) {
1466			if (w2dc_map_markers_attrs_array[i].map_id == map_id) {
1467				w2dc_map_markers_attrs_array[i].map_attrs.swLat = south_west.lat();
1468				w2dc_map_markers_attrs_array[i].map_attrs.swLng = south_west.lng();
1469				w2dc_map_markers_attrs_array[i].map_attrs.neLat = north_east.lat();
1470				w2dc_map_markers_attrs_array[i].map_attrs.neLng = north_east.lng();
1471			}
1472		}
1473		
1474		var post_params = w2dc_collectAJAXParams({ hash: map_id, from_set_ajax: 1 });
1475		post_params.swLat = south_west.lat();
1476		post_params.swLng = south_west.lng();
1477		post_params.neLat = north_east.lat();
1478		post_params.neLng = north_east.lng();
1479	
1480		$.ajax({
1481			type: "POST",
1482			url: w2dc_js_objects.ajaxurl,
1483			data: post_params,
1484			dataType: 'json',
1485			success: function(response_from_the_action_function) {
1486				if (response_from_the_action_function) {
1487					var response_hash = response_from_the_action_function.hash;
1488					
1489					// check opened info window
1490					var opened_location_id;
1491					var keep_info_window_opened = false;
1492		    		if (typeof w2dc_infoWindows[map_id] != 'undefined') {
1493		    			opened_location_id = w2dc_infoWindows[map_id].location.id;
1494		    		}
1495	
1496					if (response_from_the_action_function.html) {
1497						var listings_block = $("#w2dc-controller-"+response_hash);
1498						listings_block.replaceWith(response_from_the_action_function.html);
1499						//w2dc_ajax_loader_target_hide('w2dc-controller-'+response_hash);
1500					}
1501					
1502					var map_listings_block = $("#w2dc-map-listings-panel-"+response_hash);
1503			    	if (map_listings_block.length) {
1504			    		map_listings_block.html(response_from_the_action_function.map_listings);
1505			    		
1506			    		if (opened_location_id) {
1507			    			w2dc_map_sidebar_scrollto(map_id, opened_location_id.id);
1508			    		}
1509			    	}
1510	
1511					w2dc_clearMarkers(map_id);
1512					w2dc_removeShapes(map_id);
1513					w2dc_removeCircles(map_id);
1514					
1515					if (typeof map_attrs.ajax_markers_loading != 'undefined' && map_attrs.ajax_markers_loading == 1) {
1516						var is_ajax_markers = true;
1517					} else {
1518						var is_ajax_markers = false;
1519					}
1520		
1521					var markers_array = response_from_the_action_function.map_markers;
1522					w2dc_global_locations_array[map_id] = [];
1523			    	for (var j=0; j<markers_array.length; j++) {
1524		    			var map_coords_1 = markers_array[j][1];
1525				    	var map_coords_2 = markers_array[j][2];
1526				    	if ($.isNumeric(map_coords_1) && $.isNumeric(map_coords_2)) {
1527			    			var point = new google.maps.LatLng(map_coords_1, map_coords_2);
1528	
1529			    			var location_obj = new w2dc_glocation(markers_array[j][0], point, 
1530			    				markers_array[j][3],
1531			    				markers_array[j][4],
1532			    				markers_array[j][6],
1533			    				markers_array[j][7],
1534			    				markers_array[j][8],
1535			    				markers_array[j][9],
1536			    				markers_array[j][10],
1537			    				markers_array[j][11],
1538			    				show_summary_button,
1539			    				show_readmore_button,
1540			    				map_id,
1541			    				is_ajax_markers
1542				    		);
1543				    		var marker = location_obj.w2dc_placeMarker(map_id);
1544	
1545				    		w2dc_global_locations_array[map_id].push(location_obj);
1546				    		
1547				    		// check opened info window
1548				    		if (opened_location_id == location_obj.id) {
1549				    			keep_info_window_opened = true;
1550				    		}
1551				    	}
1552		    		}
1553			    	
1554					if (!keep_info_window_opened) {
1555						w2dc_closeInfoWindow(map_id);
1556					}
1557			    	
1558			    	w2dc_setClusters(enable_clusters, map_id, w2dc_global_markers_array[map_id]);
1559
1560			    	if (typeof response_from_the_action_function.radius_params != 'undefined') {
1561						var radius_params = response_from_the_action_function.radius_params;
1562						
1563						w2dc_saveGeocodedCoordinates(radius_params, map_id);
1564
1565						if (enable_radius_circle) {
1566							
1567							w2dc_drawRadius(radius_params, map_id);
1568						}
1569					}
1570				}
1571			},
1572			complete: w2dc_completeAJAXSearchOnMap(map_id)
1573		});
1574	}
1575	var w2dc_completeAJAXSearchOnMap = function(map_id) {
1576		return function() {
1577			w2dc_equalColumnsHeight();
1578		}
1579	}
1580	window.w2dc_drawRadius = function(radius_params, map_id) {
1581		var map_radius = parseFloat(radius_params.radius_value);
1582		
1583		if (radius_params.dimension == 'miles') {
1584			map_radius *= 1.609344;
1585		}
1586		
1587		var map_coords_1 = radius_params.map_coords_1;
1588		var map_coords_2 = radius_params.map_coords_2;
1589
1590		if ($.isNumeric(map_coords_1) && $.isNumeric(map_coords_2)) {
1591			map_radius *= 1000; // we need radius exactly in meters
1592			w2dc_drawCircles[map_id] = new google.maps.Circle({
1593		    	center: new google.maps.LatLng(map_coords_1, map_coords_2),
1594		        radius: map_radius,
1595		        strokeColor: "#FF0000",
1596		        strokeOpacity: 0.25,
1597		        strokeWeight: 1,
1598		        fillColor: "#FF0000",
1599		        fillOpacity: 0.1,
1600		        map: w2dc_maps[map_id]
1601		    });
1602			google.maps.event.addListener(w2dc_drawCircles[map_id], 'mouseup', function(event) {
1603				w2dc_dragended = false;
1604			});
1605		}
1606	}
1607	
1608	var w2dc_bouncing_z_index = 0;
1609	var w2dc_bouncing_marker = null;
1610	window.w2dc_placeMarker = function(location, map_id) {
1611		
1612		var bounce_selectors = ".w2dc-show-on-map[data-location-id="+location.id+"], .w2dc-listing-has-location-"+location.id;
1613		
1614		// PNG images
1615		if (w2dc_maps_objects.map_markers_type != 'icons') {
1616			if (w2dc_maps_objects.global_map_icons_path != '') {
1617				var re = /(?:\.([^.]+))?$/;
1618				if (location.map_icon_file && typeof re.exec(w2dc_maps_objects.global_map_icons_path+'icons/'+location.map_icon_file)[1] != "undefined")
1619					var icon_file = w2dc_maps_objects.global_map_icons_path+'icons/'+location.map_icon_file;
1620				else
1621					var icon_file = w2dc_maps_objects.global_map_icons_path+"blank.png";
1622		
1623				var customIcon = {
1624					url: icon_file,
1625				    size: new google.maps.Size(parseInt(w2dc_maps_objects.marker_image_width), parseInt(w2dc_maps_objects.marker_image_height)),
1626				    origin: new google.maps.Point(0, 0),
1627				    anchor: new google.maps.Point(parseInt(w2dc_maps_objects.marker_image_anchor_x), parseInt(w2dc_maps_objects.marker_image_anchor_y))
1628				};
1629		
1630				var marker = new google.maps.Marker({
1631					position: location.point,
1632					map: w2dc_maps[map_id],
1633					icon: customIcon,
1634					animation: google.maps.Animation.DROP
1635				});
1636			} else {
1637				var marker = new google.maps.Marker({
1638					position: location.point,
1639					map: w2dc_maps[map_id],
1640					animation: google.maps.Animation.DROP
1641				});
1642			}
1643			
1644			$(document).on("mouseenter", bounce_selectors, {marker: marker}, function(event) {
1645				event.data.marker.setAnimation(google.maps.Animation.BOUNCE);
1646			});
1647			$(document).on("mouseleave", bounce_selectors, {marker: marker}, function(event) {
1648				event.data.marker.setAnimation(null);
1649			});
1650			
1651			w2dc_dragended = false;
1652		} else {
1653			// fa- Icons
1654			w2dc_load_richtext();
1655			
1656			if (location.map_icon_color)
1657				var map_marker_color = location.map_icon_color;
1658			else
1659				var map_marker_color = w2dc_maps_objects.default_marker_color;
1660
1661			if (typeof location.map_icon_file == 'string' && location.map_icon_file.indexOf("w2dc-fa-") != -1) {
1662				var map_marker_icon = '<span class="w2dc-map-marker-icon w2dc-fa '+location.map_icon_file+'" style="color: '+map_marker_color+';"></span>';
1663				var map_marker_class = 'w2dc-map-marker';
1664			} else {
1665				if (w2dc_maps_objects.default_marker_icon) {
1666					var map_marker_icon = '<span class="w2dc-map-marker-icon w2dc-fa '+w2dc_maps_objects.default_marker_icon+'" style="color: '+map_marker_color+';"></span>';
1667					var map_marker_class = 'w2dc-map-marker';
1668				} else {
1669					var map_marker_icon = '';
1670					var map_marker_class = 'w2dc-map-marker-empty';
1671				}
1672			}
1673
1674			var marker = new RichMarker({
1675				position: location.point,
1676				map: w2dc_maps[map_id],
1677				flat: true,
1678				content: '<div class="'+map_marker_class+' w2dc-map-marker-'+location.id+'" style="background: '+map_marker_color+' none repeat scroll 0 0;">'+map_marker_icon+'</div>'
1679			});
1680			
1681			w2dc_dragended = false;
1682			google.maps.event.addListener(w2dc_maps[map_id], 'dragend', function(event) {
1683			    w2dc_dragended = true;
1684			});
1685			google.maps.event.addListener(w2dc_maps[map_id], 'mouseup', function(event) {
1686				w2dc_dragended = false;
1687			});
1688			
1689			function doBounce(element, times, distance, speed) {
1690				if (w2dc_bouncing_marker && !w2dc_bouncing_marker.is(':animated')) {
1691					w2dc_bouncing_marker.stop(true, true);
1692					
1693					for (var i = 0; i < times; i++) {
1694						element
1695						.animate({marginTop: '-='+distance},speed)
1696						.animate({marginTop: '+='+distance},speed);
1697					}
1698				}
1699				
1700				window.setTimeout(function() {
1701					doBounce(element, times, distance, speed);
1702				}, 0);
1703			}
1704			
1705			google.maps.event.addListener(marker, 'ready', function() {
1706				$(document).on("mouseenter", bounce_selectors, function(event) {
1707					if (!w2dc_bouncing_marker) {
1708						if ($('.w2dc-map-marker-'+location.id).is(':visible')) {
1709							w2dc_bouncing_z_index++;
1710							$('.w2dc-map-marker-'+location.id).css("z-index", w2dc_bouncing_z_index);
1711							w2dc_bouncing_marker = $('.w2dc-map-marker-'+location.id).parent().parent();
1712							doBounce(w2dc_bouncing_marker, 10, '10px', 300);
1713						}
1714					}
1715				});
1716				$(document).on("mouseleave", bounce_selectors, function(event) {
1717					if (w2dc_bouncing_marker) {
1718						w2dc_bouncing_marker.finish();
1719						w2dc_bouncing_marker = null;
1720					}
1721				});
1722			});
1723		}
1724		
1725		w2dc_global_markers_array[map_id].push(marker);
1726
1727		google.maps.event.addListener(marker, 'click', function() {
1728			if (!w2dc_dragended) {
1729				var attrs_array = w2dc_get_map_markers_attrs_array(map_id);
1730				if (attrs_array.center_map_onclick) {
1731					var map_attrs = attrs_array.map_attrs;
1732					if (typeof map_attrs.ajax_loading == 'undefined' || map_attrs.ajax_loading == 0) {
1733						w2dc_maps[map_id].panTo(marker.getPosition());
1734					}
1735				}
1736					
1737				w2dc_map_sidebar_scrollto(map_id, location.id);
1738
1739				if (!location.is_ajax_markers) {
1740					w2dc_showInfoWindow(location, marker, map_id);
1741				} else {
1742					//w2dc_ajax_loader_target_show($('#w2dc-map-canvas-'+map_id));
1743		
1744					var post_data = {
1745							'location_id': location.id,
1746							'action': 'w2dc_get_map_marker_info',
1747							'map_id': map_id,
1748							'show_summary_button': location.show_summary_button,
1749							'show_readmore_button': location.show_readmore_button
1750					};
1751					$.ajax({
1752			    		type: "POST",
1753			    		url: w2dc_js_objects.ajaxurl,
1754			    		data: eval(post_data),
1755			    		dataType: 'json',
1756			    		success: function(response_from_the_action_function) {
1757			    			var marker_array = response_from_the_action_function;
1758			    			var map_coords_1 = marker_array[1];
1759					    	var map_coords_2 = marker_array[2];
1760					    	if ($.isNumeric(map_coords_1) && $.isNumeric(map_coords_2)) {
1761				    			var point = new google.maps.LatLng(map_coords_1, map_coords_2);
1762		
1763				    			var new_location_obj = new w2dc_glocation(marker_array[0], point, 
1764				    				marker_array[3],
1765				    				marker_array[4],
1766				    				marker_array[6],
1767				    				marker_array[7],
1768				    				marker_array[8],
1769				    				marker_array[9],
1770				    				marker_array[10],
1771				    				marker_array[11],
1772				    				location.show_summary_button,
1773				    				location.show_readmore_button,
1774				    				map_id,
1775				    				true
1776					    		);
1777				    			w2dc_showInfoWindow(new_location_obj, marker, map_id);
1778					    	}
1779			    		},
1780			    		complete: function() {
1781							//w2dc_ajax_loader_target_hide("w2dc-map-canvas-"+map_id);
1782						}
1783					});
1784				}
1785			}
1786		});
1787	
1788		return marker;
1789	}
1790	// This function builds info Window and shows it hiding another
1791	function w2dc_showInfoWindow(w2dc_glocation, marker, map_id) {
1792		// infobox_packed.js -------------------------------------------------------------------------------------------------------------------------------------------
1793		function InfoBox(t){t=t||{},google.maps.OverlayView.apply(this,arguments),this.content_=t.content||"",this.disableAutoPan_=t.disableAutoPan||!1,this.maxWidth_=t.maxWidth||0,this.pixelOffset_=t.pixelOffset||new google.maps.Size(0,0),this.position_=t.position||new google.maps.LatLng(0,0),this.zIndex_=t.zIndex||null,this.boxClass_=t.boxClass||"infoBox",this.boxStyle_=t.boxStyle||{},this.closeBoxMargin_=t.closeBoxMargin||"2px",this.closeBoxURL_=t.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif",""===t.closeBoxURL&&(this.closeBoxURL_=""),this.infoBoxClearance_=t.infoBoxClearance||new google.maps.Size(1,1),"undefined"==typeof t.visible&&(t.visible="undefined"==typeof t.isHidden?!0:!t.isHidden),this.isHidden_=!t.visible,this.alignBottom_=t.alignBottom||!1,this.pane_=t.pane||"floatPane",this.enableEventPropagation_=t.enableEventPropagation||!1,this.div_=null,this.closeListener_=null,this.moveListener_=null,this.contextListener_=null,this.eventListeners_=null,this.fixedWidthSet_=null}InfoBox.prototype=new google.maps.OverlayView,InfoBox.prototype.createInfoBoxDiv_=function(){var t,e,i,o=this,s=function(t){t.cancelBubble=!0,t.stopPropagation&&t.stopPropagation()},n=function(t){t.returnValue=!1,t.preventDefault&&t.preventDefault(),o.enableEventPropagation_||s(t)};if(!this.div_){if(this.div_=document.createElement("div"),this.setBoxStyle_(),"undefined"==typeof this.content_.nodeType?this.div_.innerHTML=this.getCloseBoxImg_()+this.content_:(this.div_.innerHTML=this.getCloseBoxImg_(),this.div_.appendChild(this.content_)),this.getPanes()[this.pane_].appendChild(this.div_),this.addClickHandler_(),this.div_.style.width?this.fixedWidthSet_=!0:0!==this.maxWidth_&&this.div_.offsetWidth>this.maxWidth_?(this.div_.style.width=this.maxWidth_,this.div_.style.overflow="auto",this.fixedWidthSet_=!0):(i=this.getBoxWidths_(),this.div_.style.width=this.div_.offsetWidth-i.left-i.right+"px",this.fixedWidthSet_=!1),this.panBox_(this.disableAutoPan_),!this.enableEventPropagation_){for(this.eventListeners_=[],e=["mousedown","mouseover","mouseout","mouseup","click","dblclick","touchstart","touchend","touchmove"],t=0;t<e.length;t++)this.eventListeners_.push(this.div_.addEventListener(e[t],s));this.eventListeners_.push(this.div_.addEventListener("mouseover",function(){this.style.cursor="default"}))}this.contextListener_=this.div_.addEventListener("contextmenu",n),google.maps.event.trigger(this,"domready")}},InfoBox.prototype.getCloseBoxImg_=function(){var t="";return""!==this.closeBoxURL_&&(t="<img",t+=" src='"+this.closeBoxURL_+"'",t+=" align=right",t+=" style='",t+=" position: relative;",t+=" cursor: pointer;",t+=" margin: "+this.closeBoxMargin_+";",t+="'>"),t},InfoBox.prototype.addClickHandler_=function(){var t;""!==this.closeBoxURL_?(t=this.div_.firstChild,this.closeListener_=t.addEventListener("click",this.getCloseClickHandler_())):this.closeListener_=null},InfoBox.prototype.getCloseClickHandler_=function(){var t=this;return function(e){e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation(),google.maps.event.trigger(t,"closeclick"),t.close()}},InfoBox.prototype.panBox_=function(t){var e,i,o=0,s=0;if(!t&&(e=this.getMap(),e instanceof google.maps.Map)){e.getBounds().contains(this.position_)||e.setCenter(this.position_),i=e.getBounds();var n=e.getDiv(),h=n.offsetWidth,d=n.offsetHeight,l=this.pixelOffset_.width,r=this.pixelOffset_.height,a=this.div_.offsetWidth,p=this.div_.offsetHeight,_=this.infoBoxClearance_.width,f=this.infoBoxClearance_.height,v=this.getProjection().fromLatLngToContainerPixel(this.position_);if(v.x<-l+_?o=v.x+l-_:v.x+a+l+_>h&&(o=v.x+a+l+_-h),this.alignBottom_?v.y<-r+f+p?s=v.y+r-f-p:v.y+r+f>d&&(s=v.y+r+f-d):v.y<-r+f?s=v.y+r-f:v.y+p+r+f>d&&(s=v.y+p+r+f-d),0!==o||0!==s){{e.getCenter()}e.panBy(o,s)}}},InfoBox.prototype.setBoxStyle_=function(){var t,e;if(this.div_){this.div_.className=this.boxClass_,this.div_.style.cssText="",e=this.boxStyle_;for(t in e)e.hasOwnProperty(t)&&(this.div_.style[t]=e[t]);this.div_.style.WebkitTransform="translateZ(0)","undefined"!=typeof this.div_.style.opacity&&""!==this.div_.style.opacity&&(this.div_.style.MsFilter='"progid:DXImageTransform.Microsoft.Alpha(Opacity='+100*this.div_.style.opacity+')"',this.div_.style.filter="alpha(opacity="+100*this.div_.style.opacity+")"),this.div_.style.position="absolute",this.div_.style.visibility="hidden",null!==this.zIndex_&&(this.div_.style.zIndex=this.zIndex_)}}
vendor: 5,207 bytes, lines 1793-1810
1793,InfoBox.prototype.getBoxWidths_=function(){var t,e={top:0,bottom:0,left:0,right:0},i=this.div_;return document.defaultView&&document.defaultView.getComputedStyle?(t=i.ownerDocument.defaultView.getComputedStyle(i,""),t&&(e.top=parseInt(t.borderTopWidth,10)||0,e.bottom=parseInt(t.borderBottomWidth,10)||0,e.left=parseInt(t.borderLeftWidth,10)||0,e.right=parseInt(t.borderRightWidth,10)||0)):document.documentElement.currentStyle&&i.currentStyle&&(e.top=parseInt(i.currentStyle.borderTopWidth,10)||0,e.bottom=parseInt(i.currentStyle.borderBottomWidth,10)||0,e.left=parseInt(i.currentStyle.borderLeftWidth,10)||0,e.right=parseInt(i.currentStyle.borderRightWidth,10)||0),e},InfoBox.prototype.onRemove=function(){this.div_&&(this.div_.parentNode.removeChild(this.div_),this.div_=null)},InfoBox.prototype.draw=function(){this.createInfoBoxDiv_();var t=this.getProjection().fromLatLngToDivPixel(this.position_);this.div_.style.left=t.x+this.pixelOffset_.width+"px",this.alignBottom_?this.div_.style.bottom=-(t.y+this.pixelOffset_.height)+"px":this.div_.style.top=t.y+this.pixelOffset_.height+"px",this.div_.style.visibility=this.isHidden_?"hidden":"visible"},InfoBox.prototype.setOptions=function(t){"undefined"!=typeof t.boxClass&&(this.boxClass_=t.boxClass,this.setBoxStyle_()),"undefined"!=typeof t.boxStyle&&(this.boxStyle_=t.boxStyle,this.setBoxStyle_()),"undefined"!=typeof t.content&&this.setContent(t.content),"undefined"!=typeof t.disableAutoPan&&(this.disableAutoPan_=t.disableAutoPan),"undefined"!=typeof t.maxWidth&&(this.maxWidth_=t.maxWidth),"undefined"!=typeof t.pixelOffset&&(this.pixelOffset_=t.pixelOffset),"undefined"!=typeof t.alignBottom&&(this.alignBottom_=t.alignBottom),"undefined"!=typeof t.position&&this.setPosition(t.position),"undefined"!=typeof t.zIndex&&this.setZIndex(t.zIndex),"undefined"!=typeof t.closeBoxMargin&&(this.closeBoxMargin_=t.closeBoxMargin),"undefined"!=typeof t.closeBoxURL&&(this.closeBoxURL_=t.closeBoxURL),"undefined"!=typeof t.infoBoxClearance&&(this.infoBoxClearance_=t.infoBoxClearance),"undefined"!=typeof t.isHidden&&(this.isHidden_=t.isHidden),"undefined"!=typeof t.visible&&(this.isHidden_=!t.visible),"undefined"!=typeof t.enableEventPropagation&&(this.enableEventPropagation_=t.enableEventPropagation),this.div_&&this.draw()},InfoBox.prototype.setContent=function(t){this.content_=t,this.div_&&(this.closeListener_&&(google.maps.event.removeListener(this.closeListener_),this.closeListener_=null),this.fixedWidthSet_||(this.div_.style.width=""),"undefined"==typeof t.nodeType?this.div_.innerHTML=this.getCloseBoxImg_()+t:(this.div_.innerHTML=this.getCloseBoxImg_(),this.div_.appendChild(t)),this.fixedWidthSet_||(this.div_.style.width=this.div_.offsetWidth+"px","undefined"==typeof t.nodeType?this.div_.innerHTML=this.getCloseBoxImg_()+t:(this.div_.innerHTML=this.getCloseBoxImg_(),this.div_.appendChild(t))),this.addClickHandler_()),google.maps.event.trigger(this,"content_changed")},InfoBox.prototype.setPosition=function(t){this.position_=t,this.div_&&this.draw(),google.maps.event.trigger(this,"position_changed")},InfoBox.prototype.setZIndex=function(t){this.zIndex_=t,this.div_&&(this.div_.style.zIndex=t),google.maps.event.trigger(this,"zindex_changed")},InfoBox.prototype.setVisible=function(t){this.isHidden_=!t,this.div_&&(this.div_.style.visibility=this.isHidden_?"hidden":"visible")},InfoBox.prototype.getContent=function(){return this.content_},InfoBox.prototype.getPosition=function(){return this.position_},InfoBox.prototype.getZIndex=function(){return this.zIndex_},InfoBox.prototype.getVisible=function(){var t;return t="undefined"==typeof this.getMap()||null===this.getMap()?!1:!this.isHidden_},InfoBox.prototype.show=function(){this.isHidden_=!1,this.div_&&(this.div_.style.visibility="visible")},InfoBox.prototype.hide=function(){this.isHidden_=!0,this.div_&&(this.div_.style.visibility="hidden")},InfoBox.prototype.open=function(t,e){var i=this;e&&(this.position_=e.getPosition(),this.moveListener_=google.maps.event.addListener(e,"position_changed",function(){i.setPosition(this.getPosition())})),this.setMap(t),this.div_&&this.panBox_()},InfoBox.prototype.close=function(){var t;if(this.closeListener_&&(google.maps.event.removeListener(this.closeListener_),this.closeListener_=null),this.eventListeners_){for(t=0;t<this.eventListeners_.length;t++)google.maps.event.removeListener(this.eventListeners_[t]);this.eventListeners_=null}this.moveListener_&&(google.maps.event.removeListener(this.moveListener_),this.moveListener_=null),this.contextListener_&&(google.maps.event.removeListener(this.contextListener_),this.contextListener_=null),this.setMap(null)};
1794		
1795		var windowHtml = w2dc_glocation.content_fields;
1796		
1797		// remove summary button when no listing excerpt visible
1798		windowHtml = $($.parseHTML(windowHtml));
1799		var listing_id = windowHtml.find(".w2dc-info-window-summary-button").data("listing-id");
1800		if (!$("#post-"+listing_id).length) {
1801			var summary_btn = windowHtml.find(".w2dc-info-window-summary-button");
1802			
1803			summary_btn.parent()
1804			.removeClass("w2dc-map-info-window-buttons")
1805			.addClass("w2dc-map-info-window-buttons-single");
1806			
1807			summary_btn.remove();
1808		}
1809		windowHtml = $(windowHtml)[0].outerHTML;
1810		
1811		var tongue_pos = (parseInt(w2dc_maps_objects.infowindow_width)/2);
1812	            
1813	    var myOptions = {
1814	             content: windowHtml
1815	            ,alignBottom: true
1816	            ,disableAutoPan: false
1817	            ,pixelOffset: new google.maps.Size(-tongue_pos, parseInt(w2dc_maps_objects.infowindow_offset)-24)
1818	            ,zIndex: null
1819	            ,boxStyle: { 
1820	              width: w2dc_maps_objects.infowindow_width+"px"
1821	             }
1822	    		,closeBoxURL: ""
1823	            ,infoBoxClearance: new google.maps.Size(1, 1)
1824	            ,isHidden: false
1825	            ,pane: "floatPane"
1826	            ,enableEventPropagation: false
1827	    };
1828	
1829	    // we use global infoWindow, not to close/open it - just to set new content (in order to prevent blinking)
1830	    if (typeof w2dc_infoWindows[map_id] != 'undefined') {
1831	    	w2dc_closeInfoWindow(map_id);
1832	    }
1833	
1834	    w2dc_infoWindows[map_id] = new InfoBox(myOptions);
1835	    w2dc_infoWindows[map_id].open(w2dc_maps[map_id], marker);
1836	    w2dc_infoWindows[map_id].marker = marker;
1837	    w2dc_infoWindows[map_id].location = w2dc_glocation;
1838	}
1839
1840	window.w2dc_scrollToListing = function(anchor, map_id) {
1841		var scroll_to_anchor = $("#"+anchor);
1842		var sticky_scroll_toppadding = 0;
1843		if (typeof window["w2dc_sticky_scroll_toppadding_"+map_id] != 'undefined') {
1844			sticky_scroll_toppadding = window["w2dc_sticky_scroll_toppadding_"+map_id];
1845		}
1846
1847		if (scroll_to_anchor.length) {
1848			$('html,body').animate({scrollTop: scroll_to_anchor.position().top - sticky_scroll_toppadding}, 'fast');
1849		}
1850	}
1851
1852	function w2dc_handleDirectionsErrors(status){
1853	   if (status == google.maps.DirectionsStatus.NOT_FOUND)
1854	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.");
1855	   else if (status == google.maps.DirectionsStatus.ZERO_RESULTS)
1856	     alert("No route could be found between the origin and destination.");
1857	   else if (status == google.maps.DirectionsStatus.UNKNOWN_ERROR)
1858	     alert("A directions request could not be processed due to a server error. The request may succeed if you try again.");
1859	   else if (status == google.maps.DirectionsStatus.REQUEST_DENIED)
1860	     alert("The webpage is not allowed to use the directions service.");
1861	   else if (status == google.maps.DirectionsStatus.INVALID_REQUEST)
1862	     alert("The provided DirectionsRequest was invalid.");
1863	   else if (status == google.maps.DirectionsStatus.OVER_QUERY_LIMIT)
1864	     alert("The webpage has sent too many requests within the allowed time period.");
1865	   else alert("An unknown error occurred.");
1866	}
1867	window.w2dc_setClusters = function(enable_clusters, map_id, markers) {
1868		
1869		// move markers a bit aside when they have same coordinates
1870		var accuracy = 8000;
1871		if (markers.length != 0) {
1872		    for (var i=0; i < markers.length; i++) {
1873		        var existingMarker = markers[i];
1874		        var pos = existingMarker.getPosition();
1875
1876		        for (var j=0; j < markers.length; j++) {
1877		        	var markerToCompare = markers[i];
1878			        var markerToComparePos = markerToCompare.getPosition();
1879			        if (markerToComparePos.equals(pos)) {
1880			            var newLat = markerToComparePos.lat() + (Math.random() -.5) / accuracy;
1881			            var newLng = markerToComparePos.lng() + (Math.random() -.5) / accuracy;
1882			            markers[i].setPosition(new google.maps.LatLng(newLat,newLng));
1883			        }
1884		        }
1885		    }
1886		}
1887		
1888		if (enable_clusters && typeof MarkerClusterer == 'function') {
1889			var clusterStyles = [];
1890			
1891			if (w2dc_maps_objects.global_map_icons_path != '') {
1892				var clusterStyles = [
1893					{
1894						url: w2dc_maps_objects.global_map_icons_path + 'clusters/icon_cluster1.png',
1895						height: 64,
1896						width: 64
1897					},
1898					{
1899						url: w2dc_maps_objects.global_map_icons_path + 'clusters/icon_cluster2.png',
1900						height: 74,
1901						width: 74
1902					},
1903					{
1904						url: w2dc_maps_objects.global_map_icons_path + 'clusters/icon_cluster3.png',
1905						height: 84,
1906						width: 84
1907					},
1908					{
1909						url: w2dc_maps_objects.global_map_icons_path + 'clusters/icon_cluster4.png',
1910						height: 94,
1911						width: 94
1912					},
1913					{
1914						url: w2dc_maps_objects.global_map_icons_path + 'clusters/icon_cluster5.png',
1915						height: 104,
1916						width: 104
1917					}
1918				];
1919			}
1920			var mcOptions = {
1921				gridSize: 40,
1922				styles: clusterStyles
1923			};
1924			
1925			w2dc_markerClusters[map_id] = new MarkerClusterer(w2dc_maps[map_id], markers, mcOptions);
1926		}
1927	}
1928	window.w2dc_clearMarkers = function(map_id) {
1929		if (typeof w2dc_markerClusters[map_id] != 'undefined')
1930			w2dc_markerClusters[map_id].clearMarkers();
1931	
1932		if (w2dc_global_markers_array[map_id]) {
1933			for(var i = 0; i<w2dc_global_markers_array[map_id].length; i++){
1934				w2dc_global_markers_array[map_id][i].setMap(null);
1935			}
1936		}
1937		w2dc_global_markers_array[map_id] = [];
1938		w2dc_global_locations_array[map_id] = [];
1939	}
1940	window.w2dc_removeCircles = function(map_id) {
1941		if (typeof w2dc_drawCircles[map_id] != 'undefined') {
1942			google.maps.event.clearListeners(w2dc_drawCircles[map_id], 'mouseup');
1943			w2dc_drawCircles[map_id].setMap(null);
1944		}
1945	}
1946	window.w2dc_removeShapes = function(map_id) {
1947		if (typeof w2dc_polygons[map_id] != 'undefined') {
1948			w2dc_polygons[map_id].setMap(null);
1949		}
1950	}
1951	window.w2dc_reloadMap = function(map_id) {
1952		if (typeof google != 'undefined' && typeof google.maps != 'undefined') {
1953    		var bounds = new google.maps.LatLngBounds();
1954    		for (var j=0; j<w2dc_global_markers_array[map_id].length; j++) {
1955    			var marker = w2dc_global_markers_array[map_id][j];
1956			    w2dc_extendBounds(bounds, w2dc_getMarkerPosition(marker));
1957    		}
1958    		w2dc_mapFitBounds(map_id, bounds);
1959    		
1960    		var map_attrs_array;
1961    		if (map_attrs_array = w2dc_get_map_markers_attrs_array(map_id)) {
1962    			var map_attrs = map_attrs_array.map_attrs;
1963    			var markers_array = map_attrs_array.markers_array;
1964    			
1965    			w2dc_setMapZoomCenter(map_id, map_attrs, markers_array);
1966    		}
1967		}
1968	}
1969
1970	window.w2dc_geocodeField = function(field, error_message) {
1971		if (navigator.geolocation) {
1972			navigator.geolocation.getCurrentPosition(
1973				function(position) {
1974					var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
1975					var geocoder = new google.maps.Geocoder();
1976					geocoder.geocode({'latLng': latlng}, function(results, status) {
1977						if (status == google.maps.GeocoderStatus.OK) {
1978							if (results[0]) {
1979								field.val(results[0].formatted_address);
1980								field.trigger('change');
1981							}
1982						}
1983					});
1984			    },
1985			    function(e) {
1986			    	//alert(e.message);
1987		    	},
1988			    {enableHighAccuracy: true, timeout: 10000, maximumAge: 0}
1989		    );
1990		} else
1991			alert(error_message);
1992	}
1993})(jQuery);
1994
1995
1996//google_maps_clasterer.js -------------------------------------------------------------------------------------------------------------------------------------------
1997(function(){var d=null;function e(a){return function(b){this[a]=b}}function h(a){return function(){return this[a]}}var j;
1998function k(a,b,c){this.extend(k,google.maps.OverlayView);this.c=a;this.a=[];this.f=[];this.ca=[53,56,66,78,90];this.j=[];this.A=!1;c=c||{};this.g=c.gridSize||60;this.l=c.minimumClusterSize||2;this.J=c.maxZoom||d;this.j=c.styles||[];this.X=c.imagePath||this.Q;this.W=c.imageExtension||this.P;this.O=!0;
1998if(c.zoomOnClick!=void 0)this.O=c.zoomOnClick;this.r=!1;if(c.averageCenter!=void 0)this.r=c.averageCenter;l(this);this.setMap(a);this.K=this.c.getZoom();var f=this;google.maps.event.addListener(this.c,
1999"zoom_changed",function(){var a=f.c.getZoom();if(f.K!=a)f.K=a,f.m()});google.maps.event.addListener(this.c,"idle",function(){f.i()});b&&b.length&&this.C(b,!1)}j=k.prototype;j.Q="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m";j.P="png";j.extend=function(a,b){return function(a){for(var b in a.prototype)this.prototype[b]=a.prototype[b];return this}.apply(a,[b])};j.onAdd=function(){if(!this.A)this.A=!0,n(this)};j.draw=function(){};
2000function l(a){if(!a.j.length)for(var b=0,c;c=a.ca[b];b++)a.j.push({url:a.X+(b+1)+"."+a.W,height:c,width:c})}j.S=function(){for(var a=this.o(),b=new google.maps.LatLngBounds,c=0,f;f=a[c];c++)b.extend(f.getPosition());this.c.fitBounds(b)};j.z=h("j");j.o=h("a");j.V=function(){return this.a.length};j.ba=e("J");j.I=h("J");j.G=function(a,b){for(var c=0,f=a.length,g=f;g!==0;)g=parseInt(g/10,10),c++;c=Math.min(c,b);return{text:f,index:c}};j.$=e("G");j.H=h("G");
2001j.C=function(a,b){for(var c=0,f;f=a[c];c++)q(this,f);b||this.i()};function q(a,b){b.s=!1;b.draggable&&google.maps.event.addListener(b,"dragend",function(){b.s=!1;a.L()});a.a.push(b)}j.q=function(a,b){q(this,a);b||this.i()};function r(a,b){var c=-1;if(a.a.indexOf)c=a.a.indexOf(b);else for(var f=0,g;g=a.a[f];f++)if(g==b){c=f;break}if(c==-1)return!1;b.setMap(d);a.a.splice(c,1);return!0}j.Y=function(a,b){var c=r(this,a);return!b&&c?(this.m(),this.i(),!0):!1};
2002j.Z=function(a,b){for(var c=!1,f=0,g;g=a[f];f++)g=r(this,g),c=c||g;if(!b&&c)return this.m(),this.i(),!0};j.U=function(){return this.f.length};j.getMap=h("c");j.setMap=e("c");j.w=h("g");j.aa=e("g");
2003j.v=function(a){var b=this.getProjection(),c=new google.maps.LatLng(a.getNorthEast().lat(),a.getNorthEast().lng()),f=new google.maps.LatLng(a.getSouthWest
2003().lat(),a.getSouthWest().lng()),c=b.fromLatLngToDivPixel(c);c.x+=this.g;c.y-=this.g;f=b.fromLatLngToDivPixel(f);f.x-=this.g;f.y+=this.g;c=b.fromDivPixelToLatLng(c);b=b.fromDivPixelToLatLng(f);a.extend(c);a.extend(b);return a};j.R=function(){this.m(!0);this.a=[]};
2004j.m=function(a){for(var b=0,c;c=this.f[b];b++)c.remove();for(b=0;c=this.a[b];b++)c.s=!1,a&&c.setMap(d);this.f=[]};j.L=function(){var a=this.f.slice();this.f.length=0;this.m();this.i();window.setTimeout(function(){for(var b=0,c;c=a[b];b++)c.remove()},0)};j.i=function(){n(this)};
2005function n(a){if(a.A)for(var b=a.v(new google.maps.LatLngBounds(a.c.getBounds().getSouthWest(),a.c.getBounds().getNorthEast())),c=0,f;f=a.a[c];c++)if(!f.s&&b.contains(f.getPosition())){for(var g=a,u=4E4,o=d,v=0,m=void 0;m=g.f[v];v++){var i=m.getCenter();if(i){var p=f.getPosition();if(!i||!p)i=0;else var w=(p.lat()-i.lat())*Math.PI/180,x=(p.lng()-i.lng())*Math.PI/180,i=Math.sin(w/2)*Math.sin(w/2)+Math.cos(i.lat()*Math.PI/180)*Math.cos(p.lat()*Math.PI/180)*Math.sin(x/2)*Math.sin(x/2),i=6371*2*Math.atan2(Math.sqrt(i),
2006Math.sqrt(1-i));i<u&&(u=i,o=m)}}o&&o.F.contains(f.getPosition())?o.q(f):(m=new s(g),m.q(f),g.f.push(m))}}function s(a){this.k=a;this.c=a.getMap();this.g=a.w();this.l=a.l;this.r=a.r;this.d=d;this.a=[];this.F=d;this.n=new t(this,a.z(),a.w())}j=s.prototype;
2007j.q=function(a){var b;a:if(this.a.indexOf)b=this.a.indexOf(a)!=-1;else{b=0;for(var c;c=this.a[b];b++)if(c==a){b=!0;break a}b=!1}if(b)return!1;if(this.d){if(this.r)c=this.a.length+1,b=(this.d.lat()*(c-1)+a.getPosition().lat())/c,c=(this.d.lng()*(c-1)+a.getPosition().lng())/c,this.d=new google.maps.LatLng(b,c),y(this)}else this.d=a.getPosition(),y(this);a.s=!0;this.a.push(a);b=this.a.length;b<this.l&&a.getMap()!=this.c&&a.setMap(this.c);if(b==this.l)for(c=0;c<b;c++)this.a[c].setMap(d);b>=this.l&&a.setMap(d);
2008a=this.c.getZoom();if((b=this.k.I())&&a>b)for(a=0;b=this.a[a];a++)b.setMap(this.c);else if(this.a.length<this.l)z(this.n);else{b=this.k.H()(this.a,this.k.z().length);this.n.setCenter(this.d);a=this.n;a.B=b;a.ga=b.text;a.ea=b.index;if(a.b)a.b.innerHTML=b.text;b=Math.max(0,a.B.index-1);b=Math.min(a.j.length-1,b);b=a.j[b];a.da=b.url;a.h=b.height;a.p=b.width;a.M=b.textColor;a.e=b.anchor;a.N=b.textSize;a.D=b.backgroundPosition;this.n.show()}return!0};
2009j.getBounds=function(){for(var a=new google.maps.LatLngBounds(this.d,this.d),b=this.o(),c=0,f;f=b[c];c++)a.extend(f.getPosition());return a};j.remove=function(){this.n.remove();this.a.length=0;delete this.a};j.T=function(){return this.a.length};j.o=h("a");j.getCenter=h("d");function y(a){a.F=a.k.v(new google.maps.LatLngBounds(a.d,a.d))}j.getMap=h("c");
2010function t(a,b,c){a.k.extend(t,google.maps.OverlayView);this.j=b;this.fa=c||0;this.u=a;this.d=d;this.c=a.getMap();this.B=this.b=d;this.t=!1;this.setMap(this.c)}j=t.prototype;
2011j.onAdd=function(){this.b=document.createElement("DIV");if(this.t)this.b.style.cssText=A(this,B(this,this.d)),this.b.innerHTML=this.B.text;this.getPanes().overlayMouseTarget.appendChild(this.b);var a=this;this.b.addEventListener("click",function(){var b=a.u.k;google.maps.event.trigger(b,"clusterclick",a.u);b.O&&a.c.fitBounds(a.u.getBounds())})};function B(a,b){var c=a.getProjection().fromLatLngToDivPixel(b);c.x-=parseInt(a.p/2,10);c.y-=parseInt(a.h/2,10);return c}
2012j.draw=function(){if(this.t){var a=B(this,this.d);this.b.style.top=a.y+"px";this.b.style.left=a.x+"px"}};function z(a){if(a.b)a.b.style.display="none";a.t=!1}j.show=function(){if(this.b)this.b.style.cssText=A(this,B(this,this.d)),this.b.style.display="";this.t=!0};j.remove=function(){this.setMap(d)};j.onRemove=function(){if(this.b&&this.b.parentNode)z(this),this.b.parentNode.removeChild(this.b),this.b=d};j.setCenter=e("d");
2013function A(a,b){var c=[];c.push("background-image:url('"+a.da+"');");c.push("background-position:"+(a.D?a.D:"0 0")+";");typeof a.e==="object"?(typeof a.e[0]==="number"&&a.e[0]>0&&a.e[0]<a.h?c.push("height:"+(a.h-a.e[0])+"px; padding-top:"+a.e[0]+"px;"):c.push("height:"+a.h+"px; line-height:"+a.h+"px;"),typeof a.e[1]==="number"&&a.e[1]>0&&a.e[1]<a.p?c.push("width:"+(a.p-a.e[1])+"px; padding-left:"+a.e[1]+"px;"):c.push("width:"+a.p+"px; text-align:center;")):c.push("height:"+a.h+"px; line-height:"+a.h+
2014"px; width:"+a.p+"px; text-align:center;");c.push("cursor:pointer; top:"+b.y+"px; left:"+b.x+"px; color:"+(a.M?a.M:"black")+"; position:absolute; font-size:"+(a.N?a.N:11)+"px; font-family:Arial,sans-serif; font-weight:bold");return c.join("")}window.MarkerClusterer=k;k.prototype.addMarker=k.prototype.q;k.prototype.addMarkers=k.prototype.C;k.prototype.clearMarkers=k.prototype.R;k.prototype.fitMapToMarkers=k.prototype.S;k.prototype.getCalculator=k.prototype.H;k.prototype.getGridSize=k.prototype.w;
2015k.prototype.getExtendedBounds=k.prototype.v;k.prototype.getMap=k.prototype.getMap;k.prototype.getMarkers=k.prototype.o;k.prototype.getMaxZoom=k.prototype.I;k.prototype.getStyles=k.prototype.z;k.prototype.getTotalClusters=k.prototype.U;k.prototype.getTotalMarkers=k.prototype.V;k.prototype.redraw=k.prototype.i;k.prototype.removeMarker=k.prototype.Y;k.prototype.removeMarkers=k.prototype.Z;k.prototype.resetViewport=k.prototype.m;k.prototype.repaint=k.prototype.L;k.prototype.setCalculator=k.prototype.$;
2016k.prototype.setGridSize=k.prototype.aa;k.prototype.setMaxZoom=k.prototype.ba;k.prototype.onAdd=k.prototype.onAdd;k.prototype.draw=k.prototype.draw;s.prototype.getCenter=s.prototype.getCenter;s.prototype.getSize=s.prototype.T;s.prototype.getMarkers=s.prototype.o;t.prototype.onAdd=t.prototype.onAdd;t.prototype.draw=t.prototype.draw;t.prototype.onRemove=t.prototype.onRemove;
2017})();
2018
2019//richmarker-compiled.js -------------------------------------------------------------------------------------------------------------------------------------------
2020function w2dc_load_richtext() {
2021(function(){var b=true,f=false;
2021function g(a){var c=a||{};this.d=this.c=f;if(a.visible==undefined)a.visible=b;if(a.shadow==undefined)a.shadow="7px -3px 5px rgba(88,88,88,0.7)";if(a.anchor==undefined)a.anchor=i.BOTTOM;this.setValues(c)}g.prototype=new google.maps.OverlayView;window.RichMarker=g;g.prototype.getVisible=function(){return this.get("visible")};g.prototype.getVisible=g.prototype.getVisible;g.prototype.setVisible=function(a){this.set("visible",a)};g.prototype.setVisible=g.prototype.setVisible;
2022g.prototype.s=function(){if(this.c){this.a.style.display=this.getVisible()?"":"none";this.draw()}};g.prototype.visible_changed=g.prototype.s;g.prototype.setFlat=function(a){this.set("flat",!!a)};g.prototype.setFlat=g.prototype.setFlat;g.prototype.getFlat=function(){return this.get("flat")};g.prototype.getFlat=g.prototype.getFlat;g.prototype.p=function(){return this.get("width")};g.prototype.getWidth=g.prototype.p;g.prototype.o=function(){return this.get("height")};g.prototype.getHeight=g.prototype.o;
2023g.prototype.setShadow=function(a){this.set("shadow",a);this.g()};g.prototype.setShadow=g.prototype.setShadow;g.prototype.getShadow=function(){return this.get("shadow")};g.prototype.getShadow=g.prototype.getShadow;g.prototype.g=function(){if(this.c)this.a.style.boxShadow=this.a.style.webkitBoxShadow=this.a.style.MozBoxShadow=this.getFlat()?"":this.getShadow()};g.prototype.flat_changed=g.prototype.g;g.prototype.setZIndex=function(a){this.set("zIndex",a)};g.prototype.setZIndex=g.prototype.setZIndex;
2024g.prototype.getZIndex=function(){return this.get("zIndex")};g.prototype.getZIndex=g.prototype.getZIndex;g.prototype.t=function(){if(this.getZIndex()&&this.c)this.a.style.zIndex=this.getZIndex()};g.prototype.zIndex_changed=g.prototype.t;g.prototype.getDraggable=function(){return this.get("draggable")};g.prototype.getDraggable=g.prototype.getDraggable;g.prototype.setDraggable=function(a){this.set("draggable",!!a)};g.prototype.setDraggable=g.prototype.setDraggable;
2025g.prototype.k=function(){if(this.c)this.getDraggable()?j(this,this.a):k(this)};g.prototype.draggable_changed=g.prototype.k;g.prototype.getPosition=function(){return this.get("position")};g.prototype.getPosition=g.prototype.getPosition;g.prototype.setPosition=function(a){this.set("position",a)};g.prototype.setPosition=g.prototype.setPosition;g.prototype.q=function(){this.draw()};g.prototype.position_changed=g.prototype.q;g.prototype.l=function(){return this.get("anchor")};g.prototype.getAnchor=g.prototype.l;
2026g.prototype.r=function(a){this.set("anchor",a)};g.prototype.setAnchor=g.prototype.r;g.prototype.n=function(){this.draw()};g.prototype.anchor_changed=g.prototype.n;function l(a,c){var d=document.createElement("DIV");d.innerHTML=c;if(d.childNodes.length==1)return d.removeChild(d.firstChild);else{for(var e=document.createDocumentFragment();d.firstChild;)e.appendChild(d.firstChild);return e}}function m(a,c){if(c)for(var d;d=c.firstChild;)c.removeChild(d)}
2027g.prototype.setContent=function(a){this.set("content",a)};g.prototype.setContent=g.prototype.setContent;g.prototype.getContent=function(){return this.get("content")};g.prototype.getContent=g.prototype.getContent;
2028g.prototype.j=function(){if(this.b){m(this,this.b);var a=this.getContent();if(a){if(typeof a=="string"){a=a.replace(/^\s*([\S\s]*)\b\s*$/,"$1");a=l(this,a)}this.b.appendChild(a);var c=this;a=this.b.getElementsByTagName("IMG");for(var d=0,e;e=a[d];d++){e.addEventListener("mousedown",function(h){if(c.getDraggable()){h.preventDefault&&h.preventDefault();h.returnValue=f}});e.addEventListener("load",function(){c.draw()})}google.maps.event.trigger(this,"domready")}this.c&&
2029this.draw()}};g.prototype.content_changed=g.prototype.j;function n(a,c){if(a.c){var d="";if(navigator.userAgent.indexOf("Gecko/")!==-1){if(c=="dragging")d="-moz-grabbing";if(c=="dragready")d="-moz-grab"}else if(c=="dragging"||c=="dragready")d="move";if(c=="draggable")d="pointer";if(a.a.style.cursor!=d)a.a.style.cursor=d}}
2030function o(a,c){if(a.getDraggable())if(!a.d){a.d=b;var d=a.getMap();a.m=d.get("draggable");d.set("draggable",f);a.h=c.clientX;a.i=c.clientY;n(a,"dragready");a.a.style.MozUserSelect="none";a.a.style.KhtmlUserSelect="none";a.a.style.WebkitUserSelect="none";a.a.unselectable="on";a.a.onselectstart=function(){return f};p(a);google.maps.event.trigger(a,"dragstart")}}
2031function q(a){if(a.getDraggable())if(a.d){a.d=f;a.getMap().set("draggable",a.m);a.h=a.i=a.m=null;a.a.style.MozUserSelect="";a.a.style.KhtmlUserSelect="";a.a.style.WebkitUserSelect="";a.a.unselectable="off";a.a.onselectstart=function(){};r(a);n(a,"draggable");google.maps.event.trigger(a,"dragend");a.draw()}}
2032function s(a,c){if(!a.getDraggable()||!a.d)q(a);else{var d=a.h-c.clientX,e=a.i-c.clientY;a.h=c.clientX;a.i=c.clientY;d=parseInt(a.a.style.left,10)-d;e=parseInt(a.a.style.top,10)-e;a.a.style.left=d+"px";a.a.style.top=e+"px";var h=t(a);a.setPosition(a.getProjection().fromDivPixelToLatLng(new google.maps.Point(d-h.width,e-h.height)));n(a,"dragging");google.maps.event.trigger(a,"drag")}}function k(a){if(a.f){google.maps.event.removeListener(a.f);delete a.f}n(a,"")}
2033function j(a,c){if(c){a.f=c.addEventListener("mousedown",function(d){o(a,d)});n(a,"draggable")}}
2033function p(a){if(a.a.setCapture){a.a.setCapture(b);a.e=[a.a.addEventListener("mousemove",function(c){s(a,c)},b),a.a.addEventListener("mouseup",function(){q(a);a.a.releaseCapture()},b)]}else a.e=[window.addEventListener("mousemove",function(c){s(a,c)},b),window.addEventListener("mouseup",function(){q(a)},b)]}
2034function r(a){if(a.e){for(var c=0,d;d=a.e[c];c++)google.maps.event.removeListener(d);a.e.length=0}}
2035function t(a){var c=a.l();if(typeof c=="object")return c;var d=new google.maps.Size(0,0);if(!a.b)return d;var e=a.b.offsetWidth;a=a.b.offsetHeight;switch(c){case i.TOP:d.width=-e/2;break;case i.TOP_RIGHT:d.width=-e;break;case i.LEFT:d.height=-a/2;break;case i.MIDDLE:d.width=-e/2;d.height=-a/2;break;case i.RIGHT:d.width=-e;d.height=-a/2;break;case i.BOTTOM_LEFT:d.height=-a;break;case i.BOTTOM:d.width=-e/2;d.height=-a;break;case i.BOTTOM_RIGHT:d.width=-e;d.height=-a}return d}
2036g.prototype.onAdd=function(){if(!this.a){this.a=document.createElement("DIV");this.a.style.position="absolute"}if(this.getZIndex())this.a.style.zIndex=this.getZIndex();this.a.style.display=this.getVisible()?"":"none";if(!this.b){this.b=document.createElement("DIV");this.a.appendChild(this.b);var a=this;this.b.addEventListener("click",function(){google.maps.event.trigger(a,"click")});this.b.addEventListener("mouseover",function(){google.maps.event.trigger(a,"mouseover")});
2037this.b.addEventListener("mouseout",function(){google.maps.event.trigger(a,"mouseout")})}this.c=b;this.j();this.g();this.k();var c=this.getPanes();c&&c.overlayImage.appendChild(this.a);google.maps.event.trigger(this,"ready")};g.prototype.onAdd=g.prototype.onAdd;
2038g.prototype.draw=function(){if(!(!this.c||this.d)){var a=this.getProjection();if(a){var c=this.get("position");a=a.fromLatLngToDivPixel(c);c=t(this);this.a.style.top=a.y+c.height+"px";this.a.style.left=a.x+c.width+"px";a=this.b.offsetHeight;c=this.b.offsetWidth;c!=this.get("width")&&this.set("width",c);a!=this.get("height")&&this.set("height",a)}}};g.prototype.draw=g.prototype.draw;g.prototype.onRemove=function(){this.a&&this.a.parentNode&&this.a.parentNode.removeChild(this.a);k(this)};
2039g.prototype.onRemove=g.prototype.onRemove;var i={TOP_LEFT:1,TOP:2,TOP_RIGHT:3,LEFT:4,MIDDLE:5,RIGHT:6,BOTTOM_LEFT:7,BOTTOM:8,BOTTOM_RIGHT:9};window.RichMarkerPosition=i;
2040})();
2041};

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.