var centerLocation='4800 Bender Street, Niagara Falls, Ontario, L2G 3K1';var latlngCordinates='';var getCordinatesMode='off';var startZoom=15;var map;
function init(){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("directionsMap"));geocoder=new GClientGeocoder();if(latlngCordinates){setCenterLocation(latlngCordinates);}else{setCenterLocation(centerLocation);}map.addControl(new GSmallMapControl());map.addControl(new GMapTypeControl());if(getCordinatesMode=='on'){GEvent.addListener(map,'click',function(overlay,latlng){addMarker(overlay,latlng);});}}}window.onload=init;window.onunload=GUnload;
function addMarker(overlay,latlng){var marker=new GMarker(latlng);map.addOverlay(marker);document.getElementById("directionsDirections").innerHTML=latlng;}
function setCenterLocation(address){if(geocoder){geocoder.getLatLng(address,function(point){if(!point){alert(address+" not found");}else{map.setCenter(point, startZoom);var marker=new GMarker(point);map.addOverlay(marker);}});}}
function getDirections(){var from=document.getElementById("directionsFrom").value;var to;if(latlngCordinates){to=latlngCordinates;}else{to=centerLocation;}if(window.gDirections){window.gDirections.clear();}window.gDirections = new GDirections(map,document.getElementById("directionsDirections"));window.gDirections.load("from: "+from+" to: "+to);}