1 function updatelinks(lon,lat,zoom) {
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 node.href = setArgs(node.href, args);
22 node = document.getElementById("editanchor");
25 var args = new Object();
29 node.href = setArgs("/edit.html", args);
30 node.style.fontStyle = 'normal';
32 node.href = 'javascript:alert("zoom in to edit map");';
33 node.style.fontStyle = 'italic';
38 function getArgs(url) {
39 var args = new Object();
40 var querystart = url.indexOf("?");
42 if (querystart >= 0) {
43 var querystring = url.substring(querystart + 1);
44 var queryitems = querystring.split("&");
46 for (var i = 0; i < queryitems.length; i++) {
47 if (match = queryitems[i].match(/^(.*)=(.*)$/)) {
48 args[unescape(match[1])] = unescape(match[2]);
50 args[unescape(queryitems[i])] = null
58 function setArgs(url, args) {
59 var queryitems = new Array();
63 if (args[arg] == null) {
64 queryitems.push(escape(arg));
66 queryitems.push(escape(arg) + "=" + escape(args[arg]));
70 return url.replace(/\?.*$/, "") + "?" + queryitems.join("&");