var GoogleMaps=new Class({mMap:null,mGClient:null,mZoom:12,mPointLocation:null,mDisplayInfo:null,mMarkers:{},initialize:function(A){this.mMap=new GMap2(A);this.mGClient=new GClientGeocoder();if(this.mMap){window.addEvent("unload",function(){GUnload()})}this.mMap.addControl(new GSmallMapControl())},findAddress:function(B,D,C){var A=B+" Polska";this.mGClient.getLatLng(A,function(E){if(!E){console.log("Nieznaleziono adresu: "+A);return }this.showAddress(E,D,C)}.bind(this))},showAddress:function(F,E,D){D=D||"red";var C=new GIcon(G_DEFAULT_ICON);C.iconSize=new GSize(32,32);C.image="http://www.google.com/intl/en_us/mapfiles/ms/micons/"+D+"-dot.png";var G={icon:C};console.log(F);this.mMap.setCenter(new GLatLng(F.y,F.x),this.mZoom);var A=new GLatLng(F.y,F.x);var B=new GMarker(this.mMap.getCenter(),G);GEvent.addListener(B,"click",this.fireEvent.bind(this,["pointClick",[A,E]]));this.mMarkers[E]=B;this.mMap.addOverlay(B)},showInfo:function(B){this.createMessage();var C=this.mMap.fromLatLngToContainerPixel(B);var A=this.mMap.fromContainerPixelToLatLng(new GPoint(C.x.toInt()+2,C.y.toInt()-29));this.mMap.openInfoWindow(A,this.createMessage())},createMessage:function(){var A=new Element("div");var B="";var C=new Hash(this.mDisplayInfo);C.each(function(D,E){if("header"==E){B+="<h3>"+D+"</h3>";return }B+="<b>"+E+"</b>: "+D+"<br/>"});A.setHTML(B);return A},getMarker:function(A){return this.mMarkers[A]||false},centerOnMarker:function(A){this.mMap.setCenter(A.getLatLng(),17)}});GoogleMaps.implement(new Events);
