    //<![CDATA[
    
    if (GBrowserIsCompatible()) {

      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 = "#ffffff";
        container.style.textAlign = "center";
        container.innerHTML = "More...";
      
        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));
      }

      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.innerHTML = '<center><b>More...<\/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);
        
        setTimeout("map.removeControl(layerControl)",5000);
        
        return container;
      }
      
      LayerControl.prototype.getDefaultPosition = function() {
        return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(210, 7));
      }

      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(57.557102, -4.921875),7);
      map.addControl(new GMapTypeControl());
      map.addControl(new GLargeMapControl());

      var layers = [];      
          layers[0] = new GLayer("org.wikipedia.en");
          layers[0].Visible = false;
          layers[0].Added = false;
          
          layers[1] = new GLayer("com.panoramio.all");
            map.addOverlay(layers[1]);  
        layers[1].Visible = true;
          layers[1].Added = true;
      
      var layerControl = new LayerControl(["Wiki", "Photos"]);

      map.addControl(new MoreControl());


    }

    //]]>
