function genera_mappa(data) {	
	var mapOpts = {
	  mapTypeId: google.maps.MapTypeId.ROADMAP,
	  scaleControl: true,
	  scrollwheel: false
	}
	var map = new google.maps.Map(document.getElementById("map"), mapOpts);
	
	var infoWindow = new google.maps.InfoWindow();
	var markerBounds = new google.maps.LatLngBounds();
	var markerArray = [];
	 
	function makeMarker(options){
	  var pushPin = new google.maps.Marker({map:map});
	  pushPin.setOptions(options);
	  google.maps.event.addListener(pushPin, "click", function(){
	    infoWindow.setOptions(options);
	    infoWindow.open(map, pushPin);
	  });
	  markerBounds.extend(options.position);
	  markerArray.push(pushPin);
	  return pushPin;
	}
	
	google.maps.event.addListener(map, "click", function(){
	  infoWindow.close();
	});

	count = data.length;	
	for (var i = 0; i < count; i++) {
		var azienda = data[i];
		makeMarker({
		  position: new google.maps.LatLng(azienda.lat,azienda.lng),
		  title: azienda.azienda_nome,
		  content: azienda.azienda_contenuto
		});  
	}	
	map.fitBounds(markerBounds);	
}




