// JavaScript Document

/* Google Map code */

var localSearch = new GlocalSearch();

function usePointFromPostcode(postcode)
{

    if (GBrowserIsCompatible())
    {

        localSearch.setSearchCompleteCallback(null, function() 
        {
                if (localSearch.results[0])
                {       
                var resultLat = localSearch.results[0].lat;
                var resultLng = localSearch.results[0].lng;
                var map = new GMap2(document.getElementById("googleMap"));
                var marker = new GMarker(new GLatLng(resultLat, resultLng));
                map.setCenter(new GLatLng(resultLat, resultLng), 13);
                map.addControl(new GSmallMapControl());
                map.addOverlay(marker);

                }
                else
                {
                //alert("Postcode not found!");
                $("#google_map_container").hide();
                return false;
                }
        }); 
    }
    else
    {
        alert("Sorry, your browser doesn't support Google Maps.");
    }

    localSearch.execute(postcode + ", UK");
}


function useLatLong(resultLat, resultLng)
{

    if (GBrowserIsCompatible())
    {
        var map = new GMap2(document.getElementById("googleMap"));
        var marker = new GMarker(new GLatLng(resultLat, resultLng));
        map.setCenter(new GLatLng(resultLat, resultLng), 13);
        map.addControl(new GSmallMapControl());
        map.addOverlay(marker);
    }
    else
    {
        alert("Sorry, your browser doesn't support Google Maps.");
    }

}

/* end */

