if (typeof(unsafeWindow) == 'undefined') unsafeWindow = window;
+String.prototype.ltrim = function() { return this.replace(/^\s+/,'') };
+String.prototype.rtrim = function() { return this.replace(/\s+$/,'') };
+String.prototype.trim = function() { return this.ltrim().rtrim() };
+
(function () {
/* replace the non-standard startDownload() behavior with standard XMLHttpRequest */
var param = nodes[i];
var match = /^(\d+)-Label$/.exec(param.name);
if (match) {
- ops[parseFloat(match[1])-1] = {label: param.value, entry: []};
+ ops[parseFloat(match[1])-1] = {label: param.value.trim(), entry: []};
continue;
}
match = /^(\d+)-Entry(\d+)$/.exec(param.name);
if (match) {
- ops[parseFloat(match[1])-1].entry[parseFloat(match[2]-1)] = {label: param.value};
+ ops[parseFloat(match[1])-1].entry[parseFloat(match[2]-1)] = {label: param.value.trim()};
continue;
}
match = /^(\d+)-URL(\d+)$/.exec(param.name);
menu.appendChild(document.createElement('li'));
var item = menu.lastChild;
item.id = ops[i].label.replace(/\./g,'').replace(/\W/g,'-').toLowerCase();
- item.appendChild(document.createTextNode(ops[i].label));
+ item.appendChild(document.createElement('p'));
+ item.lastChild.appendChild(document.createTextNode(ops[i].label));
item.appendChild(document.createElement('ul'));
+ item = item.lastChild;
for (var j = 0; j < ops[i].entry.length; ++j) {
item.appendChild(document.createElement('li'));
- item = item.lastChild;
- // item.id = ops[i].entry[j].label.replace(/\./g,'').replace(/\W/g,'-').toLowerCase();
- item.appendChild(document.createElement('a'));
- item = item.lastChild;
- item.href = ops[i].entry[j].url;
- item.appendChild(document.createTextNode(ops[i].entry[j].label));
+ item.lastChild.appendChild(document.createElement('a'));
+ link = item.lastChild.lastChild;
+ link.href = ops[i].entry[j].url;
+ link.appendChild(document.createTextNode(ops[i].entry[j].label));
}
}
pnode.appendChild(menu);
}
}
+ /* Styling for the menu */
+ /* we could grab most of these from the params to the java applet, but I'm too lazy to write that code for now */
+ /* TODO: metal effect */
+ style = '#hypermenu { font-family: Dialog, sans-serif; font-size: 12px; list-style-type: none; text-align: left; background-color: #e2e2e2; margin:0 auto; padding:0;width: 100%}';
+ style += '#hypermenu > li { margin:0; padding:0}';
+ style += '#hypermenu > li > p { font-weight: bold; background-color: #284828; margin:0; padding: 6px 0 6px 3px; }';
+ style += '#hypermenu > li > p:hover { color: #00FF00; }';
+ style += '#hypermenu ul { color:black; font-weight:normal; list-style-type: none; margin:0; padding:0; background-color: #C0C0C0}';
+ style += '#hypermenu ul > li { padding: 3px}';
+ style += '#hypermenu ul > li:hover { color: #CC0000; font-weight: bold}';
+ style += '#hypermenu a { color:inherit; text-decoration:none }' ;
+
+ /* rolling effect */
+ style += '#hypermenu > li > p { border: 1px solid gray }';
+ style += '#hypermenu > li > ul {display:none}';
+ style += '#hypermenu > li:hover > ul {display:block}';
+
+ stel = unsafeWindow.document.createElement('style');
+ stel.appendChild(document.createTextNode(style));
+ unsafeWindow.document.getElementsByTagName('head')[0].appendChild(stel);
+
+
})();