1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$(function() {

   map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
   markerManager = new MarkerManager(map, {maxZoom:19});

   $.get('test.xml', function(xml){
   //does a lot of stuff like create icons and markers
   //for example
   var icons = xml.documentElement.getElementsByTagName("icon");
        for(var i = 0; i < icons.length; i++) {
          var id = icons[i].getAttribute("id");
          //and a lot more...
        }
    //uses the stuff from above
    //only works with the timeout
    setTimeout("addMarkers(markers)", 100);

   });

});

function addMarkers(markers){
    for(var i in markers)
        //this gives strange api errors without timeout
        markerManager.addMarker(marker[i]);
}