
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(37.217206,-8.20816), 6);
	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(37.32212,-7.547607);
	bounds.extend(point);
	var marker = createMarker(point, "Monchique", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Monchique</b><br>Visit this beautiful and traditional village<br />in the Algarve. Monchique is great for<br />shopping and eating out but also a cultural hotspot<br />with history and traditional landmarks.<br>", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Monchique</b><br>Visit this beautiful and traditional village<br />in the Algarve. Monchique is great for<br />shopping and eating out but also a cultural hotspot<br />with history and traditional landmarks<br>";
	map.addOverlay(marker);


	var icon = new GIcon(baseIcon);
	var point = new GLatLng(37.187126,-8.422394);
	bounds.extend(point);
	var marker = createMarker(point, "Portimao", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Portimao</b><br>The port of Portimao is the<br />second largest town in the Algarve.<br />The area is renowned for the variety of fish<br />on sale and in the restaurants but also<br>has a wealth of shops, bars, fishing activities<br>and beaches.<br>", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Portimao</b><br>The port of Portimao is the<br />second largest town in the Algarve.<br />The area is renowned for the variety of fish<br />on sale and in the restaurants but also<br>has a wealth of shops, bars, fishing activities<br>and beaches.<br>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(37.187126,-8.422394);
	bounds.extend(point);
	var marker = createMarker(point, "Silves", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Silves</b><br>Silves has much cultural heritage,<br>most prominantly seen at the medieval castle.<br>This market town has much to see, and<br>features a museum hilighting the history<br>of the area.<br>", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Silves</b><br>Silves has much cultural heritage,<br>most prominantly seen at the medieval castle.<br>This market town has much to see, and<br>features a museum hilighting the history<br>of the area.<br>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(37.144582,-8.558178);
	bounds.extend(point);
	var marker = createMarker(point, "Alvor", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Alvor</b><br>Alvor sits in a lagune in the bay of Lagos.<br> A rich history and culture<br>is evident here, popular amoungst locals<br>amd holiday makers alike. Visit<br>the lagune, the fantastic beach and the<br>historical hotspots.<br>", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Alvor</b><br>Alvor sits in a lagune in the bay of Lagos.<br> A rich history and culture<br>is evident here, popular amoungst locals<br>amd holiday makers alike. Visit<br>the lagune, the fantastic beach and the<br>historical hotspots.<br>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(37.14855,-8.55835);
	bounds.extend(point);
	var marker = createMarker(point, "Slide and Splash Aqua Park", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Slide and Splash Aqua Park</b><br>Fun for the entire family at the highly<br>Algarve aqua park. Rides<br>for all ages and a jacuzzi for the older<br>ones!<br></p>", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Slide and Splash Aqua Park</b><br>Slide and Splash Aqua Park</b><br>Fun for the entire family at the highly<br>Algarve aqua park. Rides<br>for all ages and a jacuzzi for the older<br>ones!<br></p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(37.14855,-8.55835);
	bounds.extend(point);
	var marker = createMarker(point, "Zoo Marine", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Zoo Marine</b><br>The Zoo Marine is home to many entertaining<br>and fascinating sea creatures. Fun for all<br>the family with regular Dolphin, Sea-Lion<br>and Seal shows.<br></p>", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Zoo Marine</b><br>The Zoo Marine is home to many entertaining<br>and fascinating sea creatures. Fun for all<br>the family with regular Dolphin, Sea-Lion<br>and Seal shows.<br></p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(37.233472,-8.278327);
	bounds.extend(point);
	var marker = createMarker(point, "Krazy World", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Krazy World</b><br>Truely a park for all the family. Find a<br>swimming pool, a mini golf course, a<br>petting zoo, pony rides, quad bikes and<br>much much more!<br></p>", 7);
	gmarkers[6] = marker;
	htmls[6] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Krazy World</b><br>Truely a park for all the family. Find a<br>swimming pool, a mini golf course, a<br>petting zoo, pony rides, quad bikes and<br>much much more!<br></p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(37.099996,-7.966676);
	bounds.extend(point);
	var marker = createMarker(point, "Milreu", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Milreu</b><br>First Centuary A.D Roman ruins set<br>in the beautiful Portugese Countryside.<br></p>", 8);
	gmarkers[7] = marker;
	htmls[7] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Milreu</b><br>First Centuary A.D Roman ruins set<br>in the beautiful Portugese Countryside.<br></p>";
	map.addOverlay(marker);
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(37.0122,-7.933567);
	bounds.extend(point);
	var marker = createMarker(point, "Museu Arqueologico", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museu Arqueologico</b><br>This museum houses some amazing artifacts<br>from all over southern Portugal. Find relics<br>from Roman ruins in Mireu, art exhibitions<br>and more.<br></p>", 9);
	gmarkers[8] = marker;
	htmls[8] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museu Arqueologico</b><br>This museum houses some amazing artifacts<br>from all over southern Portugal. Find relics<br>from Roman ruins in Mireu, art exhibitions<br>and more.<br></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]);
}
