(function($){
    /* Based on Ivan's code at:
    http://ihatecode.blogspot.com/2008/04/jquery-time-delay-event-binding-plugin.html
    and Erik Beeson's at:
    http://www.mail-archive.com/discuss@jquery.com/msg18931.html */
    
    $.fn.delay = function(options) {
        var timer = undefined, delay = function(event) {
            if (timer != undefined) {
                clearTimeout(timer);
            }
            timer = setTimeout(function() {
                timer = undefined;
                options.fn(event);
            }, options.delay);
        }
       
        return this.each(function() {
            $(this).bind(options.event, function(event) {
                delay(event);  
            });
        });
    };
})(jQuery);
