var GoogleMapEditor=Class.create();GoogleMapEditor.prototype={initialize:function(b,d,c){this.mapcontainer=$(b);Event.observe(window,"resize",function(){this.centreAndZoom();}.bind(this));if(GBrowserIsCompatible()){this.map=new GMap2(this.mapcontainer);this.map.addControl(new GSmallMapControl());this.map.addControl(new GMapTypeControl());this.map.setCenter(new GLatLng(0,0),0);this.bounds=new GLatLngBounds();Event.observe(window,"unload",function(){GUnload();});}else{alert("Google Maps not supported on this browser.");return false;}Event.observe(document,"tab:click",function(){this.centreAndZoom();}.bind(this));this.map.setMapType(G_HYBRID_MAP);var a=new GLatLng(d,c);this.marker=new GMarker(a,{draggable:true});this.map.addOverlay(this.marker);this.bounds.extend(a);this.centreAndZoom();GEvent.addListener(this.marker,"dragend",this.onDragEnd.bindAsEventListener(this,this.marker));},centreAndZoom:function(){this.map.checkResize();this.map.setZoom(14);this.map.setCenter(this.bounds.getCenter());this.map.savePosition();},geocodePostcode:function(a){var b=new GlocalSearch();b.setSearchCompleteCallback(null,function(){if(b.results[0]){var d=b.results[0].lat;var e=b.results[0].lng;var c=new GLatLng(d,e);this.marker.setLatLng(c,13);this.bounds=new GLatLngBounds();this.bounds.extend(c);this.centreAndZoom();$("latitude").value=d;$("longitude").value=e;}}.bind(this));b.execute(a+", UK");},onDragEnd:function(b,a){var c=a.getLatLng();$("latitude").value=c.lat();$("longitude").value=c.lng();}};var mapObj;
