$.fn.disableButton = function()
{
    this.each(function() {

        if ($(this).data('buttonDataLink' + $(this).attr('id')) === undefined) {
            $(this).data('buttonDataLink' + $(this).attr('id'), $(this).attr('href'));
        }

        $(this).attr('href', '#');
        
        var events = [];
        if ($(this).data('events') !== undefined) {
            $($(this).data('events').click).each(function(){
                events.push(this.handler);
            });
        }

        if (events.length !== 0) {
            $(this).data('buttonDataEvents', events);
        }
        $(this).unbind();
    });
};

$.fn.enableButton = function()
{
    this.each(function() {

        $(this).attr('href', $(this).data('buttonDataLink' + $(this).attr('id')));
        $(this).removeData('buttonDataLink' + $(this).attr('id'));

        var events = $(this).data('buttonDataEvents');
        $(this).removeData('buttonDataEvents');
        if (events !== undefined && events.length > 0) {
            for(var i in events) {
                $(this).click(events[i]);
            }
        }
    });
};
