moveRight(num) problems!
<p>Hey there Stackoverflow! I'm pretty new at Javascript, but I'm getting the hang of it pretty quickly. I'm working on a website and I can't quite get it working.</p>

<p>First we have a button.</p>

<pre><code>&lt;SPAN ID="button2"&gt;
&lt;A HREF="#" 
onClick="changeZIndex(1,'contactus');changeZIndex(0,'aboutus');changeZIndex(0,'pagethree');moveRight(310)"&gt;
&lt;IMG NAME="two" SRC="contactus.gif"&gt;&lt;/A&gt;
&lt;/SPAN&gt;
</code></pre>

<p>Next we have the code chunk that controls moveRight</p>

<pre><code>&lt;script type="text/javascript"&gt;

var userWidth = window.screen.width;
function moveRight(num) {
var pp2 = document.getElementById("bar");
var lft = parseInt(pp2.style.left);
var tim = setTimeout("moveRight()",10); 
lft = lft+5; 
pp2.style.left = lft+"px";
if (lft &gt; num) {  
pp2.style.left = num;  
clearTimeout(tim);
}
}
&lt;/script&gt;
</code></pre>

<p>The movement is fine. The problem I have is with stopping it, which is what this snippet does</p>

<pre><code> pp2.style.left = lft+"px";
 if (lft &gt; num) {  
 pp2.style.left = num;
</code></pre>

<p>When the num in (lft > num) and pp2.style.left = num is substituted with a real number, say 310, it works just fine. However when "num" is left in it does not stop. The reason I want to be able to substitute the stopping number is because I will have several buttons that will make the bar stop at various places on the site. I've been working on it for several hours and I've done everything I could think of. Hopefully you guys can do better than me! :)</p>
