(function()
{
	Common.Object.create('Common.Dispatcher', {
		scope : null,
		listeners : null,
	
		Dispatcher : function(s) {
			this.scope = s || this;
			this.listeners = [];
		},
	
		add : function(cb, s) {
			this.listeners.push({cb : cb, scope : s || this.scope});
	
			return cb;
		},
	
		addToTop : function(cb, s) {
			this.listeners.unshift({cb : cb, scope : s || this.scope});
	
			return cb;
		},
	
		remove : function(cb) {
			var l = this.listeners, o = null;
	
			l.each(function(c, i) {
				if (cb == c.cb) {
					o = cb;
					l.splice(i, 1);
					return false;
				}
			});
	
			return o;
		},
	
		dispatch : function() {
			var s, a = arguments, i, li = this.listeners, c;
	
			for (i = 0; i<li.length; i++) {
				c = li[i];
				s = c.cb.apply(c.scope, a);
	
				if (s === false)
					break;
			}
	
			return s;
		}
	
	});	
})();
