Trying to pass a selector but on second pass the object is passed
<p>I am trying to write a function to change the image every half second 10 iterations. On the last iteration the image src will be set to the actual value.  This works for the first loop but the first time the <code>setTimeout</code> fires it passes the <strong>object</strong> <code>mo456</code> instead of the <strong><em>string</em></strong>. I am using Firebug and the console shows: </p>

<p><img src="http://i.stack.imgur.com/y6LYo.gif" alt="enter image description here"></p>

<pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"&gt;&lt;/script&gt;
&lt;script&gt;
function loopMoHolder(lmc,thisMoDivID){
    ++lmc;
    ffRan = parseInt(Math.floor((Math.random()*10)+1));
    console.log(lmc);
    console.log(thisMoDivID);
    $('#'+thisMoDivID+' .moHolder .ffbg img').attr('src','/img/moMoniker/mo'+ffRan+'.png');

    if (lmc &lt;= 10) {
        setTimeout("loopMoHolder("+lmc+","+thisMoDivID+")" , 500); }
    else {
        $('#'+thisMoDivID+' .moHolder .ffbg img').attr('src','/img/moMoniker/mo10.png');
    }
    }
&lt;/script&gt;
</code></pre>

<p>this is the html</p>

<pre><code>&lt;div class="moHolder"&gt;
    &lt;div id='mo456' class="moCol ffbg"&gt;&lt;img src="/img/moMoniker/mo1.png"&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>I am sure the problem is the setTimeout line but I am unsure how to correct it.</p>
