/**
 * JavaScript for the GoogleMap block
 *
 * Generated by GoogleMap.class.php
 *
 * @author Dan Bettles <dan.bettles@boxuk.com>
 */


/***************************************************

    GoogleMap

    Singleton

    2007-05-18  DB  Created
    2007-06-11  CM  Added custom marker capability and fix for Safari
    2007-07-17  CM  Added marker type grouping and changed marker icons
                    to override marker types when set
    2007-08-16  CM  Added error handling
    2008-05-09  CC  Refactored for National Gallery and World Vision, added
                    polygons, polylines and other changes.

***************************************************/


function GoogleMap()
{
    if ((GoogleMap.caller != null) &&
    		(GoogleMap.caller != GoogleMap.getInstance)) {
        throw new Error ('You must use "getInstance" to instantiate this class');
    }

    /* Global Variables */

    this.oGMap;
    this.errorContainer;
    this.oGDirections;
    this.visualGroups = Array();
    this.aoMarkersAndOptions = Array();
    this.aoPolylinesAndOptions = Array();
    this.aoPolygonsAndOptions = Array();

  	if (GBrowserIsCompatible())
  	{
        this.oGMap = new GMap2 (document.getElementById ('GoogleMap_227'));
        this.errorContainer = document.getElementById('GoogleMap_227_errors');

        this.oGMap.setCenter (new GLatLng(51.5086,  -0.1284), 0);
        var bounds = new GLatLngBounds();
        var zoomLevel = 0;
        var maxZoomLevel;

        
        this.oGMap.setMapType(G_NORMAL_MAP);

        
        
        
        
        this.oGMap.addControl (new GLargeMapControl());

        
        
        this.oGMap.addControl (new GMapTypeControl());

        
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' The London Eye';
                oMarkerOptions.description = ' County Hall, Riverside Building (Tube: Waterloo)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5033,  -0.1195);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Westminster Cathedral';
                oMarkerOptions.description = ' Clergy House 42 Francis Street (Tube: Victoria)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.4957,  -0.1393);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Westminster Abbey';
                oMarkerOptions.description = ' (Tube: Westminster)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.4993,  -0.1275);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' St. Paul&#39;s Cathedral';
                oMarkerOptions.description = ' 36 Carter Lane (Tube: St. Paul&#39;s)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5138,  -0.0983);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Houses of Parliament';
                oMarkerOptions.description = ' Parliament Square (Bus: 11, 12, 87; Tube: Westminster)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5002,  -0.1246);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Horse Guard&#39;s Parade';
                oMarkerOptions.description = ' Whitehall';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5046,  -0.1292);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' The Churchill Museum and Cabinet War Rooms';
                oMarkerOptions.description = ' King Charles Street (Bus: 11, 12, 87; Tube: Westminster)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5020,  -0.1290);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Imperial War Museum';
                oMarkerOptions.description = ' Lambeth Road (Tube: Lambeth North)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.4963,  -0.1086);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Barbican';
                oMarkerOptions.description = ' (Tube: Barbican)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5202,  -0.0936);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' White Cube Mason&#39;s Yard Site';
                oMarkerOptions.description = ' 25-26 Mason&#39;s Yard (Tube: Piccadilly Circus)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5076,  -0.1375);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Tate Modern';
                oMarkerOptions.description = ' Bankside (Bus: 11, 15, 23 to St. Paul&#39;s)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5079,  -0.0994);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Tate Britain';
                oMarkerOptions.description = ' Millbank (Bus: 88, 98; Tube: Pimlico)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.4908,  -0.1269);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Sir John&#39;s Soane&#39;s Museum';
                oMarkerOptions.description = ' 13 Lincoln&#39;s Inn Fields (Bus: 15, 91; Tube: Holborn)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5168,  -0.1176);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' The Royal Academy of Arts';
                oMarkerOptions.description = ' Piccadilly (Bus: 9; Tube: Green Park/Piccadilly Circus)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5087,  -0.1389);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Buckingham Palace, Queen&#39;s Gallery';
                oMarkerOptions.description = ' (Tube: St James&#39;s Park)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5011,  -0.1423);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Photographers&#39; Gallery';
                oMarkerOptions.description = ' 5 & 8 Great Newport Street (Tube: Leicester Square)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5119,  -0.1274);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' The British Library';
                oMarkerOptions.description = ' 96 Euston Road (Tube: Euston or King&#39;s Cross)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5288,  -0.1271);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Mall Galleries';
                oMarkerOptions.description = ' The Mall (Tube: Charing Cross)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5061,  -0.1318);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' London Transport Museum';
                oMarkerOptions.description = ' The Piazza, Covent Garden (Tube: Covent Garden)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5116,  -0.1224);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Institute of Contemporary Arts (ICA)';
                oMarkerOptions.description = ' The Mall (Tube: Charing Cross)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5057,  -0.1328);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Southbank Centre, Hayward Gallery, Royal Festival Hall';
                oMarkerOptions.description = ' (Bus: 176; Tube: Waterloo)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5059,  -0.1169);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Banqueting House';
                oMarkerOptions.description = ' Whitehall';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5043,  -0.1260);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' Courtauld Gallery';
                oMarkerOptions.description = ' Somerset House, Strand (Tube: Temple)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5113,  -0.1177);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' British Museum';
                oMarkerOptions.description = ' Great Russell Street (Bus: 91; Tube: Tottenham Court Road)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5186,  -0.1259);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this marker
                var oMarkerOptions = new Object();
                oMarkerOptions.title = ' National Portrait Gallery';
                oMarkerOptions.description = ' St. Martin&#39;s Place (Tube: Leicester Square)';
                oMarkerOptions.infoWindowWidth = '300px';
                oMarkerOptions.infoWindowHeight = '140px';
                oMarkerOptions.icon = 'default';
                oMarkerOptions.icon_x = 20;
                oMarkerOptions.icon_y = 34;
                oMarkerOptions.shadow = 'default';
                oMarkerOptions.shadow_x = 37;
                oMarkerOptions.shadow_y = 34;
                oMarkerOptions.visualGroup = '';

                var oGPoint = new GLatLng (51.5093,  -0.1276);
                bounds.extend(oGPoint);

                // create marker
                var oGMarker = GoogleMap.createMarker (oGPoint, oMarkerOptions);
                var newElt = Array();
                newElt['marker'] = oGMarker;
                newElt['options'] = oMarkerOptions;
                this.aoMarkersAndOptions.push(newElt);

                // add marker to the map
                this.oGMap.addOverlay (oGMarker);

                
                // Array object which will hold the parameters for this polygon.
                var oPolygonOptions = new Object();
                oPolygonOptions.strLatLngs = '(51.50828,-0.129792)(51.50851,-0.130025)(51.50877,-0.130130)(51.50886,-0.129660)(51.50875,-0.129598)(51.50878,-0.129448)(51.50887,-0.129486)(51.50886,-0.129537)(51.50900,-0.129593)(51.50902,-0.129502)(51.50906,-0.129523)(51.50902,-0.129714)(51.50940,-0.129808)(51.50946,-0.129239)(51.50921,-0.129126)(51.50926,-0.128748)(51.50923,-0.128732)(51.50927,-0.128496)(51.50918,-0.128437)(51.509256,-0.127908)(51.508899,-0.127709)(51.508934,-0.127447)(51.50882,-0.127386)(51.50878,-0.127571)(51.50875,-0.127563)(51.50865,-0.128220)(51.50855,-0.128182)(51.50851,-0.128436)(51.50861,-0.128496)(51.50849,-0.129338)(51.50862,-0.129413)(51.50863,-0.129373)(51.50872,-0.129413)(51.50869,-0.129569)(51.50850,-0.129491)(51.50833,-0.129588)(51.50828,-0.129792)';
                oPolygonOptions.altTitle = 'National Gallery';
                oPolygonOptions.visualGroup = '';
                oPolygonOptions.hexStrokeColour = '#ff0000';
                oPolygonOptions.pxStrokeWeight = 2;
                oPolygonOptions.strokeOpacity = 0.2;
                oPolygonOptions.hexFillColour = '#0060c9';
                oPolygonOptions.fillOpacity = 0.5;

                // Create a GLatLng for each coordinate in the line.
                oPolygonOptions.aLatLng = Array();
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50828, -0.129792));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50851, -0.130025));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50877, -0.130130));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50886, -0.129660));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50875, -0.129598));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50878, -0.129448));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50887, -0.129486));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50886, -0.129537));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50900, -0.129593));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50902, -0.129502));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50906, -0.129523));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50902, -0.129714));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50940, -0.129808));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50946, -0.129239));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50921, -0.129126));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50926, -0.128748));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50923, -0.128732));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50927, -0.128496));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50918, -0.128437));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.509256, -0.127908));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.508899, -0.127709));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.508934, -0.127447));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50882, -0.127386));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50878, -0.127571));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50875, -0.127563));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50865, -0.128220));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50855, -0.128182));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50851, -0.128436));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50861, -0.128496));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50849, -0.129338));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50862, -0.129413));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50863, -0.129373));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50872, -0.129413));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50869, -0.129569));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50850, -0.129491));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50833, -0.129588));
                                oPolygonOptions.aLatLng.push(new GLatLng(51.50828, -0.129792));
                
                // Create polygon.
                var oGPolygon = GoogleMap.createPolygon(oPolygonOptions);
                var newElt2 = Array();
                newElt2['polygon'] = oGPolygon;
                newElt2['options'] = oPolygonOptions;
                this.aoPolygonsAndOptions.push(newElt2);

                // add polygon to the map
                this.oGMap.addOverlay(oGPolygon);

                
        zoomLevel = 14;

        
        /*
         * Everything loaded - set initial map zoom level and centre.
         */

        
        this.oGMap.setZoom(zoomLevel);

    }
}


/**
 *  static class variables
 */

GoogleMap._oInstance;


/**
 *  static class method
 */
GoogleMap.getInstance = function()
{
    if (! GoogleMap._oInstance)
    {
    	GoogleMap._oInstance = new GoogleMap();
    }
    return GoogleMap._oInstance;
};


/**
 * Check the map is inside the bounds.
 */
GoogleMap.checkMapBounds = function() {
    var cLatLng = this.getCenter();
    alert(cLatLng);
    /*if (this.overallMapBounds.contains(cLatLng)) {
        // Centre is in the bounds, do nothing.
    }*//*
    else {
        cLat = c.lat();
        cLng = c.lng();

        var maxLat = this.overallMapBounds.getNorthEast().lat();
        var maxLng = this.overallMapBounds.getNorthEast().lng();
        var minLat = this.overallMapBounds.getSouthWest().lat();
        var minLng = this.overallMapBounds.getSouthWest().lng();

        if (cLat < minLat) {
            newLat = minLat;
        }
        if (cLat > maxLat) {
            newLat = maxLat;
        }
        if (cLng < minLng) {
            newLng = minLng;
        }
        if (cLng > maxLng) {
            newLng = maxLng;
        }
    }*/
};


/**
 * Increments the map zoom level by one
 */
GoogleMap.zoomIn = function()
{
    GoogleMap.getInstance().oGMap.zoomIn();
};


/**
 * Decrements the map zoom level by one
 */
GoogleMap.zoomOut = function()
{
    GoogleMap.getInstance().oGMap.zoomOut();
};


/**
 * Sets the zoom level of the map
 */
GoogleMap.setZoom = function(p_zoom)
{
    if(typeof p_zoom != "undefined")
        GoogleMap.getInstance().oGMap.setZoom(p_zoom);
};


/**
 * Moves map along a compass axis
 */
GoogleMap.panDirection = function(p_x, p_y)
{
    if(typeof p_x != "undefined" && typeof p_y != "undefined")
        GoogleMap.getInstance().oGMap.panDirection(p_x, p_y);
};


/**
 * Moves map to a specified point
 */
GoogleMap.panTo = function(p_x, p_y)
{
    if(typeof p_x != "undefined" && typeof p_y != "undefined")
        GoogleMap.getInstance().oGMap.panTo(new GLatLng(p_x, p_y));
};


/**
 * Open the infoWindow and pan to the marker in the given index.
 */
GoogleMap.viewMarker = function(markerIndex) {
    var gMap = GoogleMap.getInstance();
    var oMarkerAndOptions = gMap.aoMarkersAndOptions[markerIndex];
    if (oMarkerAndOptions != "undefined") {
        var markerHtml = this.infoWindowHtmlFromOptions(oMarkerAndOptions['options']);
        oMarkerAndOptions['marker'].openInfoWindow(markerHtml);
    }
}


/**
 * Sets map type (map, hybrid, satellite etc..)
 */
GoogleMap.setMapType = function(p_mapType)
{
    if(typeof p_mapType != "undefined")
        GoogleMap.getInstance().oGMap.setMapType(p_mapType);
};


/**
 * Toggles visibility of Visual Groups.
 */
GoogleMap.toggleVisualGroup = function(p_groupRef) {
    var visualGroups = GoogleMap.getInstance().visualGroups;

    var overlayTypes = Array('markers', 'polylines', 'polygons');
    var visualItem = '';

    for (i = 0; i < overlayTypes.length; i++) { // For each overlay type.
        var thisOverlayType = overlayTypes[i];
        for (var j = 0; j < visualGroups[p_groupRef][thisOverlayType].length; j++) { // For each overlay of this type in the specified visual group.
            visualItem = visualGroups[p_groupRef][thisOverlayType][j];
            if (visualItem.isHidden()) {
                visualItem.show();
            }
            else {
                if (thisOverlayType == 'markers') {
                    visualItem.closeInfoWindow();
                }
                visualItem.hide();
            }
        }
    }
};


/**
 * Creates a marker with a click handler that displays information about the
 * point
 */
GoogleMap.createMarker = function (p_oGPoint, p_oMarkerOptions)
{
    var oGMarker = null;

    if (p_oGPoint && (p_oGPoint instanceof Object))
    {
        var oGMarkerOptions = {};

        if (p_oMarkerOptions.title && p_oMarkerOptions.title.length)
            oGMarkerOptions.title = p_oMarkerOptions.title;

        if(p_oMarkerOptions.icon != 'default' || p_oMarkerOptions.shadow != 'default')
        {
            var icon = new GIcon();

            if(p_oMarkerOptions.icon != 'default')
            {
                icon.image = p_oMarkerOptions.icon;
                icon.iconSize = new GSize(p_oMarkerOptions.icon_x, p_oMarkerOptions.icon_y);
            }
            if(p_oMarkerOptions.shadow != 'default')
            {
                icon.shadow = p_oMarkerOptions.shadow;
                icon.shadowSize = new GSize(p_oMarkerOptions.shadow_x, p_oMarkerOptions.shadow_y);
            }

                            icon.iconAnchor = new GPoint(9, 34);
                icon.infoWindowAnchor = new GPoint(9, 2);
                icon.infoShadowAnchor = new GPoint(18, 25);
                

            oGMarkerOptions.icon = icon;
        }

        var oGMarker = new GMarker (p_oGPoint, oGMarkerOptions);

        if (p_oMarkerOptions.title && p_oMarkerOptions.title.length)
        {
            var markerHtml = GoogleMap.infoWindowHtmlFromOptions(p_oMarkerOptions);

            GEvent.addListener (oGMarker, 'click', function()
            {
                oGMarker.openInfoWindowHtml (markerHtml);

                
            });
        }
    }

    return oGMarker;
};

/**
 * Creates a polyline based on a set of polyline options
 */
GoogleMap.createPolyline = function(p_oPolylineOptions) {
    var oPolyline = null;
    oPolyline = new GPolyline(p_oPolylineOptions.aLatLng, p_oPolylineOptions.hexColour, p_oPolylineOptions.pxWeight, p_oPolylineOptions.opacity);
    return oPolyline;
};

/**
 * Creates a polygon based on a set of polygon options
 */
GoogleMap.createPolygon = function(p_oPolygonOptions) {
    var oGPolygon = null;
    oGPolygon = new GPolygon(p_oPolygonOptions.aLatLng, p_oPolygonOptions.hexStrokeColour, p_oPolygonOptions.pxStrokeWeight, p_oPolygonOptions.strokeOpacity, p_oPolygonOptions.hexFillColour, p_oPolygonOptions.fillOpacity);
    return oGPolygon;
};

/**
 * Returns the info window HTML based on a set of marker options.
 */
GoogleMap.infoWindowHtmlFromOptions = function (p_oMarkerOptions) {
    // default marker info window - show title and description
    var markerHtml = "";

    markerHtml = '<div style="width: ##infoWindowWidth##;">'
               + '<div style="padding: 0; margin: 0; margin-bottom: 10px;"><b>##title##</b></div>'
               + '<div style="padding: 0; margin: 0">##description##</div>'
    markerHtml + '</div>';

    // add in the variables
    markerHtml = markerHtml.replace(/##infoWindowWidth##/, p_oMarkerOptions.infoWindowWidth);
    markerHtml = markerHtml.replace(/##infoWindowHeight##/, p_oMarkerOptions.infoWindowHeight);
    markerHtml = markerHtml.replace(/##title##/, p_oMarkerOptions.title);
    markerHtml = markerHtml.replace(/##description##/, p_oMarkerOptions.description);

    return markerHtml;
};


/*
 * Creates the directions list that appears underneath the map
 */
GoogleMap.handleDirectionsLoad = function (p_directionsContainerID, p_origin, p_destination)
{
    var oGDirections = GoogleMap.getInstance().oGDirections;

    var oStatus = oGDirections.getStatus();

    // if the request was successful - we should have already trapped this anyway...
    if(oStatus.code == 200)
    {
        var summaryHTML = oGDirections.getSummaryHtml();

        // HTML container
        var directionsContainerHTML = "";

        // Loop through all routes
        for(var r=0; r < oGDirections.getNumRoutes(); r++)
        {
            var oRoute = oGDirections.getRoute(r);

            // Add the origin to the container
            directionsContainerHTML += '<div id="GMRouteStart" class="GMDirWayPoint">'
                                    + '<div class="GMBookendLeftCol">'
                                    + '<img src="/img/wtb/googleMap/icon-dd-play-trans.png" alt="Origin Marker" width="24px" height="38px" />'
                                    + '<a href="javascript:;" onclick="GoogleMap.showStep('+r+', 0)">From:</a>'
                                    + '</div>'
                                    + '<div id="GMOriginDescription" class="GMBookendCenterCol"><p>' + p_origin + '</p></div>'
                                    + '<div id="GMOriginForm" class="GMBookendCenterCol" style="display:none">'
                                    + '<label for="GoogleMap[origin]">Change Origin</label>'
                                    + '<input id="GoogleMap[origin]" name="GoogleMap[origin]" type="textfield" value="' + p_origin + '" />'
                                    + '<br />'
                                    + '<input type="button" name="cancel" value="Cancel" onclick="GoogleMap.toggleRouteBookendVisibility(\'GMOriginDescription\', \'GMOriginForm\')" />'
                                    + '<input type="submit" name="submit" value="Change" />'
                                    + '</div>'
                                    + '<div class="GMBookendRightCol">'
                                    + '<a href="javascript:;" onclick="GoogleMap.toggleRouteBookendVisibility(\'GMOriginDescription\', \'GMOriginForm\')">Edit</a>'
                                    + '</div>'
                                    + '</div>';

            // Add the summary and collapsing div button
            directionsContainerHTML += '<table class="GMDirectionsSummary">'
                                    + '<tr>'
                                    + '<td class="zipper">'
                                    + 'Drive:'
                                    + '</div>'
                                    + '</td>'
                                    + '<td class="timedist" align="right">'
                                    + '<div class="summary">' + summaryHTML + '</div>'
                                    + '</td>'
                                    + '</tr>'
                                    + '</table>';

            // Loop through steps and add them to container
            var numSteps = oRoute.getNumSteps();

            directionsContainerHTML += '<table class="GMRouteSteps" cellpadding="0" cellspacing="0" border="0">'

            for(var s=0; s < numSteps; s++)
            {
                var oStep = oRoute.getStep(s);

                var stepNo = s+1;

                directionsContainerHTML += '<tr class="GMRouteStep">'
                                        + '<td class="stepNo"><a href="javascript:;" onclick="GoogleMap.showStep('+r+', '+s+')">' + stepNo + '.</a></td>'
                                        + '<td class="instructions">' + oStep.getDescriptionHtml() + '</td>'
                                        + '<td class="distance">' + oStep.getDistance().html + '</td>'
                                        + '</tr>';
            }

            directionsContainerHTML += '</table>'

            // Add the destination to the container
            directionsContainerHTML += '<div id="GMRouteEnd" class="GMDirWayPoint">'
                                    + '<div class="GMBookendLeftCol">'
                                    + '<img src="/img/wtb/googleMap/icon-dd-stop-trans.png" alt="Destination Marker" />'
                                    + '<a href="javascript:;" onclick="GoogleMap.showStep('+r+', '+(s-1)+')">To:</a>'
                                    + '</div>'
                                    + '<div id="GMDestinationDescription" class="GMBookendCenterCol"><p>' + p_destination + '</p></div>'
                                    + '<div id="GMDestinationForm" class="GMBookendCenterCol" style="display:none">'
                                    + '<label for="GoogleMap[destination]">Change Destination</label>'
                                    + '<input id="GoogleMap[destination]" name="GoogleMap[destination]" type="textfield" value="' + p_destination + '" />'
                                    + '<br />'
                                    + '<input type="button" name="cancel" value="Cancel" onclick="GoogleMap.toggleRouteBookendVisibility(\'GMDestinationDescription\', \'GMDestinationForm\')" />'
                                    + '<input type="submit" name="submit" value="Change" />'
                                    + '</div>'
                                    + '<div class="GMBookendRightCol">'
                                    + '<a href="javascript:;" onclick="GoogleMap.toggleRouteBookendVisibility(\'GMDestinationDescription\', \'GMDestinationForm\')">Edit</a>'
                                    + '</div>'
                                    + '</div>';
        }

        document.getElementById(p_directionsContainerID).innerHTML = directionsContainerHTML;
    }
}


/*
 * Deal with direction errors
 */
GoogleMap.handleDirectionsError = function (p_origin, p_destination)
{
    var oGDirections = GoogleMap.getInstance().oGDirections;
    var errorContainer = GoogleMap.getInstance().errorContainer;

    var oStatus = oGDirections.getStatus();

    var message = GoogleMap.getErrorMessage( oStatus );

    errorContainer.className = errorContainer.className + '_active';
    errorContainer.innerHTML += '<p><strong>An error occurred:</strong> <em>' + message + '</em></p>'
                             + '<p>We apologise for the inconvenience. '
                             + 'It is possible your waypoints were not recognised - please check and try again.</p>'
                             + '<p><em>Tip: try to make your waypoints as specific as possible</em></p>'
                             + '<form action="server.php">'
                             + '<p><label for="GoogleMap[origin]">Origin: </label>'
                             + '<input id="GoogleMap[origin]" name="GoogleMap[origin]" type="textfield" value="' + p_origin + '" /></p>'
                             + '<p><label for="GoogleMap[destination]">Destination: </label>'
                             + '<input id="GoogleMap[destination]" name="GoogleMapdestination]" type="textfield" value="' + p_destination + '" /></p>'
                             + '<p><input type="submit" value="Change" name="submit" /></p>'
                             + '</form>';
}


/*
 * Returns a user-friendly message for an error code
 */
GoogleMap.getErrorMessage = function (p_oStatus)
{
    /* Define Google Error codes */
    var G_GEO_UNKNOWN_ADDRESS        = 601;
    var G_GEO_SERVER_ERROR           = 500;
    var G_GEO_MISSING_QUERY          = 601;
    var G_UNAVAILABLE_ADDRESS        = 603;
    var G_GEO_BAD_KEY                = 610;
    var G_GEO_UNKNOWN_DIRECTIONS     = 604;
    var G_GEO_BAD_REQUEST            = 400;

    switch(p_oStatus.code)
    {
        case G_GEO_UNKNOWN_ADDRESS:
            return "No corresponding geographic location could be found for one of the specified addresses.\n" +
                   "This may be due to the fact that the address is relatively new, or it may be incorrect.";

        case G_GEO_UNKNOWN_DIRECTIONS:
            return "Directions could not be found";

        case G_GEO_SERVER_ERROR:
            return "A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.";

        case G_GEO_MISSING_QUERY:
            return "The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.";

        case G_UNAVAILABLE_ADDRESS:
            return "The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons."

        case G_GEO_BAD_KEY:
            return "The given key is either invalid or does not match the domain for which it was given.";

        case G_GEO_BAD_REQUEST:
            return "A directions request could not be successfully parsed.";

        default:
            return "An error occurred";

    }
}


/*
 * Toggles the Direction 'Bookend' (origin/destination) between description and
 * editable form
 */
GoogleMap.toggleRouteBookendVisibility = function (p_bookendId1, p_bookendId2)
{
    var oBookend1 = document.getElementById(p_bookendId1);
    var oBookend2 = document.getElementById(p_bookendId2);

    if(oBookend1.style.display == 'none')
    {
        oBookend1.style.display = '';
        oBookend2.style.display = 'none';
    }
    else
    {
        oBookend1.style.display = 'none';
        oBookend2.style.display = '';
    }
}

/**
 * Displays a tabbed info window with details of a step in a route of directions
 */
GoogleMap.showStep = function(route,step)
{
    oGMap = GoogleMap.getInstance().oGMap;
    oGMap.closeInfoWindow();

    oGDirections = GoogleMap.getInstance().oGDirections;

    var oStep = oGDirections.getRoute(route).getStep(step);

    var stepLatLng = oStep.getLatLng();
    var stepDescriptionHTML = oStep.getDescriptionHtml();

    var stepDistance = oStep.getDistance();
    var stepDuration = oStep.getDuration();

    var infoHTML = '<div id="tab1" class="bubble">';
    infoHTML += '<table>';
    infoHTML += '<tr class="stepRow"><td>&nbsp;&nbsp;' + (step+1) + '.</td><td> ' + stepDescriptionHTML + '</td><td>' + stepDistance.html + '</td></tr>';
    infoHTML += '<tr class="stepRow"><td>&nbsp;&nbsp;</td colspan="2"><td> ' + stepLatLng + '</td></tr>';
    infoHTML += '</table>';
    infoHTML += '</div>';

    var tab1 = new GInfoWindowTab("Location", '<div id="detailmap"></div>');
    var tab2 = new GInfoWindowTab("Info", infoHTML);
    var infoTabs = [tab1,tab2];

    oGMap.openInfoWindowTabsHtml(stepLatLng,infoTabs);

    //Minimap for driving directions
    var dMapDiv = document.getElementById("detailmap");
    var detailmap = new GMap2(dMapDiv);
    detailmap.setCenter(stepLatLng,15);

    detailmap.addOverlay(oGDirections.getPolyline());

    var CopyrightDiv = dMapDiv.firstChild.nextSibling;
    var CopyrightImg = dMapDiv.firstChild.nextSibling.nextSibling;
    CopyrightDiv.style.display = "none";
    CopyrightImg.style.display = "none";

    detailmap.addControl(new GSmallMapControl());

}