function MarkerClusterer(e,a,d){this.extend(MarkerClusterer,google.maps.OverlayView);this.map_=e;this.markers_=[];this.clusters_=[];this.sizes=[53,56,66,78,90];this.styles_=[];this.ready_=false;var b=d||{};this.gridSize_=b.gridSize||60;this.maxZoom_=b.maxZoom||null;this.styles_=b.styles||[];this.imagePath_=b.imagePath||this.MARKER_CLUSTER_IMAGE_PATH_;this.imageExtension_=b.imageExtension||this.MARKER_CLUSTER_IMAGE_EXTENSION_;this.zoomOnClick_=b.zoomOnClick||true;this.setupStyles_();this.setMap(e);this.prevZoom_=this.map_.getZoom();var c=this;google.maps.event.addListener(this.map_,"zoom_changed",function(){var f=c.map_.maxZoom,g=c.map_.getZoom();if(g<0||g>f)return;if(c.prevZoom_!=g){c.prevZoom_=c.map_.getZoom();c.resetViewport()}});google.maps.event.addListener(this.map_,"idle",function(){c.redraw()});if(a&&a.length)this.addMarkers(a,false)};MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m";MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_="png";MarkerClusterer.prototype.extend=function(b,a){return(function(c){for(property in c.prototype)this.prototype[property]=c.prototype[property];return this}).apply(b,[a])};MarkerClusterer.prototype.onAdd=function(){this.setReady_(true)};MarkerClusterer.prototype.idle=function(){};MarkerClusterer.prototype.draw=function(){};MarkerClusterer.prototype.setupStyles_=function(){for(var b=0,a;a=this.sizes[b];b++)this.styles_.push({url:this.imagePath_+(b+1)+"."+this.imageExtension_,height:a,width:a})};MarkerClusterer.prototype.setStyles=function(a){this.styles_=a};MarkerClusterer.prototype.getStyles=function(){return this.styles_};MarkerClusterer.prototype.isZoomOnClick=function(){return this.zoomOnClick_};MarkerClusterer.prototype.getMarkers=function(){return this.markers_};MarkerClusterer.prototype.getTotalMarkers=function(){return this.markers_};MarkerClusterer.prototype.setMaxZoom=function(a){this.maxZoom_=a};MarkerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_||this.map_.mapTypes[this.map_.getMapTypeId()].maxZoom};MarkerClusterer.prototype.calculator_=function(e,d){var a=0,c=e.length,b=c;while(b!==0){b=parseInt(b/10,10);a++};a=Math.min(a,d);return{text:c,index:a}};MarkerClusterer.prototype.setCalculator=function(a){this.calculator_=a};MarkerClusterer.prototype.getCalculator=function(){return this.calculator_};MarkerClusterer.prototype.addMarkers=function(d,c){for(var b=0,a;a=d[b];b++)this.pushMarkerTo_(a);if(!c)this.redraw()};MarkerClusterer.prototype.pushMarkerTo_=function(a){a.setVisible(false);a.setMap(null);a.isAdded=false;if(a.draggable){var b=this;google.maps.event.addListener(a,"dragend",function(){a.isAdded=false;b.resetViewport();b.redraw()})};this.markers_.push(a)};MarkerClusterer.prototype.addMarker=function(a,b){this.pushMarkerTo_(a);if(!b)this.redraw()};MarkerClusterer.prototype.removeMarker=function(b){var c=-1;if(this.markers_.indexOf){c=this.markers_.indexOf(b)}else for(var d=0,a;a=this.markers_[d];d++)if(a==b){c=d;continue};if(c==-1)return false;this.markers_.splice(c,1);b.setVisible(false);b.setMap(null);this.resetViewport();this.redraw();return true};MarkerClusterer.prototype.setReady_=function(a){if(!this.ready_){this.ready_=a;this.createClusters_()}};MarkerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length};MarkerClusterer.prototype.getMap=function(){return this.map_};MarkerClusterer.prototype.setMap=function(a){this.map_=a};MarkerClusterer.prototype.getGridSize=function(){return this.gridSize_};MarkerClusterer.prototype.setGridSize=function(a){this.gridSize_=a};MarkerClusterer.prototype.getExtendedBounds=function(e){var c=this.getProjection(),f=new google.maps.LatLng(e.getNorthEast().lat(),e.getNorthEast().lng()),h=new google.maps.LatLng(e.getSouthWest().lat(),e.getSouthWest().lng()),d=c.fromLatLngToDivPixel(f);d.x+=this.gridSize_;d.y-=this.gridSize_;var b=c.fromLatLngToDivPixel(h);b.x-=this.gridSize_;b.y+=this.gridSize_;var g=c.fromDivPixelToLatLng(d),a=c.fromDivPixelToLatLng(b);e.extend(g);e.extend(a);return e};MarkerClusterer.prototype.isMarkerInBounds_=function(a,b){return b.contains(a.getPosition())};MarkerClusterer.prototype.clearMarkers=function(){this.resetViewport();this.markers_=[]};MarkerClusterer.prototype.resetViewport=function(){for(var c=0,a;a=this.clusters_[c];c++)a.remove();for(var c=0,b;b=this.markers_[c];c++){b.isAdded=false;b.setMap(null);b.setVisible(false)};this.clusters_=[]};MarkerClusterer.prototype.redraw=function(){this.createClusters_()};MarkerClusterer.prototype.createClusters_=function(){if(!this.ready_)return;var c=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast()),g=this.getExtendedBounds(c);for(var e=0,b;b=this.markers_[e];e++){var f=false;if(!b.isAdded&&this.isMarkerInBounds_(b,g)){for(var d=0,a;a=this.clusters_[d];d++)if(!f&&a.getCenter()&&a.isMarkerInClusterBounds(b)){f=true;a.addMarker(b);break};if(!f){var a=new Cluster(this);a.addMarker(b);this.clusters_.push(a)}}}}
function Cluster(a){this.markerClusterer_=a;this.map_=a.getMap();this.gridSize_=a.getGridSize();this.center_=null;this.markers_=[];this.bounds_=null;this.clusterIcon_=new ClusterIcon(this,a.getStyles(),a.getGridSize())};Cluster.prototype.isMarkerAlreadyAdded=function(b){if(this.markers_.indexOf){return this.markers_.indexOf(b)!=-1}else for(var c=0,a;a=this.markers_[c];c++)if(a==b)return true;return false};Cluster.prototype.addMarker=function(a){if(this.isMarkerAlreadyAdded(a))return false;if(!this.center_){this.center_=a.getPosition();this.calculateBounds_()};if(this.markers_.length==0){a.setMap(this.map_);a.setVisible(true)}else if(this.markers_.length==1){this.markers_[0].setMap(null);this.markers_[0].setVisible(false)};a.isAdded=true;this.markers_.push(a);this.updateIcon();return true};Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_};Cluster.prototype.getBounds=function(){this.calculateBounds_();return this.bounds_};Cluster.prototype.remove=function(){this.clusterIcon_.remove();delete this.markers_};Cluster.prototype.getCenter=function(){return this.center_};Cluster.prototype.calculateBounds_=function(){var a=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(a)};Cluster.prototype.isMarkerInClusterBounds=function(a){return this.bounds_.contains(a.getPosition())};Cluster.prototype.getMap=function(){return this.map_};Cluster.prototype.updateIcon=function(){var e=this.map_.getZoom(),f=this.markerClusterer_.getMaxZoom();if(e>f){for(var c=0,a;a=this.markers_[c];c++){a.setMap(this.map_);a.setVisible(true)};return};if(this.markers_.length<2){this.clusterIcon_.hide();return};var d=this.markerClusterer_.getStyles().length,b=this.markerClusterer_.getCalculator()(this.markers_,d);this.clusterIcon_.setCenter(this.center_);this.clusterIcon_.setSums(b);this.clusterIcon_.show()}
function ClusterIcon(a,c,b){a.getMarkerClusterer().extend(ClusterIcon,google.maps.OverlayView);this.styles_=c;this.padding_=b||0;this.cluster_=a;this.center_=null;this.map_=a.getMap();this.div_=null;this.sums_=null;this.visible_=false;this.setMap(this.map_)};ClusterIcon.prototype.triggerClusterClick=function(){var a=this.cluster_.getMarkerClusterer();google.maps.event.trigger(a,"clusterclick",[this.cluster_]);if(a.isZoomOnClick()){this.map_.panTo(this.cluster_.getCenter());this.map_.fitBounds(this.cluster_.getBounds())}};ClusterIcon.prototype.onAdd=function(){this.div_=document.createElement("DIV");if(this.visible_){var c=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(c);this.div_.innerHTML=this.sums_.text};var a=this.getPanes();a.overlayImage.appendChild(this.div_);var b=this;google.maps.event.addDomListener(this.div_,"click",function(){b.triggerClusterClick()})};ClusterIcon.prototype.getPosFromLatLng_=function(b){var a=this.getProjection().fromLatLngToDivPixel(b);a.x-=parseInt(this.width_/2,10);a.y-=parseInt(this.height_/2,10);return a};ClusterIcon.prototype.draw=function(){if(this.visible_){var a=this.getPosFromLatLng_(this.center_);this.div_.style.top=a.y+"px";this.div_.style.left=a.x+"px"}};ClusterIcon.prototype.hide=function(){if(this.div_)this.div_.style.display="none";this.visible_=false};ClusterIcon.prototype.show=function(){if(this.div_){var a=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(a);this.div_.style.display=""};this.visible_=true};ClusterIcon.prototype.remove=function(){this.setMap(null)};ClusterIcon.prototype.onRemove=function(){if(this.div_&&this.div_.parentNode){this.hide();this.div_.parentNode.removeChild(this.div_);this.div_=null}};ClusterIcon.prototype.setSums=function(a){this.sums_=a;this.text_=a.text;this.index_=a.index;if(this.div_)this.div_.innerHTML=a.text;this.useStyle()};ClusterIcon.prototype.useStyle=function(){var a=Math.max(0,this.sums_.index-1);a=Math.min(this.styles_.length-1,a);var b=this.styles_[a];this.url_=b.url;this.height_=b.height;this.width_=b.width;this.textColor_=b.opt_textColor;this.anchor=b.opt_anchor;this.textSize_=b.opt_textSize};ClusterIcon.prototype.setCenter=function(a){this.center_=a};ClusterIcon.prototype.createCss=function(d){var c=[];if(document.all){c.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'+this.url_+'");')}else c.push("background:url("+this.url_+");");if(typeof this.anchor_==="object"){if(typeof this.anchor_[0]==="number"&&this.anchor_[0]>0&&this.anchor_[0]<this.height_){c.push("height:"+(this.height_-this.anchor_[0])+"px; padding-top:"+this.anchor_[0]+"px;")}else c.push("height:"+this.height_+"px; line-height:"+this.height_+"px;");if(typeof this.anchor_[1]==="number"&&this.anchor_[1]>0&&this.anchor_[1]<this.width_){c.push("width:"+(this.width_-this.anchor_[1])+"px; padding-left:"+this.anchor_[1]+"px;")}else c.push("width:"+this.width_+"px; text-align:center;")}else c.push("height:"+this.height_+"px; line-height:"+this.height_+"px; width:"+this.width_+"px; text-align:center;");var a=this.textColor_?this.textColor_:"black",b=this.textSize_?this.textSize_:11;c.push("cursor:pointer; top:"+d.y+"px; left:"+d.x+"px; color:"+a+"; position:absolute; font-size:"+b+"px; font-family:Arial,sans-serif; font-weight:bold");return c.join("")};window.MarkerClusterer=MarkerClusterer;MarkerClusterer.prototype.addMarker=MarkerClusterer.prototype.addMarker;MarkerClusterer.prototype.addMarkers=MarkerClusterer.prototype.addMarkers;MarkerClusterer.prototype.clearMarkers=MarkerClusterer.prototype.clearMarkers;MarkerClusterer.prototype.getCalculator=MarkerClusterer.prototype.getCalculator;MarkerClusterer.prototype.getGridSize=MarkerClusterer.prototype.getGridSize;MarkerClusterer.prototype.getMap=MarkerClusterer.prototype.getMap;MarkerClusterer.prototype.getMarkers=MarkerClusterer.prototype.getMarkers;MarkerClusterer.prototype.getMaxZoom=MarkerClusterer.prototype.getMaxZoom;MarkerClusterer.prototype.getStyles=MarkerClusterer.prototype.getStyles;MarkerClusterer.prototype.getTotalClusters=MarkerClusterer.prototype.getTotalClusters;MarkerClusterer.prototype.getTotalMarkers=MarkerClusterer.prototype.getTotalMarkers;MarkerClusterer.prototype.redraw=MarkerClusterer.prototype.redraw;MarkerClusterer.prototype.removeMarker=MarkerClusterer.prototype.removeMarker;MarkerClusterer.prototype.resetViewport=MarkerClusterer.prototype.resetViewport;MarkerClusterer.prototype.setCalculator=MarkerClusterer.prototype.setCalculator;MarkerClusterer.prototype.setGridSize=MarkerClusterer.prototype.setGridSize;MarkerClusterer.prototype.onAdd=MarkerClusterer.prototype.onAdd;MarkerClusterer.prototype.draw=MarkerClusterer.prototype.draw;MarkerClusterer.prototype.idle=MarkerClusterer.prototype.idle;ClusterIcon.prototype.onAdd=ClusterIcon.prototype.onAdd;ClusterIcon.prototype.draw=ClusterIcon.prototype.draw;ClusterIcon.prototype.onRemove=ClusterIcon.prototype.onRemove
function InfoBox(a){a=a||{};google.maps.OverlayView.apply(this,arguments);this.content_=a.content||"";this.disableAutoPan_=a.disableAutoPan||false;this.maxWidth_=a.maxWidth||0;this.pixelOffset_=a.pixelOffset||new google.maps.Size(0,0);this.position_=a.position||new google.maps.LatLng(0,0);this.zIndex_=a.zIndex||null;this.boxClass_=a.boxClass||"infoBox";this.boxStyle_=a.boxStyle||{};this.closeBoxMargin_=a.closeBoxMargin||"2px";this.closeBoxURL_=a.closeBoxURL||"http://www.google.com/intl/en_us/mapfiles/close.gif";if(a.closeBoxURL==="")this.closeBoxURL_="";this.infoBoxClearance_=a.infoBoxClearance||new google.maps.Size(1,1);this.isHidden_=a.isHidden||false;this.pane_=a.pane||"floatPane";this.enableEventPropagation_=a.enableEventPropagation||false;this.div_=null;this.closeListener_=null;this.eventListener1_=null;this.eventListener2_=null;this.eventListener3_=null;this.contextListener_=null;this.fixedWidthSet_=null};InfoBox.prototype=new google.maps.OverlayView();InfoBox.prototype.createInfoBoxDiv_=function(){var d,a=this,b=function(f){f.cancelBubble=true;if(f.stopPropagation)f.stopPropagation()},c=function(f){f.returnValue=false;if(f.preventDefault)f.preventDefault();if(!a.enableEventPropagation_)b(f)};if(!this.div_){this.div_=document.createElement("div");this.setBoxStyle_();if(typeof this.content_.nodeType==="undefined"){this.div_.innerHTML=this.getCloseBoxImg_()+this.content_}else{this.div_.innerHTML=this.getCloseBoxImg_();this.div_.appendChild(this.content_)};this.getPanes()[this.pane_].appendChild(this.div_);this.addClickHandler_();if(this.div_.style.width){this.fixedWidthSet_=true}else if(this.maxWidth_!==0&&this.div_.offsetWidth>this.maxWidth_){this.div_.style.width=this.maxWidth_;this.div_.style.overflow="auto";this.fixedWidthSet_=true}else{d=this.getBoxWidths_();this.div_.style.width=(this.div_.offsetWidth-d.left-d.right)+"px";this.fixedWidthSet_=false};this.panBox_(this.disableAutoPan_);if(!this.enableEventPropagation_){this.eventListener1_=google.maps.event.addDomListener(this.div_,"mousedown",b);this.eventListener2_=google.maps.event.addDomListener(this.div_,"click",b);this.eventListener3_=google.maps.event.addDomListener(this.div_,"dblclick",b)};this.contextListener_=google.maps.event.addDomListener(this.div_,"contextmenu",c);google.maps.event.trigger(this,"domready")}};InfoBox.prototype.getCloseBoxImg_=function(){var a="";if(this.closeBoxURL_!==""){a="<img";a+=" src='"+this.closeBoxURL_+"'";a+=" align=right";a+=" style='";a+=" position: absolute;";a+=" top: 0px;";a+=" right: 0px;";a+=" cursor: pointer;";a+=" margin: "+this.closeBoxMargin_+";";a+="'>"};return a};InfoBox.prototype.addClickHandler_=function(){var a;if(this.closeBoxURL_!==""){a=this.div_.firstChild;this.closeListener_=google.maps.event.addDomListener(a,"click",this.getCloseClickHandler_())}else this.closeListener_=null};InfoBox.prototype.getCloseClickHandler_=function(){var a=this;return function(b){b.cancelBubble=true;if(b.stopPropagation)b.stopPropagation();a.close();google.maps.event.trigger(a,"closeclick")}};InfoBox.prototype.panBox_=function(a){if(!a){var z=this.getMap(),g=z.getBounds(),t=z.getDiv(),v=t.offsetWidth,s=t.offsetHeight,A=g.toSpan(),u=A.lng(),k=A.lat(),n=u/v,j=k/s,i=g.getSouthWest().lng(),p=g.getNorthEast().lng(),y=g.getNorthEast().lat(),d=g.getSouthWest().lat(),B=this.position_,h=this.pixelOffset_.width,f=this.pixelOffset_.height,o=this.infoBoxClearance_.width,m=this.infoBoxClearance_.height,b=B.lng()+(h-o)*n,e=B.lng()+(h+this.div_.offsetWidth+o)*n,r=B.lat()-(f-m)*j,l=B.lat()-(f+this.div_.offsetHeight+m)*j,q=(b<i?i-b:0)+(e>p?p-e:0),x=(r>y?y-r:0)+(l<d?d-l:0);if(!(x===0&&q===0)){var w=z.getCenter();z.panTo(new google.maps.LatLng(w.lat()-x,w.lng()-q))}}};InfoBox.prototype.setBoxStyle_=function(){var a,b;if(this.div_){this.div_.className=this.boxClass_;this.div_.style.cssText="";b=this.boxStyle_;for(a in b)if(b.hasOwnProperty(a))this.div_.style[a]=b[a];if(typeof this.div_.style.opacity!=="undefined")this.div_.style.filter="alpha(opacity="+(this.div_.style.opacity*100)+")";this.div_.style.position="absolute";this.div_.style.visibility="hidden";if(this.zIndex_!==null)this.div_.style.zIndex=this.zIndex_}};InfoBox.prototype.getBoxWidths_=function(){var a,c={top:0,bottom:0,left:0,right:0},b=this.div_;if(document.defaultView&&document.defaultView.getComputedStyle){a=b.ownerDocument.defaultView.getComputedStyle(b,"");if(a){c.top=parseInt(a.borderTopWidth,10)||0;c.bottom=parseInt(a.borderBottomWidth,10)||0;c.left=parseInt(a.borderLeftWidth,10)||0;c.right=parseInt(a.borderRightWidth,10)||0}}else if(document.documentElement.currentStyle)if(b.currentStyle){c.top=parseInt(b.currentStyle.borderTopWidth,10)||0;c.bottom=parseInt(b.currentStyle.borderBottomWidth,10)||0;c.left=parseInt(b.currentStyle.borderLeftWidth,10)||0;c.right=parseInt(b.currentStyle.borderRightWidth,10)||0};return c};InfoBox.prototype.onRemove=function(){if(this.div_){this.div_.parentNode.removeChild(this.div_);this.div_=null}};InfoBox.prototype.draw=function(){this.createInfoBoxDiv_();var a=this.getProjection().fromLatLngToDivPixel(this.position_);this.div_.style.left=(a.x+this.pixelOffset_.width)+"px";this.div_.style.top=(a.y+this.pixelOffset_.height)+"px";if(this.isHidden_){this.div_.style.visibility="hidden"}else this.div_.style.visibility="visible"};InfoBox.prototype.setOptions=function(a){if(typeof a.boxClass!=="undefined"){this.boxClass_=a.boxClass;this.setBoxStyle_()};if(typeof a.boxStyle!=="undefined"){this.boxStyle_=a.boxStyle;this.setBoxStyle_()};if(typeof a.content!=="undefined")this.setContent(a.content);if(typeof a.disableAutoPan!=="undefined")this.disableAutoPan_=a.disableAutoPan;if(typeof a.maxWidth!=="undefined")this.maxWidth_=a.maxWidth;if(typeof a.pixelOffset!=="undefined")this.pixelOffset_=a.pixelOffset;if(typeof a.position!=="undefined")this.setPosition(a.position);if(typeof a.zIndex!=="undefined")this.setZIndex(a.zIndex);if(typeof a.closeBoxMargin!=="undefined")this.closeBoxMargin_=a.closeBoxMargin;if(typeof a.closeBoxURL!=="undefined")this.closeBoxURL_=a.closeBoxURL;if(typeof a.infoBoxClearance!=="undefined")this.infoBoxClearance_=a.infoBoxClearance;if(typeof a.isHidden!=="undefined")this.isHidden_=a.isHidden;if(typeof a.enableEventPropagation!=="undefined")this.enableEventPropagation_=a.enableEventPropagation;if(this.div_)this.draw()};InfoBox.prototype.setContent=function(a){this.content_=a;if(this.div_){if(this.closeListener_){google.maps.event.removeListener(this.closeListener_);this.closeListener_=null};if(!this.fixedWidthSet_)this.div_.style.width="";if(typeof a.nodeType==="undefined"){this.div_.innerHTML=this.getCloseBoxImg_()+a}else{this.div_.innerHTML=this.getCloseBoxImg_();this.div_.appendChild(a)};if(!this.fixedWidthSet_){this.div_.style.width=this.div_.offsetWidth+"px";this.div_.innerHTML=this.getCloseBoxImg_()+a};this.addClickHandler_()};google.maps.event.trigger(this,"content_changed")};InfoBox.prototype.setPosition=function(a){this.position_=a;if(this.div_)this.draw();google.maps.event.trigger(this,"position_changed")};InfoBox.prototype.setZIndex=function(a){this.zIndex_=a;if(this.div_)this.div_.style.zIndex=a;google.maps.event.trigger(this,"zindex_changed")};InfoBox.prototype.getContent=function(){return this.content_};InfoBox.prototype.getPosition=function(){return this.position_};InfoBox.prototype.getZIndex=function(){return this.zIndex_};InfoBox.prototype.show=function(){this.isHidden_=false;this.div_.style.visibility="visible"};InfoBox.prototype.hide=function(){this.isHidden_=true;this.div_.style.visibility="hidden"};InfoBox.prototype.open=function(b,a){if(a)this.position_=a.getPosition();this.setMap(b);if(this.div_)this.panBox_()};InfoBox.prototype.close=function(){if(this.closeListener_){google.maps.event.removeListener(this.closeListener_);this.closeListener_=null};if(this.eventListener1_){google.maps.event.removeListener(this.eventListener1_);google.maps.event.removeListener(this.eventListener2_);google.maps.event.removeListener(this.eventListener3_);this.eventListener1_=null;this.eventListener2_=null;this.eventListener3_=null};if(this.contextListener_){google.maps.event.removeListener(this.contextListener_);this.contextListener_=null};this.setMap(null)};var browserName=navigator.appName,browserVer=parseInt(navigator.appVersion),version="",msie4=(browserName=="Microsoft Internet Explorer"&&browserVer>=4);if((browserName=="Netscape"&&browserVer>=3)||msie4||browserName=="Konqueror"||browserName=="Opera"){version="n3"}else version="n2"
function blurLink(theObject){if(msie4)theObject.blur()};if(typeof(tm)==="undefined"){tm={};tm.st=new Date().getTime();tm.id=3};
