
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(44.821488,0.478592), 12);
	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(44.849647,0.483742);
	bounds.extend(point);
	var marker = createMarker(point, "Bergerac Tobacco Museum", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Bergerac Tobacco Museum</b><br>Also known as Musee du Tebac, the museum provides a useful<br> insight into how the tobacco trade became so important to<br> the South West of France and Bergerac.", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Bergerac Tobacco Museum</b><br>Also known as Musee du Tebac, the museum provides a useful<br> insight into how the tobacco trade became so important to<br> the South West of France and Bergerac.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(44.851229,0.483012);
	bounds.extend(point);
	var marker = createMarker(point, "Costi Museum", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Costi Museum</b><br>A breathtaking museum containing bronze statues and busts<br> by sculpturer Constantin Papachristopoulos (Costi). Set in the cellars<br> of the Saint Jacques presbytery, this fantastic display is well worth<br> a visit whilst in Bergerac.", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Costi Museum</b><br>A breathtaking museum containing bronze statues and busts<br> by sculpturer Constantin Papachristopoulos (Costi). Set in the cellars<br> of the Saint Jacques presbytery, this fantastic display is well worth<br> a visit whilst in Bergerac.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(44.849799,0.482379);
	bounds.extend(point);
	var marker = createMarker(point, "Maison des Vins", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Maison des Vins</b><br>Housed in a section of a magical 17th century cloister, the surrounds<br> of the Maison de Vins are just as compelling as the tour itself.<br> Take a self guided tour to learn about the history of the Bergerac<br> wine trade and then sample the local tipple in the wine<br> tasting area.", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Maison des Vins</b><br>Housed in a section of a magical 17th century cloister, the surrounds<br> of the Maison de Vins are just as compelling as the tour itself.<br> Take a self guided tour to learn about the history of the Bergerac<br> wine trade and then sample the local tipple in the wine<br> tasting area.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(44.796089,0.497131);
	bounds.extend(point);
	var marker = createMarker(point, "Chateau De Monbazillac", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Chateau De Monbazillac</b><br>This 16th century Chateau is a truly beautiful example of Renaissance flamboyance<br> coupled with medieval defensive fortifications which remains almost as<br> it did when originally constructed. The Chateau is open for self guided tours throughout the<br> year to groups of visitors or individuals. After the tour visitors have the<br> opportunity to sample the local Monbazillac wine.", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Chateau De Monbazillac</b><br>This 16th century Chateau is a truly beautiful example of Renaissance flamboyance<br> coupled with medieval defensive fortifications which remains almost as<br> it did when originally constructed. The Chateau is open for self guided tours throughout the<br> year to groups of visitors or individuals. After the tour visitors have the<br> opportunity to sample the local Monbazillac wine.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(44.833322,0.438938);
	bounds.extend(point);
	var marker = createMarker(point, "Aqua Park Junior Land", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Aqua Park Junior Land</b><br>A fun day out for the whole family can be had at Aqua Park<br> Junior Land. With four pools, water slides, mini golf, table tennis<br> and bowling, plus much more, there's plenty to keep the kids<br> occupied on a day trip to the Aqua Park in Bergerac.", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Aqua Park Junior Land</b><br>A fun day out for the whole family can be had at Aqua Park<br> Junior Land. With four pools, water slides, mini golf, table tennis<br> and bowling, plus much more, there's plenty to keep the kids<br> occupied on a day trip to the Aqua Park in Bergerac.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(44.852948,0.482497);
	bounds.extend(point);
	var marker = createMarker(point, "L'eglise Notre-Dame", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>L'eglise Notre-Dame</b><br>The 19th-century Notre Dame Cathedral can be found<br> just on the outskirts of the pedestrianised part of the old<br> town of Bergerac. On a clear day, climb to the top where<br> you will find spectacular views over the city.", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>L'eglise Notre-Dame</b><br>The 19th-century Notre Dame Cathedral can be found<br> just on the outskirts of the pedestrianised part of the old<br> town of Bergerac. On a clear day, climb to the top where<br> you will find spectacular views over the city.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(44.825081,0.52096);
	bounds.extend(point);
	var marker = createMarker(point, "Bergerac Airport", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Bergerac Airport</b><br>Address: Aeroport de Bergerac Perigord Dordogne,<br>Route d'Agen,<br>24100 BERGERAC.", 7);
	gmarkers[6] = marker;
	htmls[6] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Bergerac Airport</b><br>Address: Aeroport de Bergerac Perigord Dordogne,<br>Route d'Agen,<br>24100 BERGERAC.";
	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]);
}

