
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(40.842905,9.500427), 6);
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());

	baseIcon = new GIcon();
	baseIcon.image = "Graphics/Markers/marker.png";
	baseIcon.shadow = "Graphics/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(40.5592,8.322144);
	bounds.extend(point);
	var marker = createMarker(point, "Alghero", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Alghero</b><br>Found on the northwest coast of Sardinia,<br>Alghero is one of the most charming towns on Sardinia. The main<br>highlights of the town, other than the city’s ancient<br>defences, are the impressive domed cathedral, two dazzling<br>palaces and a string of restaurants, shops and bars along<br>via Roma, via Carlo Alnerto and Principe Umberto.<br>", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Alghero</b><br>Found on the northwest coast of Sardinia,<br>Alghero is one of the most charming towns on Sardinia. The main<br>highlights of the town, other than the city's ancient<br>defences, are the impressive domed cathedral, two dazzling<br>palaces and a string of restaurants, shops and bars along<br>via Roma, via Carlo Alnerto and Principe Umberto.<br>";
	map.addOverlay(marker);


	var icon = new GIcon(baseIcon);
	var point = new GLatLng(40.912994,9.524117);
	bounds.extend(point);
	var marker = createMarker(point, "Costa Smeralda", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Costa Smeralda</b><br>The Costa Smeralda is the main tourist base in Sardinia,<br>it is a beautiful stretch of coastline. There are<br>some beautiful beaches and coves here and the water is<br>crystal clear and great for diving.<br>", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Costa Smeralda</b><br>The Costa Smeralda is the main tourist base in Sardinia,<br>it is a beautiful stretch of coastline. There are<br>some beautiful beaches and coves here and the water is<br>crystal clear and great for diving.<br>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(41.21934,9.460344);
	bounds.extend(point);
	var marker = createMarker(point, "Garibaldis House", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Garibaldis House</b><br>The famous revolutionary Giuseppe Garibaldi, spent the<br>last years of his life here on the pretty island of<br>Caprera. Regular ferries leave Palau, where visitors<br>can take a tour of Garibaldi’s house and the museum, which<br>includes his homestead and his tomb.<br>", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Garibaldis House</b><br>The famous revolutionary Giuseppe Garibaldi, spent the<br>last years of his life here on the pretty island of<br>Caprera. Regular ferries leave Palau, where visitors<br>can take a tour of Garibaldi’s house and the museum, which<br>includes his homestead and his tomb.<br>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(40.320504,9.332714);
	bounds.extend(point);
	var marker = createMarker(point, "Nuoro", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Nuoro</b><br>Those who are interested in taking<br>in some real Sardinian culture and outdoor activities<br>should head for Nuoro, situated roughly in the centre<br>of the island.<br>", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Nuoro</b><br>Those who are interested in taking<br>in some real Sardinian culture and outdoor activities<br>should head for Nuoro, situated roughly in the centre<br>of the island.<br>";
	map.addOverlay(marker);


	var icon = new GIcon(baseIcon);
	var point = new GLatLng(40.916075,8.712502);
	bounds.extend(point);
	var marker = createMarker(point, "Museo dell'Intreccio", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museo dell'Intreccio</b><br>Museum of Basket Weaving is located in the magnificent<br>12th-century castle built by the Genoese family Doria.<br>Examples of craft products using this technique from all<br>over the Mediterranean can be seen including local lagoon<br>boats. <br></p>", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museo dell'Intreccio</b><br>Museum of Basket Weaving is located in the magnificent<br>12th-century castle built by the Genoese family Doria.<br>Examples of craft products using this technique from all<br>over the Mediterranean can be seen including local lagoon<br>boats.<br></p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(40.896419,8.744645);
	bounds.extend(point);
	var marker = createMarker(point, "Roccia dell'Elefante", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Roccia dell'Elefante</b><br>Sculpted over several millennia by the wind this huge<br>piece of rough, dark trachyte rock closely resembles an<br>elephant with its trunk elevated as if trumpeting. Originally tombs<br>were cut into the base of the rock and, on close inspection<br>these can still be seen.<br></p>", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Roccia dell'Elefante</b><br>Sculpted over several millennia by the wind this huge<br>piece of rough, dark trachyte rock closely resembles an<br>elephant with its trunk elevated as if trumpeting. Originally tombs<br>were cut into the base of the rock and, on close inspection<br>these can still be seen.<br></p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(41.005018,9.616578);
	bounds.extend(point);
	var marker = createMarker(point, "Golfo Aranci", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Golfo Aranci</b><br>A resort in its own right, Golfo Aranci is an attractive<br>seaside town which also doubles as the ferry port. There<br>are some great beaches and nightlife to<br>be sampled.<br></p>", 7);
	gmarkers[6] = marker;
	htmls[6] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Golfo Aranci</b><br>A resort in its own right, Golfo Aranci is an attractive<br>seaside town which also doubles as the ferry port. There<br>are some great beaches and nightlife to<br>be sampled.<br></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]);
}
