2 var searchBarExpanded = false;
11 var orgTreeVisible = false;
13 /* if set by the org selector, this will be the location used the
14 next time the search is submitted */
15 var newSearchLocation;
17 function searchBarInit() {
19 G.ui.searchbar.text.focus();
20 G.ui.searchbar.text.onkeydown =
21 function(evt) {if(userPressedEnter(evt)) searchBarSubmit();};
22 G.ui.searchbar.submit.onclick = searchBarSubmit;
24 searchBarTable = G.ui.searchbar.table;
25 searchBarTagLink = G.ui.searchbar.tag;
26 searchBarExtraRow = G.ui.searchbar.extra_row;
27 searchBarMainRow = G.ui.searchbar.main_row;
29 typeSelector = G.ui.searchbar.type_selector;
30 depthSelector = G.ui.searchbar.depth_selector;
31 formSelector = G.ui.searchbar.form_selector;
33 searchBarTagLink.onclick = function(){searchBarToggle();}
35 /* set up the selector objects, etc */
38 G.ui.searchbar.text.value = t;
39 setSelector(typeSelector, getStype());
40 setSelector(depthSelector, getDepth());
41 setSelector(formSelector, getForm());
43 //typeSelector.onchange = function(){searchBarSelectorChanged("type");};
44 //depthSelector.onchange = function(){searchBarSelectorChanged("depth");};
45 //formSelector.onchange = function(){searchBarSelectorChanged("form");};
47 if(getSearchBarExtras()) searchBarToggle();
49 G.ui.searchbar.location_tag.onclick = function() {
50 if(orgTreeVisible) showCanvas();
51 else swapCanvas(G.ui.common.org_tree);
52 orgTreeVisible = !orgTreeVisible;
57 function searchBarSelectorChanged(type) {
63 args[PARAM_STYPE] = typeSelector.options[typeSelector.selectedIndex].value
67 args[PARAM_DEPTH] = parseInt(depthSelector.options[depthSelector.selectedIndex].value);
71 args[PARAM_FORM] = formSelector.options[formSelector.selectedIndex].value;
75 args[PARAM_OFFSET] = 0;
77 if(findCurrentPage() == MRESULT || findCurrentPage() == RRESULT )
78 goTo(buildOPACLink(args));
82 function searchBarSubmit() {
83 var text = G.ui.searchbar.text.value;
84 if(!text || text == "") return;
85 var type_s = G.ui.searchbar.type_selector;
89 args[PARAM_OFFSET] = 0;
90 args[PARAM_TERM] = text;
91 args[PARAM_STYPE] = type_s.options[type_s.selectedIndex].value;
92 args[PARAM_LOCATION] = newSearchLocation;
94 args[PARAM_DEPTH] = parseInt(depthSelector.options[depthSelector.selectedIndex].value);
95 args[PARAM_FORM] = formSelector.options[formSelector.selectedIndex].value;
96 goTo(buildOPACLink(args));
100 function searchBarToggle() {
102 if(searchBarExpanded) {
104 hideMe(searchBarExtraRow);
105 searchBarExpanded = false;
106 hideMe(G.ui.searchbar.tag_on);
107 unHideMe(G.ui.searchbar.tag_off);
108 //SEARCHBAR_EXTRAS = 0; set cookie...
112 removeCSSClass(searchBarExtraRow,config.css.hide_me);
113 searchBarExpanded = true;
114 hideMe(G.ui.searchbar.tag_off);
115 unHideMe(G.ui.searchbar.tag_on);
116 //SEARCHBAR_EXTRAS = 1; set cookie...