// Script to load and position a KML/XML Google Map // See www.reviewmylife.co.uk for details. var kml; var lat; var lng; var zoom; function LoadGoogleMap(){ // Find mapinfo span and get name attribute var mapxml = document.getElementById('mapxml').getAttribute('name'); if (document.getElementById('lat')){ lat = document.getElementById('lat').getAttribute('name'); } if (document.getElementById('lng')){ lng = document.getElementById('lng').getAttribute('name'); } if (document.getElementById('zoom')){ zoom = parseInt(document.getElementById('zoom').getAttribute('name')); } kml = new GGeoXml(mapxml, PositionMapCallback); } function PositionMapCallback(){ var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); if (typeof lat=="undefined" || typeof lng=="undefined"){ kml.gotoDefaultViewport(map); } else{ map.setCenter(new GLatLng(lat, lng)); } if (typeof zoom!="undefined"){ map.setZoom(zoom); } map.addOverlay(kml); }