/*
 * jQuery SimpleBlock Plugin
 *
 * version: 1.1
 * author: Anton Lindqvist <anton@qvister.se>
 * url: http://qvister.se
 *
 * Examples and documentation: http://github.com/mptre/jquery-simpleblock/
 */

(function($) {
    $.fn.simpleBlock = function(duration) {
        var off, h, w, t;

        $(this).each(function() {
            t = this;
            off = $(this).offset();
            h = $(this).outerHeight();
            w = $(this).outerWidth();

            $(this).after(
                $('<div></div>')
                    .css({
                        'height': h,
                        'width': w,
                        'position': 'absolute',
                        'top': off.top,
                        'left': off.left,
                        'z-index': 9999
                    })
                    .addClass('simpleBlock')
            );

            if (duration) {
                setTimeout(function() { $(t).simpleUnBlock(); }, duration);
            }
        });
    };
    $.fn.simpleUnBlock = function() {
        $(this).next('.simpleBlock').remove();
    };
})(jQuery);
