
googleMap = true;

var map;
var baseIcon;
var gmarkers = [];
var htmls = [];
function ShowMap(){
	var bounds = new GLatLngBounds();

	map = new GMap2(document.getElementById("map"));
	map.setCenter(new GLatLng(43.605753,1.441269), 12);
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());

	baseIcon = new GIcon();
	baseIcon.image = "../Images/Markers/marker.png";
	baseIcon.shadow = "../Images/Markers/shadow50.png";
	baseIcon.iconSize = new GSize(20, 34);
	baseIcon.shadowSize = new GSize(37, 34);
	baseIcon.iconAnchor = new GPoint(9, 34);
	baseIcon.infoWindowAnchor = new GPoint(9, 2);
	baseIcon.infoShadowAnchor = new GPoint(18, 25);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.608457,1.442063);
	bounds.extend(point);
	var marker = createMarker(point, "Basilique St. Sernin", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Basilique St. Sernin</b><br />This is the largest remaining Romanesque<br/ > church in the world.</p>", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Basilique St. Sernin</b><br />This is the largest remaining Romanesque<br/ > church in the world.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.611463,1.416389);
	bounds.extend(point);
	var marker = createMarker(point, "Canal du Midi", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Canal du Midi</b><br />It took 12,000 workers and over ten years to build<br /> the canal connecting the Atlantic to the Mediterranean.<br /> Pierre-Paul Riquet designed it in 1667 to boost the<br />  local economy; it  is now considered one of the<br /> masterpieces of Louis XIV's reign, and is<br /> a Unesco World Heritage Site.</p>", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Canal du Midi</b><br />It took 12,000 workers and over ten years to build<br /> the canal connecting the Atlantic to the Mediterranean.<br /> Pierre-Paul Riquet designed it in 1667 to boost the<br />  local economy; it  is now considered one of the<br /> masterpieces of Louis XIV's reign, and is<br /> a Unesco World Heritage Site.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.604635,1.445528);
	bounds.extend(point);
	var marker = createMarker(point, "Capitole (Le)", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Capitole (Le)</b><br />Formerly the head office of the old town magistrates,<br /> the city hall is impressive, with its white<br /> marble columns all along the front. Today it houses<br /> the Capitole Theatre and the Town Hall.</p>", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Capitole (Le)</b><br />Formerly the head office of the old town magistrates,<br /> the city hall is impressive, with its white<br /> marble columns all along the front. Today it houses<br /> the Capitole Theatre and the Town Hall.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.595894,1.436419);
	bounds.extend(point);
	var marker = createMarker(point, "Prairie des Filtres", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Prairie des Filtres</b><br>The largest green space in the city centre<br /> runs all the way from the Pont-Neuf to the<br /> Pont-Saint-Michel, along the river bank. It's<br /> one of the best places in the city for a walk.</p>", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Prairie des Filtres</b><br>The largest green space in the city centre<br /> runs all the way from the Pont-Neuf to the<br /> Pont-Saint-Michel, along the river bank. It's<br /> one of the best places in the city for a walk.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.612722,1.445732);
	bounds.extend(point);
	var marker = createMarker(point, "Statue de Clemence Isaure", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Statue de Clemence Isaure</b><br />On the corner of the Rue de la Concorde<br /> and the Rue Falguières, a tiny unnamed square has<br />  one of the most stunning fountains in Toulouse.</p>", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Statue de Clemence Isaure</b><br />On the corner of the Rue de la Concorde<br /> and the Rue Falguières, a tiny unnamed square has<br />one of the most stunning fountains in Toulouse.</p>";
	map.addOverlay(marker);
	
	//map.setZoom(map.getBoundsZoomLevel(bounds));
	map.savePosition();
}

function createMarker(point, title, text, index){
	var icon = new GIcon(baseIcon);
	icon.image = "../images/icons/" + index + ".png";
	var marker = new GMarker(point, icon);
	marker.title = "" + title + "";
	GEvent.addListener(marker, "click", function() {
	  marker.openInfoWindowHtml("" + text + "");
	});
	return marker;
}

function myclick(i) {
	gmarkers[i].openInfoWindowHtml(htmls[i]);
}
