
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(50.414425,-5.078087), 14);
	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(50.410651,-5.068302);
	bounds.extend(point);
	var marker = createMarker(point, "Newquay Zoo", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Newquay Zoo</b><br>Opened since 1969, and specialising in breeding many endangered<br>species, Newquay Zoo is home to over 1000 animals including<br> big cats, primates, small mammals, birds, lizards &amp; so much more.<br><br><b>Opening Times:</b><br>Summer opening: 9.30am-6pm (last entry 5pm)<br>Winter opening: 10am-5pm.", 1);
	gmarkers[0] = marker;
	htmls[0] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Newquay Zoo</b><br>Opened since 1969, and specialising in breeding many endangered<br>species, Newquay Zoo is home to over 1000 animals including<br> big cats, primates, small mammals, birds, lizards &amp; so much more.<br><br><b>Opening Times:</b><br>Summer opening: 9.30am-6pm (last entry 5pm)<br>Winter opening: 10am-5pm.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(50.367159,-5.03927);
	bounds.extend(point);
	var marker = createMarker(point, "Lappa Valley Steam Railway", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Lappa Valley Steam Railway</b><br>Originally opened in 1849, the Lappa Valley Steam Railway<br> runs on one of the oldest railway trackbeds in Cornwall.<br> Choose from three different train routes which take you on<br> a leisurely ride through the beautiful Lappa Valley grounds.<br> There is also a golf course in the area as well as picnic areas,<br> childrens play areas &amp; so much more for an entertaining<br> day out in Newquay.", 2);
	gmarkers[1] = marker;
	htmls[1] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Lappa Valley Steam Railway</b><br>Originally opened in 1849, the Lappa Valley Steam Railway<br> runs on one of the oldest railway trackbeds in Cornwall.<br> Choose from three different train routes which take you on<br> a leisurely ride through the beautiful Lappa Valley grounds.<br> There is also a golf course in the area as well as picnic areas,<br> childrens play areas &amp; so much more for an entertaining<br> day out in Newquay.</p>";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(50.415519,-5.085468);
	bounds.extend(point);
	var marker = createMarker(point, "Newquay Harbour Seals", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Newquay Harbour Seals</b><br>The calm waters of Newquay Harbour is home to many fantastic<br> sea creatures including dolphins &amp; killer whales. From<br> the harbours edge you may catch sight of groups of Wild Grey Seals<br> basking in the sunshine. The harbour offers boat trips around<br> the bay where you can see Newquay from a different angle &amp;<br> if you are lucky you may even see some dolphins!", 3);
	gmarkers[2] = marker;
	htmls[2] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Newquay Harbour Seals</b><br>The calm waters of Newquay Harbour is home to many fantastic<br> sea creatures including dolphins &amp; killer whales. From<br> the harbours edge you may catch sight of groups of Wild Grey Seals<br> basking in the sunshine. The harbour offers boat trips around<br> the bay where you can see Newquay from a different angle &amp;<br> if you are lucky you may even see some dolphins!";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(50.414726,-5.086112);
	bounds.extend(point);
	var marker = createMarker(point, "Blue Reef Aquarium", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Blue Reef Aquarium</b><br>Located in the centre of Newquay, the Blue Reef Aquarium<br> has everything from various local marine life to hundreds of tropical species<br> in a gigantic ocean display, as well as a fantastic underwater tunnel.<br> Make sure you pay a special visit to the clever Octopus who<br> can open jam jars to get to its food.<br><br><b>Opening Times:</b><br>Daily: 10am-5pm.", 4);
	gmarkers[3] = marker;
	htmls[3] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Blue Reef Aquarium</b><br>Located in the centre of Newquay, the Blue Reef Aquarium<br> has everything from various local marine life to hundreds of tropical species<br> in a gigantic ocean display, as well as a fantastic underwater tunnel.<br> Make sure you pay a special visit to the clever Octopus who<br> can open jam jars to get to its food.<br><br><b>Opening Times:</b><br>Daily: 10am-5pm.";
	map.addOverlay(marker);

	var icon = new GIcon(baseIcon);
	var point = new GLatLng(50.411608,-5.086241);
	bounds.extend(point);
	var marker = createMarker(point, "Tunnels Through Time", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Tunnels Through Time</b><br>This city centre attraction takes you on a journey<br> to visit mythical characters from Cornwall's past.<br><br><b>Opening Times:</b><br>Daily except Saturday.", 5);
	gmarkers[4] = marker;
	htmls[4] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Tunnels Through Time</b><br>This city centre attraction takes you on a journey<br> to visit mythical characters from Cornwall's past.<br><br><b>Opening Times:</b><br>Daily except Saturday.";
	map.addOverlay(marker);
	
	var icon = new GIcon(baseIcon);
	var point = new GLatLng(50.418951,-5.096948);
	bounds.extend(point);
	var marker = createMarker(point, "Fistral Beach", "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Fistral Beach</b><br>One of Newquays most popular beaches, Fistral<br> Beach offers fantastic conditions for surfing and<br> bodyboarding throughout the year", 6);
	gmarkers[5] = marker;
	htmls[5] = "<p style='font-size: smaller; padding: 0; margin: 0;'><b>Fistral Beach</b><br>One of Newquays most popular beaches, Fistral<br> Beach offers fantastic conditions for surfing and<br> bodyboarding throughout the year.";
	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]);
}
