jQuery slideshow
<p>I'm trying to make a jquery slideshow, the slide show has .click function, so basically if I click on the arrows it'll take me to the next slide or the previous, but I need to make it slide automatically if no one clicks, so I was just wondering if I can use a if statement so look if its clicked move to next slide if not do it automatically in 5 seconds,</p>

<p>thanks for the help</p>

<pre><code>// Create event listeners for .controls clicks
  jQuery('.control')
    .bind('click', function(){
    // Determine new position
      currentPosition = (jQuery(this).attr('id')=='right_arrow')
    ? currentPosition+1 : currentPosition-1;

      // Hide / show controls
      manageControls(currentPosition);
      // Move slideInner using margin-left

      jQuery('#slideInner').animate({
        'marginLeft' : slideWidth*(-currentPosition)
      });
    });

    var interval = setInterval(function() {

    // Move slideInner using margin-left
    jQuery('#slideInner').animate({
        'marginLeft' : slideWidth*(-currentPosition)
      });   
  },5000);

    currentPosition = currentPosition + 1;

    //clear the interval
    clear();

  function clear() {
    if(position==numberOfSlides-1) {
        clearInterval(interval);    
    }
   }

  // manageControls: Hides and shows controls depending on currentPosition
  function manageControls(position){
    // Hide left arrow if position is first slide
    if(position==0){ jQuery('#left_arrow').hide() }
    else{ jQuery('#left_arrow').show() }
    // Hide right arrow if position is last slide
    if(position==numberOfSlides-1){ jQuery('#right_arrow').hide() }
    else{ jQuery('#right_arrow').show() }
    }
  });
</code></pre>
