What I ended up doing:
Declared the infobox before the marker, and added the infobox as a custom attribute to the marker - this way, each state marker has an infobox with the correct text attached to it.
// text for info box
var info = statesArray[i].name + "<br/>" + "Total: " + statesArray[i].total + "<br/>";
//set text for infoBox
var boxText = '<div class="stateMarker">' + info + '</div>';
//set options for infoBox
var myOptions = {
content: boxText,
disableAutoPan: true,
maxWidth: 0,
zIndex: null,
boxStyle: {
background: "url('tipbox.gif') no-repeat",
opacity: 1,
width: "75px"
},
closeBoxMargin: "10px 2px 2px 2px",
closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif",
infoBoxClearance: new google.maps.Size(1, 1),
isHidden: false,
pane: "floatPane",
enableEventPropagation: false
};
//instantiate infoBox with options set in myOptions
var ib = new InfoBox(myOptions);
mark = new google.maps.Marker({
map: map,
position: center,
icon:markerImage,
stateIndex: i, // custom attribute for state index so that we can access allStates[index] from within the marker event callbacks
infobox: ib
});
stateMarkers.push(mark);
//create mouseover listener for marker on each state
google.maps.event.addListener(mark, 'mouseover', function () {
this.infobox.open(map, this); //open infoBox
});
//create mouseout listener for marker on each state
google.maps.event.addListener(mark, 'mouseout',function(){
this.infobox.close(map,this); //close infoBox
});