// an object to hold the captured event
var eventObject;

// the text inside the search box
var searchBoxText;

// Attach the listener to the search box
if(window.addEventListener)
{
    window.addEventListener("load",searchBoxListener,true);
}
else
{
    window.attachEvent("onload",searchBoxListener);
}

// Add the onfocus and onblur elements for the search box
function searchBoxListener()
{
  var inputElement = document.getElementById("q");
  if(inputElement)
  {
    inputElement.onfocus = clearBox;
    inputElement.onblur = checkBoxClear;
  }
}

// Clear out any text the search box may have, and save it to add it back in later
function clearBox(){
  var query = document.getElementById("q");
  if(query.value.toString() == "Search George Fox" || query.value.toString() == "Search library site") {
    searchBoxText = query.value;
    query.value = "";
  }

}

// Check to see if the search box text should be added back to the search box
function checkBoxClear(){
  var query = document.getElementById("q");

  if(query.value.toString() == "") {
    query.value = searchBoxText;
  }
}