docs: function(layer, setNewBaseLayer) {
          if (this.events.triggerEvent("preremovelayer", {layer: layer}) === false) {
              return;
          }
          if (setNewBaseLayer == null) {
              setNewBaseLayer = true;
          }
  
          if (layer.isFixed) {
              this.viewPortDiv.removeChild(layer.div);
          } else {
              this.layerContainerDiv.removeChild(layer.div);
          }
          OpenLayers.Util.removeItem(this.layers, layer);
          layer.removeMap(this);
          layer.map = null;
  
          // if we removed the base layer, need to set a new one
          if(this.baseLayer == layer) {
              this.baseLayer = null;
              if(setNewBaseLayer) {
                  for(var i=0, len=this.layers.length; i<len; i++) {
                      var iLayer = this.layers[i];
                      if (iLayer.isBaseLayer || this.allOverlays) {
                          this.setBaseLayer(iLayer);
                          break;
                      }
                  }
              }
          }
  
          this.resetLayersZIndex();
  
          this.events.triggerEvent("removelayer", {layer: layer});
          layer.events.triggerEvent("removed", {map: this, layer: layer});
      }