(function($) {
  $.fn.defaultText = function(text) {
    this.each( function() {
      var defText = text;
      if (this.nodeName == 'INPUT' && $(this).attr('type') == 'text') {
        if (typeof(defText) === 'undefined') {
          defText = $(this).val();
        }
        $(this).data('defaultText', defText);
        $(this).focus( function() {
          if ($(this).val() == $(this).data('defaultText')) {
            $(this).val('');
          }
        });
        $(this).blur( function() {
          if ($(this).val().match(/^\s*$/)) {
            $(this).val($(this).data('defaultText'));
          }
        });
      }
      return this;
    });
  };    
})(jQuery);

