
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(42.640999,18.10902), 16);
	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(42.641788,18.107561);
	bounds.extend(point);
	var marker = createMarker(point, "Franciscan Monastery", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Fransiscan Monastery</b><br>14th Century Franciscan Monastery, including museum, Gothic<br> and Romanesque architecture and the oldest working pharmacy in Europe.", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Fransiscan Monastery</b><br/>14th Century Franciscan Monastery, including museum, Gothic<br> and Romanesque architecture and the oldest working pharmacy in Europe.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(42.641851,18.110919);
	bounds.extend(point);
	var marker = createMarker(point, "Dominican Monastery", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Dominican Monastery</b><br>Sometimes called 'the defense and salvation of the city',<br> the Dominican Monastery was built into the city walls, only<br> to be destroyed and rebuilt after the 1667 earthquake.", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Dominican Monastery</b><br>Sometimes called 'the defense and salvation of the city',<br> the Dominican Monastery was built into the city walls, only<br> to be destroyed and rebuilt after the 1667 earthquake.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(42.640928,18.110297);
	bounds.extend(point);
	var marker = createMarker(point, "Church of St. Blaise", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Church of St Blaise</b><br>The Church of St. Blaise, the patron saint of Dubrovnik,<br> is a baroque style church located on the square.", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Church of St Blaise</b><br>The Church of St. Blaise, the patron saint of Dubrovnik,<br> is a baroque style church located on the square.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(42.640044,18.110361);
	bounds.extend(point);
	var marker = createMarker(point, "Cathedral of the Assumption", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Cathedral of the Assumption</b><br>The Cathedral of the Assumption of the Virgin was rebuilt just after<br> the 1667 earthquake in the baroque style, and contains a large<br> treasury and a number of influential paintings, including <i>The Assumption</i> by Titian.", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Cathedral of the Assumption</b><br>The Cathedral of the Assumption of the Virgin was rebuilt just after<br> the 1667 earthquake in the baroque style, and contains a large<br> treasury and a number of influential paintings, including <i>The Assumption</i> by Titian.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(42.640715,18.110822);
	bounds.extend(point);
	var marker = createMarker(point, "Rector's Palace", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Rector's Palace</b><br>Restored to its former glory, the Rector's Palace near the<br> Church of St. Blaise is one of the most beautiful places<br> to see. In summer, open air concerts are also held here.", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Rector's Palace</b><br>Restored to its former glory, the Rector's Palace near the<br> Church of St. Blaise is one of the most beautiful places<br> to see. In summer, open air concerts are also held here.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(42.641623,18.107218);
	bounds.extend(point);
	var marker = createMarker(point, "Onofrio's Fountain", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Onofrio's Fountain</b><br>Large Onofrio's Fountain was built in 1438 to serve<br> as both a fountain and a water tank. The water flows out<br> of 16 masked figures. <b>Small Onofrio's Fountain</b> can be found <br>near Luza Square.", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Onofrio's Fountain</b><br>Large Onofrio's Fountain was built in 1438 to serve<br> as both a fountain and a water tank. The water flows out<br> of 16 masked figures. <b>Small Onofrio's Fountain</b> can be found <br>near Luza Square.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(42.64107,18.109932);
	bounds.extend(point);
	var marker = createMarker(point, "Orlando's Column", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Orlando's Column</b><br>Orlando's column was erected to celebrate Dubrovnik's independence,<br> and depicts a knight dressed for battle. The length<br> of the knight's forearm (about half a metre) decicded<br> the standard unit of measure in Dubrovnik, the <b>ell</b>.", 7);
	gmarkers[6] = marker;
	htmls[6] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Orlando's Column</b><br>Orlando's column was erected to celebrate Dubrovnik's independence,<br> and depicts a knight dressed for battle. The length<br> of the knight's forearm (about half a metre) decicded<br> the standard unit of measure in Dubrovnik, the <b>ell</b>.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(42.641796,18.106531);
	bounds.extend(point);
	var marker = createMarker(point, "Pile Gate", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Pile Gate</b><br>The main port of entry to the Old Town, the Pile Gate<br> was built on the site of the old Pile Fortress.<br> It is situated on the westernmost end of <b>Stradun</b>, the main<br> street in the old town.", 8);
	gmarkers[7] = marker;
	htmls[7] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Pile Gate</b><br>The main port of entry to the Old Town, the Pile Gate<br> was built on the site of the old Pile Fortress.<br> It is situated on the westernmost end of <b>Stradun</b>, the main<br> street in the old town.";
	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]);
}
