
var map;
var icon;

function createMarker(point, textPoint) {
	icon = new GIcon();
	icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
	icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	icon.iconSize = new GSize(12, 20);
	icon.shadowSize = new GSize(22, 20);
	icon.iconAnchor = new GPoint(6, 20);
	icon.infoWindowAnchor = new GPoint(5, 1);
	
	var marker = new GMarker(point, icon);
	map.addOverlay(marker);
  
	GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(textPoint);});
}

function pintarMapa(latitud,longitud,textPoint){
	
if (GBrowserIsCompatible()) {
	
	map = new GMap2(document.getElementById("map"), {size:new GSize(520,400)}, [G_HYBRID_MAP]) ;
      
      G_NORMAL_MAP.getName = function() { return 'Mapa'; }
	map.addMapType(G_NORMAL_MAP);
	G_HYBRID_MAP.getName = function() { return 'Híbrido'; }
	map.addMapType(G_HYBRID_MAP);
	G_SATELLITE_MAP.getName = function() { return 'Satélite'; }
	map.addMapType(G_SATELLITE_MAP);
        
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	
      map.setMapType(G_HYBRID_MAP);

	point = new GLatLng(latitud,longitud);
      map.setCenter(point, 16);

	map.clearOverlays();       
	createMarker(point,textPoint);   
}
} 


