title: Call a function when my timer reaches zero
body: <p>I've got a timer function as follows (which I've just grabbed off a jsfiddle):</p>
  
  <pre><code>function countdown( elementName, minutes, seconds )
  {
      var element, endTime, hours, mins, msLeft, time;
  
      function returnDate(){
      return Number(new Date);
      }
  
      function twoDigits( n )
      {
          return (n &lt;= 9 ? "0" + n : n);
      }
  
      function updateTimer()
      {
          msLeft = endTime - (returnDate());
          if ( msLeft &lt; 1000 ) {
              element.innerHTML = "0:00";
          } else {
              time = new Date( msLeft );
              hours = time.getUTCHours();
              mins = time.getUTCMinutes();
              element.innerHTML = (hours ? hours + ':' + twoDigits( mins ) : mins) + ':' + twoDigits( time.getUTCSeconds() );
              setTimeout( updateTimer, time.getUTCMilliseconds() + 500 );
          }
      }
  
      element = document.getElementById( elementName );
      endTime = (+new Date) + 1000 * (60*minutes + seconds) + 500;
      updateTimer();
  }
  </code></pre>
  
  <p>I call the function and set it to countdown to 2 minutes like so:</p>
  
  <pre><code>$(".btn-start").click(function(){
   countdown("countdown-2-minutes",2,0);
  
  });
  </code></pre>
  
  <p>I have another element with id <code>countdown-8-minutes</code> that I want to start immediately when the timer on <code>countdown-2-minutes</code> reaches 0. How should I do this? I suppose an okay way would be to monitor when the html on the first element reads "0:00" but I don't exactly know how to implement that.</p>