    //<![CDATA[
	var points, infoHtmls, markers, map, points2, infoHtmls2, markers2, polylinePark, polylineCycle, polylineFerry;

	// Monitor the window resize event and let the map know when it occurs
	if (window.attachEvent) { 
	window.attachEvent("onresize", function() {this.map.onResize()} );
	} else {
	window.addEventListener("resize", function() {this.map.onResize()} , false);
	}
	
	function makeOpenerCaller(i) {
		return function() {markers[i].openInfoWindowHtml(infoHtmls[i]);};
	}
	function makeOpenerCaller2(i) {
		return function() {markers2[i].openInfoWindowHtml(infoHtmls2[i]);};
	}
	
	function getMap(){
		map = new GMap2(document.getElementById("gmapLarge"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.addControl(new GMapTypeControl());
		map.addControl(new GOverviewMapControl());
		map.setCenter(new GLatLng(56.08, -4.55),10);
		
		// "BB" marker icon
		iconBB = new GIcon();
		iconBB.image = "../img/gmap/bb_marker.png";
		iconBB.shadow = "../img/gmap/shadow.png";
		iconBB.iconSize = new GSize(20, 34);
		iconBB.shadowSize = new GSize(37, 34);
		iconBB.iconAnchor = new GPoint(10, 34);
		iconBB.infoWindowAnchor = new GPoint(10, 1);
		// "SC" marker icon
		iconSC = new GIcon();
		iconSC.image = "../img/gmap/sc_marker.png";
		iconSC.shadow = "../img/gmap/shadow.png";
		iconSC.iconSize = new GSize(20, 34);
		iconSC.shadowSize = new GSize(37, 34);
		iconSC.iconAnchor = new GPoint(10, 34);
		iconSC.infoWindowAnchor = new GPoint(10, 1);
		// "H" marker icon
		iconH = new GIcon();
		iconH.image = "../img/gmap/h_marker.png";
		iconH.shadow = "../img/gmap/shadow.png";
		iconH.iconSize = new GSize(20, 34);
		iconH.shadowSize = new GSize(37, 34);
		iconH.iconAnchor = new GPoint(10, 34);
		iconH.infoWindowAnchor = new GPoint(10, 1);
		
		icons = [iconBB,iconSC,iconH];
		
		// Mountain icon
		iconM = new GIcon();
		iconM.image = "../img/gmap/mount_marker.png";
		iconM.iconSize = new GSize(20, 20);
		iconM.iconAnchor = new GPoint(10, 20);
		iconM.infoWindowAnchor = new GPoint(10, 1);
		// Train icon
		iconT = new GIcon();
		iconT.image = "../img/gmap/train_marker.png";
		iconT.iconSize = new GSize(12, 12);
		iconT.iconAnchor = new GPoint(6, 6);
		iconT.infoWindowAnchor = new GPoint(12, 1);
		// Info icon
		iconI = new GIcon();
		iconI.image = "../img/gmap/info_marker.png";
		iconI.iconSize = new GSize(20, 34);
		iconI.iconAnchor = new GPoint(10, 34);
		iconI.infoWindowAnchor = new GPoint(10, 1);
		// Airport icon
		iconAP = new GIcon();
		iconAP.image = "../img/gmap/plane_marker.png";
		iconAP.iconSize = new GSize(20, 20);
		iconAP.iconAnchor = new GPoint(10, 20);
		iconAP.infoWindowAnchor = new GPoint(10, 1);
		// Hill Icon
		iconHL = new GIcon();
		iconHL.image = "../img/gmap/hill_marker.png";
		iconHL.iconSize = new GSize(20, 20);
		iconHL.iconAnchor = new GPoint(10, 10);
		iconHL.infoWindowAnchor = new GPoint(10, 1);
		
		icons2 = [iconM,iconT,iconI,iconAP,iconHL];
		
		// Creates LL boundary polyline
		polylinePark = new GPolyline([new GPoint(-4.748, 56.199),new GPoint(-4.788, 56.166),new GPoint(-4.736, 56.1547),
		new GPoint(-4.774, 56.0764),new GPoint(-4.7814, 56.0511),new GPoint(-4.690, 56.022),new GPoint(-4.598, 55.999),
		new GPoint(-4.460, 56.039),new GPoint(-4.430, 56.053),new GPoint(-4.431, 56.088),new GPoint(-4.307, 56.1647),
		new GPoint(-4.271, 56.168),new GPoint(-4.202, 56.244),new GPoint(-4.208, 56.364),new GPoint(-4.109, 56.392),
		new GPoint(-4.243, 56.392),new GPoint(-4.317, 56.478),new GPoint(-4.620, 56.429),new GPoint(-4.642, 56.476),
		new GPoint(-4.833, 56.390),new GPoint(-4.791, 56.346),new GPoint(-4.979, 56.195),new GPoint(-5.131, 56.013),
		new GPoint(-4.956, 56.003),new GPoint(-4.897, 55.982),new GPoint(-4.913, 56.052),new GPoint(-4.875, 56.093),
		new GPoint(-4.912, 56.120),new GPoint(-4.920, 56.164),new GPoint(-4.905, 56.174),new GPoint(-4.883, 56.146),
		new GPoint(-4.866, 56.101),new GPoint(-4.787, 56.188),new GPoint(-4.748, 56.199)],"#666666",4);
		map.addOverlay(polylinePark);
		polylineCycle = new GPolyline([new GPoint(-4.554, 55.942),new GPoint(-4.578, 55.948),new GPoint(-4.574, 56.003),
		new GPoint(-4.446, 56.044),new GPoint(-4.416, 56.048),new GPoint(-4.449, 56.081),new GPoint(-4.390, 56.130),
		new GPoint(-4.366, 56.158),new GPoint(-4.384, 56.178),new GPoint(-4.367, 56.205),new GPoint(-4.376, 56.210),
		new GPoint(-4.356, 56.213),new GPoint(-4.361, 56.219),new GPoint(-4.297, 56.214),new GPoint(-4.217, 56.243),
		new GPoint(-4.284, 56.248),new GPoint(-4.298, 56.288),new GPoint(-4.338, 56.305),new GPoint(-4.349, 56.350),
		new GPoint(-4.373, 56.356),new GPoint(-4.330, 56.357),new GPoint(-4.293, 56.383),new GPoint(-4.335, 56.415),
		new GPoint(-4.342, 56.445),new GPoint(-4.316, 56.460),new GPoint(-4.235, 56.484),new GPoint(-4.161, 56.493),
		new GPoint(-4.091, 56.549),new GPoint(-3.996, 56.581)],"#0033FF",4);
		polylineFerry = new GPolyline([new GPoint(-4.735, 56.002),new GPoint(-4.817, 55.963),new GPoint(-4.824, 55.984),
		new GPoint(-4.817, 55.963),new GPoint(-4.921, 55.946)],"#FF0000",4);
	
	var request = GXmlHttp.create();
	request.open("GET", "gmapbus.xml.php", true);
	request.onreadystatechange = function() {
  	if (request.readyState == 4) {
    	var xmlDoc = request.responseXML;
   		var busElements = xmlDoc.documentElement.getElementsByTagName("bus");
   		var otherElements = xmlDoc.documentElement.getElementsByTagName("other");
		
		len1 = busElements.length;
		len2 = otherElements.length;
		
		markers = new Array(busElements.length);
		points = new Array(busElements.length);
		infoHtmls = new Array(busElements.length);
		
		markers2 = new Array(otherElements.length);
		points2 = new Array(otherElements.length);
		infoHtmls2 = new Array(otherElements.length);
	   	
			for (var i = 0; i < busElements.length; i++) {

			var typeid = busElements[i].getAttribute("typeid");
			var typeid = parseFloat(typeid);
			var typeid = typeid - 1;
			var type = busElements[i].getAttribute("type");
			var bid = busElements[i].getAttribute("bid");
			var bname = busElements[i].getAttribute("bname");
			var seoname = busElements[i].getAttribute("seoname");
			var contact = busElements[i].getAttribute("contact");
			var add1 = busElements[i].getAttribute("add1");
			var add2 = busElements[i].getAttribute("add2");
			var tel = busElements[i].getAttribute("tel");
 
			points[i] = new GLatLng(parseFloat(busElements[i].getAttribute("lat")),parseFloat(busElements[i].getAttribute("lng")));
			markers[i] = new GMarker(points[i],{icon:icons[typeid],title:[bname]+" ("+[type]+")"});
			
			// BUILD HTML MARKUP FOR INFOWINDOWS
			infoHtmls[i] = '<span style="font-family:Arial,Helvetica,sans-serif;">';
			infoHtmls[i] += '<a href="javascript:;" onclick="opener.location=\'/loch-lomond-accommodation/' + type + '/' + seoname + '/\';self.close();;"><b>' + bname + '</b></a><br />'; 
			infoHtmls[i] += '<i>' + type + '</i><br />' + add1 + '<br />' + add2 + '<br /><br /><b>Contact: </b>' + contact + '<br />' + tel + '<br /><br />';
			infoHtmls[i] += '<a href="javascript:;" onclick="window.opener.location=\'/loch-lomond-accommodation/' + type + '/' + seoname + '/\';self.close();">more details &gt;&gt;</a></span>';
			
			GEvent.addListener(markers[i],"click",makeOpenerCaller(i));
			map.addOverlay(markers[i]);
    		}
			
			for (var i = 0; i < otherElements.length; i++) {

			var typeid2 = otherElements[i].getAttribute("typeid");
			var typeid2 = parseFloat(typeid2);
			var typeid2 = typeid2 - 1;
			var type2 = otherElements[i].getAttribute("type");
			var oid = otherElements[i].getAttribute("id");
			var text = otherElements[i].getAttribute("text");
 
			points2[i] = new GLatLng(parseFloat(otherElements[i].getAttribute("lat")),parseFloat(otherElements[i].getAttribute("lng")));
			markers2[i] = new GMarker(points2[i],{icon:icons2[typeid2],title:[type2]});
			
			// BUILD HTML MARKUP FOR INFOWINDOWS
			infoHtmls2[i] = text;
			
			GEvent.addListener(markers2[i],"click",makeOpenerCaller2(i));
			map.addOverlay(markers2[i]);
    		}
		}
	}
	request.send(null);
	}

	function removeBB(){
	if (document.getElementById("BB").checked==false) {
	for (z2=0;z2<len1;z2++) {
		if (markers[z2].icon.image=="../img/gmap/bb_marker.png")  {
			map.removeOverlay(markers[z2]);
		}}} else {
	for (z2=0;z2<len1;z2++) {
		if (markers[z2].icon.image=="../img/gmap/bb_marker.png")  {
			map.addOverlay(markers[z2]);}}}}
		  
	function removeSC(){
	if (document.getElementById("SC").checked==false) {
	for (z2=0;z2<y2;z2++) {
		if (markers[z2].icon.image=="../img/gmap/sc_marker.png")  {
			map.removeOverlay(markers[z2]);
		} else {}}} else {
	for (z2=0;z2<y2;z2++) {
		if (markers[z2].icon.image=="../img/gmap/sc_marker.png")  {
			map.addOverlay(markers[z2]);}}}}
			
	function removeM(){
	if (document.getElementById("mount").checked==false) {
		var y4 = markers2.length;
	for (z4=0;z4<y4;z4++) {
		if (markers2[z4].icon.image=="../img/gmap/mount_marker.png")  {
			map.removeOverlay(markers2[z4]);
		} else {}}} else {
		var y4 = markers2.length;
	for (z4=0;z4<y4;z4++) {
		if (markers2[z4].icon.image=="../img/gmap/mount_marker.png")  {
			map.addOverlay(markers2[z4]);
			}}}}

	function removeT(){
	if (document.getElementById("train").checked==false) {
		var y5 = markers2.length;
	for (z5=0;z5<y5;z5++) {
		if (markers2[z5].icon.image=="../img/gmap/train_marker.png")  {
			map.removeOverlay(markers2[z5]);
		} else {}}} else {
		var y5 = markers2.length;
	for (z5=0;z5<y5;z5++) {
		if (markers2[z5].icon.image=="../img/gmap/train_marker.png")  {
			map.addOverlay(markers2[z5]);
			}}}}

	function removeI(){
	if (document.getElementById("info").checked==false) {
		var y6 = markers2.length;
	for (z6=0;z6<y6;z6++) {
		if (markers2[z6].icon.image=="../img/gmap/info_marker.png")  {
			map.removeOverlay(markers2[z6]);
		} else {}}} else {
		var y6 = markers2.length;
	for (z6=0;z6<y6;z6++) {
		if (markers2[z6].icon.image=="../img/gmap/info_marker.png")  {
			map.addOverlay(markers2[z6]);
			}}}}

	function removeAP(){
	if (document.getElementById("plane").checked==false) {
		var y7 = markers2.length;
	for (z7=0;z7<y7;z7++) {
		if (markers2[z7].icon.image=="../img/gmap/plane_marker.png")  {
			map.removeOverlay(markers2[z7]);
		} else {}}} else {
		var y7 = markers2.length;
	for (z7=0;z7<y7;z7++) {
		if (markers2[z7].icon.image=="../img/gmap/plane_marker.png")  {
			map.addOverlay(markers2[z7]);
			}}}}

	function removeHL(){
	if (document.getElementById("hill").checked==false) {
		var y8 = markers2.length;
	for (z8=0;z8<y8;z8++) {
		if (markers2[z8].icon.image=="../img/gmap/hill_marker.png")  {
			map.removeOverlay(markers2[z8]);
		} else {}}} else {
		var y8 = markers2.length;
	for (z8=0;z8<y8;z8++) {
		if (markers2[z8].icon.image=="../img/gmap/hill_marker.png")  {
			map.addOverlay(markers2[z8]);
			}}}}

	function removeCycle(){
	if (document.getElementById("Cycle").checked==false) {
		map.removeOverlay(polylineCycle);
	} else {
		map.addOverlay(polylineCycle);
	 }
	}
	function removeFerry(){
	if (document.getElementById("Ferry").checked==false) {
		map.removeOverlay(polylineFerry);
	} else {
		map.addOverlay(polylineFerry);
	 }
	}
	function removePark(){
	if (document.getElementById("Park").checked==false) {
		map.removeOverlay(polylinePark);
	} else {
		map.addOverlay(polylinePark);
	 }
	}
	 
//]]>
