/* Plugin to clear the specified input field. From
 * Based on http://plugins.jquery.com/project/smartFocus
 * but heavily modified by rgh. Licensed as the original
 * But given there's no licensing information on the site... */

(function ($) {
  $.extend($.fn, {
    smartFocus: function (options) {

      return this.each(function () {
        defaults = {blurClass: 'blur'};
        options = $.extend(defaults, options);

        input = $(this).addClass(options.blurClass);

        text = $(this).attr('title');
        input.val(text).focus(function(){
          if(input.val() == text){
            input.val('');
            input.removeClass('blur');
          }
        }).blur(function(){
          if(input.val() == ''){
            input.addClass('blur');
            input.val(text);
          }
        });
      });
    }
  });
})(jQuery);
