code: function (layer) {
          for(var i = 0, len = this.layers.length; i < len; i++) {
              if (this.layers[i] == layer) {
                  return false;
              }
          }
          if (this.events.triggerEvent("preaddlayer", {layer: layer}) === false) {
              return false;
          }
          if(this.allOverlays) {
              layer.isBaseLayer = false;
          }
          
          layer.div.className = "olLayerDiv";
          layer.div.style.overflow = "";
          this.setLayerZIndex(layer, this.layers.length);
  
          if (layer.isFixed) {
              this.viewPortDiv.appendChild(layer.div);
          } else {
              this.layerContainerDiv.appendChild(layer.div);
          }
          this.layers.push(layer);
          layer.setMap(this);
  
          if (layer.isBaseLayer || (this.allOverlays && !this.baseLayer))  {
              if (this.baseLayer == null) {
                  // set the first baselaye we add as the baselayer
                  this.setBaseLayer(layer);
              } else {
                  layer.setVisibility(false);
              }
          } else {
              layer.redraw();
          }
  
          this.events.triggerEvent("addlayer", {layer: layer});
          layer.events.triggerEvent("added", {map: this, layer: layer});
          layer.afterAdd();
  
          return true;
      }
docs: APIMethod: addLayer
  
  Parameters:
  layer - {<OpenLayers.Layer>}
  
  Returns:
  {Boolean} True if the layer has been added to the map.