call to a function that changes picture every 2 seconds
<p>i have a picture and i want to change it every 2 seconds when my mouse is on it.
so i write:</p>

<pre><code>$("#profilePic").mouseover(function() {
    var t = setTimeout("pictureChanger()",2000);
});
</code></pre>

<p>and this is the function:</p>

<pre><code>function pictureChanger() {
    currentPicture++;
    currentPicture = currentPicture % NUM_PICTURES;
    $("#profilePic").src = pictures[currentPicture];
}
</code></pre>

<p>it doesn't work.. however when i write <code>$("#profilePic").src = pictures[currentPicture];</code> inside the function of <code>mouseover</code> it does replace the picture. so i guess the problem is with the function <code>pictureChanger</code>..
how to i fix it so that the function will replace my pictures?</p>

<p>thank you! </p>
