﻿function doMap(latitude, longitude, postcode) {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(latitude, longitude), 13);
        var mapControl = new GMapTypeControl();
        map.addControl(mapControl);
        map.addControl(new GSmallMapControl());
        var baseIcon = new GIcon();
        baseIcon.image = "http://www.holidayhometobuy.com/images/map_icon.png";
        baseIcon.iconSize = new GSize(27, 26);
        baseIcon.iconAnchor = new GPoint(14, 14);
        // Set up our GMarkerOptions object
        point = new GLatLng(latitude, longitude);
        var marker = new GMarker(point, baseIcon);

        GEvent.addListener(marker, "click", function() {
        window.open('http://maps.google.co.uk/maps?f=q&hl=en&geocode=&q=' + postcode + '');
        });

        
        map.addOverlay(marker);
    }
}
