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.474919, -2.241243, '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, '0844 871 7645');
			venues['bat']	= Array('Bradford Alhambra Theatre', 53.791712, -1.756579, '01274 432 000');

			
												
			// Bradford Alhambra Theatre
			var pointBAT = new GLatLng(venues['bat'][1], venues['bat'][2]);
			var markerBAT = new GMarker(pointBAT);
			map.addOverlay(markerBAT);
			GEvent.addListener(markerBAT, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<h3><b>"+venues['bat'][0]+"</h3>"+
							"<ul>"+
							"<li>"+
							"<a href='swanlake.aspx'><b>Swan Lake</b></a>: 29 September - 2 October, "+
							"(<a target='_blank' href='http://www.bradford-theatres.co.uk/event/nbt-swan-lake'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p><i>Box office: "+venues['bat'][3]+"</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointBAT, myHtml);
			});
			document.getElementById('mapBAT')['onclick'] = new Function('map.setCenter(new GLatLng('+venues['bat'][1]+', '+venues['bat'][2]+'), 17);return false;');
			
												
			// Manchester Palace Theatre
			var pointMPT = new GLatLng(venues['mpt'][1], venues['mpt'][2]);
			var markerMPT = new GMarker(pointMPT);
			map.addOverlay(markerMPT);
			GEvent.addListener(markerMPT, "click", function() {
				var myHtml = "<div class='inMaps'>"+
							"<h3><b>"+venues['mpt'][0]+"</h3>"+
							"<ul>"+
							"<li>"+
							"<a href='nutcracker.aspx'><b>The Nutcracker</b></a>: 23 - 27 November, "+
							"(<a target='_blank' href='http://www.ticketmaster.co.uk/The-Nutcracker-tickets/artist/804130'>Book Now</a> via <i>Ticketmaster</i>)"+
							"</li>"+
							"</ul>"+
							"<p><i>Box office: "+venues['mpt'][3]+"</i></p>"+
							"<p><a href='talksandevents.aspx'>Events at the theatre&hellip;</a></p>"+
							"</div>";
				map.openInfoWindowHtml(pointMPT, myHtml);
			});
			document.getElementById('mapMPT')['onclick'] = new Function('map.setCenter(new GLatLng('+venues['mpt'][1]+', '+venues['mpt'][2]+'), 17);return false;');
			

			
			// 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>"+
							"<li>"+
							"<a href='cleopatra.php'><b>Cleopatra</b></a>: 26 Feb - 5 Mar, "+
							"(<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('+venues['lgt'][1]+', '+venues['lgt'][2]+'), 17);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, "+
							"(<a href='http://wyp.org.uk/events/event_details.asp?event_ID=5558'>Book now</a>)"+
							"</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]+'), 17);return false;');
		
			
			// Edinburgh Festival Theatre
			/*var pointEFT = new GLatLng(venues['eft'][1], venues['eft'][2]);
			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>"+venues['eft'][0]+"</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: "+venues['eft'][3]+"</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('+venues['eft'][1]+', '+venues['eft'][2]+'), 17);return false;');
			*/
			// Sheffield Lyceum Theatre
			/*var pointSLT = new GLatLng(venues['slt'][1], venues['slt'][2]);
			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>"+venues['slt'][0]+"</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: "+venues['slt'][3]+"</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('+venues['slt'][1]+', '+venues['slt'][2]+'), 17);return false;');
			*/
			// Woking New Victoria Theatre
			var pointWNVT = new GLatLng(venues['wnvt'][1], venues['wnvt'][2]);
			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>"+venues['wnvt'][0]+"</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='swanlake.aspx'><b>Swan Lake</b></a>:5 - 9 October, "+
							"(<a target='_blank' href='http://www.ambassadortickets.com/1731/689/New-Victoria-Theatre/NBT-Swan-Lake'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: "+venues['wnvt'][3]+"</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('+venues['wnvt'][1]+', '+venues['wnvt'][2]+'), 17);return false;');
			
			// Theatre Royal Nottingham
			var pointTRN = new GLatLng(venues['trn'][1], venues['trn'][2]);
			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>"+venues['trn'][0]+"</b></p>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='nutcracker.aspx'><b>The Nutcracker</b></a>: 26 - 30 October, "+
							"(<a target='_blank' href='http://www.royalcentre-nottingham.co.uk/default.asp?id=514'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: "+venues['trn'][3]+"</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('+venues['trn'][1]+', '+venues['trn'][2]+'), 17);return false;');
			
			// Milton Keynes Theatre
			var pointMKT = new GLatLng(venues['mkt'][1], venues['mkt'][2]);
			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>"+venues['mkt'][0]+"</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: "+venues['mkt'][3]+"</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('+venues['mkt'][1]+', '+venues['mkt'][2]+'), 17);return false;');
			
			// Norwich Theatre Royal
			var pointNTR = new GLatLng(venues['ntr'][1], venues['ntr'][2]);
			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>"+venues['ntr'][0]+"</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>"+
							"<ul>"+
							"<li style='color: #000;'>"+
							"<a href='nutcracker.aspx'><b>The Nutcracker</b></a>: 2 - 6 November, "+
							"(<a target='_blank' href='http://www.theatreroyalnorwich.co.uk/whatson/shows/thenutcracker2010.aspx'>Book Now</a>)"+
							"</li>"+
							"</ul>"+
							"<p style='color: #000;'><i>Box office: "+venues['ntr'][3]+"</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('+venues['ntr'][1]+', '+venues['ntr'][2]+'), 17);return false;');
			
			// Venue Cymru
			var pointVC = new GLatLng(venues['vc'][1], venues['vc'][2]);
			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>"+venues['vc'][0]+"</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: "+venues['vc'][3]+"</i></p>"+
							"</div>";
				map.openInfoWindowHtml(pointVC, myHtml);
			});
			document.getElementById('mapVC')['onclick'] = new Function('map.setCenter(new GLatLng('+venues['vc'][1]+', '+venues['vc'][2]+'), 17);return false;');
			
			// Hull New Theatre
			var pointHNT = new GLatLng(venues['hnt'][1], venues['hnt'][2]);
			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>"+venues['hnt'][0]+"</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: "+venues['hnt'][3]+"</i></p>"+
							"</div>";
				map.openInfoWindowHtml(pointHNT, myHtml);
			});
			document.getElementById('mapHNT')['onclick'] = new Function('map.setCenter(new GLatLng('+venues['hnt'][1]+', '+venues['hnt'][2]+'), 17);return false;');
			
			// Theatre Royal Glasgow
			var pointTRG = new GLatLng(venues['trg'][1], venues['trg'][2]);
			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>"+venues['trg'][0]+"</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: "+venues['trg'][3]+"</i></p>"+
							"</div>";
				map.openInfoWindowHtml(pointTRG, myHtml);
			});
			document.getElementById('mapTRG')['onclick'] = new Function('map.setCenter(new GLatLng('+venues['trg'][1]+', '+venues['trg'][2]+'), 17);return false;');
			
			// New Theatre Cardiff
			var pointNTC = new GLatLng(venues['ntc'][1], venues['ntc'][2]);
			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>"+venues['ntc'][0]+"</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: "+venues['ntc'][3]+"</i></p>"+
							"</div>";
				map.openInfoWindowHtml(pointNTC, myHtml);
			});
			document.getElementById('mapNTC')['onclick'] = new Function('map.setCenter(new GLatLng('+venues['ntc'][1]+', '+venues['ntc'][2]+'), 17);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]+'), 17);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;
