//var map; //var request; window.addEvent('load', function() { makeMap('-30.640','151.450','11', 'complete'); document.addEvent('unload', function(){ GUnload(); }); }); var id = '1233810047'; var idmarkers = []; function createMarker(point,name,html,ident) { // FF 1.5 fix html = '
' + html + '
'; var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); idmarkers[ident] = marker; return marker; } function myclick(i) { gmarkers[i].openInfoWindowHtml(htmls[i]); } function makeMap() { var map = new google.maps.Map( document.getElementById('map_canvas'), { center: new google.maps.LatLng( -30.640, 151.450 ), zoom: 11, mapTypeId: google.maps.MapTypeId.ROADMAP }); /* var marker = new google.maps.Marker({ position: new google.maps.LatLng( -30.640, 151.450 ), map: map, title : "HOME" }); var infowindow = new google.maps.InfoWindow({ content: "infostring...." }); google.maps.event.addListener(marker, 'click', function() { infowindow.open(map,marker); }); */ getXMLfile(map); } function getXMLfile(map) { filename = '/xml/map.xml'; if (filename.length == 0) { alert("Please enter a filename!"); return false; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET",filename,true); xmlhttp.send(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { xmlDoc=xmlhttp.responseXML; processXMLfile(map,xmlhttp); } } return false; } var M= null; var info = new Array(); function processXMLfile(map,xmlhttp) { infowindow = new google.maps.InfoWindow({ content : "HEY" }); if (true) { // obtain the array of markers and loop through it var markers = xmlDoc.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { // obtain the attribues of each marker M = markers[i]; var lat = parseFloat(markers[i].getAttribute("lat")); var lng = parseFloat(markers[i].getAttribute("lng")); var ident = parseFloat(markers[i].getAttribute("ident")); // var point = new GPoint(lng,lat); //var point = new GLatLng(lat,lng); var html = markers[i].getAttribute("infowindow"); var label = markers[i].getAttribute("label"); info[i] = M.textContent; // create the marker //var marker = createMarker(point,label,html,ident); //map.addOverlay(marker); // // alert(label); marker = new google.maps.Marker({ position: new google.maps.LatLng( lat, lng ), map: map, title: label }); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(info[i]); infowindow.open(map, marker); } })(marker, i)); } } }