3 function setLocation( e ) {
6 var lonlat = getEventPosition(e);
8 $("#latitude").val(lonlat.lat);
9 $("#longitude").val(lonlat.lon);
12 removeMarkerFromMap(marker);
15 marker = addMarkerToMap(lonlat, null, I18n.t('diary_entry.edit.marker_text'));
22 var params = $("#map").data();
23 var centre = new OpenLayers.LonLat(params.lon, params.lat);
24 var map = createMap("map");
26 setMapCenter(centre, params.zoom);
28 if ($("#latitude").val() && $("#longitude").val()) {
29 marker = addMarkerToMap(centre, null, I18n.t('diary_entry.edit.marker_text'));
32 map.events.register("click", map, setLocation);