
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(28.300196,-16.575623), 10);
	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(28.259483,-16.608067);
	bounds.extend(point);
	var marker = createMarker(point, "Teide national park", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Teide national park</b><br>Declared a national park in 1954, the Parque <br />Nacional de las Cañadas del Teide includes an enormous volcanic <br />crater 48 km in circumference, out of which rises <br />Mount Teide (pronounced the same as Lady)<br /> at a staggering 3.718 metres, making it the<br /> highest mountain in the whole of Spain.", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Teide national park</b><br>Declared a national park in 1954, the Parque <br />Nacional de las Cañadas del Teide includes an <br />enormous volcanic crater 48 km in circumference, <br />out of which rises Mount Teide (pronounced the <br />same as Lady) at a staggering 3.718 metres, <br />making it the highest mountain in the whole of Spain.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(28.280196,-16.575623);
	bounds.extend(point);
	var marker = createMarker(point, "Loro Parque", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Loro Parque</b><br>Regardless of your age you will be fascinated by Loro <br />Parque.Originally a Parrot Park, it has now grown into <br />Tenerife's second biggest attraction after<br />  mount Teide", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Loro Parque</b><br>Regardless of your age you will be fascinated by Loro<br />Parque.Originally a Parrot Park, it has now grown into<br />Tenerife's second biggest attraction after<br />mount Teide</p>.";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(28.511087,-16.355124);
	bounds.extend(point);
	var marker = createMarker(point, "Barranco del infierno", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Barranco del infierno</b><br>In spite of its fearsome name 'Hells Gorge', <br />this lush green ravine is an oasis in the harsh <br />and arid south Tenerife landscape. It is<br /> the only location you will find natural <br />running water.</p>", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Barranco del infierno</b><br>In spite of its fearsome name 'Hells Gorge',<br />this lush green ravine is an oasis in the harsh<br />and arid south Tenerife landscape. It is<br />the only location you will find natural<br />running water.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(28.32176,-16.412759);
	bounds.extend(point);
	var marker = createMarker(point, "Pyramids at  G&uuml;imar", "<b>The Pyramids at  G&uuml;imar</b>The Pyramids at  G&uuml;imar  are were painstakingly<br /> built step-pyramids, constructed according to similar<br /> principlesas those  of Mexico, Peru, and ancient <br />Mesopotamia. The Ethnographic Park 'Pir&aacute;mides '<br />de Güímar offers you the possibility to visit <br />these rare and interesting structures,and will<br />  provide you with theories regarding the <br />possible diffusion of ancient civilisations.</p>", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>The Pyramids at  G&uuml;imar</b><br />The Pyramids at  G&uuml;imar  are were painstakingly<br /> built step-pyramids, constructed according to similar<br />principlesas those  of Mexico, Peru, and ancient <br />Mesopotamia. The Ethnographic Park 'Pir&aacute;mides '<br />de G&uuml;imar offers you the possibility to visit <br />these rare and interesting structures,and will<br />  provide you with theories regarding the <br />possible diffusion of ancient civilisations.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(28.392004,-16.523437);
	bounds.extend(point);
	var marker = createMarker(point, "La Orotava", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>La Orotava</b><br/>The Villa de la Orotava lies on the banana plantations<br/> of the Valley which bears its same name. This old town<br/> distinguishes itself by its magnificent and monumental <br/>architectonic structures, by its characteristic <br/>well-shaded Canarian patios, squares and ancestral<br/> mellow houses.</p>", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>La Orotava</b><br/>The Villa de la Orotava lies on the banana plantations<br/> of the Valley which bears its same name. This old town<br/>distinguishes itself by its magnificent and monumental <br/>architectonic structures, by its characteristic<br/> well-shaded Canarian patios, squares and ancestral <br/>mellow houses.</p>";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(28.282615,-16.67038);
	bounds.extend(point);
	var marker = createMarker(point, "AquaPark", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>AquaPark</b><br />This aquatic park situated not far from Los Cristianos and Playa de las Americas (5 minutes) is the focal point for sun seekers and water babes.</p>", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>AquaPark</b><br />This aquatic park situated not far from Los Cristianos<br />and Playa de las Americas (5 minutes) is the focal <br />point for sunseekers and water babes.</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]);
}
