IF File Exists Javascript
<p>Can anyone see anything wrong with this? It stops the image changing when the image is not here as I want but it does not change the image all the time when it does!</p>

<p>Cheers, 
Shaun    </p>

<pre><code>var myFile = "/_images/multi/" + productCode + "/" + imgCodeAlt + "_l.jpg";
if (myFile.exists()) {
    $("#imgMain img").attr({
        rel: 'lightbox',
        src: "/_images/multi/" + productCode + "/" + imgCodeAlt + "_l.jpg"
    });
}
</code></pre>
