var TimerQueue = {				
	_timer: null,				
	_TimerQueue: [],
	speed: 500,
	add: function(fn, context, time) {
		var setTimer = function(time) {
			TimerQueue._timer = setTimeout(function() {
				time = TimerQueue.add();
				if (TimerQueue._TimerQueue.length) {
					setTimer(time);
				}					
			}, time || TimerQueue.speed);
		};
 
		if (fn) {
			TimerQueue._TimerQueue.push([fn, context, time]);
			if (TimerQueue._TimerQueue.length == 1) {
				setTimer(time);
			}
			return;
		}
 
		var next = TimerQueue._TimerQueue.shift();
		if (!next) {						
			return 0;
		}
		next[0](next[1] || window);
		return next[2];
	},	
	clear: function() {
		clearTimeout(TimerQueue._timer);
		TimerQueue._TimerQueue = [];
	},
	size: function() {
		return TimerQueue._TimerQueue.length;
	}
};