/*
#(c)#=====================================================================
#(c)#
#(c)# Copyright 2007 ExLibris Group
#(c)# All Rights Reserved
#(c)#
#(c)#=====================================================================
** Product : WebVoyage :: disable/enable limits on basic search, adjust search tips
** Version : 7.0
** Created : 23-JAN-2008
** Orig Author :
** Last Modified : 18-APR-2008
** Last Modified By : ASP
*/
//////////////////////////////////////////////////////////////////////
function updateSearchTip ()
{
// added to searchCode.onchange to customize search tip based on index
// save the defautl search tip the first time through
defaultTip = window.defaultTip ||
document.getElementById('customSearchTip').innerHTML;
currentSearchCode = document.getElementById('searchCode').value
switch (currentSearchCode)
{
case 'CMD':
case 'CMD*':
document.getElementById('customSearchTip').innerHTML = "build a simple Boolean search: <span class=\"example\">(cats or dogs) and therapy</span>"
break;
case 'NAME':
case 'AUTH':
case 'NKEY^':
document.getElementById('customSearchTip').innerHTML = "search for an author by keyword: <span class=\"example\">Joss Whedon</span>, or  <span class=\"example\">Darwin</span>"

break;
case 'CALL+':
document.getElementById('customSearchTip').innerHTML = "enter as much of the call number that you know: <span class=\"example\">PR 1297</span>"
break;
case 'JALL':
document.getElementById('customSearchTip').innerHTML = "Enter the title (or the start of the title ) of a Journal, Magazine or Newspaper: <span class=\"example\">New England Journal of Med</span>"
break;
case 'TALL':
document.getElementById('customSearchTip').innerHTML = "Enter the title (or the start of the title ) of a Book: <span class=\"example\">The Old Man and the Sea</span> or <span class=\"example\">The Lord of the</span>"
break;
case 'SUBJ@':
document.getElementById('customSearchTip').innerHTML = "search for a list of subject headings: <span class=\"example\">vampires</span>"
break;
case 'NAME@':
document.getElementById('customSearchTip').innerHTML = "search for a list of authors by keyword: <span class=\"example\">Mark Twain</span>"
break;
case 'AUTH@':
document.getElementById('customSearchTip').innerHTML = "enter terms which identify the author and title: <span class=\"example\">Mozart Sonatas violin</span>"
break;

default:
// use the default tip if not otherwise overridden
document.getElementById('customSearchTip').innerHTML = defaultTip;
}
}
function searchCodeChanged ()
{
/*
** Disable the limits drop for searches that do not support it.
*/
currentSearchCode = document.getElementById('searchCode').value.substring(0,4);
if (!document.getElementById('limitTo').disabled) {
currentLimit = document.getElementById('limitTo').value;
}
switch(currentSearchCode)
{
// OPAC HEADING INDEXES
case 'SUBJ':
case 'TITL':
case 'NAME':
case 'AUTH':
// MAIN CALL NUMBER INDEX
case 'CALL':
// JOURNAL INDEX WITH PRELIMITS
case 'JKEY':
case 'JALL':
// Other Indexes

document.getElementById('limitTo').value="none";
document.getElementById('limitTo').disabled=true;
break;
default:
document.getElementById('limitTo').disabled=false;
document.getElementById('limitTo').value=currentLimit;
}
}
function addSearchCodeChanged ()
{
document.getElementById('searchCode').onchange = function()
{searchCodeChanged(); updateSearchTip();}
// run the script to catch default index doesn't support limits or edit
search
searchCodeChanged ();
updateSearchTip();
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(addSearchCodeChanged);
