
(
  function(jQuery) {
    jQuery.fn.sneakytext = function(sneakytext,options) {
      // Build main options before element iteration...
      var opts = jQuery.extend({}, jQuery.fn.sneakytext.defaults, options);
      // Iterate and reformat each matched element...
      return this.each(function() {
        _this = jQuery(this);
        // Build element specific options...
        var o = jQuery.meta ? jQuery.extend({}, opts, _this.data()) : opts;
        // Make nifty effects happen...
        _this.data('st_default',sneakytext);
        st_set( _this );
        _this.focus( function() {
          if ( _this.data('st_empty') ) {
            st_unset( _this );
            _this.val('');
          }
        });
        _this.blur( function() {
          if ( _this.val().match(/\S/i) ) {
            // The user typed something here...
            st_unset( _this );
          } else {
            // The user left it blank...
            st_set( _this );
          }
        });
      });
      // Functions for setting the sneaky text back up...
      function st_set( element ) {
        element.data('st_empty',true);
        element.addClass('st_class');
        element.val(element.data('st_default'));
      };
      function st_unset( element ) {
        element.data('st_empty',false);
        element.removeClass('st_class');
      };
    }
  }
)
(jQuery);


