JavaScript
var addresses = ["Havana, CU", "Ottawa, CA", "Washington, US", "Nassau, BS", "Saint-Pierre, PM", "Cockburn Town, TC", "Hamilton, BM", "New York, US", "Chicago, US", "Toronto, CA", "Houston, US", "Guadalajara, MX", "Philadelphia, US", "Ciudad Juárez, MX", "Phoenix, US", "Tijuana, MX", "Dallas, US", "Gustavo A. Madero, MX", "Monterrey, MX", "Indianapolis, US", "Jacksonville, US", "Chihuahua, MX", "Charlotte, US", "Mérida, MX", "Culiacán, MX", "Aguascalientes, MX", "Memphis, US", "Winnipeg, CA", "Boston, US", "Denver, US", "Milwaukee, US", "Las Vegas, US", "Santiago de Cuba, CU", "Albuquerque, US", "Nashville, US", "Québec, CA", "Durango, MX", "Virginia Beach, US", "Atlanta, US", "Colorado Springs, US", "Omaha, US", "Tulsa, US", "Minneapolis, US", "Wichita, US", "Halifax, CA", "Nuevo Laredo, MX", "Anaheim, US"];
var bounds = new google.maps.LatLngBounds();
var successCnt = 0;
var failCnt = 0;
var map;
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(30.51687, 69.40949);
var myOptions = {
zoom: 10,
center: latlng,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
navigationControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
if (geocoder) {
for (var i = 0; i < addresses.length; i++) {
codeAddress(addresses[i]);
}
}
}
google.maps.event.addDomListener(window, "load", initialize);
function codeAddress(address) {
geocoder.geocode({
'address': address
}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
successCnt++;
map.setCenter(results[0].geometry.location);
var infowindow = new...