
SM_USER_LOGIN   = 0;
SM_USER_CREATED = 1;

SM_ADDRESS_CREATED = 2;

var SystemMessageBus = Class.create();

SystemMessageBus.prototype = {
        listener: new Array(),
    
        initialize: function() {
    
        },

        notify: function( msg, data ) {
            if ( this.listener[msg] != null ) {
                var callbacks = this.listener[msg];

                var i = 0;
                for ( i = 0; i < callbacks.length; i++ ) {
                    callbacks[i]( data );
                }
            }
        },

        register: function( msg, cb ) {
            if ( this.listener[msg] == null ) {
                this.listener[msg] = new Array();
            }

            this.listener[msg].push( cb );
        }
};

SYSTEM_MESSAGE_BUS = new SystemMessageBus();