(function($) {
    $.extend($, {fallingText2: function(str, opt, fn) {
        opt = opt || {};
        
        var
            h = opt["height"] || $(window).height(),
            f = (typeof opt["factor"]==='number') ? opt["factor"] : 3,
            fade = opt["fade"],
            off = opt["width"] || ($(window).width()/2)|0,
            body = $("body"),
            rnd = Math.random;
            
        for(var i=0; i<str.length; i++) {
            var div =$("<div/>")
                .appendTo(body)
                .html(str[i].replace(/ /, '&nbsp;'))
                .css({"position": "absolute", "top": "0px", "left": off+"px", "font-family": "Verdana", "font-size": "140px", "color": "#970000", "text-shadow": "#000000 3px 3px", "font-weight": "bold" });
            
            off += div.width();
            
            div.animate({
                "top": ((h-div.height())|0)+"px"
            }, (5*h+(rnd()*h*2) * f)|0, "easeOutBounce", function() {
                if(fade) {
                    $(this).fadeOut("slow", function() {
                        $(this).remove();
                        if($.isFunction(fn)) fn();
                    });
                }
                else
                    if($.isFunction(fn)) fn();
            });
        }
    }});
})
(jQuery)

