Replace Javascript click event with timed event?
<p>I've found some javascript code that layers photos on top of each other when you click on them.</p>

<p>Rather than having to click I'd like the function to automatically run every 5 seconds.  How can I change this event to a timed one:</p>

<pre><code>$('a#nextImage, #image img').click(function(event){ 
</code></pre>

<p>Full code below. Thanks</p>

<pre><code>$(document).ready(function() {
    $('#description').css({ 'display': 'block' });
    $('#image img').hover(
        function() { $(this).addClass('hover'); },
        function() { $(this).removeClass('hover'); }
    );

    $('a#nextImage, #image img').click(function(event) {
        event.preventDefault();
        $('#description p:first-child').css({ 'visibility': 'hidden' });
        if($('#image img.current').next().length) {
            $('#image img.current').removeClass('current').next().fadeIn('normal').addClass('current').css({ 'position': 'absolute' });
        }
        else{
            $('#image img').removeClass('current').css({ 'display': 'none' });
            $('#image img:first-child').fadeIn('normal').addClass('current').css({ 'position': 'absolute' });
        }

        if($('#image img.current').width() &gt;= ($('#page').width() - 100)) {
            xPos = 170;
        }
        else {
            do {
                xPos = 120 + (Math.floor(Math.random() * ($('#page').width() - 100)));
            } while(xPos + $('#image img.current').width() &gt; $('#page').width());
        }
        if($('#image img.current').height() &gt;= 300) {
            yPos = 0;
        }
        else{
            do {
                yPos = Math.floor(Math.random() * 300);
            } while(yPos + $('#image img.current').height() &gt; 300);
        }
        $('#image img.current').css({ 'left' :xPos, 'top' :yPos });
    });
});
</code></pre>
