javascript to refer to img url: best practices?
<p>I have written a tiny bit of javascript which uses two images.</p>

<p>inside the code it does something like</p>

<pre><code>str+='&lt;img src="left.jpg"&gt;&lt;/img&gt;';
...
str+='&lt;img src="right.jpg"&gt;&lt;/img&gt;';
...
</code></pre>

<p>The script works very well. 
The problem is that depending which HTML page uses my script I might get the images broken.</p>

<p>I could solve the problem by defining a directory /img for all the images but I would rather not. 
I would rather pack the images required by each script in their folders.</p>

<p>Can somebody suggest how to do this ?  or what are the best practices for doing this </p>

<p>thanks</p>
