variable reassignment problem in JS, braking my head trying to understand
<p>I'm building my own custom made image slideshow, here is a code so far:</p>

<pre><code>function slideSwitch() {
    var images = new Array('Aerodynamics.jpg','ABC_news.jpg','yep.jpg');
    var currentImage = 0; 
    var newImage = 'url(images/'+images[currentImage]+')';    
    $('.inner_img').css('background-image',newImage).animate({opacity:1.0},4000,function(){
        if (currentImage != images.length-1){
            currentImage++;
        } else {
            currentImage = 0;
        };
        $(this).animate({opacity:0.0},4000);
    });
};

function interval(){
    setInterval(slideSwitch,1000);
};

interval();
</code></pre>

<p>Problem is, when interval triggers slideSwitch() function again, the variable newImage holds with the same value when it triggered for the first time. Can you please tell me what am I doing wrong. I also tryed to place variables outside the function, gives me the same result. </p>
