1 function updatelinks(lon,lat,zoom,layers) {
2 var decimals = Math.pow(10, Math.floor(zoom/3));
5 lat = Math.round(lat * decimals) / decimals;
6 lon = Math.round(lon * decimals) / decimals;
8 node = document.getElementById("permalinkanchor");
10 var args = getArgs(node.href);
15 args["layers"] = layers;
17 node.href = setArgs(node.href, args);
20 node = document.getElementById("viewanchor");
22 var args = getArgs(node.href);
27 args["layers"] = layers;
29 node.href = setArgs(node.href, args);
32 node = document.getElementById("editanchor");
35 var args = new Object();
39 node.href = setArgs("/edit.html", args);
40 node.style.fontStyle = 'normal';
42 node.href = 'javascript:alert("zoom in to edit map");';
43 node.style.fontStyle = 'italic';
48 function getArgs(url) {
49 var args = new Object();
50 var querystart = url.indexOf("?");
52 if (querystart >= 0) {
53 var querystring = url.substring(querystart + 1);
54 var queryitems = querystring.split("&");
56 for (var i = 0; i < queryitems.length; i++) {
57 if (match = queryitems[i].match(/^(.*)=(.*)$/)) {
58 args[unescape(match[1])] = unescape(match[2]);
60 args[unescape(queryitems[i])] = null
68 function setArgs(url, args) {
69 var queryitems = new Array();
73 if (args[arg] == null) {
74 queryitems.push(escape(arg));
76 queryitems.push(escape(arg) + "=" + escape(args[arg]));
80 return url.replace(/\?.*$/, "") + "?" + queryitems.join("&");
83 function getStyle(el, property) {
86 if (el.currentStyle) {
87 style = el.currentStyle[property];
88 } else if( window.getComputedStyle ) {
89 style = document.defaultView.getComputedStyle(el,null).getPropertyValue(property);
91 style = el.style[property];