1 var searchBarExpanded = false;
2 /* our search selector boxes */
6 /* if set by the org selector, this will be the location used the
7 next time the search is submitted */
10 function searchBarInit() {
12 _ts = G.ui.searchbar.type_selector;
13 _ds = G.ui.searchbar.depth_selector;
14 _fs = G.ui.searchbar.form_selector;
16 G.ui.searchbar.text.focus();
17 G.ui.searchbar.text.onkeydown =
18 function(evt) {if(userPressedEnter(evt)) searchBarSubmit();};
20 G.ui.searchbar.submit.onclick = searchBarSubmit;
21 G.ui.searchbar.tag.onclick = function(){searchBarToggle();}
23 /* set up the selector objects, etc */
24 G.ui.searchbar.text.value = (getTerm() != null) ? getTerm() : "";
25 setSelector(_ts, getStype());
26 setSelector(_ds, getDepth());
27 setSelector(_fs, getForm());
29 G.ui.searchbar.location_tag.onclick = function() {
30 orgTreeSelector.openTo(
31 (newSearchLocation != null) ? parseInt(newSearchLocation) : getLocation(), true );
32 swapCanvas(G.ui.common.org_container);
36 function updateLoc(location, depth) {
37 if( location != null )
38 newSearchLocation = location;
40 setSelector(G.ui.searchbar.depth_selector, depth);
42 function searchBarSubmit() {
44 var text = G.ui.searchbar.text.value;
45 if(!text || text == "") return;
50 args[PARAM_OFFSET] = 0;
51 args[PARAM_TERM] = text;
52 args[PARAM_STYPE] = _ts.options[_ts.selectedIndex].value;
53 args[PARAM_LOCATION] = newSearchLocation;
54 args[PARAM_DEPTH] = parseInt(_ds.options[_ds.selectedIndex].value);
55 args[PARAM_FORM] = _fs.options[_fs.selectedIndex].value;
57 goTo(buildOPACLink(args));
61 function searchBarToggle() {
62 if(searchBarExpanded) {
63 hideMe(G.ui.searchbar.extra_row);
64 hideMe(G.ui.searchbar.tag_on);
65 unHideMe(G.ui.searchbar.tag_off);
67 unHideMe(G.ui.searchbar.extra_row);
68 hideMe(G.ui.searchbar.tag_off);
69 unHideMe(G.ui.searchbar.tag_on);
71 searchBarExpanded = !searchBarExpanded;