// JavaScript Document


  //Start up the tab box once the page loads.  Set a cookie, which expires in 30 days, to allow the tab box to have memory (i.e. to be sticky)
  
  $(document).ready(function(){
    $('#tabs > ul').tabs({ fx: { 
 opacity: "toggle" }, cookie: { expires: 30 } 
    }) ;
  });



// Adds text to the inbox telling the user how to search for authors
 function author(){
  $('#searcharg').val("Last Name, First Name");  
 }

function others()
{
var author = "Last Name, First Name";
//Makes sure that the user has entered text into the input before clearing it 
if ($('#searcharg').val()==author)
{
//If the input value is simply the string from author above, then clear it
 $('#searcharg').val(""); 
 }
 }



// Search 
function goSearch() {
        
  // catch empty search
  var nonEmpty = /\w+/;
nonEmpty.test(document.searchbox.qt.value);
  if(!nonEmpty.test(document.searchbox.qt.value)) {
     alert('Please supply a search term.');
         return false;
  }


//Wilson Search
//var searchurl="http://vnweb.hwwilsonweb.com.ezproxy.bu.edu/hww/jumpstart.jhtml?query=%3Cnear%3E%20%28"+document.searchbox.qt.value+"%29+%3Cin%3E+ALL&prod=ARTFT,ASTFT,BUSFT,EDUFT,GSFT,HUMFT,SSFT";
// window.open(searchurl);
// return false;
// }
 

var searchurl="http://find.galegroup.com.ezproxy.bu.edu/itx/quickSearch.do?userGroupName=mlin_b_bumml&searchType=BasicSearchForm&prodId=AONE&tabID=&searchId=&quickSearchTerm="+document.searchbox.qt.value;

 window.open(searchurl);
 return false;
 }




//Toggles List buttons, used on the Pardee top page and site index
function toggle(id){
    ul = "ul_" + id;
    img = "img_" + id;
    ulElement = document.getElementById(ul);
    imgElement = document.getElementById(img);
    if (ulElement){
            if (ulElement.className == 'closed'){
                    ulElement.className = "open";
                    imgElement.src="http://www.bu.edu/library/management/images/opened.gif";
                    }else{
                    ulElement.className = "closed";
                    imgElement.src="http://www.bu.edu/library/management/images/closed.gif";
                    }
            }
    }
