Well, let me guess it was intended to work with the loop and around posts and pages, and not only in posts and pages.
Also, custom post types are treated as posts, so it should work too.
We’re listing posts in a term page but inside a loop, so it should work correctly just like in any archive page because archive pages use the loop to show posts data, and even it occurs in this same page in the other loop.
We loop 2 times to show the term posts in both ways, text and infowindows in the map.
When i rate some post on the list, if the infowindow is open you can see the stars appearing, but with wrong rating. Also, with another post on a rating update you can see the info loaded into the infowindow. Strange behaviours. :\
BTW the code you provided does not solve the problem, either if included inside custom JS file or at the end of the gMap script, but remember the code is loaded, because there’s other list of posts showing the stars and able to rate.
I would provide a URL but it’s in a private machine while under development. If you want access drop me a line over gtalk or mail and i show you. ??