how to use settimeout for looping a function
<p>i have a slideshow with 4 pictures which has a pagination, now i want them to be show one by one in a loop, for looping i have this code:</p>

<pre><code>  function myfn(interaltime) {
  setTimeout('$("#picgallery_pagging li:eq(0)").trigger("click")', 0);
  setTimeout('$("#picgallery_pagging li:eq(1)").trigger("click")', interaltime);
  setTimeout('$("#picgallery_pagging li:eq(2)").trigger("click")', interaltime*2);
  setTimeout('$("#picgallery_pagging li:eq(3)").trigger("click")', interaltime*3);
  setTimeout('myfn('+interaltime+')',interaltime*4);
  };
  myfn(3000);  
</code></pre>

<p>my problem: it doesn't work properly and just runs it once and interaltime variable is empty in the second round</p>

<p>each button in pagination runs my custom function effect for showing the pic and as u see i have to trigger click function on each button on my pagination.(i dont know how to use delay in jquery with my own function)</p>

<p><strong>note</strong>: i checked intervaltime variable in console log and it was empty on the seconde turn! but i dont know how to fix it!<br>
<strong>edit</strong>: i used setInterval but still intercaltime variable was empty in the second ture</p>
