var IntervalManager =
{
intervals : [],
set : function( intervalID, funcRef, period )
{
if( !this.intervals[ intervalID ] )
this.intervals[ intervalID ] = setInterval( funcRef, period );
else
alert("Attempted to set " + intervalID + ' more than once.');
},
clear : function( id )
{
clearInterval( this.intervals[ id ] );
delete this.intervals[ id ];
},
clearAll : function()
{
var table = this.intervals;
for( var i in table )
{
clearInterval( table[ i ] );
delete table[ i ];
}
},
any : function()
{
var table = this.intervals, found = false;
for( var i in table )
if( table[ i ] !== null )
{
found = table[ i ];
break;
}
return found;
}
}