1 function updatelinks(lon,lat,zoom,layers) {
2 var links = new Object();
3 links['viewanchor'] = '/index.html';
4 //links['editanchor'] = 'edit.html';
5 links['uploadanchor'] = '/traces';
6 links['loginanchor'] = '/login.html';
7 links['logoutanchor'] = '/logout.html';
8 links['registeranchor'] = '/create-account.html';
12 for (anchor in links) {
13 node = document.getElementById(anchor);
14 if (! node) { continue; }
15 var args = getArgs(node.href);
19 args["layers"] = layers;
20 node.href = setArgs(node.href, args);
23 node = document.getElementById("editanchor");
26 var args = new Object();
30 node.href = setArgs("/edit.html", args);
31 node.style.fontStyle = 'normal';
33 node.href = 'javascript:alert("zoom in to edit map");';
34 node.style.fontStyle = 'italic';
39 function getArgs(url) {
40 var args = new Object();
41 var querystart = url.indexOf("?");
43 if (querystart >= 0) {
44 var querystring = url.substring(querystart + 1);
45 var queryitems = querystring.split("&");
47 for (var i = 0; i < queryitems.length; i++) {
48 if (match = queryitems[i].match(/^(.*)=(.*)$/)) {
49 args[unescape(match[1])] = unescape(match[2]);
51 args[unescape(queryitems[i])] = null
59 function setArgs(url, args) {
60 var queryitems = new Array();
64 if (args[arg] == null) {
65 queryitems.push(escape(arg));
67 queryitems.push(escape(arg) + "=" + escape(args[arg]));
71 return url.replace(/\?.*$/, "") + "?" + queryitems.join("&");