if(GBrowserIsCompatible()){var mapLocation="BH21 6RD";function createMarker(point,html,icon){var marker=new GMarker(point,icon);GEvent.addListener(marker,"click",function(){marker.openInfoWindowHtml(html);});return marker;}
function getDestination(){localSearch.setSearchCompleteCallback(null,function(){if(localSearch.results[0]){var resultLat=localSearch.results[0].lat;var resultLng=localSearch.results[0].lng;setMap(new GLatLng(resultLat,resultLng));}else{alert("Postcode not found!");}});localSearch.execute(mapLocation);}
function setMap(GLatLng){point=GLatLng;map.setCenter(point,11);var marker=createMarker(point,'<div>DORSET JAGUAR &amp; SPORTS CARS<br />Three Cross Garage<br />Ringwood Road<br />Three Legged Cross<br />Wimborne<br />Dorset<br />BH21 6RD<br \/>&nbsp;<br \/></div>',icon)
var thehtml="<div>DORSET JAGUAR &amp; SPORTS CARS<br />Three Cross Garage<br />Ringwood Road<br />Three Legged Cross<br />Wimborne<br />Dorset<br />BH21 6RD<br \/>&nbsp;<br \/></div>";map.openInfoWindowHtml(map.getCenter(),(thehtml));map.addOverlay(marker);}
var map=new GMap2(document.getElementById("gmap"));var directions=new GDirections(map,document.getElementById('map_directions'));var geoCoder=new GClientGeocoder();var localSearch=new GlocalSearch();map.setMapType(G_NORMAL_MAP);map.removeMapType(G_HYBRID_MAP);map.removeMapType(G_SATELLITE_MAP);var point;getDestination();map.addControl(new GLargeMapControl());map.addControl(new GMapTypeControl());map.addControl(new GOverviewMapControl());var icon=new GIcon(G_DEFAULT_ICON);icon.image="/images/Gmarkers/darkgreen_MarkerB.png";}
else
{alert("Sorry, the Google Maps API is not compatible with this browser");}
function getDirections(postcode){localSearch.setSearchCompleteCallback(null,function(){if(localSearch.results[0]){var resultLat=localSearch.results[0].lat;var resultLng=localSearch.results[0].lng;var point=new GLatLng(resultLat,resultLng);showDirections(point);}else{alert("Postcode not found!");}});localSearch.execute(postcode+", UK");}
function showDirections(GLatLng){var to=point.lat()+", "+point.lng();var fromTo='from: '+GLatLng.lat()+', '+GLatLng.lng()+' to: '+mapLocation+'@'+to;directions.load(fromTo);}