clearTimeout on multiple references
<p>I have a set of complex setTimeout() calls that trigger some jQuery animations.
I would like to be able to clear them all without knowing their various refs.</p>

<p>This code will not work - but should illustrate what I'm trying to do...</p>

<pre><code>window.ref = [];
function doAnimation(i) {
    $('div').each(function(index) {
        window.ref.push(setTimeout('foo(index,i)',index*1000));
        window.ref.push(setTimeout('bar(index,i)',index*2000));
    });
}
</code></pre>

<p>Then clear them with</p>

<pre><code>clearTimeout(window.ref);
</code></pre>
