Ved at bruge @Dr.Molle-linket fik jeg det til at virke. Hvis nogen er ude efter denne funktion, er dette min nye kode
var markerContents={};
var infoWindow = new google.maps.InfoWindow;
downloadUrl("map/map_data_source.php", function(data) {
var xml = data.responseXML;
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var date = markers[i].getAttribute("date");
var artist = markers[i].getAttribute("artist");
var venue = markers[i].getAttribute("venue");
var address = markers[i].getAttribute("address");
var city = markers[i].getAttribute("city");
var idgigs = markers[i].getAttribute("id");
var country = markers[i].getAttribute("country");
var count = markers[i].getAttribute("count");
var swith = markers[i].getAttribute("swith");
var stage = markers[i].getAttribute("stage");
var type = markers[i].getAttribute("type");
var point = new google.maps.LatLng(
parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var customIcons = {
FFFFFF: {
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + count + '|' + type + '|000000'
},
upcoming: {
icon: '../map/marker/orange.png'
}
};
var markerId = point.toString();
if(!markerContents[markerId]){
markerContents[markerId] = [];
}
var html =
'<div id="infoWindow" width="600px"><img src="projects/components/' + artist + '">' +
'<br><br>' + date +
'<br><b>' + venue + '</b> / ' + city + '<br>' + swith + stage +
'<br><b><a class="second_sub_menu" href="../projects/bands.php?sub=Setlist&info=' + artist + '&id=' + idgigs + '">SHOW INFORMATION</a></b>';
var icon = customIcons[type] || {};
markerContents[markerId].push(html);
var marker = new google.maps.Marker({
map: map,
position: point,
zIndex: i,
icon: icon.icon
});
bindInfoWindow(marker, map, infoWindow, markerContents[markerId]);
}
});
}
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html.join('<hr/>'));
infoWindow.open(map, marker);
if (map.getZoom() < 4) map.setCenter(marker.getPosition());
if (map.getZoom() < 4) map.setZoom(4);
});
google.maps.event.addListener(map, "click", function() {infoWindow.close();});
}
Fordi jeg ønskede brugerdefinerede ikoner, og jeg ønskede, at en udvalgt gruppe af markører altid skulle være øverst, var jeg også nødt til at ændre ikonkoden, men det virker. Så tak til dem, der hjalp