\n * This is an enhanced V3 implementation of the\n * V2 MarkerClusterer by Xiaoxi Wu. It is based on the\n * V3 MarkerClusterer port by Luke Mahe. MarkerClustererPlus was created by Gary Little.\n *
\n * v2.0 release: MarkerClustererPlus v2.0 is backward compatible with MarkerClusterer v1.0. It\n * adds support for the ignoreHidden, title, batchSizeIE,\n * and calculator properties as well as support for four more events. It also allows\n * greater control over the styling of the text that appears on the cluster marker. The\n * documentation has been significantly improved and the overall code has been simplified and\n * polished. Very large numbers of markers can now be managed without causing Javascript timeout\n * errors on Internet Explorer. Note that the name of the clusterclick event has been\n * deprecated. The new name is click, so please change your application code now.\n */\n\n/**\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n/**\n * @name ClusterIconStyle\n * @class This class represents the object for values in the styles array passed\n * to the {@link MarkerClusterer} constructor. The element in this array that is used to\n * style the cluster icon is determined by calling the calculator function.\n *\n * @property {string} url The URL of the cluster icon image file. Required.\n * @property {number} height The display height (in pixels) of the cluster icon. Required.\n * @property {number} width The display width (in pixels) of the cluster icon. Required.\n * @property {Array} [anchorText] The position (in pixels) from the center of the cluster icon to\n * where the text label is to be centered and drawn. The format is [yoffset, xoffset]\n * where yoffset increases as you go down from center and xoffset\n * increases to the right of center. The default is [0, 0].\n * @property {Array} [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the\n * spot on the cluster icon that is to be aligned with the cluster position. The format is\n * [yoffset, xoffset] where yoffset increases as you go down and\n * xoffset increases to the right of the top-left corner of the icon. The default\n * anchor position is the center of the cluster icon.\n * @property {string} [textColor=\"black\"] The color of the label text shown on the\n * cluster icon.\n * @property {number} [textSize=11] The size (in pixels) of the label text shown on the\n * cluster icon.\n * @property {string} [textDecoration=\"none\"] The value of the CSS text-decoration\n * property for the label text shown on the cluster icon.\n * @property {string} [fontWeight=\"bold\"] The value of the CSS font-weight\n * property for the label text shown on the cluster icon.\n * @property {string} [fontStyle=\"normal\"] The value of the CSS font-style\n * property for the label text shown on the cluster icon.\n * @property {string} [fontFamily=\"Arial,sans-serif\"] The value of the CSS font-family\n * property for the label text shown on the cluster icon.\n * @property {string} [backgroundPosition=\"0 0\"] The position of the cluster icon image\n * within the image defined by url. The format is \"xpos ypos\"\n * (the same format as for the CSS background-position property). You must set\n * this property appropriately when the image defined by url represents a sprite\n * containing multiple images. Note that the position must be specified in px units.\n */\n/**\n * @name ClusterIconInfo\n * @class This class is an object containing general information about a cluster icon. This is\n * the object that a calculator function returns.\n *\n * @property {string} text The text of the label to be shown on the cluster icon.\n * @property {number} index The index plus 1 of the element in the styles\n * array to be used to style the cluster icon.\n * @property {string} title The tooltip to display when the mouse moves over the cluster icon.\n * If this value is undefined or \"\", title is set to the\n * value of the title property passed to the MarkerClusterer.\n */\n/**\n * A cluster icon.\n *\n * @constructor\n * @extends google.maps.OverlayView\n * @param {Cluster} cluster The cluster with which the icon is to be associated.\n * @param {Array} [styles] An array of {@link ClusterIconStyle} defining the cluster icons\n * to use for various cluster sizes.\n * @private\n */\nfunction ClusterIcon(cluster, styles) {\n cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView);\n\n this.cluster_ = cluster;\n this.className_ = cluster.getMarkerClusterer().getClusterClass();\n this.styles_ = styles;\n this.center_ = null;\n this.div_ = null;\n this.sums_ = null;\n this.visible_ = false;\n\n this.setMap(cluster.getMap()); // Note: this causes onAdd to be called\n}\n\n\n/**\n * Adds the icon to the DOM.\n */\nClusterIcon.prototype.onAdd = function() {\n var cClusterIcon = this;\n var cMouseDownInCluster;\n var cDraggingMapByCluster;\n\n this.div_ = document.createElement(\"div\");\n this.div_.className = this.className_;\n if (this.visible_) {\n this.show();\n }\n\n this.getPanes().overlayMouseTarget.appendChild(this.div_);\n\n // Fix for Issue 157\n this.boundsChangedListener_ = google.maps.event.addListener(this.getMap(), \"bounds_changed\", function() {\n cDraggingMapByCluster = cMouseDownInCluster;\n });\n\n google.maps.event.addDomListener(this.div_, \"mousedown\", function() {\n cMouseDownInCluster = true;\n cDraggingMapByCluster = false;\n });\n\n google.maps.event.addDomListener(this.div_, \"click\", function(e) {\n cMouseDownInCluster = false;\n if (!cDraggingMapByCluster) {\n var theBounds;\n var mz;\n var mc = cClusterIcon.cluster_.getMarkerClusterer();\n /**\n * This event is fired when a cluster marker is clicked.\n * @name MarkerClusterer#click\n * @param {Cluster} c The cluster that was clicked.\n * @event\n */\n google.maps.event.trigger(mc, \"click\", cClusterIcon.cluster_);\n google.maps.event.trigger(mc, \"clusterclick\", cClusterIcon.cluster_); // deprecated name\n\n // The default click handler follows. Disable it by setting\n // the zoomOnClick property to false.\n if (mc.getZoomOnClick()) {\n // Zoom into the cluster.\n mz = mc.getMaxZoom();\n theBounds = cClusterIcon.cluster_.getBounds();\n mc.getMap().fitBounds(theBounds);\n // There is a fix for Issue 170 here:\n setTimeout(function() {\n mc.getMap().fitBounds(theBounds);\n // Don't zoom beyond the max zoom level\n if (mz !== null && (mc.getMap().getZoom() > mz)) {\n mc.getMap().setZoom(mz + 1);\n }\n }, 100);\n }\n\n // Prevent event propagation to the map:\n e.cancelBubble = true;\n if (e.stopPropagation) {\n e.stopPropagation();\n }\n }\n });\n\n google.maps.event.addDomListener(this.div_, \"mouseover\", function() {\n var mc = cClusterIcon.cluster_.getMarkerClusterer();\n /**\n * This event is fired when the mouse moves over a cluster marker.\n * @name MarkerClusterer#mouseover\n * @param {Cluster} c The cluster that the mouse moved over.\n * @event\n */\n google.maps.event.trigger(mc, \"mouseover\", cClusterIcon.cluster_);\n });\n\n google.maps.event.addDomListener(this.div_, \"mouseout\", function() {\n var mc = cClusterIcon.cluster_.getMarkerClusterer();\n /**\n * This event is fired when the mouse moves out of a cluster marker.\n * @name MarkerClusterer#mouseout\n * @param {Cluster} c The cluster that the mouse moved out of.\n * @event\n */\n google.maps.event.trigger(mc, \"mouseout\", cClusterIcon.cluster_);\n });\n};\n\n\n/**\n * Removes the icon from the DOM.\n */\nClusterIcon.prototype.onRemove = function() {\n if (this.div_ && this.div_.parentNode) {\n this.hide();\n google.maps.event.removeListener(this.boundsChangedListener_);\n google.maps.event.clearInstanceListeners(this.div_);\n this.div_.parentNode.removeChild(this.div_);\n this.div_ = null;\n }\n};\n\n\n/**\n * Draws the icon.\n */\nClusterIcon.prototype.draw = function() {\n if (this.visible_) {\n var pos = this.getPosFromLatLng_(this.center_);\n this.div_.style.top = pos.y + \"px\";\n this.div_.style.left = pos.x + \"px\";\n }\n};\n\n\n/**\n * Hides the icon.\n */\nClusterIcon.prototype.hide = function() {\n if (this.div_) {\n this.div_.style.display = \"none\";\n }\n this.visible_ = false;\n};\n\n\n/**\n * Positions and shows the icon.\n */\nClusterIcon.prototype.show = function() {\n if (this.div_) {\n var img = \"\";\n // NOTE: values must be specified in px units\n var bp = this.backgroundPosition_.split(\" \");\n var spriteH = parseInt(bp[0].trim(), 10);\n var spriteV = parseInt(bp[1].trim(), 10);\n var pos = this.getPosFromLatLng_(this.center_);\n this.div_.style.cssText = this.createCss(pos);\n img = \"\";\n this.div_.innerHTML = img + \"
\";\n if (typeof this.sums_.title === \"undefined\" || this.sums_.title === \"\") {\n this.div_.title = this.cluster_.getMarkerClusterer().getTitle();\n } else {\n this.div_.title = this.sums_.title;\n }\n this.div_.style.display = \"\";\n }\n this.visible_ = true;\n};\n\n\n/**\n * Sets the icon styles to the appropriate element in the styles array.\n *\n * @param {ClusterIconInfo} sums The icon label text and styles index.\n */\nClusterIcon.prototype.useStyle = function(sums) {\n this.sums_ = sums;\n var index = Math.max(0, sums.index - 1);\n index = Math.min(this.styles_.length - 1, index);\n var style = this.styles_[index];\n this.url_ = style.url;\n this.height_ = style.height;\n this.width_ = style.width;\n this.anchorText_ = style.anchorText || [0, 0];\n this.anchorIcon_ = style.anchorIcon || [parseInt(this.height_ / 2, 10), parseInt(this.width_ / 2, 10)];\n this.textColor_ = style.textColor || \"black\";\n this.textSize_ = style.textSize || 11;\n this.textDecoration_ = style.textDecoration || \"none\";\n this.fontWeight_ = style.fontWeight || \"bold\";\n this.fontStyle_ = style.fontStyle || \"normal\";\n this.fontFamily_ = style.fontFamily || \"Arial,sans-serif\";\n this.backgroundPosition_ = style.backgroundPosition || \"0 0\";\n};\n\n\n/**\n * Sets the position at which to center the icon.\n *\n * @param {google.maps.LatLng} center The latlng to set as the center.\n */\nClusterIcon.prototype.setCenter = function(center) {\n this.center_ = center;\n};\n\n\n/**\n * Creates the cssText style parameter based on the position of the icon.\n *\n * @param {google.maps.Point} pos The position of the icon.\n * @return {string} The CSS style text.\n */\nClusterIcon.prototype.createCss = function(pos) {\n var style = [];\n style.push(\"cursor: pointer;\");\n style.push(\"position: absolute; top: \" + pos.y + \"px; left: \" + pos.x + \"px;\");\n style.push(\"width: \" + this.width_ + \"px; height: \" + this.height_ + \"px;\");\n return style.join(\"\");\n};\n\n\n/**\n * Returns the position at which to place the DIV depending on the latlng.\n *\n * @param {google.maps.LatLng} latlng The position in latlng.\n * @return {google.maps.Point} The position in pixels.\n */\nClusterIcon.prototype.getPosFromLatLng_ = function(latlng) {\n var pos = this.getProjection().fromLatLngToDivPixel(latlng);\n pos.x -= this.anchorIcon_[1];\n pos.y -= this.anchorIcon_[0];\n pos.x = parseInt(pos.x, 10);\n pos.y = parseInt(pos.y, 10);\n return pos;\n};\n\n\n/**\n * Creates a single cluster that manages a group of proximate markers.\n * Used internally, do not call this constructor directly.\n * @constructor\n * @param {MarkerClusterer} mc The MarkerClusterer object with which this\n * cluster is associated.\n */\nfunction Cluster(mc) {\n this.markerClusterer_ = mc;\n this.map_ = mc.getMap();\n this.gridSize_ = mc.getGridSize();\n this.minClusterSize_ = mc.getMinimumClusterSize();\n this.averageCenter_ = mc.getAverageCenter();\n this.hideLabel_ = mc.getHideLabel();\n this.markers_ = [];\n this.center_ = null;\n this.bounds_ = null;\n this.clusterIcon_ = new ClusterIcon(this, mc.getStyles());\n}\n\n\n/**\n * Returns the number of markers managed by the cluster. You can call this from\n * a click, mouseover, or mouseout event handler\n * for the MarkerClusterer object.\n *\n * @return {number} The number of markers in the cluster.\n */\nCluster.prototype.getSize = function() {\n return this.markers_.length;\n};\n\n\n/**\n * Returns the array of markers managed by the cluster. You can call this from\n * a click, mouseover, or mouseout event handler\n * for the MarkerClusterer object.\n *\n * @return {Array} The array of markers in the cluster.\n */\nCluster.prototype.getMarkers = function() {\n return this.markers_;\n};\n\n\n/**\n * Returns the center of the cluster. You can call this from\n * a click, mouseover, or mouseout event handler\n * for the MarkerClusterer object.\n *\n * @return {google.maps.LatLng} The center of the cluster.\n */\nCluster.prototype.getCenter = function() {\n return this.center_;\n};\n\n\n/**\n * Returns the map with which the cluster is associated.\n *\n * @return {google.maps.Map} The map.\n * @ignore\n */\nCluster.prototype.getMap = function() {\n return this.map_;\n};\n\n\n/**\n * Returns the MarkerClusterer object with which the cluster is associated.\n *\n * @return {MarkerClusterer} The associated marker clusterer.\n * @ignore\n */\nCluster.prototype.getMarkerClusterer = function() {\n return this.markerClusterer_;\n};\n\n\n/**\n * Returns the bounds of the cluster.\n *\n * @return {google.maps.LatLngBounds} the cluster bounds.\n * @ignore\n */\nCluster.prototype.getBounds = function() {\n var i;\n var bounds = new google.maps.LatLngBounds(this.center_, this.center_);\n var markers = this.getMarkers();\n for (i = 0; i < markers.length; i++) {\n bounds.extend(markers[i].getPosition());\n }\n return bounds;\n};\n\n\n/**\n * Removes the cluster from the map.\n *\n * @ignore\n */\nCluster.prototype.remove = function() {\n this.clusterIcon_.setMap(null);\n this.markers_ = [];\n delete this.markers_;\n};\n\n\n/**\n * Adds a marker to the cluster.\n *\n * @param {google.maps.Marker} marker The marker to be added.\n * @return {boolean} True if the marker was added.\n * @ignore\n */\nCluster.prototype.addMarker = function(marker) {\n var i;\n var mCount;\n var mz;\n\n if (this.isMarkerAlreadyAdded_(marker)) {\n return false;\n }\n\n if (!this.center_) {\n this.center_ = marker.getPosition();\n this.calculateBounds_();\n } else {\n if (this.averageCenter_) {\n var l = this.markers_.length + 1;\n var lat = (this.center_.lat() * (l - 1) + marker.getPosition().lat()) / l;\n var lng = (this.center_.lng() * (l - 1) + marker.getPosition().lng()) / l;\n this.center_ = new google.maps.LatLng(lat, lng);\n this.calculateBounds_();\n }\n }\n\n marker.isAdded = true;\n this.markers_.push(marker);\n\n mCount = this.markers_.length;\n mz = this.markerClusterer_.getMaxZoom();\n if (mz !== null && this.map_.getZoom() > mz) {\n // Zoomed in past max zoom, so show the marker.\n if (marker.getMap() !== this.map_) {\n marker.setMap(this.map_);\n }\n } else if (mCount < this.minClusterSize_) {\n // Min cluster size not reached so show the marker.\n if (marker.getMap() !== this.map_) {\n marker.setMap(this.map_);\n }\n } else if (mCount === this.minClusterSize_) {\n // Hide the markers that were showing.\n for (i = 0; i < mCount; i++) {\n this.markers_[i].setMap(null);\n }\n } else {\n marker.setMap(null);\n }\n\n return true;\n};\n\n\n/**\n * Determines if a marker lies within the cluster's bounds.\n *\n * @param {google.maps.Marker} marker The marker to check.\n * @return {boolean} True if the marker lies in the bounds.\n * @ignore\n */\nCluster.prototype.isMarkerInClusterBounds = function(marker) {\n return this.bounds_.contains(marker.getPosition());\n};\n\n\n/**\n * Calculates the extended bounds of the cluster with the grid.\n */\nCluster.prototype.calculateBounds_ = function() {\n var bounds = new google.maps.LatLngBounds(this.center_, this.center_);\n this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds);\n};\n\n\n/**\n * Updates the cluster icon.\n */\nCluster.prototype.updateIcon_ = function() {\n var mCount = this.markers_.length;\n var mz = this.markerClusterer_.getMaxZoom();\n\n if (mz !== null && this.map_.getZoom() > mz) {\n this.clusterIcon_.hide();\n return;\n }\n\n if (mCount < this.minClusterSize_) {\n // Min cluster size not yet reached.\n this.clusterIcon_.hide();\n return;\n }\n\n var numStyles = this.markerClusterer_.getStyles().length;\n var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles);\n this.clusterIcon_.setCenter(this.center_);\n this.clusterIcon_.useStyle(sums);\n this.clusterIcon_.show();\n};\n\n\n/**\n * Determines if a marker has already been added to the cluster.\n *\n * @param {google.maps.Marker} marker The marker to check.\n * @return {boolean} True if the marker has already been added.\n */\nCluster.prototype.isMarkerAlreadyAdded_ = function(marker) {\n for (var i = 0, n = this.markers_.length; i < n; i++) {\n if (marker === this.markers_[i]) {\n return true;\n }\n }\n return false;\n};\n\n\n/**\n * @name MarkerClustererOptions\n * @class This class represents the optional parameter passed to\n * the {@link MarkerClusterer} constructor.\n * @property {number} [gridSize=60] The grid size of a cluster in pixels. The grid is a square.\n * @property {number} [maxZoom=null] The maximum zoom level at which clustering is enabled or\n * null if clustering is to be enabled at all zoom levels.\n * @property {boolean} [zoomOnClick=true] Whether to zoom the map when a cluster marker is\n * clicked. You may want to set this to false if you have installed a handler\n * for the click event and it deals with zooming on its own.\n * @property {boolean} [averageCenter=false] Whether the position of a cluster marker should be\n * the average position of all markers in the cluster. If set to false, the\n * cluster marker is positioned at the location of the first marker added to the cluster.\n * @property {number} [minimumClusterSize=2] The minimum number of markers needed in a cluster\n * before the markers are hidden and a cluster marker appears.\n * @property {boolean} [ignoreHidden=false] Whether to ignore hidden markers in clusters. You\n * may want to set this to true to ensure that hidden markers are not included\n * in the marker count that appears on a cluster marker (this count is the value of the\n * text property of the result returned by the default calculator).\n * If set to true and you change the visibility of a marker being clustered, be\n * sure to also call MarkerClusterer.repaint().\n * @property {string} [title=\"\"] The tooltip to display when the mouse moves over a cluster\n * marker. (Alternatively, you can use a custom calculator function to specify a\n * different tooltip for each cluster marker.)\n * @property {function} [calculator=MarkerClusterer.CALCULATOR] The function used to determine\n * the text to be displayed on a cluster marker and the index indicating which style to use\n * for the cluster marker. The input parameters for the function are (1) the array of markers\n * represented by a cluster marker and (2) the number of cluster icon styles. It returns a\n * {@link ClusterIconInfo} object. The default calculator returns a\n * text property which is the number of markers in the cluster and an\n * index property which is one higher than the lowest integer such that\n * 10^i exceeds the number of markers in the cluster, or the size of the styles\n * array, whichever is less. The styles array element used has an index of\n * index minus 1. For example, the default calculator returns a\n * text value of \"125\" and an index of 3\n * for a cluster icon representing 125 markers so the element used in the styles\n * array is 2. A calculator may also return a title\n * property that contains the text of the tooltip to be used for the cluster marker. If\n * title is not defined, the tooltip is set to the value of the title\n * property for the MarkerClusterer.\n * @property {string} [clusterClass=\"cluster\"] The name of the CSS class defining general styles\n * for the cluster markers. Use this class to define CSS styles that are not set up by the code\n * that processes the styles array.\n * @property {Array} [styles] An array of {@link ClusterIconStyle} elements defining the styles\n * of the cluster markers to be used. The element to be used to style a given cluster marker\n * is determined by the function defined by the calculator property.\n * The default is an array of {@link ClusterIconStyle} elements whose properties are derived\n * from the values for imagePath, imageExtension, and\n * imageSizes.\n * @property {boolean} [enableRetinaIcons=false] Whether to allow the use of cluster icons that\n * have sizes that are some multiple (typically double) of their actual display size. Icons such\n * as these look better when viewed on high-resolution monitors such as Apple's Retina displays.\n * Note: if this property is true, sprites cannot be used as cluster icons.\n * @property {number} [batchSize=MarkerClusterer.BATCH_SIZE] Set this property to the\n * number of markers to be processed in a single batch when using a browser other than\n * Internet Explorer (for Internet Explorer, use the batchSizeIE property instead).\n * @property {number} [batchSizeIE=MarkerClusterer.BATCH_SIZE_IE] When Internet Explorer is\n * being used, markers are processed in several batches with a small delay inserted between\n * each batch in an attempt to avoid Javascript timeout errors. Set this property to the\n * number of markers to be processed in a single batch; select as high a number as you can\n * without causing a timeout error in the browser. This number might need to be as low as 100\n * if 15,000 markers are being managed, for example.\n * @property {string} [imagePath=MarkerClusterer.IMAGE_PATH]\n * The full URL of the root name of the group of image files to use for cluster icons.\n * The complete file name is of the form imagePathn.imageExtension\n * where n is the image file number (1, 2, etc.).\n * @property {string} [imageExtension=MarkerClusterer.IMAGE_EXTENSION]\n * The extension name for the cluster icon image files (e.g., \"png\" or\n * \"jpg\").\n * @property {Array} [imageSizes=MarkerClusterer.IMAGE_SIZES]\n * An array of numbers containing the widths of the group of\n * imagePathn.imageExtension image files.\n * (The images are assumed to be square.)\n */\n/**\n * Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}.\n * @constructor\n * @extends google.maps.OverlayView\n * @param {google.maps.Map} map The Google map to attach to.\n * @param {Array.} [opt_markers] The markers to be added to the cluster.\n * @param {MarkerClustererOptions} [opt_options] The optional parameters.\n */\nfunction MarkerClusterer(map, opt_markers, opt_options) {\n // MarkerClusterer implements google.maps.OverlayView interface. We use the\n // extend function to extend MarkerClusterer with google.maps.OverlayView\n // because it might not always be available when the code is defined so we\n // look for it at the last possible moment. If it doesn't exist now then\n // there is no point going ahead :)\n this.extend(MarkerClusterer, google.maps.OverlayView);\n\n opt_markers = opt_markers || [];\n opt_options = opt_options || {};\n\n this.markers_ = [];\n this.clusters_ = [];\n this.listeners_ = [];\n this.activeMap_ = null;\n this.ready_ = false;\n\n this.gridSize_ = opt_options.gridSize || 60;\n this.minClusterSize_ = opt_options.minimumClusterSize || 2;\n this.maxZoom_ = opt_options.maxZoom || null;\n this.styles_ = opt_options.styles || [];\n this.title_ = opt_options.title || \"\";\n this.zoomOnClick_ = true;\n if (opt_options.zoomOnClick !== undefined) {\n this.zoomOnClick_ = opt_options.zoomOnClick;\n }\n this.averageCenter_ = false;\n if (opt_options.averageCenter !== undefined) {\n this.averageCenter_ = opt_options.averageCenter;\n }\n this.ignoreHidden_ = false;\n if (opt_options.ignoreHidden !== undefined) {\n this.ignoreHidden_ = opt_options.ignoreHidden;\n }\n this.enableRetinaIcons_ = false;\n if (opt_options.enableRetinaIcons !== undefined) {\n this.enableRetinaIcons_ = opt_options.enableRetinaIcons;\n }\n this.hideLabel_ = false;\n if (opt_options.hideLabel !== undefined) {\n this.hideLabel_ = opt_options.hideLabel;\n }\n this.imagePath_ = opt_options.imagePath || MarkerClusterer.IMAGE_PATH;\n this.imageExtension_ = opt_options.imageExtension || MarkerClusterer.IMAGE_EXTENSION;\n this.imageSizes_ = opt_options.imageSizes || MarkerClusterer.IMAGE_SIZES;\n this.calculator_ = opt_options.calculator || MarkerClusterer.CALCULATOR;\n this.batchSize_ = opt_options.batchSize || MarkerClusterer.BATCH_SIZE;\n this.batchSizeIE_ = opt_options.batchSizeIE || MarkerClusterer.BATCH_SIZE_IE;\n this.clusterClass_ = opt_options.clusterClass || \"cluster\";\n\n if (navigator.userAgent.toLowerCase().indexOf(\"msie\") !== -1) {\n // Try to avoid IE timeout when processing a huge number of markers:\n this.batchSize_ = this.batchSizeIE_;\n }\n\n this.setupStyles_();\n\n this.addMarkers(opt_markers, true);\n this.setMap(map); // Note: this causes onAdd to be called\n}\n\n\n/**\n * Implementation of the onAdd interface method.\n * @ignore\n */\nMarkerClusterer.prototype.onAdd = function() {\n var cMarkerClusterer = this;\n\n this.activeMap_ = this.getMap();\n this.ready_ = true;\n\n this.repaint();\n\n // Add the map event listeners\n this.listeners_ = [\n google.maps.event.addListener(this.getMap(), \"zoom_changed\", function() {\n cMarkerClusterer.resetViewport_(false);\n // Workaround for this Google bug: when map is at level 0 and \"-\" of\n // zoom slider is clicked, a \"zoom_changed\" event is fired even though\n // the map doesn't zoom out any further. In this situation, no \"idle\"\n // event is triggered so the cluster markers that have been removed\n // do not get redrawn. Same goes for a zoom in at maxZoom.\n if (this.getZoom() === (this.get(\"minZoom\") || 0) || this.getZoom() === this.get(\"maxZoom\")) {\n google.maps.event.trigger(this, \"idle\");\n }\n }),\n google.maps.event.addListener(this.getMap(), \"idle\", function() {\n cMarkerClusterer.redraw_();\n })\n ];\n};\n\n\n/**\n * Implementation of the onRemove interface method.\n * Removes map event listeners and all cluster icons from the DOM.\n * All managed markers are also put back on the map.\n * @ignore\n */\nMarkerClusterer.prototype.onRemove = function() {\n var i;\n\n // Put all the managed markers back on the map:\n for (i = 0; i < this.markers_.length; i++) {\n if (this.markers_[i].getMap() !== this.activeMap_) {\n this.markers_[i].setMap(this.activeMap_);\n }\n }\n\n // Remove all clusters:\n for (i = 0; i < this.clusters_.length; i++) {\n this.clusters_[i].remove();\n }\n this.clusters_ = [];\n\n // Remove map event listeners:\n for (i = 0; i < this.listeners_.length; i++) {\n google.maps.event.removeListener(this.listeners_[i]);\n }\n this.listeners_ = [];\n\n this.activeMap_ = null;\n this.ready_ = false;\n};\n\n\n/**\n * Implementation of the draw interface method.\n * @ignore\n */\nMarkerClusterer.prototype.draw = function() {};\n\n\n/**\n * Sets up the styles object.\n */\nMarkerClusterer.prototype.setupStyles_ = function() {\n var i, size;\n if (this.styles_.length > 0) {\n return;\n }\n\n for (i = 0; i < this.imageSizes_.length; i++) {\n size = this.imageSizes_[i];\n this.styles_.push({\n url: this.imagePath_ + (i + 1) + \".\" + this.imageExtension_,\n height: size,\n width: size\n });\n }\n};\n\n\n/**\n * Fits the map to the bounds of the markers managed by the clusterer.\n */\nMarkerClusterer.prototype.fitMapToMarkers = function() {\n var i;\n var markers = this.getMarkers();\n var bounds = new google.maps.LatLngBounds();\n for (i = 0; i < markers.length; i++) {\n bounds.extend(markers[i].getPosition());\n }\n\n this.getMap().fitBounds(bounds);\n};\n\n\n/**\n * Returns the value of the gridSize property.\n *\n * @return {number} The grid size.\n */\nMarkerClusterer.prototype.getGridSize = function() {\n return this.gridSize_;\n};\n\n\n/**\n * Sets the value of the gridSize property.\n *\n * @param {number} gridSize The grid size.\n */\nMarkerClusterer.prototype.setGridSize = function(gridSize) {\n this.gridSize_ = gridSize;\n};\n\n\n/**\n * Returns the value of the minimumClusterSize property.\n *\n * @return {number} The minimum cluster size.\n */\nMarkerClusterer.prototype.getMinimumClusterSize = function() {\n return this.minClusterSize_;\n};\n\n/**\n * Sets the value of the minimumClusterSize property.\n *\n * @param {number} minimumClusterSize The minimum cluster size.\n */\nMarkerClusterer.prototype.setMinimumClusterSize = function(minimumClusterSize) {\n this.minClusterSize_ = minimumClusterSize;\n};\n\n\n/**\n * Returns the value of the maxZoom property.\n *\n * @return {number} The maximum zoom level.\n */\nMarkerClusterer.prototype.getMaxZoom = function() {\n return this.maxZoom_;\n};\n\n\n/**\n * Sets the value of the maxZoom property.\n *\n * @param {number} maxZoom The maximum zoom level.\n */\nMarkerClusterer.prototype.setMaxZoom = function(maxZoom) {\n this.maxZoom_ = maxZoom;\n};\n\n\n/**\n * Returns the value of the styles property.\n *\n * @return {Array} The array of styles defining the cluster markers to be used.\n */\nMarkerClusterer.prototype.getStyles = function() {\n return this.styles_;\n};\n\n\n/**\n * Sets the value of the styles property.\n *\n * @param {Array.} styles The array of styles to use.\n */\nMarkerClusterer.prototype.setStyles = function(styles) {\n this.styles_ = styles;\n};\n\n\n/**\n * Returns the value of the title property.\n *\n * @return {string} The content of the title text.\n */\nMarkerClusterer.prototype.getTitle = function() {\n return this.title_;\n};\n\n\n/**\n * Sets the value of the title property.\n *\n * @param {string} title The value of the title property.\n */\nMarkerClusterer.prototype.setTitle = function(title) {\n this.title_ = title;\n};\n\n\n/**\n * Returns the value of the zoomOnClick property.\n *\n * @return {boolean} True if zoomOnClick property is set.\n */\nMarkerClusterer.prototype.getZoomOnClick = function() {\n return this.zoomOnClick_;\n};\n\n\n/**\n * Sets the value of the zoomOnClick property.\n *\n * @param {boolean} zoomOnClick The value of the zoomOnClick property.\n */\nMarkerClusterer.prototype.setZoomOnClick = function(zoomOnClick) {\n this.zoomOnClick_ = zoomOnClick;\n};\n\n\n/**\n * Returns the value of the averageCenter property.\n *\n * @return {boolean} True if averageCenter property is set.\n */\nMarkerClusterer.prototype.getAverageCenter = function() {\n return this.averageCenter_;\n};\n\n\n/**\n * Sets the value of the averageCenter property.\n *\n * @param {boolean} averageCenter The value of the averageCenter property.\n */\nMarkerClusterer.prototype.setAverageCenter = function(averageCenter) {\n this.averageCenter_ = averageCenter;\n};\n\n\n/**\n * Returns the value of the ignoreHidden property.\n *\n * @return {boolean} True if ignoreHidden property is set.\n */\nMarkerClusterer.prototype.getIgnoreHidden = function() {\n return this.ignoreHidden_;\n};\n\n\n/**\n * Sets the value of the ignoreHidden property.\n *\n * @param {boolean} ignoreHidden The value of the ignoreHidden property.\n */\nMarkerClusterer.prototype.setIgnoreHidden = function(ignoreHidden) {\n this.ignoreHidden_ = ignoreHidden;\n};\n\n\n/**\n * Returns the value of the enableRetinaIcons property.\n *\n * @return {boolean} True if enableRetinaIcons property is set.\n */\nMarkerClusterer.prototype.getEnableRetinaIcons = function() {\n return this.enableRetinaIcons_;\n};\n\n\n/**\n * Sets the value of the enableRetinaIcons property.\n *\n * @param {boolean} enableRetinaIcons The value of the enableRetinaIcons property.\n */\nMarkerClusterer.prototype.setEnableRetinaIcons = function(enableRetinaIcons) {\n this.enableRetinaIcons_ = enableRetinaIcons;\n};\n\n\n/**\n * Returns the value of the imageExtension property.\n *\n * @return {string} The value of the imageExtension property.\n */\nMarkerClusterer.prototype.getImageExtension = function() {\n return this.imageExtension_;\n};\n\n\n/**\n * Sets the value of the imageExtension property.\n *\n * @param {string} imageExtension The value of the imageExtension property.\n */\nMarkerClusterer.prototype.setImageExtension = function(imageExtension) {\n this.imageExtension_ = imageExtension;\n};\n\n\n/**\n * Returns the value of the imagePath property.\n *\n * @return {string} The value of the imagePath property.\n */\nMarkerClusterer.prototype.getImagePath = function() {\n return this.imagePath_;\n};\n\n\n/**\n * Sets the value of the imagePath property.\n *\n * @param {string} imagePath The value of the imagePath property.\n */\nMarkerClusterer.prototype.setImagePath = function(imagePath) {\n this.imagePath_ = imagePath;\n};\n\n\n/**\n * Returns the value of the imageSizes property.\n *\n * @return {Array} The value of the imageSizes property.\n */\nMarkerClusterer.prototype.getImageSizes = function() {\n return this.imageSizes_;\n};\n\n\n/**\n * Sets the value of the imageSizes property.\n *\n * @param {Array} imageSizes The value of the imageSizes property.\n */\nMarkerClusterer.prototype.setImageSizes = function(imageSizes) {\n this.imageSizes_ = imageSizes;\n};\n\n\n/**\n * Returns the value of the calculator property.\n *\n * @return {function} the value of the calculator property.\n */\nMarkerClusterer.prototype.getCalculator = function() {\n return this.calculator_;\n};\n\n\n/**\n * Sets the value of the calculator property.\n *\n * @param {function(Array., number)} calculator The value\n * of the calculator property.\n */\nMarkerClusterer.prototype.setCalculator = function(calculator) {\n this.calculator_ = calculator;\n};\n\n/**\n * Sets the value of the hideLabel property.\n *\n * @param {boolean} printable The value of the hideLabel property.\n */\nMarkerClusterer.prototype.setHideLabel = function(hideLabel) {\n this.hideLabel_ = hideLabel;\n};\n\n/**\n * Returns the value of the hideLabel property.\n *\n * @return {boolean} the value of the hideLabel property.\n */\nMarkerClusterer.prototype.getHideLabel = function() {\n return this.hideLabel_;\n};\n\n/**\n * Returns the value of the batchSizeIE property.\n *\n * @return {number} the value of the batchSizeIE property.\n */\nMarkerClusterer.prototype.getBatchSizeIE = function() {\n return this.batchSizeIE_;\n};\n\n\n/**\n * Sets the value of the batchSizeIE property.\n *\n * @param {number} batchSizeIE The value of the batchSizeIE property.\n */\nMarkerClusterer.prototype.setBatchSizeIE = function(batchSizeIE) {\n this.batchSizeIE_ = batchSizeIE;\n};\n\n\n/**\n * Returns the value of the clusterClass property.\n *\n * @return {string} the value of the clusterClass property.\n */\nMarkerClusterer.prototype.getClusterClass = function() {\n return this.clusterClass_;\n};\n\n\n/**\n * Sets the value of the clusterClass property.\n *\n * @param {string} clusterClass The value of the clusterClass property.\n */\nMarkerClusterer.prototype.setClusterClass = function(clusterClass) {\n this.clusterClass_ = clusterClass;\n};\n\n\n/**\n * Returns the array of markers managed by the clusterer.\n *\n * @return {Array} The array of markers managed by the clusterer.\n */\nMarkerClusterer.prototype.getMarkers = function() {\n return this.markers_;\n};\n\n\n/**\n * Returns the number of markers managed by the clusterer.\n *\n * @return {number} The number of markers.\n */\nMarkerClusterer.prototype.getTotalMarkers = function() {\n return this.markers_.length;\n};\n\n\n/**\n * Returns the current array of clusters formed by the clusterer.\n *\n * @return {Array} The array of clusters formed by the clusterer.\n */\nMarkerClusterer.prototype.getClusters = function() {\n return this.clusters_;\n};\n\n\n/**\n * Returns the number of clusters formed by the clusterer.\n *\n * @return {number} The number of clusters formed by the clusterer.\n */\nMarkerClusterer.prototype.getTotalClusters = function() {\n return this.clusters_.length;\n};\n\n\n/**\n * Adds a marker to the clusterer. The clusters are redrawn unless\n * opt_nodraw is set to true.\n *\n * @param {google.maps.Marker} marker The marker to add.\n * @param {boolean} [opt_nodraw] Set to true to prevent redrawing.\n */\nMarkerClusterer.prototype.addMarker = function(marker, opt_nodraw) {\n this.pushMarkerTo_(marker);\n if (!opt_nodraw) {\n this.redraw_();\n }\n};\n\n\n/**\n * Adds an array of markers to the clusterer. The clusters are redrawn unless\n * opt_nodraw is set to true.\n *\n * @param {Array.} markers The markers to add.\n * @param {boolean} [opt_nodraw] Set to true to prevent redrawing.\n */\nMarkerClusterer.prototype.addMarkers = function(markers, opt_nodraw) {\n var key;\n for (key in markers) {\n if (markers.hasOwnProperty(key)) {\n this.pushMarkerTo_(markers[key]);\n }\n }\n if (!opt_nodraw) {\n this.redraw_();\n }\n};\n\n\n/**\n * Pushes a marker to the clusterer.\n *\n * @param {google.maps.Marker} marker The marker to add.\n */\nMarkerClusterer.prototype.pushMarkerTo_ = function(marker) {\n // If the marker is draggable add a listener so we can update the clusters on the dragend:\n if (marker.getDraggable()) {\n var cMarkerClusterer = this;\n google.maps.event.addListener(marker, \"dragend\", function() {\n if (cMarkerClusterer.ready_) {\n this.isAdded = false;\n cMarkerClusterer.repaint();\n }\n });\n }\n marker.isAdded = false;\n this.markers_.push(marker);\n};\n\n\n/**\n * Removes a marker from the cluster and map. The clusters are redrawn unless\n * opt_nodraw is set to true. Returns true if the\n * marker was removed from the clusterer.\n *\n * @param {google.maps.Marker} marker The marker to remove.\n * @param {boolean} [opt_nodraw] Set to true to prevent redrawing.\n * @param {boolean} [opt_noMapRemove] Set to true to prevent removal from map but still removing from cluster management\n * @return {boolean} True if the marker was removed from the clusterer.\n */\nMarkerClusterer.prototype.removeMarker = function(marker, opt_nodraw, opt_noMapRemove) {\n var removeFromMap = true && !opt_noMapRemove;\n var removed = this.removeMarker_(marker, removeFromMap);\n\n if (!opt_nodraw && removed) {\n this.repaint();\n }\n\n return removed;\n};\n\n\n/**\n * Removes an array of markers from the cluster and map. The clusters are redrawn unless\n * opt_nodraw is set to true. Returns true if markers\n * were removed from the clusterer.\n *\n * @param {Array.} markers The markers to remove.\n * @param {boolean} [opt_nodraw] Set to true to prevent redrawing.\n * @param {boolean} [opt_noMapRemove] Set to true to prevent removal from map but still removing from cluster management\n * @return {boolean} True if markers were removed from the clusterer.\n */\nMarkerClusterer.prototype.removeMarkers = function(markers, opt_nodraw, opt_noMapRemove) {\n var i, r;\n var removed = false;\n var removeFromMap = true && !opt_noMapRemove;\n\n for (i = 0; i < markers.length; i++) {\n r = this.removeMarker_(markers[i], removeFromMap);\n removed = removed || r;\n }\n\n if (!opt_nodraw && removed) {\n this.repaint();\n }\n\n return removed;\n};\n\n\n/**\n * Removes a marker and returns true if removed, false if not.\n *\n * @param {google.maps.Marker} marker The marker to remove\n * @param {boolean} removeFromMap set to true to explicitly remove from map as well as cluster manangement\n * @return {boolean} Whether the marker was removed or not\n */\nMarkerClusterer.prototype.removeMarker_ = function(marker, removeFromMap) {\n var i;\n var index = -1;\n if (this.markers_.indexOf) {\n index = this.markers_.indexOf(marker);\n } else {\n for (i = 0; i < this.markers_.length; i++) {\n if (marker === this.markers_[i]) {\n index = i;\n break;\n }\n }\n }\n\n if (index === -1) {\n // Marker is not in our list of markers, so do nothing:\n return false;\n }\n\n if (removeFromMap) {\n marker.setMap(null);\n }\n\n this.markers_.splice(index, 1); // Remove the marker from the list of managed markers\n return true;\n};\n\n\n/**\n * Removes all clusters and markers from the map and also removes all markers\n * managed by the clusterer.\n */\nMarkerClusterer.prototype.clearMarkers = function() {\n this.resetViewport_(true);\n this.markers_ = [];\n};\n\n\n/**\n * Recalculates and redraws all the marker clusters from scratch.\n * Call this after changing any properties.\n */\nMarkerClusterer.prototype.repaint = function() {\n var oldClusters = this.clusters_.slice();\n this.clusters_ = [];\n this.resetViewport_(false);\n this.redraw_();\n\n // Remove the old clusters.\n // Do it in a timeout to prevent blinking effect.\n setTimeout(function() {\n var i;\n for (i = 0; i < oldClusters.length; i++) {\n oldClusters[i].remove();\n }\n }, 0);\n};\n\n\n/**\n * Returns the current bounds extended by the grid size.\n *\n * @param {google.maps.LatLngBounds} bounds The bounds to extend.\n * @return {google.maps.LatLngBounds} The extended bounds.\n * @ignore\n */\nMarkerClusterer.prototype.getExtendedBounds = function(bounds) {\n var projection = this.getProjection();\n\n // Turn the bounds into latlng.\n var tr = new google.maps.LatLng(bounds.getNorthEast().lat(),\n bounds.getNorthEast().lng());\n var bl = new google.maps.LatLng(bounds.getSouthWest().lat(),\n bounds.getSouthWest().lng());\n\n // Convert the points to pixels and the extend out by the grid size.\n var trPix = projection.fromLatLngToDivPixel(tr);\n trPix.x += this.gridSize_;\n trPix.y -= this.gridSize_;\n\n var blPix = projection.fromLatLngToDivPixel(bl);\n blPix.x -= this.gridSize_;\n blPix.y += this.gridSize_;\n\n // Convert the pixel points back to LatLng\n var ne = projection.fromDivPixelToLatLng(trPix);\n var sw = projection.fromDivPixelToLatLng(blPix);\n\n // Extend the bounds to contain the new bounds.\n bounds.extend(ne);\n bounds.extend(sw);\n\n return bounds;\n};\n\n\n/**\n * Redraws all the clusters.\n */\nMarkerClusterer.prototype.redraw_ = function() {\n this.createClusters_(0);\n};\n\n\n/**\n * Removes all clusters from the map. The markers are also removed from the map\n * if opt_hide is set to true.\n *\n * @param {boolean} [opt_hide] Set to true to also remove the markers\n * from the map.\n */\nMarkerClusterer.prototype.resetViewport_ = function(opt_hide) {\n var i, marker;\n // Remove all the clusters\n for (i = 0; i < this.clusters_.length; i++) {\n this.clusters_[i].remove();\n }\n this.clusters_ = [];\n\n // Reset the markers to not be added and to be removed from the map.\n for (i = 0; i < this.markers_.length; i++) {\n marker = this.markers_[i];\n marker.isAdded = false;\n if (opt_hide) {\n marker.setMap(null);\n }\n }\n};\n\n\n/**\n * Calculates the distance between two latlng locations in km.\n *\n * @param {google.maps.LatLng} p1 The first lat lng point.\n * @param {google.maps.LatLng} p2 The second lat lng point.\n * @return {number} The distance between the two points in km.\n * @see http://www.movable-type.co.uk/scripts/latlong.html\n */\nMarkerClusterer.prototype.distanceBetweenPoints_ = function(p1, p2) {\n var R = 6371; // Radius of the Earth in km\n var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;\n var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) *\n Math.sin(dLon / 2) * Math.sin(dLon / 2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c;\n return d;\n};\n\n\n/**\n * Determines if a marker is contained in a bounds.\n *\n * @param {google.maps.Marker} marker The marker to check.\n * @param {google.maps.LatLngBounds} bounds The bounds to check against.\n * @return {boolean} True if the marker is in the bounds.\n */\nMarkerClusterer.prototype.isMarkerInBounds_ = function(marker, bounds) {\n return bounds.contains(marker.getPosition());\n};\n\n\n/**\n * Adds a marker to a cluster, or creates a new cluster.\n *\n * @param {google.maps.Marker} marker The marker to add.\n */\nMarkerClusterer.prototype.addToClosestCluster_ = function(marker) {\n var i, d, cluster, center;\n var distance = 40000; // Some large number\n var clusterToAddTo = null;\n for (i = 0; i < this.clusters_.length; i++) {\n cluster = this.clusters_[i];\n center = cluster.getCenter();\n if (center) {\n d = this.distanceBetweenPoints_(center, marker.getPosition());\n if (d < distance) {\n distance = d;\n clusterToAddTo = cluster;\n }\n }\n }\n\n if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {\n clusterToAddTo.addMarker(marker);\n } else {\n cluster = new Cluster(this);\n cluster.addMarker(marker);\n this.clusters_.push(cluster);\n }\n};\n\n\n/**\n * Creates the clusters. This is done in batches to avoid timeout errors\n * in some browsers when there is a huge number of markers.\n *\n * @param {number} iFirst The index of the first marker in the batch of\n * markers to be added to clusters.\n */\nMarkerClusterer.prototype.createClusters_ = function(iFirst) {\n var i, marker;\n var mapBounds;\n var cMarkerClusterer = this;\n if (!this.ready_) {\n return;\n }\n\n // Cancel previous batch processing if we're working on the first batch:\n if (iFirst === 0) {\n /**\n * This event is fired when the MarkerClusterer begins\n * clustering markers.\n * @name MarkerClusterer#clusteringbegin\n * @param {MarkerClusterer} mc The MarkerClusterer whose markers are being clustered.\n * @event\n */\n google.maps.event.trigger(this, \"clusteringbegin\", this);\n\n if (typeof this.timerRefStatic !== \"undefined\") {\n clearTimeout(this.timerRefStatic);\n delete this.timerRefStatic;\n }\n }\n\n // Get our current map view bounds.\n // Create a new bounds object so we don't affect the map.\n //\n // See Comments 9 & 11 on Issue 3651 relating to this workaround for a Google Maps bug:\n if (this.getMap().getZoom() > 3) {\n mapBounds = new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),\n this.getMap().getBounds().getNorthEast());\n } else {\n mapBounds = new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472, -178.48388434375), new google.maps.LatLng(-85.08136444384544, 178.00048865625));\n }\n var bounds = this.getExtendedBounds(mapBounds);\n\n var iLast = Math.min(iFirst + this.batchSize_, this.markers_.length);\n\n for (i = iFirst; i < iLast; i++) {\n marker = this.markers_[i];\n if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds)) {\n if (!this.ignoreHidden_ || (this.ignoreHidden_ && marker.getVisible())) {\n this.addToClosestCluster_(marker);\n }\n }\n }\n\n if (iLast < this.markers_.length) {\n this.timerRefStatic = setTimeout(function() {\n cMarkerClusterer.createClusters_(iLast);\n }, 0);\n } else {\n delete this.timerRefStatic;\n\n /**\n * This event is fired when the MarkerClusterer stops\n * clustering markers.\n * @name MarkerClusterer#clusteringend\n * @param {MarkerClusterer} mc The MarkerClusterer whose markers are being clustered.\n * @event\n */\n google.maps.event.trigger(this, \"clusteringend\", this);\n\n for (i = 0; i < this.clusters_.length; i++) {\n this.clusters_[i].updateIcon_();\n }\n }\n};\n\n\n/**\n * Extends an object's prototype by another's.\n *\n * @param {Object} obj1 The object to be extended.\n * @param {Object} obj2 The object to extend with.\n * @return {Object} The new extended object.\n * @ignore\n */\nMarkerClusterer.prototype.extend = function(obj1, obj2) {\n return (function(object) {\n var property;\n for (property in object.prototype) {\n this.prototype[property] = object.prototype[property];\n }\n return this;\n }).apply(obj1, [obj2]);\n};\n\n\n/**\n * The default function for determining the label text and style\n * for a cluster icon.\n *\n * @param {Array.} markers The array of markers represented by the cluster.\n * @param {number} numStyles The number of marker styles available.\n * @return {ClusterIconInfo} The information resource for the cluster.\n * @constant\n * @ignore\n */\nMarkerClusterer.CALCULATOR = function(markers, numStyles) {\n var index = 0;\n var title = \"\";\n var count = markers.length.toString();\n\n var dv = count;\n while (dv !== 0) {\n dv = parseInt(dv / 10, 10);\n index++;\n }\n\n index = Math.min(index, numStyles);\n return {\n text: count,\n index: index,\n title: title\n };\n};\n\n\n/**\n * The number of markers to process in one batch.\n *\n * @type {number}\n * @constant\n */\nMarkerClusterer.BATCH_SIZE = 2000;\n\n\n/**\n * The number of markers to process in one batch (IE only).\n *\n * @type {number}\n * @constant\n */\nMarkerClusterer.BATCH_SIZE_IE = 500;\n\n\n/**\n * The default root name for the marker cluster images.\n *\n * @type {string}\n * @constant\n */\nMarkerClusterer.IMAGE_PATH = \"//cdn.rawgit.com/mahnunchik/markerclustererplus/master/images/m\";\n\n\n/**\n * The default extension name for the marker cluster images.\n *\n * @type {string}\n * @constant\n */\nMarkerClusterer.IMAGE_EXTENSION = \"png\";\n\n\n/**\n * The default array of sizes for the marker cluster images.\n *\n * @type {Array.}\n * @constant\n */\nMarkerClusterer.IMAGE_SIZES = [53, 56, 66, 78, 90];\n\nif (typeof String.prototype.trim !== 'function') {\n /**\n * IE hack since trim() doesn't exist in all browsers\n * @return {string} The string with removed whitespace\n */\n String.prototype.trim = function() {\n return this.replace(/^\\s+|\\s+$/g, '');\n };\n}\n","(function($) {\n\t'use strict';\n\t$.widget('msv.articleList', {\n\t\tvars: {},\n\t\tel: {},\n\t\t_create: function() {\n\t\t\t//---------- define vars and elements -----------------------------\n\t\t\tthis.el.filtersForm = this.element.find('.js-filter-form');\n\t\t\tthis.el.listContainer = this.element.find('.js-container');\n\t\t\tthis.el.loadMore = this.element.find('.js-load-more');\n\n\t\t\tthis.vars.endpoint = this.element.data('endpoint');\n\t\t\tthis.vars.start = this.element.data('start');\n\t\t\tthis.vars.contentId = this.element.data('content-id');\n\t\t\tthis.vars.pageSize = this.element.data('pagesize') ? this.element.data('pagesize') : 10;\n\t\t\tthis.vars.isLoading = false;\n\t\t},\n\t\t_init: function() {\n\t\t\tvar self = this;\n\t\t\t//---------- define events ---------------------------------\n\t\t\tself.el.filtersForm.off('change').change(function() {\n\t\t\t\tself.vars.start = 0;\n\t\t\t\t$(self.el.main).data('start', self.vars.start);\n\t\t\t\tself.el.listContainer.html(null);\n\t\t\t\tself.loadContainer();\n\t\t\t});\n\n\n\t\t\tself.el.loadMore.off('click').click(function() {\n\t\t\t\tself.loadContainer();\n\t\t\t});\n\t\t},\n\t\t_destroy: function() {},\n\t\tloadContainer: function() {\n\t\t\tvar self = this;\n\n\t\t\t//prevent to load when it is already loading\n\t\t\tif (self.vars.isLoading)\n\t\t\t\treturn;\n\n\t\t\tvar params = self.el.filtersForm.serialize();\n\t\t\tparams += '&start=' + self.vars.start;\n\t\t\tparams += '&pageSize=' + self.vars.pageSize;\n\t\t\tif (self.vars.contentId)\n\t\t\t\tparams += '&contentId=' + self.vars.contentId;\n\n\t\t\t//add loading state to button\n\t\t\tself.el.loadMore.attr('disabled', true).addClass('btn-loading');\n\t\t\tself.el.loadMore.append(\"\");\n\t\t\tself.vars.isLoading = true;\n\t\t\t//ajax request\n\t\t\t$.get(self.vars.endpoint, params, function(data, m, e) {\n\t\t\t\tself.vars.isLoading = false;\n\n\t\t\t\tif (self.vars.start == 0)\n\t\t\t\t\tself.el.listContainer.html(data);\n\t\t\t\telse\n\t\t\t\t\tself.el.listContainer.append(data);\n\n\t\t\t\tself.el.loadMore.removeClass('loading');\n\t\t\t\tif (e.status == 200) {\n\t\t\t\t\tself.el.loadMore.hide();\n\t\t\t\t}\n\t\t\t\telse if (e.status == 202) {\n\t\t\t\t\tself.el.loadMore.show();\n\t\t\t\t\tself.vars.start += self.vars.pageSize;\n\t\t\t\t\t$(self.element).data('start', self.vars.start);\n\t\t\t\t}\n\n\t\t\t\t//remove loading state from button \n\t\t\t\tself.el.loadMore.attr('disabled', false).removeClass('btn-loading');\n\t\t\t\tself.el.loadMore.find(\".btn-loading-spinner\").remove();\n\t\t\t});\n\t\t}\n\t});\n})(jQuery);","(function($) {\n\t'use strict';\n\n\t$.widget('msv.breadcrumbs', {\n\n\t\tvars: {\n\t\t\ttimer: 0,\n\t\t\toffset: null\n\t\t},\n\t\tel: {\n\t\t\tpreviousElement: null,\n\t\t},\n\n\t\tgetOffset: function() {\n\t\t\tvar self = this;\n\t\t\tvar currentScroll = $(window).scrollTop();\n\t\t\tvar menuHeight = $('.menu').height();\n\t\t\tvar menuDouble = $('.menu__double');\n\t\t\tvar menuDoubleHeight = $('.menu__double').height();\n\t\t\tvar heroHeight = self.el.previousElement.height();\n\t\t\tif (menuDouble.length) {\n\t\t\t\treturn currentScroll > heroHeight + menuHeight + menuDoubleHeight ? menuHeight + menuDoubleHeight : heroHeight + menuHeight + menuDoubleHeight;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn currentScroll > heroHeight + menuHeight ? menuHeight : heroHeight + menuHeight;\n\t\t\t}\n\n\t\t},\n\n\t\t_create: function() {\n\t\t\tvar self = this;\n\t\t\tself.el.previousElement = $(this.element.data('previous-element'));\n\t\t},\n\t\t_init: function() {\n\t\t\tvar self = this;\n\t\t\t$(window).on('scroll', function() {\n\t\t\t\tself.vars.timer = setTimeout(function() {\n\n\t\t\t\t\tif ($(window).scrollTop() >= self.getOffset())\n\t\t\t\t\t\tself.element.addClass('fixed').css('top', self.getOffset())\n\t\t\t\t\telse\n\t\t\t\t\t\tself.element.removeClass('fixed').removeAttr('style')\n\n\t\t\t\t}, 100)\n\t\t\t})\n\t\t}\n\n\t});\n\n})(jQuery);","(function($) {\n\t'use strict';\n\n\t$.widget('msv.carousel', {\n\n\t\toptions: {},\n\n\t\t_create: function() {\n\t\t\tvar self = this,\n\t\t\t\tvideoElement = this.element.find('.hero--video'),\n\t\t\t\tsettingsElement = this.element.data('settings'),\n\t\t\t\tslideAmount = this.element.find(\"> div\").length;\n\n\t\t\t/**/\n\n\t\t\tif (slideAmount > 1) {\n\t\t\t\tif (settingsElement) {\n\t\t\t\t\tself.settings = JSON.parse($(settingsElement).text());\n\t\t\t\t}\n\n\t\t\t\tif (self.settings.identifier == \"eventos\") {\n\n\t\t\t\t\tif (window.innerWidth > 960) {\n\n\t\t\t\t\t\tthis.element.owlCarousel(self.settings);\n\n\t\t\t\t\t}\n\t\t\t\t\t$(window).resize(function() {\n\n\t\t\t\t\t\tself._handleCarousel();\n\t\t\t\t\t});\n\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (videoElement.length) {\n\t\t\t\t\t\tif (window.innerWidth > 960) {\n\t\t\t\t\t\t\tthis.element.owlCarousel(self.settings)\n\t\t\t\t\t\t\t\t.on('translate.owl.carousel', function() {\n\t\t\t\t\t\t\t\t\tvideoElement.find('video').each(function() {\n\t\t\t\t\t\t\t\t\t\t$(this).get(0).pause();\n\t\t\t\t\t\t\t\t\t\t!$(this).get(0).muted ? $(this).get(0).muted = true : '';\n\t\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t.on('translated.owl.carousel', function() {\n\t\t\t\t\t\t\t\t\tvideoElement.parent('.active').find('video').get(0).play();\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tvideoElement.each(function() {\n\t\t\t\t\t\t\t\tvar src = $(this).data('video');\n\t\t\t\t\t\t\t\tif (typeof src !== typeof undefined && src !== false) {\n\t\t\t\t\t\t\t\t\t$(this).prepend('')\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tvideoElement.parent('.active').find('video').attr({ 'autoplay': true, 'loop': true })\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.element.owlCarousel(self.settings);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t_handleCarousel: function() {\n\t\t\tvar self = this;\n\n\t\t\tif (window.innerWidth < 960) {\n\t\t\t\tself.element.trigger('destroy.owl.carousel');\n\n\t\t\t}\n\t\t\telse {\n\n\t\t\t\tself.element.owlCarousel(self.settings);\n\n\t\t\t}\n\t\t}\n\n\t});\n\n})(jQuery);","(function($) {\n\t'use strict';\n\t$.widget('msv.cookieConsent', {\n\t\tel: {},\n\t\toptions: {},\n\t\t_create: function() {\n\t\t\tvar self = this;\n\t\t\tthis.options = {\n\t\t\t\t\"palette\": {\n\t\t\t\t\t\"popup\": {\n\t\t\t\t\t\t\"background\": \"#00B1D7\",\n\t\t\t\t\t\t\"text\": \"#fff\"\n\t\t\t\t\t},\n\t\t\t\t\t\"button\": {\n\t\t\t\t\t\t\"background\": \"transparent\",\n\t\t\t\t\t\t\"text\": \"#fff\",\n\t\t\t\t\t\t\"border\": \"#fff\"\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t\"content\": {\n\t\t\t\t\t\"message\": this.element.data(\"consent-message\"),\n\t\t\t\t\t\"dismiss\": this.element.data(\"consent-dismiss\"),\n\t\t\t\t\t\"link\": this.element.data(\"consent-link\"),\n\t\t\t\t\t\"href\": this.element.data(\"consent-href\")\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t_init: function() {\n\t\t\tvar self = this;\n\t\t\twindow.addEventListener(\"load\", function() {\n\t\t\t\twindow.cookieconsent.initialise(self.options)\n\t\t\t});\n\t\t}\n\t});\n})(jQuery);","(function($) {\n\t'use strict';\n\n\t$.widget('msv.datalist', {\n\t\tvars: {},\n\t\toptions: {\n\t\t\tlimit: 4,\n\t\t\twrapper: '.form-datalist',\n\t\t\ttextField: '.form-item-text',\n\t\t\toptionsList: '.form-datalist__options',\n\t\t\tpointer: '.form-datalist__pointer'\n\t\t},\n\n\t\t_create: function() {\n\t\t\tvar self = this;\n\t\t\tthis.options.wrapper = this.element;\n\t\t\tthis.options.textField = this.options.wrapper.find(this.options.textField);\n\t\t\tthis.options.optionsList = this.options.wrapper.find(this.options.optionsList);\n\t\t\tthis.options.pointer = this.options.wrapper.find(this.options.pointer);\n\t\t\tthis.buttonViewAll = this.element.parent().parent().find('.js-btn-view-all');\n\t\t\tthis.vars.enableScroll = self.element.data('enable-scroll');\n\n\t\t\tif (self.vars.enableScroll)\n\t\t\t\tthis.options.optionsList.css({ 'overflow-y': 'auto', 'max-height': '300px' });\n\n\t\t\tthis.options.textField.click(function(e) {\n\t\t\t\tvar result = self.filterBy($(e.target).val());\n\t\t\t\tself.populateLocations(result);\n\t\t\t\tself.open();\n\t\t\t});\n\t\t\tthis.options.textField.keyup(function(e) {\n\t\t\t\t//console.log('text keyup');\n\t\t\t\tvar result = self.filterBy(self.options.textField.val());\n\t\t\t\tself.populateLocations(result);\n\t\t\t\tself.open();\n\t\t\t});\n\t\t\tthis.options.textField.blur(function(e) {\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tself.close();\n\t\t\t\t}, 200);\n\t\t\t});\n\t\t\tthis.options.pointer.mouseup(function() {\n\t\t\t\tif (self.options.wrapper.hasClass(\"opened\")) {\n\t\t\t\t\tself.close();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tvar result = self.filterBy(self.options.textField.val());\n\t\t\t\t\tself.populateLocations(result);\n\t\t\t\t\tself.open();\n\t\t\t\t}\n\t\t\t});\n\t\t\t$(window).resize(function() {\n\t\t\t\tself.redraw();\n\t\t\t});\n\t\t},\n\n\t\topen: function() {\n\t\t\tthis.options.wrapper.addClass(\"opened\");\n\t\t\tthis.redraw();\n\t\t\tthis.options.textField.focus();\n\t\t},\n\n\t\tclose: function() {\n\t\t\tthis.options.textField.val('');\n\t\t\tthis.options.wrapper.removeClass(\"opened\");\n\t\t},\n\n\t\tredraw: function() {\n\t\t\t//console.log('redraw');\n\t\t\tthis.options.optionsList.width(this.options.textField.width() + 2);\n\t\t},\n\n\t\tfilterBy: function(inserted) {\n\t\t\t//console.log(\"filterby: \", inserted);\n\t\t\tvar temp = [];\n\t\t\tif (inserted) {\n\t\t\t\t$.each(BEC.locations, function(index, value) {\n\t\t\t\t\tif (BEC.locations[index].name.toLowerCase().indexOf(inserted.toLowerCase()) > -1) {\n\t\t\t\t\t\ttemp.push(BEC.locations[index]);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttemp = BEC.locations;\n\t\t\t}\n\t\t\treturn temp;\n\t\t},\n\n\t\tpopulateLocations: function(list) {\n\t\t\tvar self = this;\n\t\t\tthis.options.optionsList.empty();\n\t\t\tif (!list || list.length === 0) {\n\t\t\t\tthis.options.optionsList.append(\"No results.\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\t$.each(list, function(index, value) {\n\t\t\t\t\tvar option = $(\"\" + value.name + \"\");\n\t\t\t\t\toption.click(self, function(e) {\n\t\t\t\t\t\tvar mapElementId = $(e.data.element).data('bind-map');\n\t\t\t\t\t\tif (mapElementId)\n\t\t\t\t\t\t\t$(mapElementId).googlemap('focusMarkerById', value.id);\n\t\t\t\t\t});\n\t\t\t\t\tself.options.optionsList.append(option);\n\t\t\t\t\tif (!self.vars.enableScroll && index >= self.options.limit) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (!self.vars.enableScroll && list.length > this.options.limit) {\n\t\t\t\t\tself.options.optionsList.append(\"Total of \" + list.length + \" results found.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t});\n\n})(jQuery);","(function($) {\n\t'use strict';\n\n\t$.widget('msv.dateRange', {\n\n\t\toptions: {\n\t\t\tmediumAndUp: window.matchMedia('(min-width: 960px)')\n\t\t},\n\n\t\t_init: function() {\n\n\t\t\tthis._events()\n\t\t\tthis._showDates()\n\t\t},\n\n\t\t_events: function() {\n\t\t\tvar self = this;\n\n\t\t\t//input daterange\n\t\t\tthis.element.daterangepicker({\n\t\t\t\tautoUpdateInput: false,\n\t\t\t\tstartDate: moment(),\n\t\t\t\tminDate: moment(),\n\t\t\t\tautoApply: true,\n\t\t\t\topens: self.options.mediumAndUp.matches ? 'right' : 'center',\n\t\t\t\tlocale: {\n\t\t\t\t\t'format': 'MM/DD/YYYY',\n\t\t\t\t\t'daysOfWeek': self.element.parent().data('days'),\n\t\t\t\t\t\"monthNames\": self.element.parent().data('months')\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\t_showDates: function() {\n\t\t\tthis.element.on('apply.daterangepicker', function(_, picker) {\n\t\t\t\t$(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));\n\t\t\t});\n\t\t}\n\t});\n\n})(jQuery);","(function($) {\n\t'use strict';\n\t$.widget('msv.dropdown', {\n\t\toptions: {\n\t\t\tlimit: 6,\n\t\t\ttext: '.form-item-text',\n\t\t\toptionsList: '.form-datalist__options',\n\t\t\tpointer: '.form-datalist__pointer',\n\t\t\tinput: 'input[type=hidden]',\n\t\t\tremoveBtn: '',\n\t\t\tremoveBtnClass: '.remove-it'\n\t\t},\n\t\tvars: {},\n\t\tel: {},\n\t\t_create: function() {\n\t\t\t//---------- define vars and elements -----------------------------\n\t\t\tvar self = this;\n\t\t\tself.vars = {};\n\t\t\tself.vars.required = self.element.data('required');\n\t\t\tself.vars.fieldName = self.element.data('name');\n\t\t\tself.vars.defaultText = self.element.find(self.options.text).val();\n\t\t\tself.vars.enableScroll = self.element.data('enable-scroll');\n\t\t},\n\t\t_init: function() {\n\t\t\tvar self = this;\n\n\t\t\tself.element.find(self.options.text).click(function(e) {\n\t\t\t\tself.populate();\n\t\t\t\tself.open();\n\t\t\t});\n\t\t\tself.element.find(self.options.text).blur(function(e) {\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tself.close();\n\t\t\t\t}, 200);\n\t\t\t});\n\t\t\tself.element.find(self.options.pointer).mouseup(function() {\n\t\t\t\tif (self.element.hasClass(\"opened\")) {\n\t\t\t\t\tself.close();\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tself.populate();\n\t\t\t\t\tself.open();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tself.element.find(self.options.optionsList).on('click', function(item) {\n\t\t\t\tif (self.element.find(self.options.optionsList)[0] == item.target)\n\t\t\t\t\treturn false;\n\n\t\t\t\tself.updateValue(item);\n\n\t\t\t\tself.close();\n\t\t\t});\n\n\t\t\t$(window).resize(function() {\n\t\t\t\tself.redraw();\n\t\t\t});\n\n\t\t\tif (self.vars.enableScroll) {\n\t\t\t\tself.element.find(self.options.optionsList)\n\t\t\t\t\t.css({ 'overflow-y': 'auto', 'max-height': '300px' });\n\t\t\t}\n\t\t},\n\t\tupdateValue: function(selectedOption) {\n\t\t\tvar self = this;\n\t\t\tvar inputHidden = self.element.find('input[type=hidden]');\n\t\t\tvar inputText = self.element.find('input[type=text]');\n\t\t\tvar selectedValue = selectedOption ? selectedOption == 'reset' ? null : $(selectedOption.target).data('value') : inputHidden.val();\n\t\t\tvar selectedText = selectedOption ? selectedOption == 'reset' ? null : $(selectedOption.target).text() : inputText.val();\n\t\t\tvar selectedLimit = selectedOption ? selectedOption == 'reset' ? null : $(selectedOption.target).data(\"limit\") !== 'undefined' ? $(selectedOption.target).data('limit') : '' : '';\n\n\t\t\tif (selectedLimit)\n\t\t\t\t$('.js-atendees').attr('max', selectedLimit)\n\n\t\t\tinputText.val(selectedText).attr('data-value', selectedValue);\n\t\t\tinputHidden.val(selectedValue).trigger('change');\n\n\t\t\tif (inputHidden.val()) {\n\t\t\t\tself.element.find('.btn-remove-it').remove();\n\t\t\t\tself.element.addClass('has-value');\n\t\t\t\tself.vars.btnRemove = $(self.options.removeBtn).off('click').click(function() {\n\t\t\t\t\tinputHidden.val(null).trigger('change');\n\t\t\t\t\tinputText.val(null);\n\t\t\t\t\tself.updateValue('reset');\n\t\t\t\t});\n\n\t\t\t\tself.element.append(self.vars.btnRemove);\n\n\t\t\t\tinputHidden.valid();\n\t\t\t\tinputText.valid();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tself.element.removeClass('has-value');\n\t\t\t\tself.element.find('.btn-remove-it').remove();\n\t\t\t}\n\t\t},\n\t\t_destroy: function() {},\n\t\topen: function() {\n\t\t\tvar self = this;\n\t\t\tself.element.addClass(\"opened\");\n\t\t\tself.redraw();\n\t\t\tself.element.find(self.options.text).focus();\n\t\t},\n\n\t\tclose: function() {\n\t\t\tvar self = this;\n\t\t\tself.element.removeClass(\"opened\");\n\t\t},\n\n\t\tredraw: function() {\n\t\t\tvar self = this;\n\t\t\t//console.log('redraw');\n\t\t\tself.element.find(self.options.optionsList).width(self.element.find(self.options.text).width() + 2);\n\t\t},\n\t\tpopulate: function() {\n\t\t\tvar self = this;\n\t\t\tself.element.find(self.options.optionsList).empty();\n\n\t\t\t//------------------- hide-option-if algorithm ---------------\n\t\t\tvar hideOptionIf = self.element.data('hide-option-if');\n\t\t\tvar optionValue = null;\n\t\t\tvar hideOption = false;\n\t\t\tif (hideOptionIf) {\n\t\t\t\t//{\"complaint\":{\"userType\":\"is-not-customer\"}}\n\t\t\t\toptionValue = Object.keys(hideOptionIf) && Object.keys(hideOptionIf).length > 0 ? Object.keys(hideOptionIf)[0] : null; //complaint\n\t\t\t\tvar condition = optionValue ? hideOptionIf[optionValue] : null;\n\t\t\t\tvar inputControllerName = condition && Object.keys(condition) && Object.keys(condition).length > 0 ? Object.keys(condition)[0] : null; //userType\n\t\t\t\t//$('[name=' + inputControllerName + ']').change(function () {\n\t\t\t\t// console.log(this);\n\t\t\t\t//});\n\t\t\t\tvar inputControllerTargetValue = condition ? condition[inputControllerName] : null; //is-not-customer\n\t\t\t\tvar inputControllerValue = $.getFieldFormValue(self.element.closest('form'), inputControllerName); //(currentValue)\n\n\t\t\t\thideOption = inputControllerTargetValue == inputControllerValue;\n\t\t\t}\n\t\t\tself.updateValue();\n\t\t\t//----------------------------------------------------------------\n\n\t\t\t$.each(self.element.data('json'), function(index, item) {\n\t\t\t\tif (!(hideOption && item.value == optionValue)) { //hide-option-if algorithm : CONDITION\n\t\t\t\t\t//self.reset();\n\t\t\t\t\tvar option = $('