var geocoder;
var map;
var addresses = new Array();
var names = new Array();
var counter=0;
var zoom1=14;
	function load(address,z)
	{
		if(z) zoom1=z;
		 addresses[0] = address;
		 names[0] = address;

		 // 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="";

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

 if (counter==0)
  {
	map.setCenter(point, zoom1);
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
   }

  counter++;
  }


