setTimeout clearInterval problem

I am using the setTimeout function that clears the Interval after it fires. In some cases, I need to clear those intervals before they fire however I cannot access the interval id to do so. Any suggestions for how I could do this? Basically I need to clear ALL existing intervals before proceeding to the next. There may be more than one interval active at a time.


_global.setTimeout = function(a,b,c, args){
        // for a basic function call:
        if (typeof a == "function"){
                args = arguments.slice(2);
                var ID, func = function(){
                        a.apply(null, args);
                        clearInterval(ID);
                }
                ID = setInterval(func, b, args);
                
                // for an object method call:
        }else{
                args = arguments.slice(3);
                var ID, func = function(){
                        a**.apply(a, args);
                        clearInterval(ID);
                }
                ID = setInterval(func, c, args);
        }
        return ID;
}
_global.clearTimeout = clearInterval;

Any ideas would be very helpful!

Thanks.

Jason