/* quickSearch.js
//   Detects the enter key for the Quick Search text box and 
//   effectively submits the data to the server.
//   Also check the "go" button and submits on that.
//   This script used in all pages.
//------------------------------------------------------------*/

function CheckEnter(e){
  var characterCode;
  if (e && e.which) {
    e = e;
    characterCode = e.which;
  }
	else {
    e = event;
    characterCode = e.keyCode;
  }	 
	 
  if (characterCode == 13) {
    SubmitQuickSearch();
  }
  return true
}

function SubmitQuickSearch() {  
  var mySid = document.getElementById("sid").value;
  var mySearchText = document.getElementById("searchText").value;
    
  if (mySearchText != '') 
    window.location.href = '/' + baseDir + '/search.cgi?sid=' + mySid + '&searchText=' + mySearchText;
  else 
    document.getElementById("searchText").focus();
  return false;
}


/* set focus on quick search box on Ctrl-S
----------------------------------------------*/
shortcut.add("Ctrl+S", function() {
  document.getElementById("searchText").focus();
});


