﻿// JScript File

var map;

function getGoogleMap(StreetAddress, ElementName, addMarker)
{
    if(GBrowserIsCompatible())
    {
        map = new GMap2(document.getElementById(ElementName));
        var GeoCoder = new GClientGeocoder();
        GeoCoder.getLocations(StreetAddress, PinPoint);
        
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());

    }    
}

function PinPoint(response)
{
    place = response.Placemark[0];
    
    // Retrieve the latitude and longitude
    point = new GLatLng(place.Point.coordinates[1],
                      place.Point.coordinates[0]);
    
    // Center the map on this point
    map.setCenter(point, 13);
    
    
    marker = new GMarker(point);
    map.addOverlay(marker);
    //marker.openInfoWindowHtml(StreetAddress);
}
