jQuery.fn.placeholder = function(options) {

   options = jQuery.extend({
      className: 'placeholder'
   }, options);

   return this.each(function() {

      var $target = $(this);
      var placeholderValue = options.value || $target.attr('placeholder');

      var showPlaceholder = function() {
         if (!$target.val()) $target.addClass(options.className).val(placeholderValue);
      }

      var hidePlaceholder = function() {
         if ($target.val() == placeholderValue) $target.val('').removeClass(options.className);
      }

      if (!$target.val() || $target.val() == placeholderValue) $target.addClass(options.className);
      if ($target.hasClass(options.className)) $target.val(placeholderValue);

      $target.unbind('focus', this.hidePlaceholder).unbind('blur', this.showPlaceholder).focus(hidePlaceholder).blur(showPlaceholder).closest('form').submit(hidePlaceholder);

   });

}

jQuery.fn.selectable = function(options) {

   return this.each(function() {

      var $target = $(this);

      var selectContents = function() {
         $target.select();
      }

      $target.one('click', selectContents).blur(function() { $target.one('click', selectContents); });

   });

}
