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);
14 args["layers"] = layers;
15 node.href = setArgs(node.href, args);
18 node = document.getElementById("viewanchor");
20 var args = getArgs(node.href);
24 args["layers"] = layers;
25 node.href = setArgs(node.href, args);
28 node = document.getElementById("editanchor");
31 var args = new Object();
35 node.href = setArgs("/edit.html", args);
36 node.style.fontStyle = 'normal';
38 node.href = 'javascript:alert("zoom in to edit map");';
39 node.style.fontStyle = 'italic';
44 function getArgs(url) {
45 var args = new Object();
46 var querystart = url.indexOf("?");
48 if (querystart >= 0) {
49 var querystring = url.substring(querystart + 1);
50 var queryitems = querystring.split("&");
52 for (var i = 0; i < queryitems.length; i++) {
53 if (match = queryitems[i].match(/^(.*)=(.*)$/)) {
54 args[unescape(match[1])] = unescape(match[2]);
56 args[unescape(queryitems[i])] = null
64 function setArgs(url, args) {
65 var queryitems = new Array();
69 if (args[arg] == null) {
70 queryitems.push(escape(arg));
72 queryitems.push(escape(arg) + "=" + escape(args[arg]));
76 return url.replace(/\?.*$/, "") + "?" + queryitems.join("&");
79 function getStyle(el, property) {
82 if (el.currentStyle) {
83 style = el.currentStyle[property];
84 } else if( window.getComputedStyle ) {
85 style = document.defaultView.getComputedStyle(el,null).getPropertyValue(property);
87 style = el.style[property];