title: OpenLayers - Map refusing to zoom to max extent
body: <p>If been changing round some OpenLayers code, and one side effect is that by Google Street base layer no longer displays a sensible map, but instead zooms out to a 3 x world view.  Nothing I put into the code which the api suggests should work does. </p>
  
  <p>The same code - but rearranged - worked OK in the past (but didn't allow the bigger picture to work unfortunately)</p>
  
  <p>I'm new to all this and way out of my comfort zone so a sanity check of the code would be much appreciated:</p>
  
  <pre><code>    function ProfileMap(mapName)
      {
          this.name = mapName;
          this.layers = [];
  
          // define Map options
          var mapoptions = {
                  projection: mercator,
                  units: "m",
                  maxExtent: world
          };
  
          // define Base Layer
          var baselayer = new OpenLayers.Layer.Google(
                  "Google Streets", 
                  {numZoomLevels: 20, spehericalMercator: 2}
          );  
  
  
          this.init = function(mapdiv, keydiv)
          {
              var layerswitcher = new OpenLayers.Control.LayerSwitcher(
                      {div: document.getElementById(keydiv)}
              );      
  
              this.map = new OpenLayers.Map(mapdiv, mapoptions);
              this.map.addLayer(baselayer);
              this.map.setCenter(mapcenter);
              this.map.zoomToMaxExtent();
  
          };
  
          this.addMapLayer = function(layerName)
          {
              var layerid = this.layers.length;
              this.layers[layerid] = new OpenLayers.Layer.Markers(layerName);
              this.map.addLayer(this.layers[layerid]);
          }
  
      }
  
  
      // Map actually created by a call to this function
      function createMap(mapName, div, keydiv, mapLayers)
      {
          mapName = new ProfileMap(mapName);
          mapName.init(div, keydiv);
          for(var i=0; i &lt; mapLayers.length; i++)
          {
              mapName.addMapLayer(mapLayers[i]);
          }
  
      }
  </code></pre>