1 $(document).ready(function () {
2 var params = $("#map").data();
3 var map = createMap("map");
5 setMapCenter(new OpenLayers.LonLat(params.lon, params.lat), params.zoom);
7 if ($("#map").hasClass("set_location")) {
11 marker = addMarkerToMap(new OpenLayers.LonLat(params.lon, params.lat));
14 map.events.register("click", map, function (e) {
17 if ($('#updatehome').is(':checked')) {
18 var lonlat = getEventPosition(e);
20 $('#homerow').removeClass();
21 $('#home_lat').val(lonlat.lat);
22 $('#home_lon').val(lonlat.lon);
25 removeMarkerFromMap(marker);
28 marker = addMarkerToMap(lonlat);
32 addMarkerToMap(new OpenLayers.LonLat(params.lon, params.lat), null, params.marker.description);
34 $("[data-user]").each(function () {
35 var user = $(this).data('user');
36 if (user.lon && user.lat) {
37 var icon = OpenLayers.Marker.defaultIcon();
38 icon.url = OpenLayers.Util.getImageLocation(user.icon);
39 addMarkerToMap(new OpenLayers.LonLat(user.lon, user.lat), icon, user.description);