
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(36.825226,27.147217), 10);
	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(36.904333,27.289352);
	bounds.extend(point);
	var marker = createMarker(point, "Hippocrates' plane tree", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Hippocrates' plane tree</b><br/>Located in the centre of Kos Town,<br> this tree is said to be the location of where<br> Hippocrates of Kos taught his pupils the art<br> of medicine.</p>", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Hippocrates' plane tree</b><br />Located in the centre of Kos Town,<br> this tree is said to be the location of where<br> Hippocrates of Kos taught his pupils the art<br> of medicine.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(36.751401,26.981049);
	bounds.extend(point);
	var marker = createMarker(point, "Kefalos Beach", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Kefalos Beach</b><br/>Arguably one of the most beautiful beaches<br> on the island of Kos with stunning white sands<br> and beautiful clear blue waters.</p>", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Kefalos Beach</b><br />Arguably one of the most beautiful beaches<br> on the island of Kos with stunning white sands<br> and beautiful clear blue waters.</p>";
	map.addOverlay(marker);
	
var icon = new GIcon(baseIcon);
	var point = new GLatLng(36.846659,27.324371);
	bounds.extend(point);
	var marker = createMarker(point, "Thermes Beach", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Thermes Beach</b><br/>With black sandy shores and hot springs,<br>this beach is a firm favourite with tourists<br>as well as locals. Just less than 5 miles<br> from Kos Town, a visit to this beach is a must<br> whilst on holiday in Kos.</p>", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Thermes Beach</b><br />With black sandy shores and hot springs,<br>this beach is a firm favourite with tourists<br>as well as locals. Just less than 5 miles<br> from Kos Town, a visit to this beach is a must<br> whilst on holiday in Kos.</p>";
	map.addOverlay(marker);

var icon = new GIcon(baseIcon);
	var point = new GLatLng(36.849956,27.083359);
	bounds.extend(point);
	var marker = createMarker(point, "Mastichari Beach", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Mastichari Beach</b><br />Positioned on the northern coastline of Kos,<br>this exotic beach is ideal for a relaxing day<br>trip taking in the beautiful views or a refreshing<br>dip in the warm emerald waters.</p>", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Mastichari Beach</b><br />Positioned on the northern coastline of Kos,<br>this exotic beach is ideal for a relaxing day<br>trip taking in the beautiful views or a refreshing<br> dip in the warm emerald waters.</p>";
	map.addOverlay(marker);
	
var icon = new GIcon(baseIcon);
	var point = new GLatLng(36.846315,27.205238);
	bounds.extend(point);
	var marker = createMarker(point, "Zia", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Zia</b><br />Romantic mountain village located on the<br>hillside in Kos. With breathtaking views,<br>stay around to witness the beautiful sunset scene.</p>", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Zia</b><br />Romantic mountain village located on the<br>hillside in Kos. With breathtaking views,<br>stay around to witness the beautiful sunset scene.</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]);
}

