<script language="JavaScript" type="text/javascript">
var Timer = function(runnable){
this._runnable=(runnable=(runnable||this));
this._runFunc0 = function(){
runnable['run'].apply(runnable);
}
this._interval = 1000;
};
Timer.prototype.run = function(){
if(this._time_count==null){
this._time_count=0;
};
document.body.innerHTML=document.body.innerHTML+'Timer: '+(this._time_count++)+'<BR>'
};
Timer.prototype.start = function()
{
this._timeId = window.setInterval(this._runFunc0, this._interval);
};
Timer.prototype.sheep = function(st)
{
var sheepTime = st || 500;
window.clearTimeout(this._timeId);
var _this = this;
window.setTimeout((function(){_this['start'].apply(_this);}), sheepTime );
};
var t = new Timer();
t.start();
</script>