Try this:
function plotProviders() {
var name = new Array();
name[0] = "Arlington Foot and Ankle";
name[1] = "Health Choices: Schum-Brady Marie MD";
name[2] = "Metropolitan Pediatrics";
var address = new Array();
address[0] = "3500 14th St N Arlington, VA";
address[1] = "4040 Fairfax Dr # 140 Arlington, VA";
address[2] = "3801 Fairfax Dr. #44 Arlington, VA";
for(x=0; x < name.length; x++)
{
currentProviderName = name[x];
currentProviderAddress = address[x];
geocode(currentProviderName, currentProviderAddress);
}
}
function geocode(provider, address) {
geocoder.geocode({
address: address,
partialmatch: true
},
function geocodeResult(results, status) {
if (status == 'OK' && results.length > 0) {
var contentString = ('<p style="font-family: arial; font-size: 12px; margin: 0px;"><b>' + provider +
'</b></p><p style="font-family: arial; font-size: 11px;">' + address);
var infowindow = new google.maps.InfoWindow({
content: contentString,
noCloseOnClick: false
});
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
title: provider});
google.maps.event.addListener(marker, 'mouseover', function() { infowindow.open(map,marker);});
google.maps.event.addListener(marker, 'mouseout', function() { infowindow.close(map.marker);});
}
else {
alert("Geocode was not successful for the following reason: " + status);
}
});