Raphael Bounce animation

http://stackoverflow.com/questions/10337743/why-arent-my-settimeouts-between-functions-working

by ryanwfiorini

HTML

<div id="bounce"></div>

JavaScript

Raphael("bounce", 640, 480, function () {
               var r = this,
                p =                 r.path("M0,77.255c0,0,269.393,37.431,412.96,247.653 c0,0,95.883-149.719,226.632-153.309").attr({stroke: "#666", opacity: .0, "stroke-width": 1}),
                len = p.getTotalLength(),
            e = r.circle(0, 0, 7).attr({stroke: "none", fill: "#000", opacity:0}).onAnimation(function () {
                    var t = this.attr("transform");
                });
            r.customAttributes.along = function (v) {
                var point = p.getPointAtLength(v * len);
                return {
                    transform: "t" + [point.x, point.y] + "r" + point.alpha
                };
            };
            e.attr({along: 0});
            
            var rotateAlongThePath = true;
            function fadecurve(ca,ba,aa,ab){
                ca.animate({opacity:1},2000);
                setTimeout(function(){fadeball(ba,aa,ab)},6000);
            }
            function fadeball(ba,aa,ab) {
                   ba.animate({opacity:1},400);
                setTimeout(function() {run(ba, aa,ab)},5000);
            }
            function run(ba,aa,ab) {
                   ba.animate({opacity:1},400);
                   ba.animate({along: aa}, ab, ">", function () {
                    ba.attr({along: aa});
                });
            }

            fadecurve(p,e,.9,500);
        });