
var map;
var geocoder;

function initialize() {
	map = new GMap2(document.getElementById("map_canvas"));
	map.setCenter(new GLatLng(34, 0), 14);
	map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
	geocoder = new GClientGeocoder();
	geocoder.getLocations('Miquel Servet,4 08860 Castelldefels Barcelona', addAddressToMap);
}

// addAddressToMap() is called when the geocoder returns an
// answer.  It adds a marker to the map with an open info window
// showing the nicely formatted version of the address and the country code.
function addAddressToMap(response) {
	map.clearOverlays();
	if (!response || response.Status.code != 200) {
		alert("Sorry, we were unable to geocode that address");
	} else {
		place = response.Placemark[0];
		point = new GLatLng(place.Point.coordinates[1],
			place.Point.coordinates[0]);
			marker = new GMarker(point);
			map.addOverlay(marker);
			marker.openInfoWindowHtml('<b>DGE-PLV:</b><br />Expertos en PLV, Cartón y Permanente.<br />'+ place.address);
		}
	}


