/*!
 * jQuery defaultValue plugin
 * Examples and documentation at: http://github.com/boltbrasil/jquery-defaultValue
 * Copyright (c) 2011 Lucas Mezêncio
 * Version: 1.0
 * Licensed under GPLv3 license.
 * http://jquery.malsup.com/license.html
 * Requires: jQuery v1.6.2 or later
 */
;(function($) {
    $.fn.defaultValue = function(opts) {
        if (!this.length) {
            return false;
        }
        
        /**
         * @todo Falta implementar algumas opções, tais como um default direto pelo jQuery
         */
        var settings = {}
        
        return this.each(function() {
            var $elem = $(this);
            
            if (opts) {
                $.extend(settings, opts);
            }
            
            $elem
                .focus(function() {
                    if ($(this).val() != '' && $(this).val() == this.defaultValue) {
                        $(this).val('');
                    }
                })
                .focusout(function() {
                    if ($(this).val() == '') {
                        $(this).val(this.defaultValue);
                    }
                });
        });
    }
})(jQuery);
