Latency problem on FF and safari and IE
<p>so i've build a function to scan a dir based on a $_GET var, the code:</p>

<pre><code>    $dir="img/".$_GET["gal"];
    $a=scandir($dir);
    $b=array_slice($a,2);


    for($i=1,$j=1;$i,$j&lt;=count($b);$i++,$j++){
    $marginRight=($i==6||$i==12||$i==18||$i==24||$i==30||$i==36)?"margin-right: 0":"margin-right: 13px";
    if($i&lt;10 &amp;&amp; $j&lt;10)
    echo '&lt;div class="GalThumbs" style="'.$marginRight.'"&gt;&lt;a href="'.$dir.'/'.$_GET["gal"].'-0'.$j.'.jpg"  rel="example3"&gt;&lt;img src="'.$dir.'/'.$_GET["gal"].'-0'.$i.'.jpg"/&gt;&lt;/a&gt;&lt;/div&gt;';
    else{
     echo '&lt;div class="GalThumbs" style="'.$marginRight.'"&gt;&lt;a href="'.$dir.'/'.$_GET["gal"].'-'.$j.'.jpg"  rel="example3"&gt;&lt;img src="'.$dir.'/'.$_GET["gal"].'-'.$i.'.jpg"/&gt;&lt;/a&gt;&lt;/div&gt;';
     }
   /* if($i==11)
    break;  */

}
</code></pre>

<p>if there are more than ten images to scan a latency occurs(redraw of the browser slowish)
i discover this using the commented: </p>

<pre><code>if($i==11)
    break;
</code></pre>

<p>if it's :</p>

<pre><code>  if($i==10)
        break;
</code></pre>

<p>there will be no latency. don't understand what's going on here..</p>
