// Make the map fill the screen (almost)
function fullWindow() {
    var point = map.getCenter();
    var myWidth = 0, myHeight = 0;
    
    /*
       Horrible, soul-stealing, baby-eating browser-detection to get the width
       and height in various different ways.
    */
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    }
    else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    }
    else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    // Change size of map
    document.getElementById("gmap").style.width = (myWidth - 50) + "px";
    document.getElementById("gmap").style.height = (myHeight - 50) + "px";
    // Update map
    map.checkResize();
    map.zoomIn();
    map.setCenter(point);
    // Hide the link
    document.getElementById("full").style.display = "none";
    document.getElementById("small").style.display = "inline";
}

// Shrink the map window to its original size
function smallWindow() {
    var point = map.getCenter();
    // Resize map
    document.getElementById("gmap").style.width = "500px";
    document.getElementById("gmap").style.height = "300px";
    // Update map to reflect the changes
    map.checkResize();
    map.zoomOut();
    map.setCenter(point);
    // Hide the link
    document.getElementById("full").style.display = "inline";
    document.getElementById("small").style.display = "none";
}

// Create a map
function newload() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("gmap"));
    map.setCenter(new GLatLng(27, 8), 1);
    
    map.addControl(new GLargeMapControl());
    //map.addControl(new GSmallMapControl());
    //map.addControl(new GSmallZoomControl());
    //map.addControl(new GScaleControl());
    map.addControl(new GMapTypeControl());
    //map.addControl(new GOverviewMapControl());
    
    map.enableDoubleClickZoom();
    map.enableContinuousZoom();
    //map.enableScrollWheelZoom();
  }
}

