
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(43.508195,16.428936), 14);
	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(43.509421,16.443948);
	bounds.extend(point);
	var marker = createMarker(point, "Diocletian's Palace", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Diocletian's Palace</b><br>Built by the emperor Diocletian at the turn of the fourth century AD,<br> Diocletian's Palace is considered to be one of the most important<br> buildings in the town of Split and throughout the world due<br> to its degree of preservation. Explore the Palace on foot for<br> a fantastic day out in Split.<br><br>The Palace is open daily 9am to 1pm except Thursdays 9am to 5pm<br> and closed on Sunday.", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Diocletian's Palace</b><br>Built by the emperor Diocletian at the turn of the fourth century AD,<br> Diocletian's Palace is considered to be one of the most important<br> buildings in the town of Split and throughout the world due<br> to its degree of preservation. Explore the Palace on foot for<br> a fantastic day out in Split.<br><br>The Palace is open daily 9am to 1pm except Thursdays 9am to 5pm<br> and closed on Sunday.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.507896,16.419303);
	bounds.extend(point);
	var marker = createMarker(point, "Marjan Hill", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Marjan Hill</b><br>Located on the western side of the the town of Split,<br> Marjan Hill is a beautiful location for spectacular views of the city,<br> sea and the surrounding Croatian countryside. On top of the hill<br> there is also a zoo and a natural history museum.", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Marjan Hill</b><br>Located on the western side of the the town of Split,<br> Marjan Hill is a beautiful location for spectacular views of the city,<br> sea and the surrounding Croatian countryside. On top of the hill<br> there is also a zoo and a natural history museum.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.505359,16.422522);
	bounds.extend(point);
	var marker = createMarker(point, "Museum of Croatian Archaeological Monuments", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museum of Croatian Archaeological Monuments</b><br>The Museum of Croatian Archaeological Monuments is one of<br> the oldest museums in Croatia, packed full of objects collected<br> from the Middle Ages, in particular from the 9th-12th centuries.<br><br>Opening times are Monday-Friday 10am-1pm and 5pm-8pm and<br> Saturday 10am-3pm.", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museum of Croatian Archaeological Monuments</b><br>The Museum of Croatian Archaeological Monuments is one of<br> the oldest museums in Croatia, packed full of objects collected<br> from the Middle Ages, in particular from the 9th-12th centuries.<br><br>Opening times are Monday-Friday 10am-1pm and 5pm-8pm and<br> Saturday 10am-3pm.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.508425,16.441169);
	bounds.extend(point);
	var marker = createMarker(point, "City Museum of Split", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>City Museum of Split</b><br>Located within the complex of medieval buildings in the north<br> eastern corner of Diocletians Palace, the City Museum of Split<br> houses many important Croatian artifacts from between the 12th<br> and 14th centuries including coins, statues, Romanesque sculpture,<br> gothic renaissance coffers and weapons.<br><br>Opening times:<br> Summer - Tue-Fri 9am-9pm; Sat and Sun 10am-1pm<br> Winter - Tue-Fri 10am-5pm; Sat and Sun 10am-12pm.", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>City Museum of Split</b><br>Located within the complex of medieval buildings in the north<br> eastern corner of Diocletians Palace, the City Museum of Split<br> houses many important Croatian artifacts from between the 12th<br> and 14th centuries including coins, statues, Romanesque sculpture,<br> gothic renaissance coffers and weapons.<br><br>Opening times:<br> Summer - Tue-Fri 9am-9pm; Sat and Sun 10am-1pm<br> Winter - Tue-Fri 10am-5pm; Sat and Sun 10am-12pm.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.504379,16.416986);
	bounds.extend(point);
	var marker = createMarker(point, "Mestrovic Gallery", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Mestrovic Gallery</b><br>The Mestrovic Gallery was home to one of Croatias most well known<br> sculptors; Ivan Mestrovic. Located in the palace, which Ivan built for his family,<br> stand beautiful elegant sculptures of human bodies created by Mestrovic,<br> along with international and Croatian art.<br><br>Opening times:<br>Summer: Tue-Sun 9am-9pm<br>Winter Tue-Sat 9am-4pm; Sun 10am-3pm", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Mestrovic Gallery</b><br>The Mestrovic Gallery was home to one of Croatias most well known<br> sculptors; Ivan Mestrovic. Located in the palace, which Ivan built for his family,<br> stand beautiful elegant sculptures of human bodies created by Mestrovic,<br> along with international and Croatian art.<br><br>Opening times:<br>Summer: Tue-Sun 9am-9pm<br>Winter Tue-Sat 9am-4pm; Sun 10am-3pm";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(43.508394,16.440268);
	bounds.extend(point);
	var marker = createMarker(point, "Temple of Jupiter", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Temple of Jupiter</b><br>Constructed in the 5th century, the Temple of Jupiter is<br> located at the end of the street Kraj Sveti Ivana. The headless<br> sphinx guarding the entrance to the Temple is made from black<br> granite and was imported from Egypt when the Temple was<br> constructed. Later converted to a Baptistry, the Temple of Jupiter<br> is now open to the public.", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Temple of Jupiter</b><br>Constructed in the 5th century, the Temple of Jupiter is<br> located at the end of the street Kraj Sveti Ivana. The headless<br> sphinx guarding the entrance to the Temple is made from black<br> granite and was imported from Egypt when the Temple was<br> constructed. Later converted to a Baptistry, the Temple of Jupiter<br> is now open to the public.";
	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]);
}
