
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(36.908725,-2.432785), 11);
	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(36.84094,-2.469885);
	bounds.extend(point);
	var marker = createMarker(point, "Alcazaba", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Alcazaba</b><br/>A huge 10th century Moorish citadel with three <br/>walled enclosures. Considered to be one of the <br/>greatest forts in Andalusia. Provides magnificent<br/>views of the city.</p>", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Alcazaba</b><br/>A huge 10th century Moorish citadel with three <br/>walled enclosures. Considered to be one of the <br/>greatest forts in Andalusia. Provides magnificent<br/>views of the city.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(36.84231,-2.468523);
	bounds.extend(point);
	var marker = createMarker(point, "Almeria Cathedral", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Almeria Cathedral</b><br>Important Christian monument dating from 1524.<br/>The architecture is a combination of Gothic and<br/>Renaissance, and the north facade is an elaborate<br/>mid 16th century design by Juan de Orea.</p>", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Almeria Cathedral</b><br>Important Christian monument dating from 1524.<br/>The architecture is a combination of Gothic and<br/>Renaissance, and the north facade is an elaborate<br/>mid 16th century design by Juan de Orea.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(36.833745,-2.298546);
	bounds.extend(point);
	var marker = createMarker(point, "Cabo de Gata Natural Park", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Cabo de Gata Natural Park</b><br>Andalusia's largest coastal nature reserve.<br/>Popular among mountain bikers, hikers, bird-watchers<br/>and water sports enthusiasts of all persuasions.<p/>", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Cabo de Gata Natural Park</b><br>Andalusia's largest coastal nature reserve.<br/>Popular among mountain bikers, hikers, bird-watchers<br/>and water sports enthusiasts of all persuasions.<p/>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(37.049355,-2.392659);
	bounds.extend(point);
	var marker = createMarker(point, "Tabernas", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Tabernas</b><br>Village with popular movie-based tourist attractions<br/>Mini Hollywood, Texas Hollywood and Western Leone.</p>", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Tabernas</b><br>Village with popular movie-based tourist attractions<br/>Mini Hollywood, Texas Hollywood and Western Leone.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(36.760891,-2.613373);
	bounds.extend(point);
	var marker = createMarker(point, "Roquetas de Mar", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Roquetas de Mar</b><br>Popular tourist resort town & Holiday Strip. A collection<br/>of hotel and apartment complexes, sandy beaches adjacent<br/>to the village, shops, numerous restaurants and bars, and<br/>plenty of activities on offer from horse riding to scuba<br/>diving or sailing.</p>", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Roquetas de Mar</b><br>Popular tourist resort town & Holiday Strip. A collection<br/>of hotel and apartment complexes, sandy beaches adjacent<br/>to the village, shops, numerous restaurants and bars, and<br/>plenty of activities on offer from horse riding to scuba<br/>diving or sailing.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(36.836287,-2.456431);
	bounds.extend(point);
	var marker = createMarker(point, "Museo De Almeria", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museo De Almeria</b><br>Located in a Neomudejar-style building, was built in<br/>1927. Houses a splendid collection of contemporary<br/>art, displayed in different thematic exhibits.</p>", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Museo De Almeria</b><br>Located in a Neomudejar-style building, was built in<br/>1927. Houses a splendid collection of contemporary<br/>art, displayed in different thematic exhibits.</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]);
}
