function createMarker(point, number) {
  var marker = new GMarker(point);
  var message = ["This","is","the","secret","message"];
  marker.value = number;
  GEvent.addListener(marker, "click", function() {
    var myHtml = "<b>#" + number + "</b><br/>" + message[number -1];
    map.openInfoWindowHtml(point, myHtml);
  });
  return marker;
}
var map;
var mapZoomOnOff = false;
function enableScrollZoom() {
	map.enableScrollWheelZoom();
	mapZoomOnOff = true;
}
function disableScrollZoom() {
	map.disableScrollWheelZoom();
	mapZoomOnOff = false;
}
function mapZoomSwitch() {
	var venueList = document.getElementById('mapControls');
	var vlEnable = document.createTextNode();
	var vlList = document.createElement('li');
}
function gMaps() {
	if(document.getElementById('map_canvas')) {
		if (GBrowserIsCompatible()) { 
			map = new GMap2(document.getElementById("map_canvas")); 
			map.setCenter(new GLatLng(54.5, -3.5), 6); 
			map.setUIToDefault();
			map.setMapType(G_HYBRID_MAP);
			map.disableScrollWheelZoom();
			
			var mapReset = document.getElementById('mapReset');
			mapReset['onclick'] = new Function('map.setCenter(new GLatLng(54.5, -3.5), 6);return false;');
			
			var venues = new Array();
			venues['awt']	= Array('Aylesbury Waterside Theatre', 51.8156890, -0.8167864, '0844 871 7627');
			venues['ntc']	= Array('New Theatre Cardiff', 51.4785647, -3.1799645, '029 2087 8889');
			venues['eft']	= Array('Edinburgh Festival Theatre', 55.9467000, -3.1861778, '0131 529 6000');
			venues['trg']	= Array('Theatre Royal Glasgow', 55.8660399, -4.2566795, '0844 871 7647');
			venues['hnt']	= Array('Hull New Theatre', 53.7475118, -0.3381289, '01482 226 655');
			venues['lgt']	= Array('Leeds Grand Theatre', 53.8001909, -1.5412503, '0844 848 2701');
			venues['wyp']	= Array('West Yorkshire Playhouse', 53.7981900, -1.5342800, '0113 213 7700');
			venues['vc']	= Array('Venue Cymru, Llandudno', 53.3220000, -3.8174000, '01492 872000');
			venues['mpt']	= Array('Palace Theatre, Manchester', 53.4757434, -2.2425406, '0844 847 2275');
			venues['mkt']	= Array('Milton Keynes Theatre', 52.0457100, -0.7489250, '0871 297 5454');
			venues['ntr']	= Array('Norwich Theatre Royal', 52.6271850, 1.2913130, '01603 630000');
			venues['trn']	= Array('Theatre Royal, Nottingham', 52.9552600, -1.1523000, '0115 989 5555');
			venues['slt']	= Array('Sheffield Lyceum Theatre', 53.3804690, -1.4665860, '0114 249 6000');
			venues['wnvt']	= Array('Woking New Victoria Theatre', 53.3804690, -1.4665860, '0114 249 6000');

			
			
			
			// Leeds Grand Theatre
			var pointLGT = new GLatLng(venues['lgt'][1], venues['lgt'][2]);
			var markerLGT = new GMarker(pointLGT);
			map.addOverlay(markerLGT);
			GEvent.addListener(markerLGT, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<h3><b>"+venues['lgt'][0]+"</h3>"+
							"<ul>"+
							"<li>"+
							"<a href='nutcracker.aspx'><b>The Nutcracker</b></a>: 30 Nov - 12 Dec, "+
							"(<a target='_blank' href='http://www.leedsgrandtheatre.com/the_nutcracker_unid90e1_page.aspx'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p><i>Box office: "+venues['lgt'][3]+"</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointLGT, myHtml);
			});
			document.getElementById('mapLGT')['onclick'] = new Function('map.setCenter(new GLatLng(53.8001909, -1.5412503), 15);return false;');
			
			
			// West Yorkshire Playhouse
			var pointWYP = new GLatLng(venues['wyp'][1], venues['wyp'][2]);
			var markerWYP = new GMarker(pointWYP);
			map.addOverlay(markerWYP);
			GEvent.addListener(markerWYP, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>West Yorkshire Playhouse</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='dangerousliaisons.aspx'><b>Dangerous Liaisons</b></a>: 7-11 September, "+
							"(not yet on sale)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: "+venues['wyp'][3]+"</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointWYP, myHtml);
			});
			document.getElementById('mapWYP')['onclick'] = new Function('map.setCenter(new GLatLng('+venues['wyp'][1]+', '+venues['wyp'][2]+'), 15);return false;');
		
			
			// Edinburgh Festival Theatre
			var pointEFT = new GLatLng(55.9467000, -3.1861778);
			var markerEFT = new GMarker(pointEFT);
			map.addOverlay(markerEFT);
			GEvent.addListener(markerEFT, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>Edinburgh Festival Theatre</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='wutheringheights.aspx'><b>Wuthering Heights</b></a>: 11 - 13 March, "+
							"(<a target='_blank' href='http://www.eft.co.uk/festival_theatre/event.aspx?evtid=270'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 0131 529 6000</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointEFT, myHtml);
			});
			document.getElementById('mapEFT')['onclick'] = new Function('map.setCenter(new GLatLng(55.9467000, -3.1861778), 15);return false;');
			
			// Sheffield Lyceum Theatre
			var pointSLT = new GLatLng(53.3804690, -1.4665860);
			var markerSLT = new GMarker(pointSLT);
			map.addOverlay(markerSLT);
			GEvent.addListener(markerSLT, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>Sheffield Lyceum Theatre</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='wutheringheights.aspx'><b>Wuthering Heights</b></a>: 16 - 20 March, "+
							"(<a target='_blank' href='http://www.sheffieldtheatres.co.uk/index.cfm?fuseaction=whatson.production&amp;ProductionID=876'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 0114 249 6000</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointSLT, myHtml);
			});
			document.getElementById('mapSLT')['onclick'] = new Function('map.setCenter(new GLatLng(53.3804690, -1.4665860), 15);return false;');
			
			// Woking New Victoria Theatre
			var pointWNVT = new GLatLng(51.319841, -0.561853);
			var markerWNVT = new GMarker(pointWNVT);
			map.addOverlay(markerWNVT);
			GEvent.addListener(markerWNVT, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>Woking New Victoria Theatre</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='peterpan.aspx'><b>Peter Pan</b></a>: 23 - 27 March, "+
							"(<a target='_blank' href='http://www.ambassadortickets.com/1496/689/New-Victoria-Theatre/NBT-Peter-Pan'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 0844 871 7645</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointWNVT, myHtml);
			});
			document.getElementById('mapWNVT')['onclick'] = new Function('map.setCenter(new GLatLng(51.319841, -0.561853), 15);return false;');
			
			// Theatre Royal Nottingham
			var pointTRN = new GLatLng(52.9552600, -1.1523000);
			var markerTRN = new GMarker(pointTRN);
			map.addOverlay(markerTRN);
			GEvent.addListener(markerTRN, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>Theatre Royal, Nottingham</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='peterpan.aspx'><b>Peter Pan</b></a>: 13 - 17 April, "+
							"(<a target='_blank' href='http://www.royalcentre-nottingham.co.uk/default.asp?id=747'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 0115 989 5555</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointTRN, myHtml);
			});
			document.getElementById('mapTRN')['onclick'] = new Function('map.setCenter(new GLatLng(52.9552600, -1.1523000), 15);return false;');
			
			// Milton Keynes Theatre
			var pointMKT = new GLatLng(52.0457100, -0.7489250);
			var markerMKT = new GMarker(pointMKT);
			map.addOverlay(markerMKT);
			GEvent.addListener(markerMKT, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>Milton Keynes Theatre</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='peterpan.aspx'><b>Peter Pan</b></a>: 20 - 24 April, "+
							"(<a target='_blank' href='http://www.ambassadortickets.com/1496/657/Milton-Keynes/Milton-Keynes-Theatre/NBT-Peter-Pan'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 0871 297 5454</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointMKT, myHtml);
			});
			document.getElementById('mapMKT')['onclick'] = new Function('map.setCenter(new GLatLng(52.0457100, -0.7489250), 15);return false;');
			
			// Norwich Theatre Royal
			var pointNTR = new GLatLng(52.6271850, 1.2913130);
			var markerNTR = new GMarker(pointNTR);
			map.addOverlay(markerNTR);
			GEvent.addListener(markerNTR, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>Norwich Theatre Royal</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='peterpan.aspx'><b>Peter Pan</b></a>: 27 April - 1 May, "+
							"(<a target='_blank' href='http://www.theatreroyalnorwich.co.uk/site.php?action=display_show&amp;showID=1102'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 01603 630000</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointNTR, myHtml);
			});
			document.getElementById('mapNTR')['onclick'] = new Function('map.setCenter(new GLatLng(52.6271850, 1.2913130), 15);return false;');
			
			// Venue Cymru
			var pointVC = new GLatLng(53.3220000, -3.8174000);
			var markerVC = new GMarker(pointVC);
			map.addOverlay(markerVC);
			GEvent.addListener(markerVC, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>Venue Cymru, Llandudno</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='dangerousliaisons.aspx'><b>Dangerous Liaisons</b></a>: 6 - 8 May"+
							//", (<a target='_blank' href='http://www.theatreroyalnorwich.co.uk/site.php?action=display_show&showID=1102'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 01492 872000</i></p>"+
							"</div>";
				map.openInfoWindowHtml(pointVC, myHtml);
			});
			document.getElementById('mapVC')['onclick'] = new Function('map.setCenter(new GLatLng(53.3220000, -3.8174000), 15);return false;');
			
			// Hull New Theatre
			var pointHNT = new GLatLng(53.7475118, -0.3381289);
			var markerHNT = new GMarker(pointHNT);
			map.addOverlay(markerHNT);
			GEvent.addListener(markerHNT, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>Hull New Theatre</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='romeoandjuliet.aspx'><b>Romeo &amp; Juliet</b></a>: 2 - 5 June, "+
							"(<a target='_blank' href='http://www.hullcc.gov.uk/portal/page?_pageid=221,155175&amp;_dad=portal&amp;_schema=PORTAL&amp;p_id=7572&amp;p_display_mode=listing&amp;p_option=DisplayEvent'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 01482 226 655</i></p>"+
							"</div>";
				map.openInfoWindowHtml(pointHNT, myHtml);
			});
			document.getElementById('mapHNT')['onclick'] = new Function('map.setCenter(new GLatLng(53.7475118, -0.3381289), 15);return false;');
			
			// Theatre Royal Glasgow
			var pointTRG = new GLatLng(55.8660399, -4.2566795);
			var markerTRG = new GMarker(pointTRG);
			map.addOverlay(markerTRG);
			GEvent.addListener(markerTRG, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>Theatre Royal Glasgow</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='dangerousliaisons.aspx'><b>Dangerous Liaisons</b></a>: 2 - 5 June, "+
							"(<a target='_blank' href='http://www.ambassadortickets.com/1509/654/Glasgow/Theatre-Royal-/NBT-Dangerous-Liaisons'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 0844 871 7647</i></p>"+
							"</div>";
				map.openInfoWindowHtml(pointTRG, myHtml);
			});
			document.getElementById('mapTRG')['onclick'] = new Function('map.setCenter(new GLatLng(55.8660399, -4.2566795), 15);return false;');
			
			// New Theatre Cardiff
			var pointNTC = new GLatLng(51.4785647, -3.1799645);
			var markerNTC = new GMarker(pointNTC);
			map.addOverlay(markerNTC);
			GEvent.addListener(markerNTC, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<p style='color: #000; font-size: larger;'><b>New Theatre Cardiff</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='dangerousliaisons.aspx'><b>Dangerous Liaisons</b></a>: 2 - 5 June, "+
							"(<a target='_blank' href='http://www.newtheatrecardiff.co.uk/english/event.asp?id=342'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: 029 2087 8889</i></p>"+
							"</div>";
				map.openInfoWindowHtml(pointNTC, myHtml);
			});
			document.getElementById('mapNTC')['onclick'] = new Function('map.setCenter(new GLatLng(51.4785647, -3.1799645), 15);return false;');
			
	
			// Aylesbury Waterside
			var pointAWT = new GLatLng(venues['awt'][1], venues['awt'][2]);
			var markerAWT = new GMarker(pointAWT);
			map.addOverlay(markerAWT);
			GEvent.addListener(markerAWT, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<h3><b>"+venues['awt'][0]+"</h3>"+
							"<ul>"+
							"<li>"+
							"<a href='swanlake.aspx'><b>Swan Lake</b></a>: 12 - 16 October, "+
							"(Not yet on sale)"+
							"</li>"+
							"</ul>"+
							"<p><i>Box office: "+venues['awt'][3]+"</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointAWT, myHtml);
			});
			document.getElementById('mapAWT')['onclick'] = new Function('map.setCenter(new GLatLng('+venues['awt'][1]+', '+venues['awt'][2]+'), 15);return false;');

			/*---
				Add line to venue list including enable + disable scollwheel zooming
			---*/
			mapZoomSwitch();
		} 
	}
}
if(window.addEventListener) window.addEventListener ("load",gMaps,false);
else if(window.attachEvent) window.attachEvent ("onload",gMaps);
else window.onload = runFirst;