function cargarMapa(markers, kmlFile) {

	if (GBrowserIsCompatible()) {
		
		$(window).unload( function () {
			GUnload();
		} );
	
		var iconBlue = new GIcon(); 
		iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
		iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
		iconBlue.iconSize = new GSize(12, 20);
		iconBlue.shadowSize = new GSize(22, 20);
		iconBlue.iconAnchor = new GPoint(6, 20);
		iconBlue.infoWindowAnchor = new GPoint(5, 1);
		
		var iconRed = new GIcon(); 
		iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
		iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
		iconRed.iconSize = new GSize(12, 20);
		iconRed.shadowSize = new GSize(22, 20);
		iconRed.iconAnchor = new GPoint(6, 20);
		iconRed.infoWindowAnchor = new GPoint(5, 1);
		
		var customIcons = [];
		customIcons["azul"] = iconBlue;
		customIcons["rojo"] = iconRed;

		function createMarker(point, name, address, type) {
			var marker = new GMarker(point, customIcons[type]);

			var html = "<div class='bocata'>";
				html += "<strong>" + name + "</strong> <br />" + address;
			html += "</div>";

			GEvent.addListener(marker, 'click', function() {
				marker.openInfoWindowHtml(html);
			});
			
			return marker;
		}
		
		try {
			
			
			var map = new GMap2(document.getElementById("mapa")); 

			map.addControl(new GScaleControl());

			map.setUIToDefault();
					
			
			
			var geoxml = new GGeoXml(kmlFile, function() {
				
				map.setCenter(new GLatLng(0,0),0);
				
				if (geoxml.loadedCorrectly()) {
					
				   	map.addOverlay(geoxml);
					
				   	var bounds = this.getDefaultBounds();
			  
//				   	console.log("Cargado");
				   	
			  	//}else{
			  
//			  		console.log("No Cargado");
			  		
//					var bounds = new GLatLngBounds();
					
					var type = 'rojo';
	
					var marker; // definimos aqui la variable, no en el for.
					
					for (var i = 0 ; i < markers.length ; i++)
					{
						if( i == 0) continue;
						
						markers[i].point = new GLatLng(markers[i].point[0], markers[i].point[1]);
						
						marker = createMarker(markers[i].point, markers[i].name, markers[i].address, type);
						
					    map.addOverlay(marker);
		
					    bounds.extend(markers[i].point);
					    
					    marker.openInfoWindow("<strong>"+markers[i].name+"</strong><br />"+markers[i].address);
					}
					
			  }
			  
			 
					var zoom = map.getBoundsZoomLevel(bounds);
			
		//			if( markers.length > 1 ){
		//				zoom = zoom - 1;
		//			}
		//				
		//			if(zoom > 13){
		//				zoom = 9;
		//			}
					
//					map.setZoom(zoom);
					map.setZoom(12);
		
//				    map.setCenter(bounds.getCenter());
				    map.setCenter(new GLatLng(42.805, -1.65));
			  
			  
			});
			

			
		  
								
		} catch (e) {

			alert(e);

			console.trace();

		}
	}
}
