code: function (type, obj, func, priority) {
          if (type in OpenLayers.Events && !this.extensions[type]) {
              this.extensions[type] = new OpenLayers.Events[type](this);
          }
          if (func != null) {
              if (obj == null)  {
                  obj = this.object;
              }
              var listeners = this.listeners[type];
              if (!listeners) {
                  listeners = [];
                  this.listeners[type] = listeners;
                  this.extensionCount[type] = 0;
              }
              var listener = {obj: obj, func: func};
              if (priority) {
                  listeners.splice(this.extensionCount[type], 0, listener);
                  if (typeof priority === "object" && priority.extension) {
                      this.extensionCount[type]++;
                  }
              } else {
                  listeners.push(listener);
              }
          }
      }
docs: APIMethod: register
  Register an event on the events object.
  
  When the event is triggered, the 'func' function will be called, in the
  context of 'obj'. Imagine we were to register an event, specifying an
  OpenLayers.Bounds Object as 'obj'. When the event is triggered, the
  context in the callback function will be our Bounds object. This means
  that within our callback function, we can access the properties and
  methods of the Bounds object through the "this" variable. So our
  callback could execute something like:
  :    leftStr = "Left: " + this.left;
  
  or
  
  :    centerStr = "Center: " + this.getCenterLonLat();
  
  Parameters:
  type - {String} Name of the event to register
  obj - {Object} The object to bind the context to for the callback#.
  If no object is specified, default is the Events's 'object' property.
  func - {Function} The callback function. If no callback is
  specified, this function does nothing.
  priority - {Boolean|Object} If true, adds the new listener to the
  *front* of the events queue instead of to the end.
  
  Valid options for priority:
  extension - {Boolean} If true, then the event will be registered as
  extension event. Extension events are handled before all other
  events.