Clusterer=function(A){this.map=A;this.markers=[];this.clusters=[];this.timeout=null;this.currentZoomLevel=A.getZoom();this.maxVisibleMarkers=Clusterer.defaultMaxVisibleMarkers;this.gridSize=Clusterer.defaultGridSize;this.minMarkersPerCluster=Clusterer.defaultMinMarkersPerCluster;this.maxLinesPerInfoBox=Clusterer.defaultMaxLinesPerInfoBox;this.icon=Clusterer.defaultIcon;GEvent.addListener(A,"zoomend",Clusterer.MakeCaller(Clusterer.Display,this));GEvent.addListener(A,"moveend",Clusterer.MakeCaller(Clusterer.Display,this));GEvent.addListener(A,"infowindowclose",Clusterer.MakeCaller(Clusterer.PopDown,this));};Clusterer.defaultMaxVisibleMarkers=150;Clusterer.defaultGridSize=5;Clusterer.defaultMinMarkersPerCluster=5;Clusterer.defaultMaxLinesPerInfoBox=10;Clusterer.defaultIcon=new GIcon();Clusterer.defaultIcon.image="http://www.acme.com/resources/images/markers/blue_large.PNG";Clusterer.defaultIcon.shadow="http://www.acme.com/resources/images/markers/shadow_large.PNG";Clusterer.defaultIcon.iconSize=new GSize(30,51);Clusterer.defaultIcon.shadowSize=new GSize(56,51);Clusterer.defaultIcon.iconAnchor=new GPoint(13,34);Clusterer.defaultIcon.infoWindowAnchor=new GPoint(13,3);Clusterer.defaultIcon.infoShadowAnchor=new GPoint(27,37);Clusterer.prototype.SetIcon=function(A){this.icon=A;};Clusterer.prototype.SetMaxVisibleMarkers=function(A){this.maxVisibleMarkers=A;};Clusterer.prototype.SetMinMarkersPerCluster=function(A){this.minMarkersPerCluster=A;};Clusterer.prototype.SetMaxLinesPerInfoBox=function(A){this.maxLinesPerInfoBox=A;};Clusterer.prototype.AddMarker=function(A,C,B){if(A.setMap!=null){A.setMap(this.map);}A.title=C;A.onMap=false;A.p_id=B;this.markers.push(A);this.DisplayLater();};Clusterer.prototype.IsMarker=function(B){var A=clusterer.getFirstMarker();while(A!=null){if(A.p_id==B){return true;}A=clusterer.getNextMarker();}return false;};Clusterer.prototype.RemoveMarker=function(B){for(var E=0;E<this.markers.length;++E){if(this.markers[E]==B){if(B.onMap){this.map.removeOverlay(B);}for(var D=0;D<this.clusters.length;++D){var A=this.clusters[D];if(A!=null){for(var C=0;C<A.markers.length;++C){if(A.markers[C]==B){A.markers[C]=null;--A.markerCount;break;}}if(A.markerCount==0){this.ClearCluster(A);this.clusters[D]=null;}else{if(A==this.poppedUpCluster){Clusterer.RePop(this);}}}}this.markers[E]=null;break;}}this.DisplayLater();};Clusterer.prototype.DisplayLater=function(){if(this.timeout!=null){clearTimeout(this.timeout);}this.timeout=setTimeout(Clusterer.MakeCaller(Clusterer.Display,this),50);};Clusterer.Display=function(Q){var S,R,J,T;clearTimeout(Q.timeout);var F=Q.map.getZoom();if(F!=Q.currentZoomLevel){for(S=0;S<Q.clusters.length;++S){if(Q.clusters[S]!=null){Q.ClearCluster(Q.clusters[S]);Q.clusters[S]=null;}}Q.clusters.length=0;Q.currentZoomLevel=F;}var I=Q.map.getBounds();var O=I.getSouthWest();var H=I.getNorthEast();var M=H.lng()-O.lng();var L=H.lat()-O.lat();if(M<300&&L<150){M*=0.1;L*=0.1;I=new GLatLngBounds(new GLatLng(O.lat()-L,O.lng()-M),new GLatLng(H.lat()+L,H.lng()+M));}var N=[];var K=[];for(S=0;S<Q.markers.length;++S){J=Q.markers[S];if(J!=null){if(I.contains(J.getPoint())){N.push(J);}else{K.push(J);}}}for(S=0;S<K.length;++S){J=K[S];if(J.onMap){Q.map.removeOverlay(J);J.onMap=false;}}for(S=0;S<Q.clusters.length;++S){T=Q.clusters[S];if(T!=null&&!I.contains(T.marker.getPoint())&&T.onMap){Q.map.removeOverlay(T.marker);T.onMap=false;}}if(N.length>Q.maxVisibleMarkers){var P=I.getNorthEast().lat()-I.getSouthWest().lat();var C=P/Q.gridSize;var E=C/Math.cos((I.getNorthEast().lat()+I.getSouthWest().lat())/2*Math.PI/180);for(var G=I.getSouthWest().lat();G<=I.getNorthEast().lat();G+=C){for(var U=I.getSouthWest().lng();U<=I.getNorthEast().lng();U+=E){T=new Object();T.clusterer=Q;T.bounds=new GLatLngBounds(new GLatLng(G,U),new GLatLng(G+C,U+E));T.markers=[];T.markerCount=0;T.onMap=false;T.marker=null;Q.clusters.push(T);}}for(S=0;S<N.length;++S){J=N[S];if(J!=null&&!J.inCluster){for(R=0;R<Q.clusters.length;++R){T=Q.clusters[R];if(T!=null&&T.bounds.contains(J.getPoint())){T.markers.push(J);++T.markerCount;J.inCluster=true;}}}}for(S=0;S<Q.clusters.length;++S){if(Q.clusters[S]!=null&&Q.clusters[S].markerCount<Q.minMarkersPerCluster){Q.ClearCluster(Q.clusters[S]);Q.clusters[S]=null;}}for(S=Q.clusters.length-1;S>=0;--S){if(Q.clusters[S]!=null){break;}else{--Q.clusters.length;}}for(S=0;S<Q.clusters.length;++S){T=Q.clusters[S];if(T!=null){for(R=0;R<T.markers.length;++R){J=T.markers[R];if(J!=null&&J.onMap){Q.map.removeOverlay(J);J.onMap=false;}}}}for(S=0;S<Q.clusters.length;++S){T=Q.clusters[S];if(T!=null&&T.marker==null){var A=0,D=0;for(R=0;R<T.markers.length;++R){J=T.markers[R];if(J!=null){A+=(+J.getPoint().lng());D+=(+J.getPoint().lat());}}var B=new GLatLng(D/T.markerCount,A/T.markerCount);J=new GMarker(B,{icon:Q.icon});T.marker=J;GEvent.addListener(J,"click",Clusterer.MakeCaller(Clusterer.PopUp,T));}}}for(S=0;S<N.length;++S){J=N[S];if(J!=null&&!J.onMap&&!J.inCluster){Q.map.addOverlay(J);if(J.addedToMap!=null){J.addedToMap();}J.onMap=true;}}for(S=0;S<Q.clusters.length;++S){T=Q.clusters[S];if(T!=null&&!T.onMap&&I.contains(T.marker.getPoint())){Q.map.addOverlay(T.marker);T.onMap=true;}}Clusterer.RePop(Q);};Clusterer.PopUp=function(A){var C=A.clusterer;var E='<table width="300">';var G=0;t_Bounds=map.getBounds();min_lat=min_lng=100;max_lat=max_lng=0;for(var D=0;D<A.markers.length;++D){var B=A.markers[D];if(B!=null){min_lat=Math.min(min_lat,B.getLatLng().lat());min_lng=Math.min(min_lng,B.getLatLng().lng());max_lat=Math.max(max_lat,B.getLatLng().lat());max_lng=Math.max(max_lng,B.getLatLng().lng());}}for(var D=0;D<A.markers.length;++D){var B=A.markers[D];if(B!=null){++G;E+="<tr><td>";B.title=G+". "+B.title.substring(0,B.title.indexOf("<br>"))+" "+B.title.substring(B.title.lastIndexOf("<br>")+4);E+=B.title+"</td></tr>";f_(B.profil_id,5);if(G==C.maxLinesPerInfoBox-1&&A.markerCount>C.maxLinesPerInfoBox){var F=new GLatLngBounds(new GLatLng(min_lat,min_lng),new GLatLng(max_lat,max_lng));canter=F.getCenter();E+='<tr><td colspan="2">...und '+(A.markerCount-G)+" <a href=\"javascript:map.setCenter(new GLatLng('"+canter.lat()+"','"+canter.lng()+"'),"+map.getBoundsZoomLevel(F)+');">noch</td></tr>';break;}}}E+="</table>";C.map.closeInfoWindow();A.marker.openInfoWindowHtml(E);C.poppedUpCluster=A;};Clusterer.RePop=function(A){if(A.poppedUpCluster!=null){Clusterer.PopUp(A.poppedUpCluster);}};Clusterer.PopDown=function(A){A.poppedUpCluster=null;};Clusterer.prototype.ClearCluster=function(A){var C,B;for(C=0;C<A.markers.length;++C){if(A.markers[C]!=null){A.markers[C].inCluster=false;A.markers[C]=null;}}A.markers.length=0;A.markerCount=0;if(A==this.poppedUpCluster){this.map.closeInfoWindow();}if(A.onMap){this.map.removeOverlay(A.marker);A.onMap=false;}};Clusterer.MakeCaller=function(B,A){return function(){B(A);};};GMarker.prototype.setMap=function(A){this.map=A;};GMarker.prototype.addedToMap=function(){this.map=null;};GMarker.prototype.origOpenInfoWindow=GMarker.prototype.openInfoWindow;GMarker.prototype.openInfoWindow=function(B,A){if(this.map!=null){return this.map.openInfoWindow(this.getPoint(),B,A);}else{return this.origOpenInfoWindow(B,A);}};GMarker.prototype.origOpenInfoWindowHtml=GMarker.prototype.openInfoWindowHtml;GMarker.prototype.openInfoWindowHtml=function(A,B){if(this.map!=null){return this.map.openInfoWindowHtml(this.getPoint(),A,B);}else{return this.origOpenInfoWindowHtml(A,B);}};GMarker.prototype.origOpenInfoWindowTabs=GMarker.prototype.openInfoWindowTabs;GMarker.prototype.openInfoWindowTabs=function(B,A){if(this.map!=null){return this.map.openInfoWindowTabs(this.getPoint(),B,A);}else{return this.origOpenInfoWindowTabs(B,A);}};GMarker.prototype.origOpenInfoWindowTabsHtml=GMarker.prototype.openInfoWindowTabsHtml;GMarker.prototype.openInfoWindowTabsHtml=function(A,B){if(this.map!=null){return this.map.openInfoWindowTabsHtml(this.getPoint(),A,B);}else{return this.origOpenInfoWindowTabsHtml(A,B);}};GMarker.prototype.origShowMapBlowup=GMarker.prototype.showMapBlowup;GMarker.prototype.showMapBlowup=function(A){if(this.map!=null){this.map.showMapBlowup(this.getPoint(),A);return true;}else{return this.origShowMapBlowup(A);}};Clusterer.prototype.getFirstMarker=function(){var B=getClustererMarkerCount(this);for(var A=0;A<B;A++){if(this.markers[A]){this.cursor=A;return this.markers[A];}}return null;};Clusterer.prototype.getNextMarker=function(){var B=getClustererMarkerCount(this);if(B>0){if(this.cursor>=0){for(var A=this.cursor+1;A<B;A++){if(this.markers[A]){this.cursor=A;return this.markers[A];}}}}return null;};function getClustererMarkerCount(A){if(A.markers){return A.markers.length;}return 0;}Clusterer.prototype.deleteAllMarkers=function(){var A=this.getFirstMarker();while(A!=null){clusterer.RemoveMarker(A);A=clusterer.getFirstMarker();}};