Populating many info windows in google maps

Hi Guys,
I’ve got a database with locations in it, lat longs, names, descriptions etc and I’d like to populate infowindows with the data (The html infowindow).

I’m fine getting the points on the map, and I can probably figure out how to get the info window to popup when a marker is clicked on.

What I’m having trouble with is what javascript code would I use to populate the info windows with?

I don’t quite know how else to put it, if I’ve got a list of locations and I want to add data to each of those locations, how would I do it just in javascript, i.e. without using external xml files (As the displayed locations will be dynamic, as will the generated javascript).

I’ve found the following code that I’d need to modify:


GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowXslt(info, "parks.xsl");
        });

I’m guessing it’s just the “parks.xsl” that’s the important bit, which is where I’d put my code to refer to many locations, and obviously change “xstl” to “html”.

I suppose if I’ve got my db query results which decides what locations to put on the map, I could create some kind of object out of it, where the name and description of the location are 2 properties of the object, then just loop through them?

I feel like the answer is on the tip of my brain, but I can’t quite get it, if anyone could help, I’d very much appreciate it.