image slider that can adapt dynamically to the number of images in the array
<p>So i've found this script:</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
    &lt;title&gt;Simple Slide Show with jQuery&lt;/title&gt;
    &lt;script type='text/javascript'
    src='http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js'&gt;
    &lt;/script&gt;
    &lt;script type="text/javascript"&gt;
        var imgs = [
        'images/emo.jpg',
        'images/icon068.gif',
        'images/icon260.jpg'];
        var cnt = imgs.length;

        $(function() {
            setInterval(Slider, 3000);
        });

        function Slider() {
        $('#imageSlide').fadeOut("slow", function() {
           $(this).attr('src', imgs[(imgs.length++) % cnt]).fadeIn("slow");
        });
        }
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;img id="imageSlide" alt="" src="" /&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>which almost does it for me.</p>

<p>How can it be converted so the images are not hard coded but the script adapts dynamically to number of images? I intend to change slider images quite often - the number of images will not always be the same.</p>

<p>I'm no javascript expert so don't laugh if it's something simple.</p>
