var marker;
function init(){
- var centre = lonLatToMercator(new OpenLayers.LonLat(<%= lon %>, <%= lat %>));
+ var centre = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
var zoom = <%= zoom %>;
<% if params['scale'] and params['scale'].length > 0 then %>
var map = createMap("map");
- map.setCenter(centre, zoom);
+ setMapCenter(centre, zoom);
<% if marker %>
- marker = addMarkerToMap(lonLatToMercator(new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>)), null, "Your location");
+ marker = addMarkerToMap(new OpenLayers.LonLat(<%= mlon %>, <%= mlat %>), null, "<%= t 'user.friend_map.your location' %>");
<% end %>
var near_icon = OpenLayers.Marker.defaultIcon();
near_icon.url = OpenLayers.Util.getImagesLocation() + "marker-green.png";;
var i = nearest.length;
while( i-- ) {
- var description = 'Nearby mapper: <a href="/user/'+nearest[i].display_name+'">'+nearest[i].display_name+'</a>'
- var nearmarker = addMarkerToMap(lonLatToMercator(new OpenLayers.LonLat(nearest[i].home_lon, nearest[i].home_lat)), near_icon.clone(), description);
+ var description = '<%= t 'user.friend_map.nearby mapper'%><a href="/user/'+nearest[i].display_name+'">'+nearest[i].display_name+'</a>'
+ var nearmarker = addMarkerToMap(new OpenLayers.LonLat(nearest[i].home_lon, nearest[i].home_lat), near_icon.clone(), description);
}
- map.events.register("click", map, setHome);
+ if (document.getElementById('updatehome')) {
+ map.events.register("click", map, setHome);
+ }
}
function setHome( e ) {
closeMapPopup();
if (document.getElementById('updatehome').checked) {
- var merc = map.getLonLatFromViewPortPx(e.xy);
- var lonlat = mercatorToLonLat(merc);
+ var lonlat = getEventPosition(e);
document.getElementById('homerow').className = '';
document.getElementById('home_lat').value = lonlat.lat;
removeMarkerFromMap(marker);
}
- marker = addMarkerToMap(merc, null, "Your location");
+ marker = addMarkerToMap(lonlat, null, "<%= t 'user.friend_map.your location' %>");
}
}