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("exportanchor");
34 var args = getArgs(node.href);
39 args["layers"] = layers;
41 node.href = setArgs(node.href, args);
44 node = document.getElementById("editanchor");
47 var args = new Object();
51 node.href = setArgs("/edit.html", args);
52 node.style.fontStyle = 'normal';
54 node.href = 'javascript:alert("zoom in to edit map");';
55 node.style.fontStyle = 'italic';
60 function getArgs(url) {
61 var args = new Object();
62 var querystart = url.indexOf("?");
64 if (querystart >= 0) {
65 var querystring = url.substring(querystart + 1);
66 var queryitems = querystring.split("&");
68 for (var i = 0; i < queryitems.length; i++) {
69 if (match = queryitems[i].match(/^(.*)=(.*)$/)) {
70 args[unescape(match[1])] = unescape(match[2]);
72 args[unescape(queryitems[i])] = null
80 function setArgs(url, args) {
81 var queryitems = new Array();
85 if (args[arg] == null) {
86 queryitems.push(escape(arg));
88 queryitems.push(escape(arg) + "=" + escape(args[arg]));
92 return url.replace(/\?.*$/, "") + "?" + queryitems.join("&");
95 function getStyle(el, property) {
98 if (el.currentStyle) {
99 style = el.currentStyle[property];
100 } else if( window.getComputedStyle ) {
101 style = document.defaultView.getComputedStyle(el,null).getPropertyValue(property);
103 style = el.style[property];