-function init(){
- var params = $("#map").data();
+$(document).ready(function () {
var map = createMap("map");
- setMapCenter(new OpenLayers.LonLat(params.lon, params.lat), params.zoom);
+ if (OSM.home) {
+ setMapCenter(new OpenLayers.LonLat(OSM.home.lon, OSM.home.lat), 12);
+ } else {
+ setMapCenter(new OpenLayers.LonLat(0, 0), 0);
+ }
if ($("#map").hasClass("set_location")) {
var marker;
- if (params.marker) {
- marker = addMarkerToMap(new OpenLayers.LonLat(params.lon, params.lat));
+ if (OSM.home) {
+ marker = addMarkerToMap(new OpenLayers.LonLat(OSM.home.lon, OSM.home.lat));
}
map.events.register("click", map, function (e) {
- closeMapPopup();
-
- if (document.getElementById('updatehome').checked) {
+ if ($('#updatehome').is(':checked')) {
var lonlat = getEventPosition(e);
- document.getElementById('homerow').className = '';
- document.getElementById('home_lat').value = lonlat.lat;
- document.getElementById('home_lon').value = lonlat.lon;
+ $('#homerow').removeClass();
+ $('#home_lat').val(lonlat.lat);
+ $('#home_lon').val(lonlat.lon);
if (marker) {
removeMarkerFromMap(marker);
}
});
} else {
- addMarkerToMap(new OpenLayers.LonLat(params.lon, params.lat), null, params.marker.description);
-
$("[data-user]").each(function () {
var user = $(this).data('user');
if (user.lon && user.lat) {
}
});
}
-}
-
-window.onload = init;
+});