window.onload = function() {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(49.559411, 16.540492), 10);
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		
		// Create a base icon for all of our markers that specifies the
		// shadow, icon dimensions, etc.
		var baseIcon = new GIcon();
		baseIcon.shadow = "http://www.google.com/mapfiles/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);
		
		// Creates a marker whose info window displays the letter corresponding
		// to the given index.
		function createMarker(point, string, index) {
			// Create a lettered icon for this point using our icon class
			var letter = String.fromCharCode("A".charCodeAt(0) + index);
			var letteredIcon = new GIcon(baseIcon);
			letteredIcon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";
			
			// Set up our GMarkerOptions object
			markerOptions = { icon:letteredIcon };
			var marker = new GMarker(point, markerOptions);
			
			GEvent.addListener(marker, "click", function() {
				marker.openInfoWindowHtml(string);
			});
			return marker;
		}
		
		var location = new Array (
			new Array (49.559411, 16.540492, "<strong>Country Hotel Svitavice</strong>"),
			new Array (49.623031, 16.409575, "<strong>Svojanov</strong><div>Castle</div>"),
			new Array (49.493058, 16.6585, "<strong>Boskovice</strong><div>Castle and chateau</div>"),
			new Array (49.507108, 16.519408, "<strong>Kunstat</strong><div>Chateau</div>"),
			new Array (49.445381, 16.532042, "<strong>Lysice</strong><div>Chateau</div>"),
			new Array (49.413969, 16.739869, "<strong>Sloup</strong><div>Moravian karst</div>"),
			new Array (49.529694, 16.753408, "<strong>Korenec</strong><div>Golf club</div>"),
			new Array (49.520386, 16.511714, "<strong>Rudka</strong><div>Blanik knights' cave</div>"),
			new Array (49.552836, 16.561364, "<strong>Isarno</strong><div>Celtic settlement</div>"),
			new Array (49.753586, 16.470683, "<strong>Svitavy</strong><div>Medieval city</div>"),
			new Array (49.448014, 16.309581, "<strong>Pernstejn</strong><div>Castle</div>")
		);
		
		for(i = 0; i < location.length; i++) {
			var latlng = new GLatLng(location[i][0], location[i][1]);
			map.addOverlay(createMarker(latlng, location[i][2], i))
		}
	}
}
