//<![CDATA[

//Google Maps UK - API2
//Copyright York 360 info@york360.co.uk

if (GBrowserIsCompatible()) {

			function createMarker(point,html) {
				var marker = new GMarker(point,icon); //make sure icon gif is correct or you will nor get an error!
				GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); });
				return marker;
				}
			function createYellowMarker(point,txt) {
				var marker = new GMarker(point, yellowicon);
				GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(txt); });
				return marker;
				}		
			function createGreenMarker(point,txt) {
				var marker = new GMarker(point, greenicon);
				GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(txt); });
				return marker;
				}		
			function createBrownMarker(point,txt) {
				var marker = new GMarker(point, hotelicon);
				GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(txt); });
				return marker;
				}

			
			function showMarker(marker){ //Show marker and open info window
					//map.clearOverlays(); clears anyway! need to centre though and maybe zoom?
					GEvent.trigger(marker,"click");
					//GEvent.trigger(gmarkers[i], "click");//might have to use array?
					}
			
	
			var map;
			map = new GMap2(document.getElementById("map"));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			map.setCenter(new GLatLng(54.290343,-0.922358),11);


			//Coloured Markers
			//the path to the icon images should be relative to the page not this external js file!!!
			
			//red icon (attractions)
			var icon = new GIcon();
			icon.image = "/maps/mm_20_red.png";
			icon.shadow = "/maps/mm_20_shadow.png";
			icon.iconSize = new GSize(12, 20);
			icon.shadowSize = new GSize(22, 20);
			icon.iconAnchor = new GPoint(6, 20);
			icon.infoWindowAnchor = new GPoint(5, 1);
			
			//yellow icon (restaurants)
			var yellowicon = new GIcon();
			yellowicon.image = "/maps/mm_20_yellow.png";
			yellowicon.shadow = "/maps/mm_20_shadow.png";
			yellowicon.iconSize = new GSize(12, 20);
			yellowicon.shadowSize = new GSize(22, 20);
			yellowicon.iconAnchor = new GPoint(6, 20);
			yellowicon.infoWindowAnchor = new GPoint(5, 1);
			
			//green icon (hotels)
			var greenicon = new GIcon();
			greenicon.image = "/maps/mm_20_green.png";
			greenicon.shadow = "/maps/mm_20_shadow.png";
			greenicon.iconSize = new GSize(12, 20);
			greenicon.shadowSize = new GSize(22, 20);
			greenicon.iconAnchor = new GPoint(6, 20);
			greenicon.infoWindowAnchor = new GPoint(5, 1);
			
			//brown (not used yet)
			var brownicon = new GIcon();
			brownicon.image = "/maps/mm_20_brown.png";
			brownicon.shadow = "/maps/mm_20_shadow.png";
			brownicon.iconSize = new GSize(12, 20);
			brownicon.shadowSize = new GSize(22, 20);
			brownicon.iconAnchor = new GPoint(6, 20);
			brownicon.infoWindowAnchor = new GPoint(5, 1);


			
			var point = new GLatLng(54.290343,-0.922358);
			var Hutton = createMarker(point,'<img src=\"/campsites/camping_and_caravan_site_sm.jpg\" border=\"0\" width=\"166\" height=\"80\" alt=\"Campsite\"><P><span class=\"v12\"><b>Hutton Le Hole Caravan Park</b><br>Westfield Lodge<br>Hutton Le Hole<br>North Yorkshire<br>YO62 6UG<br>Tel. 01751 417261</p></span>');
			map.addOverlay(Hutton);

			var point = new GLatLng(54.210253,-1.074911);
			var Helmsley = createMarker(point,'<img src=\"/campsites/camping_and_caravan_site_sm.jpg\" border=\"0\" width=\"166\" height=\"80\" alt=\"Campsite\"><P><span class=\"v12\"><b>Golden Square Caravan Park</b><br>Oswaldkirk<br>Near Helmsley<br>North Yorkshire<br>YO62 5YQ<br>Tel. 01439 788269</p></span>');
			map.addOverlay(Helmsley);

			var point = new GLatLng(54.164969,-0.928645);
			var Slingsby = createMarker(point,'<img src=\"/campsites/camping_and_caravan_site_sm.jpg\" border=\"0\" width=\"166\" height=\"80\" alt=\"Campsite\"><P><span class=\"v12\"><b>Robin Hood Caravan and Camping Park</b><br>Green Dyke Lane<br>Slingsby<br>North Yorkshire<br>YO62 4AP<br>Tel. 01653 628391</p></span>');
			map.addOverlay(Slingsby);

			var point = new GLatLng(54.218434,-0.648794);
			var Pickering = createMarker(point,'<img src=\"/campsites/camping_and_caravan_site_sm.jpg\" border=\"0\" width=\"166\" height=\"80\" alt=\"Campsite\"><P><span class=\"v12\"><b>Vale of Pickering Caravan Park</b><br>Carr House Farm<br>Allerston<br>Pickering<br>North Yorkshire<br>YO18 7PQ<br>Tel. 01723 859280</p></span>');
			map.addOverlay(Pickering);

			var point = new GLatLng(54.218434,-0.648794);
			var Pickering2 = createMarker(point,'<img src=\"/campsites/camping_and_caravan_site_sm.jpg\" border=\"0\" width=\"166\" height=\"80\" alt=\"Campsite\"><P><span class=\"v12\"><b>Spiers House Campsite</b><br>Cropton<br>Pickering<br>North Yorkshire<br>YO18 8ES<br>Tel. 0845 130 8224</p></span>');
			map.addOverlay(Pickering2);




			function OpenMarker(){ //called onload in body tag nice! all other code does not work if in onload function! just this

				//next more vars for zoom level and sat?
				get_string = document.location.search;
				Charindex = get_string.indexOf('=');

				if(Charindex != -1){ //found!
						MarkerName = get_string.substr(Charindex+1, get_string.length - Charindex+1); //(start,length)
						//alert(MarkerName);
						varResult = showMarker(eval(MarkerName));
						//alert(typeof MarkerName); //string at the moment want object eval fixed it!
						//alert(varResult);
						//showMarker(Beechwood); //I think this is an object crashes sometimes!
				}else{
					//alert("Not Set or null");
				}

			}



}else{
	alert("Sorry your browser is not compatible with our google map");
}



//]]>
