jQuery + setTimeout() + clearTimeout() not working in IE7 & 8
<p>This works in Firefox and Chrome but not in IE.</p>

<p>In Internet Explorer the timers are not being cleared out and it appears each time update_slideshow() is called a new timer is created.</p>

<pre><code>// slideshow params 
var currentSlide = 1;
var numSlides = 4;
var pause = false;

function pause_show(bool){
    pause = bool;
}

// transitions the slides 
function update_slideshow(slide){
    if(slide &gt; numSlides) slide = 1;

    //is user tyring to pause/play this slide
    if(currentSlide == slide){
        switch(pause){
            case false:
                $("#ssbut" + slide.toString()).removeClass('pause').addClass('play');
                pause = true;
            break;

            case true:
                $("#ssbut" + slide.toString()).removeClass('play').addClass('pause');
                pause = false;
            break;
        }
    }else{ //user clicked on a button other than the current slide's
        clearTimeout(slideTimer);
        function complete() {
            $("#slide" + slide.toString()).fadeIn(500, "linear");
            if(!pause)  
                $("#ssbut" + slide.toString()).removeClass('inactive').addClass('pause');
            else
                $("#ssbut" + slide.toString()).removeClass('inactive').addClass('play');
        }   
        $("#ssbut" + currentSlide.toString()).removeClass('play').addClass('inactive');
        $("#slide" + currentSlide.toString()).fadeOut(300, "linear", complete);

        currentSlide = slide;
        if (typeof(slideTimer) != 'undefined') clearTimeout(slideTimer);
        slideTimer = setTimeout("slideshow()",4000);
    }
}

function slideshow(){
    if (typeof(slideTimer) != 'undefined') clearTimeout(slideTimer);
    if(!pause){
        update_slideshow(currentSlide + 1);
    }
    slideTimer = setTimeout("slideshow()",4000);
}
var slideTimer = setTimeout("slideshow()",4000);
</code></pre>
