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) {
15 if ($('#updatehome').is(':checked')) {
16 var lonlat = getEventPosition(e);
18 $('#homerow').removeClass();
19 $('#home_lat').val(lonlat.lat);
20 $('#home_lon').val(lonlat.lon);
23 removeMarkerFromMap(marker);
26 marker = addMarkerToMap(lonlat);
30 addMarkerToMap(new OpenLayers.LonLat(params.lon, params.lat), null, params.marker.description);
32 $("[data-user]").each(function () {
33 var user = $(this).data('user');
34 if (user.lon && user.lat) {
35 var icon = OpenLayers.Marker.defaultIcon();
36 icon.url = OpenLayers.Util.getImageLocation(user.icon);
37 addMarkerToMap(new OpenLayers.LonLat(user.lon, user.lat), icon, user.description);