$(function(){
  wireUpFieldCleaner('#criteria', "search");
  wireUpFieldCleaner('#criteria2', "search");
});

// function that removes default text from an input box when focused
// and repopluates it when blurred if nothing has been entered
function wireUpFieldCleaner(fieldId, defaultValue) {
  $(fieldId).focus(function(){
    if ($(this).val() == defaultValue)
      $(this).val("");
  }).blur(function(){
    if ($(this).val() == "") {
      $(this).val(defaultValue);
    }
  });
}
