window.EventBroadcaster = new Object();
EventBroadcaster.initialize = function(obj){
	obj._listeners = new Array();
	obj.broadcastMessage = this._broadcastMessage;
	obj.addListener = this._addListener;
	obj.removeListener = this._removeListener;
}
EventBroadcaster._broadcastMessage = function() {
	var eventName = arguments[0];
	// IE won't do shift :( ...do it the long way
	//var newArguments = new Array();
	//for(var i=1;i<arguments.length;i++){
	//newArguments[(i-1)] = arguments[i]}
	//arguments = newArguments;
	var list = this._listeners;
	var maximum = list.length;
	for (var i = 0; i<maximum; ++i) {
		// we lose the ability to pass method names into this using 'apply' because IE on the Mac won't support it...
		//list[i][eventName].apply(list[i], arguments);
		//list[i].update(list[i], arguments);
		list[i].update(arguments[1]);
	}
};
EventBroadcaster._addListener = function(obj) {
	this.removeListener(obj);
	//  IE 5 on the mac won't do push :( 
	this._listeners[this._listeners.length] = obj;
	//this._listeners.push(obj);
	return (true);
}

EventBroadcaster._removeListener = function(obj) {
	var list = this._listeners;
	var i = list.length;
	while (i--) {
		if (list[i] == obj) {
			list.splice(i, 1);
			return (true);
		}
	}
	return (false);
}
