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 = 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());
28 G.ui.searchbar.location_tag.onclick = _opacHandleLocationTagClick;
31 function _opacHandleLocationTagClick() {
32 orgTreeSelector.openTo(
33 (newSearchLocation != null) ? parseInt(newSearchLocation) : getLocation(), true );
34 swapCanvas(G.ui.common.org_container);
37 function updateLoc(location, depth) {
38 if( location != null )
39 newSearchLocation = location;
41 setSelector(G.ui.searchbar.depth_selector, depth);
43 function searchBarSubmit() {
45 var text = G.ui.searchbar.text.value;
46 if(!text || text == "") return;
51 args[PARAM_OFFSET] = 0;
52 args[PARAM_TERM] = text;
53 args[PARAM_STYPE] = _ts.options[_ts.selectedIndex].value;
54 args[PARAM_LOCATION] = newSearchLocation;
55 args[PARAM_DEPTH] = parseInt(_ds.options[_ds.selectedIndex].value);
56 args[PARAM_FORM] = _fs.options[_fs.selectedIndex].value;
58 goTo(buildOPACLink(args));
62 function searchBarToggle() {
63 if(searchBarExpanded) {
64 hideMe(G.ui.searchbar.extra_row);
65 hideMe(G.ui.searchbar.tag_on);
66 unHideMe(G.ui.searchbar.tag_off);
68 unHideMe(G.ui.searchbar.extra_row);
69 hideMe(G.ui.searchbar.tag_off);
70 unHideMe(G.ui.searchbar.tag_on);
72 searchBarExpanded = !searchBarExpanded;