// JavaScript Document

			
			function codeAddress(mapa,direccion) {
				  var geocoder;
			  var map;
			  geocoder = new google.maps.Geocoder();
				var address = direccion;
				//address="sugranyes 6, barcelona, spain";
				if (geocoder) {
				  geocoder.geocode( { 'address': address}, function(results, status) {
					if (status == google.maps.GeocoderStatus.OK) {
					
					//alert(results[0].geometry.location);
					
					
					 
					var contentString = '<br><br>'+address;
					var infowindow = new google.maps.InfoWindow({
					content: contentString
					});	
					
					
					var myOptions = {
					  zoom: 16,
					  center: results[0].geometry.location,
					  mapTypeId: google.maps.MapTypeId.ROADMAP
					}
					map = new google.maps.Map(document.getElementById(mapa), myOptions);
					
					  var image='/images/puntoMapa.png'; 
					  //map.setCenter(results[0].geometry.location);
					  var marker = new google.maps.Marker({
						  map: map, 
						  title:address,
						  icon:image,
						  position: results[0].geometry.location
					  });
					
					google.maps.event.addListener(marker, 'click', function() {
						infowindow.open(map,marker);
					}); 
					
					
					
					
		
					} else {
					  //alert("Geocode was not successful for the following reason: " + status);
					}
				  });
				}
			  }
			  
			  
			  
			
              
function inicializarMapa(mapa,direccion){			 
	
	codeAddress(mapa,direccion);
}
                    
