if (GBrowserIsCompatible()) {

    // ==== The "More..." control simply accepts a mouseover to reveal the "Layer" control ===

      function MoreControl() {}
      MoreControl.prototype = new GControl();

      MoreControl.prototype.initialize = function(map) {
        var container = document.createElement("div");
        container.style.border = "2px solid black";
        container.style.fontSize = "12px";
        container.style.fontFamily = "Arial, sans-serif";
        container.style.width="80px";
        container.style.backgroundColor = "#FFF";
        container.style.textAlign = "center";
        container.style.marginRight = "80px";
        container.innerHTML = "M&aacute;s...";
      
        map.getContainer().appendChild(container);
        
        GEvent.addDomListener(container, "mouseover", function() {
          map.addControl(layerControl);
        });
        
        
        return container;
      }
      
      MoreControl.prototype.getDefaultPosition = function() {
        return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(210, 7));
      }


      
      // ==== The "Layer" control displays the "More..." plus the checkboxes ====
      // ==== The checkbox info is passed in the "opts" parameter ====

      function LayerControl(opts) {
        this.opts = opts;
      }
      LayerControl.prototype = new GControl();

      LayerControl.prototype.initialize = function(map) {
        var container = document.createElement("div");
        
        container.style.border = "2px solid black";
        container.style.fontSize = "12px";
        container.style.fontFamily = "Arial, sans-serif";
        container.style.width="80px";
        container.style.backgroundColor = "#ffffff";
        container.style.marginRight = "80px";
        container.innerHTML = '<center><b>M&aacute;s...<\/b><\/center>';
        for (var i=0; i<this.opts.length; i++) {
          if (layers[i].Visible) {
            var c = 'checked';
          } else {
            var c = '';
          }
        
          container.innerHTML += '<input type="checkbox" onclick="toggleLayer('+i+')" ' +c+ ' /> '+this.opts[i]+'<br>';
        }
          
      
        map.getContainer().appendChild(container);
        
        // === This doesn't do what I want. It kills the control if I mouseover a checkbox ===
        // === If you know how to do this better, let me know ===

        //GEvent.addDomListener(container, "mouseout", function() {
        //  map.removeControl(layerControl);
        //});
        
        setTimeout("map.removeControl(layerControl)",3000);
        
        
        return container;
      }
      
      LayerControl.prototype.getDefaultPosition = function() {
        return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(210, 7));
      }



      // ==== toggleLayer adds and removes the layers ====
      function toggleLayer(i) {
        if (layers[i].Visible) {
          layers[i].hide();
        } else {
          if(layers[i].Added) {
            layers[i].show();
          } else {
            map.addOverlay(layers[i]);
            layers[i].Added = true;
          }
        }
        layers[i].Visible = !layers[i].Visible;
      }
      

      var map = new GMap2(document.getElementById("map"));

      //map.setCenter(new GLatLng(39.898641809099914, -5.277814865112305), 6);
      map.addControl(new GMapTypeControl());
      map.addControl(new GLargeMapControl());


      // ==== Create the GLayer()s, and set them  Visible=false Added=false ====
      // If you want a GLayer open by default, addOverlay() it and set it  Visible=true Added=true

/*      var layers = [];      
          layers[0] = new GLayer("org.wikipedia.es");
          layers[0].Visible = false;
          layers[0].Added = false;
          
          layers[1] = new GLayer("org.wikipedia.en");
          layers[1].Visible = false;
          layers[1].Added = false;
          
          layers[2] = new GLayer("com.panoramio.all");
          layers[2].Visible = false;
          layers[2].Added = false;

          layers[3] = new GLayer("com.panoramio.popular");
          layers[3].Visible = false;
          layers[3].Added = false;
      
      // === Create the layerControl, but don't addControl() it ===
      // = Pass it an array of names for the checkboxes =
      var layerControl = new LayerControl(["Wiki ES", "Wiki EN", "Fotos", "Populares"]);*/

      var layers = [];      
          layers[0] = new GLayer("org.wikipedia.es");
          layers[0].Visible = false;
          layers[0].Added = false;
          
          layers[1] = new GLayer("com.panoramio.all");
          layers[1].Visible = false;
          layers[1].Added = false;
      
      // === Create the layerControl, but don't addControl() it ===
      // = Pass it an array of names for the checkboxes =
      var layerControl = new LayerControl(["Wiki ES", "Fotos"]);



      // === Create the MoreControl(), and do addControl() it ===
      map.addControl(new MoreControl());


    }