1 var searchBarExpanded = false;
2 /* our search selector boxes */
6 G.evt.common.init.push(searchBarInit);
9 /* if set by the org selector, this will be the location used the
10 next time the search is submitted */
11 var newSearchLocation;
13 function searchBarInit() {
15 /* ----------------------------------- */
16 //setActivateStyleSheet("color_test");
17 /* ----------------------------------- */
19 _ts = G.ui.searchbar.type_selector;
20 _ds = G.ui.searchbar.depth_selector;
21 _fs = G.ui.searchbar.form_selector;
23 G.ui.searchbar.text.focus();
24 G.ui.searchbar.text.onkeydown =
25 function(evt) {if(userPressedEnter(evt)) searchBarSubmit();};
27 G.ui.searchbar.submit.onclick = searchBarSubmit;
28 G.ui.searchbar.tag.onclick = searchBarToggle;
30 /* set up the selector objects, etc */
31 G.ui.searchbar.text.value = (getTerm() != null) ? getTerm() : "";
32 setSelector(_ts, getStype());
33 setSelector(_ds, getDepth());
34 setSelector(_fs, getForm());
35 G.ui.searchbar.location_tag.onclick = _opacHandleLocationTagClick;
38 function _opacHandleLocationTagClick() {
39 orgTreeSelector.openTo(
40 (newSearchLocation != null) ? parseInt(newSearchLocation) : getLocation(), true );
41 swapCanvas(G.ui.common.org_container);
44 function updateLoc(location, depth) {
45 if( location != null )
46 newSearchLocation = location;
48 setSelector(G.ui.searchbar.depth_selector, depth);
50 function searchBarSubmit() {
52 var text = G.ui.searchbar.text.value;
53 if(!text || text == "") return;
58 args[PARAM_OFFSET] = 0;
59 args[PARAM_TERM] = text;
60 args[PARAM_STYPE] = _ts.options[_ts.selectedIndex].value;
61 args[PARAM_LOCATION] = newSearchLocation;
62 args[PARAM_DEPTH] = parseInt(_ds.options[_ds.selectedIndex].value);
63 args[PARAM_FORM] = _fs.options[_fs.selectedIndex].value;
65 goTo(buildOPACLink(args));
69 function searchBarToggle() {
70 if(searchBarExpanded) {
71 hideMe(G.ui.searchbar.extra_row);
72 hideMe(G.ui.searchbar.tag_on);
73 unHideMe(G.ui.searchbar.tag_off);
75 unHideMe(G.ui.searchbar.extra_row);
76 hideMe(G.ui.searchbar.tag_off);
77 unHideMe(G.ui.searchbar.tag_on);
79 searchBarExpanded = !searchBarExpanded;