- var palette = new Palette();
- palette.create(document, document.getElementById("optionsPalette"));
- palette.write(sample.options);
- palette.onchange = redraw;
- palette.filterBar.focus();
+ // Selector is the drop-down for selecting a set of data.
+
+ // Popupate the selector with the set of data samples
+ var selector = document.getElementById("selector").getElementsByTagName("select")[0];
+ for (var idx in Samples.data) {
+ var entry = Samples.data[idx];
+ var option = document.createElement("option");
+ option.value = entry.id;
+ option.textContent = entry.title;
+ selector.appendChild(option);
+ }
+ selector.onchange = function() {
+ var id = selector.options[selector.selectedIndex].value;
+ var url = document.URL;
+ var qmIndex = url.indexOf("?");
+ if (qmIndex >= 0) {
+ url = url.substring(0, qmIndex);
+ }
+ url = url + "?sample=" + id;
+ for (var idx in variables) {
+ if (idx != "sample") {
+ url = url + "&" + idx + "=" + variables[idx];
+ }
+ }
+ window.location = url;
+ }
+ selector.selectedIndex = sampleIndex;
+
+ // Palette contains the widget that builds options.
+ Index.palette = new MultiPalette();
+ Index.palette.create(document.getElementById("optionsPalette"));
+ Index.palette.write(sample.options);
+ Index.palette.onchange = redraw;
+ Index.palette.filterBar.focus();
+