Incorrect usage of setTimeout?
<p>I've written a script that fires off 2 URLs based on some random number logic and I'm trying to set a delay before either one is fired (of half a second) but I don't think it's working properly. Am I doing this correctly? Code is below:</p>

<pre><code>var clicks  = "http://www.urlone.com";
var impressions = "http://www.urltwo.com";
var randomNumber = (Math.random()*100);

function callOut() {
for (var i = 0; i &lt; lengthVal; i++){
    if (randomNumber &lt; 75) { 
        var randomCounter = (Math.random()*100);
            if (randomCounter &lt; 50) {
                setTimeout("image1.src = clicks;",500);

            }
            else if (randomCounter &gt; 50) {
                setTimeout("image1.src = impressions;",500);                    
            }
    }
    }
}
</code></pre>
