
    //<![CDATA[
     
     var gmarkers = [];
     var gicons = [];   //keep outside of load function
      var htmls = [];
      var i = 0;
      var p = 0;
      var q = 0;
            
		gicons["info"] = new GIcon(G_DEFAULT_ICON,"/graphics/thumbwireless6.gif");
		gicons["building"] = new GIcon(G_DEFAULT_ICON,"/graphics/blue-dot2.png");
		gicons["places"] = new GIcon(G_DEFAULT_ICON,"/graphics/pink-dot2.gif");
    
      // ======= This function handles selections from the select box ====important to put outside load function action()
      // === If the dummy entry is selected, the info window is closed ==
      function handleSelected(opt) {
        var i = opt.selectedIndex - 1; 
        if (i > -1) {
          GEvent.trigger(gmarkers[i],"click");
        }
        else {
          map.closeInfoWindow();
        }
      }
// ======= This function handles selections from the check box ====important to put outside load function action()
// == a checkbox has been clicked ==

      function boxclick(box,category) {
        if (box.checked) {
          show(category);
        } else {
          hide(category);
        }
        // == rebuild the side bar
        //makeSidebar();
      }

      function myclick(i) {
        GEvent.trigger(gmarkers[i],"click");
      }
     // == shows all markers of a particular category, and ensures the checkbox is checked ==
      function show(category) {
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].mycategory == category) {
            gmarkers[i].show();
          }
        }
        // == check the checkbox ==
        document.getElementById(category+"box").checked = true;
      }

      // == hides all markers of a particular category, and ensures the checkbox is cleared ==
      function hide(category) {
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].mycategory == category) {
            gmarkers[i].hide();
          }
        }
        // == clear the checkbox ==
        document.getElementById(category+"box").checked = false;
        // == close the info window, in case its open on a marker that we just hid
       // map.closeInfoWindow();
      }

      
   //loads the map function          
 	function action() {
    if (GBrowserIsCompatible()) {
      // ==== first part of the select box ===
		var select_html = '<select onChange="handleSelected(this)">' +
                        '<option selected>&nbsp;&nbsp;&nbsp; - Select a Building - <\/option>';
      // A function to create the marker and set up the event window
      function createMarker(point,name,html,category) {
        var marker = new GMarker(point,gicons[category]); 
 	// === Store the category and name info as a marker properties ===
        marker.mycategory = category;                                 
        marker.myname = name;

        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
          marker.show();
        });
        gmarkers[i] = marker;
        htmls[i] = html;
        
        // ======= Add the entry to the select box =====
        select_html += '<option> ' + name + '<\/option>';
        // ==========================================================
        
        i++;
        return marker;

      }

      // create the map
      	var map = new GMap2(document.getElementById("map"));
      	map.setMapType(G_NORMAL_MAP);
      	map.enableScrollWheelZoom(); 
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(-27.47690,153.02845), 17);
  /*	      
		//start Mapoverlay
   		var pointNE = new GLatLng(-27.47525,153.03070);
   		var pointSW = new GLatLng(-27.47920,153.02620);

   		var groundOverlay = new GGroundOverlay("GardensPoint8.gif", new GLatLngBounds(pointSW, pointNE)) ;

   		
   		function toggleMapoverlay() {
				if(document.getElementById('toggleCheckboxOverlay').checked){
				map.addOverlay(groundOverlay);
			} else {
				map.removeOverlay(groundOverlay);
			}
		}	

		// show polygons if checkbox is checked 
		toggleMapoverlay();
		// add onclick event to toggle checkbox
		var toggleCheckboxOverlay = document.getElementById('toggleCheckboxOverlay');
		toggleCheckboxOverlay.onclick = toggleMapoverlay; if (toggleCheckboxOverlay.captureEvents) toggleCheckboxOverlay.captureEvents(Event.CLICK);
		//end Mapoverlay
	*/	
		//start Polyline overlay
		// === The array of polly points for the polyline ===
		var polyline = new GPolyline([ new GLatLng(-27.47564,153.02810),new GLatLng(-27.47580,153.02823),new GLatLng(-27.47630,153.02775),new GLatLng(-27.47658,153.02788),
		new GLatLng(-27.47688,153.02818),new GLatLng(-27.47661,153.02846),new GLatLng(-27.47610,153.02795),new GLatLng(-27.47580,153.02823),
		new GLatLng(-27.47632,153.02885),new GLatLng(-27.47661,153.02846),new GLatLng(-27.47688,153.02818),new GLatLng(-27.47715,153.02785),
		new GLatLng(-27.47723,153.02785),new GLatLng(-27.47745,153.02755),new GLatLng(-27.47768,153.02779),new GLatLng(-27.47740,153.02820),
		new GLatLng(-27.47748,153.02826),new GLatLng(-27.47705,153.02875),new GLatLng(-27.47661,153.02846),new GLatLng(-27.47632,153.02885),
		new GLatLng(-27.47710,153.02959),new GLatLng(-27.47730,153.02960),new GLatLng(-27.47827,153.02835), new GLatLng(-27.47855,153.02860),
		new GLatLng(-27.47780,153.02790),new GLatLng(-27.47680,153.02685)],"#00C000", 5);

	function togglePolyoverlay() {
				if(document.getElementById('toggleSecureRoute').checked){
				map.addOverlay(polyline);
			} else {
				map.removeOverlay(polyline);
			}
		}	

		// show polygons if checkbox is checked 
		togglePolyoverlay();
		// add onclick event to toggle checkbox
		var toggleSecureRoute = document.getElementById('toggleSecureRoute');
		toggleSecureRoute.onclick = togglePolyoverlay; if (toggleSecureRoute.captureEvents) toggleSecureRoute.captureEvents(Event.CLICK);
		//end Polyoverlay
		//map.addOverlay(polyline);
			
     	
      		/* add polygons */ 
	polygons = new Array(); 
	/* Refec */ 
	var points = new Array(); 
	points.push(new GLatLng('-27.47779','153.03010'));
	points.push(new GLatLng('-27.47758','153.02989'));
	points.push(new GLatLng('-27.47787','153.02950'));
	points.push(new GLatLng('-27.47819','153.02956'));
	points.push(new GLatLng('-27.47779','153.03010'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
	/* Artisans cafe  */ 
	var points = new Array(); 
	points.push(new GLatLng('-27.47656','153.02788'));
	points.push(new GLatLng('-27.47628','153.02822'));
	points.push(new GLatLng('-27.47635','153.02765'));
	points.push(new GLatLng('-27.47656','153.02788'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
	/* B block vending machines */ 
	var points = new Array();
	points.push(new GLatLng('-27.47614','153.02826')); 
	points.push(new GLatLng('-27.47603','153.02814'));
	points.push(new GLatLng('-27.47606','153.02811'));
	points.push(new GLatLng('-27.47617','153.02822'));
	points.push(new GLatLng('-27.47614','153.02826'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
	/* Library cafe */ 
	var points = new Array();
	points.push(new GLatLng('-27.47703','153.02885')); 
	points.push(new GLatLng('-27.47690','153.02872'));
	points.push(new GLatLng('-27.47696','153.02866'));
	points.push(new GLatLng('-27.47709','153.02878'));
	points.push(new GLatLng('-27.47703','153.02885'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
	/* Library food machines */ 
	var points = new Array();
	points.push(new GLatLng('-27.47744','153.02828')); 
	points.push(new GLatLng('-27.47738','153.02820'));
	points.push(new GLatLng('-27.47739','153.02828'));
	points.push(new GLatLng('-27.47736','153.02836'));
	points.push(new GLatLng('-27.47744','153.02828'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
	/* OP block vending machinges */ 
	var points = new Array();
	points.push(new GLatLng('-27.47795','153.02812')); 
	points.push(new GLatLng('-27.47793','153.02810'));
	points.push(new GLatLng('-27.47791','153.02812'));
	points.push(new GLatLng('-27.47792','153.02815'));
	points.push(new GLatLng('-27.47795','153.02812'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
	/* OP-P block vending machinges */ 
	var points = new Array();
	points.push(new GLatLng('-27.47800','153.02814')); 
	points.push(new GLatLng('-27.47798','153.02812'));
	points.push(new GLatLng('-27.47794','153.02817'));
	points.push(new GLatLng('-27.47796','153.02819'));
	points.push(new GLatLng('-27.47800','153.02814'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
	/* Z block cafe */ 
	var points = new Array();
	points.push(new GLatLng('-27.47794','153.02769')); 
	points.push(new GLatLng('-27.47789','153.02764'));
	points.push(new GLatLng('-27.47788','153.02769'));
	points.push(new GLatLng('-27.47790','153.02771'));
	points.push(new GLatLng('-27.47794','153.02769'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
	/* Z block vending machinges */ 
	var points = new Array();
	points.push(new GLatLng('-27.47764','153.02750')); 
	points.push(new GLatLng('-27.47762','153.02748'));
	points.push(new GLatLng('-27.47759','153.02752'));
	points.push(new GLatLng('-27.47761','153.02754'));
	points.push(new GLatLng('-27.47764','153.02750'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
	/* Merlos */ 
	var points = new Array();
	points.push(new GLatLng('-27.47740','153.02986')); 
	points.push(new GLatLng('-27.47733','153.02980'));
	points.push(new GLatLng('-27.47742','153.02969'));
	points.push(new GLatLng('-27.47749','153.02976'));
	points.push(new GLatLng('-27.47740','153.02986'));
	polygons[polygons.length] = new GPolygon(points,'#000000',2,.5,'#ff0000',.8,{clickable:false});
		
	
	function togglePolygons() {
		for(p=0;p<polygons.length;p++){
			if(document.getElementById('toggleCheckboxPolygons').checked){
				map.addOverlay(polygons[p]);
				} else {
				map.removeOverlay(polygons[p]);
				}
			}
		}	
	// show polygons if checkbox is checked 
	togglePolygons();
	// add onclick event to toggle checkbox
	var toggleCheckboxPolygons = document.getElementById('toggleCheckboxPolygons');
	toggleCheckboxPolygons.onclick = togglePolygons; if (toggleCheckboxPolygons.captureEvents) toggleCheckboxPolygons.captureEvents(Event.CLICK);
	
	/* Refec chillout */ 
		polygon = new Array(); 
		var point = new Array();
		point.push(new GLatLng('-27.47760','153.02988')); 
		point.push(new GLatLng('-27.47743','153.02970'));
		point.push(new GLatLng('-27.47755','153.02954'));
		point.push(new GLatLng('-27.47773','153.02971'));
		point.push(new GLatLng('-27.47760','153.02988'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});
	/* Kidney Lawn chillout */ 
		var point = new Array();
		point.push(new GLatLng('-27.47720','153.02960')); 
		point.push(new GLatLng('-27.47740','153.02944'));
		point.push(new GLatLng('-27.47707','153.02913'));
		point.push(new GLatLng('-27.47685','153.02928'));
		point.push(new GLatLng('-27.47720','153.02960'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});
	/* OGH Lawn chillout */ 
		var point = new Array();
		point.push(new GLatLng('-27.47764','153.02910')); 
		point.push(new GLatLng('-27.47746','153.02890'));
		point.push(new GLatLng('-27.47762','153.02883'));
		point.push(new GLatLng('-27.47770','153.02892'));
		point.push(new GLatLng('-27.47764','153.02910'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});		
	/* Library east chill */ 
		var point = new Array();
		point.push(new GLatLng('-27.47680','153.02893')); 
		point.push(new GLatLng('-27.47694','153.02874'));
		point.push(new GLatLng('-27.47675','153.02856'));
		point.push(new GLatLng('-27.47661','153.02874'));
		point.push(new GLatLng('-27.47680','153.02893'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});
	/* Artisans chill  */ 
		var point = new Array(); 
		point.push(new GLatLng('-27.47610','153.02816'));
		point.push(new GLatLng('-27.47626','153.02833'));
		point.push(new GLatLng('-27.47633','153.02785'));
		point.push(new GLatLng('-27.47610','153.02816'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});
		/* Library west chill */ 
		var point = new Array();
		point.push(new GLatLng('-27.47727','153.02828')); 
		point.push(new GLatLng('-27.47736','153.02816'));
		point.push(new GLatLng('-27.47717','153.02799'));
		point.push(new GLatLng('-27.47709','153.02811'));
		point.push(new GLatLng('-27.47727','153.02828'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});
/* O block balcony chill */ 
		var point = new Array();
		point.push(new GLatLng('-27.47758','153.02855')); 
		point.push(new GLatLng('-27.47769','153.02841'));
		point.push(new GLatLng('-27.47762','153.02835'));
		point.push(new GLatLng('-27.47752','153.02849'));
		point.push(new GLatLng('-27.47758','153.02855'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});
		/*Maths chill*/	
		var point = new Array();
		point.push(new GLatLng('-27.47743','153.02848')); 
		point.push(new GLatLng('-27.47766','153.02818'));
		point.push(new GLatLng('-27.47752','153.02810'));
		point.push(new GLatLng('-27.47740','153.02831'));
		point.push(new GLatLng('-27.47743','153.02848'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});
		/* Business science chill */ 
		var point = new Array();
		point.push(new GLatLng('-27.47651','153.02858')); 
		point.push(new GLatLng('-27.47659','153.02848'));
		point.push(new GLatLng('-27.47648','153.02838'));
		point.push(new GLatLng('-27.47641','153.02848'));
		point.push(new GLatLng('-27.47651','153.02858'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});
	/* Q block chill */ 
		var point = new Array();
		point.push(new GLatLng('-27.47700','153.02778')); 
		point.push(new GLatLng('-27.47705','153.02771'));
		point.push(new GLatLng('-27.47697','153.02764'));
		point.push(new GLatLng('-27.47692','153.02771'));
		point.push(new GLatLng('-27.47700','153.02778'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});
	/*F block chill*/	
		var point = new Array();
		point.push(new GLatLng('-27.47637','153.02761')); 
		point.push(new GLatLng('-27.47651','153.02742'));
		point.push(new GLatLng('-27.47635','153.02726'));
		point.push(new GLatLng('-27.47632','153.02730'));
		point.push(new GLatLng('-27.47644','153.02742'));
		point.push(new GLatLng('-27.47633','153.02758'));
		point.push(new GLatLng('-27.47637','153.02761'));
		polygon[polygon.length] = new GPolygon(point,'#000000',2,.5,'#FFFF40',.8,{clickable:false});		
		
		function toggleChillout() {
			for(q=0;q<polygon.length;q++){
				if(document.getElementById('toggleChilloutpoly').checked){
					map.addOverlay(polygon[q]);
					} else {
					map.removeOverlay(polygon[q]);
					}
				}
			}	

	// show polygons if checkbox is checked 
	toggleChillout();
	// add onclick event to toggle checkbox
	var toggleChilloutpoly = document.getElementById('toggleChilloutpoly');
	toggleChilloutpoly.onclick = toggleChillout; if (toggleChilloutpoly.captureEvents) toggleChilloutpoly.captureEvents(Event.CLICK);
	/*
	//Show all Buildings
	function toggleBuilding() {
			for(q=0;q<polygon.length;q++){
				if(document.getElementById('toggleChilloutpoly').checked){
					map.addOverlay(polygon[q]);
					} else {
					map.removeOverlay(polygon[q]);
					}
				}
			}	

	// show polygons if checkbox is checked 
	toggleBuilding();
	// add onclick event to toggle checkbox
	var toggleBuildings = document.getElementById('toggleBuildings');
	toggleBuildings.onclick = toggleBuilding; if (toggleBuildings.captureEvents) toggleBuildings.captureEvents(Event.CLICK);
	*/
	
      // Read the data from marker.xml      
  GDownloadUrl("xml/markers_gp.xml", function (doc) {
        var xmlDoc = GXml.parse(doc);
        var markers = xmlDoc.documentElement.getElementsByTagName("marker");
         
        for (var i = 0; i < markers.length; i++) {
          // obtain the attribues of each marker
          var lat = parseFloat(markers[i].getAttribute("lat"));
          var lng = parseFloat(markers[i].getAttribute("lng"));
          var point = new GLatLng(lat,lng);
          var html = markers[i].getAttribute("html");
          var label = markers[i].getAttribute("label");
          var category = markers[i].getAttribute("category");

          // create the marker
          var marker = createMarker(point,label,html,category);
         
          map.addOverlay(marker);
        }
        // ===== final part of the select box =====
        hide("info");
        //hide("places");
        select_html += '<\/select>';
        document.getElementById("selection").innerHTML = select_html;
       // hide("building");
	
      });
    }
    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }
} 

    //]]>