IE7 - Prevent unresponsive script error
<p>The following code is used as a visual filter on an application I'm building.  Basically, when a user types something into the textbox with id 'filter', the code below runs to hide those that match. </p>

<pre><code>$('#filter').keyup(function() {
        delay(function(){
            $(".patient:not(:contains('" + $('#filter').val() + "'))").fadeOut();
            $(".patient:contains('" + $('#filter').val() + "')").fadeIn();
        }, 300 );
        });
</code></pre>

<p>The code works fine in Firefox and Chrome, but in IE7 two things happen that I don't like:-</p>

<p>1)  The selected divs dont fadeOut/In - they just appear..
2)  Occasionally, I get an error from IE that the script is taking too long and may become unresponsive.</p>

<p>In terms of problem 2 I've read that returning control to the browser (again maybe using a timeout) might prevent the issue but I'm not sure if this is possible using my code or how to do it. </p>

<p>Can you guys help?</p>

<p>(PS - for the record, I HAVE to use IE7 in my organisation.  Bad, I know, but I can do nothing about this, just in case your solutions involve changing browser :))</p>
