Add time to javascript clock
<p>I want to be able to add a specified time to a javascript clock and have it keep updating. I have managed to chuck the below together. </p>

<pre><code>    function leadTimer(leadTime) 
    {
      var d1 = new Date (),
      d2 = new Date ( d1 );
      d2.setMinutes ( d1.getMinutes() + leadTime );
      currentHours = d2.getHours();
      currentMins = d2.getMinutes();
      // Choose either "AM" or "PM" as appropriate
      var timeOfDay = ( currentHours &lt; 12 ) ? "AM" : "PM";
      // Convert the hours component to 12-hour format if needed
      currentHours = ( currentHours &gt; 12 ) ? currentHours - 12 : currentHours;
      // Convert an hours component of "0" to "12"
      currentHours = ( currentHours == 0 ) ? 12 : currentHours;
      if (currentMins&lt;=9) { currentMins="0"+currentMins; }
      if (currentHours&lt;10) { currentHours="0"+currentHours; }
      $("#result").empty();
      $("#result").html(currentHours + ":" + currentMins + " " + timeOfDay)
      setInterval('leadTimer(leadTime)',10000)
}
</code></pre>

<p>I figured that the <code>setInterval</code> would just use the current value for <code>leadTime</code> but I just get an error saying <code>leadTime</code> is undefined.  </p>

<p>Ultimately I would like to be able to call on this to keep a clock ticking over depending on what the user selects. </p>
