﻿function GLoad() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    
    // Show the large zoom controls
    map.addControl(new GLargeMapControl());
    
    // Show the Satellite/Hybrid controls
    //map.addControl(new GMapTypeControl());            
    
    // Focus on the Abbey House address (longitude/latitude)
    //
    // StreetMap: http://www.streetmap.co.uk/streetmap.dll?GridConvert?name=464994,171148&type=OSGrid
    //
    map.setCenter(new GLatLng(51.435612,-1.066384), 13);
       
    // Zoom in several times to get closer to be able to see street names
    map.zoomIn();
    map.zoomIn();
    
    // Place a marker in the center of the map
    var marker = new GMarker(map.getCenter());
    map.addOverlay(marker);
    
    // Open the info window automatically
    GShowInfoWindow(marker);
    
    // Allow the marker to be clicked on to re-open the info window
    GEvent.addListener(marker, "click", function() {GShowInfoWindow(marker);});

  }
}

function GShowInfoWindow(marker)
{
    marker.openInfoWindowHtml("<b>Infracast</b><br>Abbey House (Building 1650)<br>Arlington Business Park<br />Theale<br />Berkshire<br />RG7 4SA<br /><br /><a href='http://maps.google.co.uk/maps?f=d&hl=en&geocode=&saddr=&daddr=Abbey+House,+RG7+4SA&sll=51.43712,-1.065948&sspn=0.011691,0.029397&ie=UTF8&z=15&om=1' target='_blank'>Get directions here <img src='images/site/new-window.gif' align='middle' border='0' alt='Open larger map in a new window' /></a>");
}