(function($) {
    
    $.fn.defaultLabel = function(options) {
        var defaults = {
            
        };
        
        var opts = $.extend(defaults, options);
        
        return this.each(function() {
            var $this = $(this);
            /* Hide associated label and assign text to field */
            var $label = $('label[for='+this.id+']').hide();
            
            /* make a clone object (no name so it doesn't mess with existing forms) and replace the field.
               We use the input type="text" to allow for passwords. */
            var $clone = $('<input type="text" />');
            $clone.attr('class','defaultText tf').val($label.text()).insertAfter($this);
            
            $clone.focus(function() {
                $clone.hide();
                $this.show();
                $this.focus();
            });
             
            $this.blur(function() {
                if($this.val()=='') {
                    $clone.show();
                    $this.hide();
                } else {
                    $clone.hide();
                    $this.show();
                }
            });

            $this.blur();
        });
    }
    
})(jQuery);


