
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(35.310643,24.919739), 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(35.300416,25.170879);
	bounds.extend(point);
	var marker = createMarker(point, "Knossos", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Knossos</b><br/>The largest Bronze Age archaeological<br>site on Crete, probably the ceremonial and<br>political center of the Minoan civilization<br>and culture.</p>", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Knossos</b><br />The largest Bronze Age archaeological<br>site on Crete, probably the ceremonial and<br>political center of the Minoan civilization<br>and culture.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(35.051289,24.813824);
	bounds.extend(point);
	var marker = createMarker(point, "Phaistos", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Phaistos</b><br/>Phaistos is an ancient city located<br>in the south-central portion of the island. It<br>was inhabited from about 4000 BC. A palace, dating<br>from the Middle Bronze Age, was destroyed<br>by an earthquake but later rebuilt toward the end of<br>the Late Bronze Age.</p>", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Phaistos</b><br />Phaistos is an ancient city located<br>in the south-central portion of the island. It<br>was inhabited from about 4000 BC. A palace, dating<br>from the Middle Bronze Age, was destroyed<br>by an earthquake but later rebuilt toward the end of<br>the Late Bronze Age.</p>";
	map.addOverlay(marker);
	
var icon = new GIcon(baseIcon);
	var point = new GLatLng(35.061196,24.932442);
	bounds.extend(point);
	var marker = createMarker(point, "Gortyn", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Gortyn</b><br/>Gortyn is an archaeological site 45 km away from Heraklion.<br>Gortyn, the Roman capital of Crete, was first inhabited around<br>3000 BC, and was a flourishing Minoan town between<br>1600-1100 BC. The island is now part of Greece.</p>", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Gortyn</b><br />Gortyn is an archaeological site 45 km away from Heraklion.<br>Gortyn, the Roman capital of Crete, was first inhabited around<br>3000 BC, and was a flourishing Minoan town between<br>1600-1100 BC. The island is now part of Greece.</p>";
	map.addOverlay(marker);

	

var icon = new GIcon(baseIcon);
	var point = new GLatLng(35.362176,24.46209);
	bounds.extend(point);
	var marker = createMarker(point, "Rethymno", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Rethymno</b><br />Rethymno a city of approximately 40,000 people.<br>It was built in antiquity even though it has never been a competitive<br>Minoan center. It was, however, strong enough to mint its own coins<br>and maintain a mild urban growth. One of these coins is today depicted<br>as the crest of the town with two dolphins in a circle.</p>", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Rethymno</b><br />Rethymno a city of approximately 40,000 people.<br>It was built in antiquity even though it has never been a competitive<br>Minoan center. It was, however, strong enough to mint its own coins<br>and maintain a mild urban growth. One of these coins is today depicted<br>as the crest of the town with two dolphins in a circle.</p>";
	map.addOverlay(marker);
	
var icon = new GIcon(baseIcon);
	var point = new GLatLng(35.271095,23.961482);
	bounds.extend(point);
	var marker = createMarker(point, "Samaria Gorge", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Samaria Gorge</b><br />The Samariá Gorge is a national park, one of<br>the major tourist attractions of the<br>island.</p>", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Samaria Gorge</b><br />The Samariá Gorge is a national park, one of<br>the major tourist attractions of the<br>island.</p>";
	map.addOverlay(marker);
	
var icon = new GIcon(baseIcon);
	var point = new GLatLng(35.307666,25.405476);
	bounds.extend(point);
	var marker = createMarker(point, "Star Beach", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Star Beach</b><br />Located in Herisonissos. The waterpark caters for young and old<br>with an internet cafe, fantastic restaurants, bunjee jumping,<br>various bars and a DJ, swimming pool with a spring board,<br>jacuzzi, pool tables and various watersport activities<br>on the beach.</p>", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Star Beach</b><br />Located in Herisonissos. The waterpark caters for young and old<br>with an internet cafe, fantastic restaurants, bunjee jumping,<br>various bars and a DJ, swimming pool with a spring board,<br>jacuzzi, pool tables and various watersport activities<br>on the beach.</p>";
	map.addOverlay(marker);

var icon = new GIcon(baseIcon);
	var point = new GLatLng(35.211229,26.097078);
	bounds.extend(point);
	var marker = createMarker(point, "Sitia", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Sitia</b><br />If you are wanting to get away from the crowds then<br>head to one of the least touristy areas in Crete.<br>Sitia has a long sandy beach which<br>is great for swimming and has perfect windsurfing conditions.</p>", 7);
	gmarkers[6] = marker;
	htmls[6] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Sitia</b><br />If you are wanting to get away from the crowds then<br>head to one of the least touristy areas in Crete.<br>Sitia has a long sandy beach which<br>is great for swimming and has perfect windsurfing conditions.</p>";
	map.addOverlay(marker);

var icon = new GIcon(baseIcon);
	var point = new GLatLng(35.330833,24.275556);
	bounds.extend(point);
	var marker = createMarker(point, "Kournas", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Kournas</b><br />Kournas is a village and lake<br>on the island. Kournas is a fairly large<br>village perched on a hill overlooking the lake.</p>", 8);
	gmarkers[7] = marker;
	htmls[7] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Kournas</b><br />Kournas is a village and lake<br>on the island. Kournas is a fairly large<br>village perched on a hill overlooking the lake.</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]);
}

