The problem is that you are defining only a single infowindow and,
after your loop, it takes on the position of the last marker in your
array. You either need to define a different infowindow for each
marker or dynamically change the position & content of a single
infowindow in the click handler for a marker. If the latter, put
infowindow.setPosition(this.getPosition()); in your click handler just
before you open the infowindow -- and define the infowindow once
outside your loop.
Gary