
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(39.984486,4.092407), 10);
	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(39.889258,4.26424);
	bounds.extend(point);
	var marker = createMarker(point, "Mao", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Mao</b><br>Mahon (Mao) in eastern Menorca is the capital with pedestrianised streets full<br/>of shops, stylish designer outlets, street cafes and restaurants. There are local<br/>markets here, historic buildings and some stunning churches.</p>", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Mao</b><br>Mahon (Mao) in eastern Menorca is the capital with pedestrianised streets full<br/>of shops, stylish designer outlets, street cafes and restaurants. There are local<br/>markets here, historic buildings and some stunning churches.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(39.8776,4.289646);
	bounds.extend(point);
	var marker = createMarker(point, "Es Castell", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Es Castell</b><br>Es Castell is one of the Menorca's favourite tourist destinations manly<br/>due to Cala Fons harbour, which is a beautiful horseshoe-shaped bay<br/>lined by fishing boats, cafes and restaurants. It has some lively night<br/>life with street entertainment, market stalls and clothes and curio shops.<br/>By day there are some fascinating walks through the town with its<br/>twisting, narrow streets.</p>", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Es Castell</b><br>Es Castell is one of the Menorca's favourite tourist destinations manly<br/>due to Cala Fons harbour, which is a beautiful horseshoe-shaped bay<br/>lined by fishing boats, cafes and restaurants. It has some lively night<br/>life with street entertainment, market stalls and clothes and curio shops.<br/>By day there are some fascinating walks through the town with its<br/>twisting, narrow streets.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(40.002339,3.83925);
	bounds.extend(point);
	var marker = createMarker(point, "Ciudadela", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Ciudadela</b><br>Ciudadela is easily the most attractive and interesting town on the island.<br/>Its Old Town is a delightful compact warren of palaces and churches, little<br/>changed in 300 years. Many of its streets are pedestrianised and shops<br/>and bars shelter beneath vaults and Italianate archways. A wide set of<br/>steps leads to the long straggling port and waterfront, with its pleasure<br/>craft, restaurants and bars.</p>", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Ciudadela</b><br>Ciudadela is easily the most attractive and interesting town on the island.<br/>Its Old Town is a delightful compact warren of palaces and churches, little<br/>changed in 300 years. Many of its streets are pedestrianised and shops<br/>and bars shelter beneath vaults and Italianate archways. A wide set of<br/>steps leads to the long straggling port and waterfront, with its pleasure<br/>craft, restaurants and bars.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(39.939324,3.963747);
	bounds.extend(point);
	var marker = createMarker(point, "Cala Galdana", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Cala Galdana</b><br>The most photographed resort on Menorca, Cala Santa Galdana enjoys a<br/>splendid picturesque situation on a horseshoe bay with a backdrop of<br/>steep densely-wooded limestone cliffs. A river divides the resort in half,<br/>continuing inland where it flows through the beautiful Algendar Gorge.<br/>The resort itself is purpose-built, low key and low rise.</p>", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Cala Galdana</b><br>The most photographed resort on Menorca, Cala Santa Galdana enjoys a<br/>splendid picturesque situation on a horseshoe bay with a backdrop of<br/>steep densely-wooded limestone cliffs. A river divides the resort in half,<br/>continuing inland where it flows through the beautiful Algendar Gorge.<br/>The resort itself is purpose-built, low key and low rise.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(39.899399,4.076872);
	bounds.extend(point);
	var marker = createMarker(point, "Son Bou", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Son Bou</b><br>Son Bou is famous for its beach, certainly the biggest and arguably the best<br/>on the island. The dunes and reed beds separate the sands from the resort<br/>giving sunbathers a feeling of seclusion. At the western end of the resort,<br/>Son Bou merges with the more residential resort of St Jaume Mediterrani.<br/>Historical traces include the scant remains of a paleo-Christian church,<br/>believed to date from the fifth century.</p>", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Son Bou</b><br>Son Bou is famous for its beach, certainly the biggest and arguably the best<br/>on the island. The dunes and reed beds separate the sands from the resort<br/>giving sunbathers a feeling of seclusion. At the western end of the resort,<br/>Son Bou merges with the more residential resort of St Jaume Mediterrani.<br/>Historical traces include the scant remains of a paleo-Christian church,<br/>believed to date from the fifth century.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(39.891365,4.26218);
	bounds.extend(point);
	var marker = createMarker(point, "Xoriguer Gin Distillery", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Xoriguer Gin Distillery</b><br>Situated at the harbour front of the Moll de Ponent, the Xoriguer Distillery<br/>has been part of Menorca’s alcohol industry since the 18th century. Take<br/>a tour of the facility and get to see the giant copper stills in which batches<br/>of spirit are destined to become Menorca gin.   Visitors who are old enough<br/>to drink can sample some of the distillery's favourite products before being<br/>offered the chance to purchase them at the on-site shop.</p>", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Xoriguer Gin Distillery</b><br>Situated at the harbour front of the Moll de Ponent, the Xoriguer Distillery<br/>has been part of Menorca’s alcohol industry since the 18th century. Take<br/>a tour of the facility and get to see the giant copper stills in which batches<br/>of spirit are destined to become Menorca gin.   Visitors who are old enough<br/>to drink can sample some of the distillery's favourite products before being<br/>offered the chance to purchase them at the on-site shop.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(39.972647,4.240036);
	bounds.extend(point);
	var marker = createMarker(point, "S'Albufera des Grau", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>S'Albufera des Grau</b><br>S'Albufera des Grau is a coastal nature reserve stretching some eight and<br/>a half kilometres from Cap de Favaritz. Visitors can explore the reserve’s<br/>wetlands and Menorcan scrub as well as getting the chance to check out<br/>some ancient ruins dating back to the Talayotic and Roman periods.<br/>Ornithologists will find some 100 species of birds living in the reserve.</p>", 7);
	gmarkers[6] = marker;
	htmls[6] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>S'Albufera des Grau</b><br>S'Albufera des Grau is a coastal nature reserve stretching some eight and<br/>a half kilometres from Cap de Favaritz. Visitors can explore the reserve’s<br/>wetlands and Menorcan scrub as well as getting the chance to check out<br/>some ancient ruins dating back to the Talayotic and Roman periods.<br/>Ornithologists will find some 100 species of birds living in the reserve.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(39.890089,4.263425);
	bounds.extend(point);
	var marker = createMarker(point, "Museu de Menorca", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museu de Menorca</b><br>The Museu de Menorca for example can be found in Mahon and is set amid<br/>the remains of an old Franciscan monastery. The museum features artefacts<br/>dating from Roman, Byzantine, Arabic and Talayotic periods as well as other<br/>items from as far back as prehistoric times.</p>", 8);
	gmarkers[7] = marker;
	htmls[7] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museu de Menorca</b><br>The Museu de Menorca for example can be found in Mahon and is set amid<br/>the remains of an old Franciscan monastery. The museum features artefacts<br/>dating from Roman, Byzantine, Arabic and Talayotic periods as well as other<br/>items from as far back as prehistoric times.</p>";
	map.addOverlay(marker);
}

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]);
}
