var map,geocoder;var e_currentZoom;var rID=0;var blowUps=new Array();var blueIcon;blueIcon=new GIcon();blueIcon.image="/bilder/markers/klein.png";blueIcon.iconSize=new GSize(24,32);blueIcon.iconAnchor=new GPoint(12,16);blueIcon.infoWindowAnchor=new GPoint(8,4);var clusterIcon;clusterIcon=new GIcon();clusterIcon.image="/bilder/markers/gross.png";clusterIcon.iconSize=new GSize(26,49);clusterIcon.shadowSize=new GSize(0,0);clusterIcon.iconAnchor=new GPoint(13,24);clusterIcon.infoWindowAnchor=new GPoint(10,4);var markerOptions={icon:blueIcon};function find_articles(A,B){$.ajax({type:"GET",url:"/get_markers.php",data:{leftlat:A.lat(),leftlng:A.lng(),rightlat:B.lat(),rightlng:B.lng(),rID:rID},success:function(C){json=JSON.parse(C);if(json.error=="error"){alert("wrong parameters");}else{if(json.points.length<1&&(e_currentZoom>1)){e_currentZoom=e_currentZoom-1;map.setZoom(e_currentZoom);find_articles(map.getBounds().getSouthWest(),map.getBounds().getNorthEast());}else{if(json.error=="debug"){alert(json.output);}else{deletehiddenMarkers();for(var D=0;D<json.points.length;D++){display_article(json.points[D]);}}}}},error:function(){}});}function deletehiddenMarkers(){e_currentBounds=map.getBounds();var A=clusterer.getFirstMarker();while(A!=null){pt=A.getPoint();if(e_currentBounds.containsLatLng(pt)!=true){clusterer.RemoveMarker(A);A=clusterer.getFirstMarker();}else{A=clusterer.getNextMarker();}}}function display_article(C){var A=new GLatLng(C.LAT,C.LNG);var B=new GMarker(A,markerOptions);if(B!=false){if(clusterer.IsMarker(C.id)){return true;}image="";if(C.bild){image='<img class="i" src="/images/mitte/'+C.bild+'">';i=new Image();i.src="/images/mitte/"+C.bild;}B.info=image+C.info+'<br><br><a target="_top" onclick="f_('+C.id+',4)" href="gotoprofil.php?id='+C.id+'">zur Detailansicht</a>';B.profil_id=C.id;GEvent.addListener(B,"click",function(){f_(this.profil_id,5);B.openInfoWindowHtml(this.info);});clusterer.AddMarker(B,C.info+'<br><a target="_top" onclick="f_('+C.id+',4)" href="gotoprofil.php?id='+C.id+'">zur Detailansicht</a>',C.id);}return true;}function map_initialize(){if((typeof GBrowserIsCompatible!="undefined")&&GBrowserIsCompatible()){map=new GMap2(document.getElementById("map"));map.enableScrollWheelZoom();mySetCenter();clusterer=new Clusterer(map);clusterer.SetMaxVisibleMarkers(100);clusterer.SetMinMarkersPerCluster(2);clusterer.SetMaxLinesPerInfoBox(10);clusterer.SetIcon(clusterIcon);map.addControl(new GSmallMapControl());e_currentZoom=map.getZoom();GEvent.addListener(map,"moveend",function(){find_articles(map.getBounds().getSouthWest(),map.getBounds().getNorthEast());});GEvent.trigger(map,"moveend");geocoder=new GClientGeocoder();}}function suchOrt(A){if(rID){clusterer.deleteAllMarkers();}if(A.indexOf("Germany")==-1){A="Germany, "+A;}rID=0;if(!map.isLoaded()){setTimeout(function(){"suchOrt('"+A+"')";},1000);return ;}if(geocoder){geocoder.getLatLng(A,function(B){if(B){map.setCenter(B,11);}});}}function showCat(A){clusterer.deleteAllMarkers();rID=A;$.ajax({type:"GET",url:"/get_bounds.php",data:{rID:rID},success:function(B){json=JSON.parse(B);if(json.error=="error"){alert("wrong parameters");}else{if(json.bounds&&json.bounds.length>0){bounds=new GLatLngBounds(new GLatLng(json.bounds[0][0],json.bounds[0][1]),new GLatLng(json.bounds[1][0],json.bounds[1][1]));map.setCenter(bounds.getCenter(),map.getBoundsZoomLevel(bounds));}}},error:function(){alert("Something went wrong...");}});}