2 var searchBarExpanded = false;
12 function searchBarInit() {
14 getId(config.ids.searchbar.text).focus();
15 getId(config.ids.searchbar.text).onkeydown =
16 function(evt) {if(userPressedEnter(evt)) searchBarSubmit();};
17 getId(config.ids.searchbar.submit).onclick = searchBarSubmit;
19 searchBarTable = getId(config.ids.searchbar.table);
20 searchBarTagLink = getId(config.ids.searchbar.tag);
21 searchBarExtraRow = getId(config.ids.searchbar.extra_row);
22 searchBarMainRow = getId(config.ids.searchbar.main_row);
24 typeSelector = getId(config.ids.searchbar.type_selector);
25 depthSelector = getId(config.ids.searchbar.depth_selector);
26 formSelector = getId(config.ids.searchbar.form_selector);
28 searchBarTagLink.onclick = function(){searchBarToggle();}
30 /* set up the selector objects, etc */
33 getId(config.ids.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 = getId(config.ids.searchbar.text).value;
73 if(!text || text == "") return;
74 var type_s = getId(config.ids.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 addCSSClass(searchBarExtraRow,config.css.hide_me);
93 searchBarExpanded = false;
94 getId(config.ids.searchbar.tag_off).className = "show_me_inline";
95 getId(config.ids.searchbar.tag_on).className = "hide_me";
96 //SEARCHBAR_EXTRAS = 0; set cookie...
100 removeCSSClass(searchBarExtraRow,config.css.hide_me);
101 searchBarExpanded = true;
102 getId(config.ids.searchbar.tag_off).className = "hide_me";
103 getId(config.ids.searchbar.tag_on).className = "show_me_inline";
104 //SEARCHBAR_EXTRAS = 1; set cookie...