firefox issue with js slider
<p>I have this slider and it works fine in IE and chrome but has a problem in firefox, it loads all the picture one time but it does not go back again and load them, in the console i get this error
"SyntaxError: missing ] after element lis" in the line of  setTimeout(func,900)</p>

<p>this is the code</p>

<pre><code>function pic_loader() {
    //alert('s');
    var func = new function () {}
    $folder = $('#foldername').attr('value');
    $files = document.getElementById('filename').value;
    $num = document.getElementById('num').value;
    $filenames = $files.split("##");
    var $img = [];
    var $link = [];
    if ($num &gt; 1) {
        for ($i = 1; $i &lt;= $num; $i++) {
            $img[$i] = $folder + "/" + $filenames[$i];
            if ($i == 1) {
                $link[$i] = "&lt;img id='slide[" + $i + "]' width=380 src=" + $img[$i] + "&gt;";
                $("#load_here").append($link[$i]);
                $first = document.getElementById('slide[1]');
                $first.style.display = "none";
                $($first).fadeIn(800);
            } else {
                $link[$i] = "&lt;img id='slide[" + $i + "]' width=380 src=" + $img[$i] + " style='display:none'&gt;";
                $("#load_here").append($link[$i]);
            }

        }
        $i = 1;
        var $loop = setInterval(function () {
            //alert('x');
            $j = $i + 1;
            $current = document.getElementById('slide[' + ($i++) + ']');
            $next = document.getElementById('slide[' + ($j) + ']');
            $($current).fadeOut(800, function () {
                $($next).fadeIn(800);
            });
            if ($j &gt; $num) {
                $($next).fadeOut(800);
                setTimeout(func, 900);

                function func() {
                    clearInterval($loop);
                    $("#load_here").html("");
                    pic_loader();
                }

            }
        }, 4500);
    } else {
        $i = 1;
        $img[$i] = $folder + "/" + $filenames[$i];
        $link[$i] = "&lt;img id='slide[" + $i + "]' width=380 src=" + $img[$i] + "&gt;";
        $("#load_here").append($link[$i]);
    }
}
</code></pre>
