Run setTimeout only when tab is active
<p>Is there a way to stop <code>setTimeout("myfunction()",10000);</code> from counting up when the page isn't active.  For instance,</p>

<ol>
<li>A user arrives at a "some page" and stays there for 2000ms</li>
<li>User goes to another tab, leaves "some page" open.</li>
<li><code>myfunction()</code> doesn't fire until they've come back for another 8000ms.</li>
</ol>
