Hi
I have this code
function initialize() {
var myLatlng = new google.maps.LatLng(xx.xx, xx.xx);
var myOptions = {
zoom: 11,
center: myLatlng,
scaleControl: true,
scrollwheel: true,
disableDoubleClickZoom: false,
mapTypeId: google.maps.MapTypeId.TERRAIN
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
window.mapload = function (myfile) {
resetAll();
var bounds = new google.maps.LatLngBounds();
jQuery.get("trace_" + myfile + ".xml", {}, function(data) {
jQuery(data).find("wpt").each(function() {
var marker = jQuery(this);
var description = marker.find('name').text();
var ele = marker.find('ele').text();
var latlng = new google.maps.LatLng(parseFloat(marker.attr("lat")),
parseFloat(marker.attr("lon")));
var marker = new google.maps.Marker({position: latlng, map: map, icon: "http://google-maps-icons.googlecode.com/files/racing.png"});
var infowindow = new google.maps.InfoWindow({
content: description
});
google.maps.event.addListener(marker, 'click', function() {
//infowindow.close();
infowindow.open(map,marker);
});
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});
markers.push(marker);
});
});
}
window.mapload('motel');
}
// Clear all overlays, reset the array of points
function resetAll() {
if (flightPathReset) {
flightPathReset.setMap(null);
}
for (var i in markers) {
markers[i].setMap(null);
}
fruits = new Array();
chart = null;
data = null;
mousemarker = null;
flightPath = null;
flightPathReset = null;
dataElev = new Array();
elevations = new Array();
markers = new Array();
bounds = null;
}
google.setOnLoadCallback(initialize);
My problem is to clear from the map all the infowindow from the "resetAll" function if some infowindow are open when I call the "mapload" function with a new xml file !
I can clear all the markers but I didn't find out for the "infowindow" !
Thanks for your help...
Chris