jquery code explanation
<p>I have this code and I need an explanation on what it does:</p>

<pre><code>function delaymethod(settings) {
    settings.timeout = settings.timeout || 2000; 
    var start = new Date();

    var id = parent.setInterval(function () {
        if (settings.condition()) {
            parent.clearInterval(id);
            if (settings.success) {
                settings.success();
            }
        }

        var now = new Date();
        if (now - start &gt; settings.timeout) {
            parent.clearInterval(id);

            if (settings.fail) {
                settings.fail();
            } else if (settings.success) {
                settings.success();
            }
        }

    }, 200);

} 
</code></pre>
