2 var searchBarExpanded = false;
12 function searchBarInit() {
14 G.ui.searchbar.text.focus();
15 G.ui.searchbar.text.onkeydown =
16 function(evt) {if(userPressedEnter(evt)) searchBarSubmit();};
17 G.ui.searchbar.submit.onclick = searchBarSubmit;
19 searchBarTable = G.ui.searchbar.table;
20 searchBarTagLink = G.ui.searchbar.tag;
21 searchBarExtraRow = G.ui.searchbar.extra_row;
22 searchBarMainRow = G.ui.searchbar.main_row;
24 typeSelector = G.ui.searchbar.type_selector;
25 depthSelector = G.ui.searchbar.depth_selector;
26 formSelector = G.ui.searchbar.form_selector;
28 searchBarTagLink.onclick = function(){searchBarToggle();}
30 /* set up the selector objects, etc */
33 G.ui.searchbar.text.value = t;
34 setSelector(typeSelector, getStype());
35 setSelector(depthSelector, getDepth());
36 setSelector(formSelector, getForm());
38 //typeSelector.onchange = function(){searchBarSelectorChanged("type");};
39 //depthSelector.onchange = function(){searchBarSelectorChanged("depth");};
40 //formSelector.onchange = function(){searchBarSelectorChanged("form");};
42 if(getSearchBarExtras()) searchBarToggle();
46 function searchBarSelectorChanged(type) {
52 args[PARAM_STYPE] = typeSelector.options[typeSelector.selectedIndex].value
56 args[PARAM_DEPTH] = parseInt(depthSelector.options[depthSelector.selectedIndex].value);
60 args[PARAM_FORM] = formSelector.options[formSelector.selectedIndex].value;
64 args[PARAM_OFFSET] = 0;
66 if(findCurrentPage() == MRESULT || findCurrentPage() == RRESULT )
67 goTo(buildOPACLink(args));
71 function searchBarSubmit() {
72 var text = G.ui.searchbar.text.value;
73 if(!text || text == "") return;
74 var type_s = G.ui.searchbar.type_selector;
78 args[PARAM_OFFSET] = 0;
79 args[PARAM_TERM] = text;
80 args[PARAM_STYPE] = type_s.options[type_s.selectedIndex].value;
82 args[PARAM_DEPTH] = parseInt(depthSelector.options[depthSelector.selectedIndex].value);
83 args[PARAM_FORM] = formSelector.options[formSelector.selectedIndex].value;
84 goTo(buildOPACLink(args));
88 function searchBarToggle() {
90 if(searchBarExpanded) {
92 hideMe(searchBarExtraRow);
93 searchBarExpanded = false;
94 G.ui.searchbar.tag_off.className = "show_me_inline";
95 hideMe(G.ui.searchbar.tag_on);
96 //SEARCHBAR_EXTRAS = 0; set cookie...
100 removeCSSClass(searchBarExtraRow,config.css.hide_me);
101 searchBarExpanded = true;
102 hideMe(G.ui.searchbar.tag_off);
103 G.ui.searchbar.tag_on.className = "show_me_inline";
104 //SEARCHBAR_EXTRAS = 1; set cookie...