﻿/**
* jQuery resetDefaultValue plugin
* @version 0.9.1
* @author Leandro Vieira Pinho 
*/
jQuery.fn.resetDefaultValue = function() {
    function _clearDefaultValue() {
        var _$ = $(this);
        if (_$.val() == this.defaultValue) { _$.val('').removeClass( "disabled" ); }
    };
    function _resetDefaultValue() {
        var _$ = $(this);
        if (_$.val() == '') { _$.addClass( "disabled" ).val(this.defaultValue); }
    };
    
    $( this ).addClass( "disabled" );
    return this.click(_clearDefaultValue).focus(_clearDefaultValue).blur(_resetDefaultValue);
}
