var geocoder;
var map;
var addresses = new Array("МАРЬИНСКИЙ БУЛЬВАР 7", "ЭЛЕВАТОРНАЯ 12", "СУДОСТРОИТЕЛЬНАЯ 27");
var names = new Array("Эвакуатор Марьинский Бульвар 7", "Эвакуатор ул. Элеваторная 12", "Эвакуатор ул. Судостроительная 27");
var counter=0;


function load()
{
// Create new map object
	map = new GMap2(document.getElementById("map"));				
// Create new geocoding object
	geocoder = new GClientGeocoder();
// Retrieve location information, pass it to addToMap()
	for (i=0; i < addresses.length; i++)
	geocoder.getLocations("Москва, "+addresses[i], addToMap);
}





function createMarker(point,html) 
{
	var marker = new GMarker(point);
	GEvent.addListener(marker, "mouseover", function() {marker.openInfoWindowHtml(html);});
	return marker;
}




				
// This function adds the point to the map	
function addToMap(response)
{
// Retrieve the object
	place = response.Placemark[0];
	point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
   
        htmlText="<b>"+names[counter]+"</b>";
				
// Create a marker

	marker=createMarker(point, htmlText);
        map.addOverlay(marker);
        //marker.openInfoWindowHtml(htmlText);

        if (counter==0)
        {
           map.setCenter(new GLatLng(55.68, 37.73), 10);
           map.addControl(new GSmallMapControl());
           map.addControl(new GMapTypeControl());
        }
           counter++;
}
