1 $(document).ready(function () {
4 function setLocation(e) {
7 var lonlat = getEventPosition(e);
9 $("#latitude").val(lonlat.lat);
10 $("#longitude").val(lonlat.lon);
13 removeMarkerFromMap(marker);
16 marker = addMarkerToMap(lonlat, null, I18n.t('diary_entry.edit.marker_text'));
19 $("#usemap").click(function (e) {
25 var params = $("#map").data();
26 var centre = new OpenLayers.LonLat(params.lon, params.lat);
27 var map = createMap("map");
29 setMapCenter(centre, params.zoom);
31 if ($("#latitude").val() && $("#longitude").val()) {
32 marker = addMarkerToMap(centre, null, I18n.t('diary_entry.edit.marker_text'));
35 map.events.register("click", map, setLocation);