-function updatelinks(lon,lat,zoom) {
- var links = new Array();
- links['viewanchor'] = '/index.html';
- //links['editanchor'] = 'edit.html';
- links['uploadanchor'] = '/traces';
- links['loginanchor'] = '/login.html';
- links['logoutanchor'] = '/logout.html';
- links['registeranchor'] = '/create-account.html';
-
- var node;
- var anchor;
- for (anchor in links) {
- node = document.getElementById(anchor);
- if (! node) { continue; }
- node.href = links[anchor] + "?lat=" + lat + "&lon=" + lon + "&zoom=" + zoom;
+//Called as the user scrolls/zooms around.
+//Maniplate hrefs of the view tab and various other links
+function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat) {
+ var decimals = Math.pow(10, Math.floor(zoom/3));
+ var node;
+
+ lat = Math.round(lat * decimals) / decimals;
+ lon = Math.round(lon * decimals) / decimals;
+
+ node = document.getElementById("permalinkanchor");
+ if (node) {
+ var args = getArgs(node.href);
+ args["lat"] = lat;
+ args["lon"] = lon;
+ args["zoom"] = zoom;
+ if (layers) {
+ args["layers"] = layers;
+ }
+ node.href = setArgs(node.href, args);
+ }
+
+ node = document.getElementById("viewanchor");
+ if (node) {
+ var args = getArgs(node.href);
+ args["lat"] = lat;
+ args["lon"] = lon;
+ args["zoom"] = zoom;
+ if (layers) {
+ args["layers"] = layers;
+ }
+ node.href = setArgs(node.href, args);
+ }
+
+ node = document.getElementById("exportanchor");
+ if (node) {
+ var args = getArgs(node.href);
+ args["lat"] = lat;
+ args["lon"] = lon;
+ args["zoom"] = zoom;
+ if (layers) {
+ args["layers"] = layers;