    //<![CDATA[
    
    if (GBrowserIsCompatible()) { 

	var addressLocality = ", Queensland";

    var map;
	var bounds;
	var centerPoint;
	var oZoom;

	var directions;
    var geo;
    var reasons=[];

	var normalProj = G_NORMAL_MAP.getProjection();	

	//read xml data and store them in the following variables
	var dataLength;
	var xmlPath = siteUrl + "data/divisions.xml";
	var kmlPath_bb, kmlPath_pp;
	var maxLat=[];
	var maxLng=[];
	var minLat=[];
	var minLng=[];
	var maxY=[];
	var maxX=[];
	var minY=[];
	var minX=[];
	var attendance=[];
	var att=[];
	var sw=[];
	var ne=[];
	var overlayName=[];
	var kmlName=[];
	var kmlLabel=[];
	var pdfName=[];
	var pdfLabel=[];
	var districtName=[];
	var distName=[];
	var distLabel=[];
	var divName=[];
	var docLabel=[];
	var kmlBooth=[]; 
	
	var count;
	var counter;
	
	var semsName=[];
	var sName=[];
	var semsDir=[];
	var semsDiv=[];
	var semsLink=[];

	var linkMain = '<a href="' + siteUrl + 'info.html">Back to Information Page</a><br />';
	var linkInfo = '<a href="' + siteUrl + 'mainindex.html">Go to Main Index Page</a><br />';
	var linkSmap = '<a href="' + pdfUrl + '" target="_blank">PDF map</a><br />';
	var linkCouncil = '<a href="' + councilInfo + '">' + "Council Information" + '</a><br />';
	var linkTitle = '<a href="' + semsUrl + pageTitle.replace(/ /g, "") + '/index.html">' + pageTitle + '</a>';
	var linkGmap = "";
	var linkSpace = '<p></p>';
	var siteLinks;

	var centerMarker;
	var radiusMarker;
	var rLine;
	var circleLine;
	var McircleLine=[];
	var circles = Array();
	var marker = null;
//	var Pmarker;
	var Mmarker=[];
	var points=[];
	var Lpp;	//number of polling places
	var Lpolygon;	//number of polygons
	var Lcoords=[];	//number of coordinates in a polygon
	var Lpoints=[];	//polygon points
	var Cpolygon; //number of polygons in a council
	var Ccoords=[]; //number of coordinates in a polygon of a council
	var Cpoints=[]; //polygon points in a council
	var kml
	var icon = new GIcon();
	
    // this variable will collect the html which will eventually be placed in the Polling Places List
    var division_html = "";
    var pollingPlaces_html = "";
    
    // arrays to hold copies of the markers used by the Polling Places because the function closure trick doesnt work there
	var gmarkers = [];
	var htmls = [];
	var names = [];
	var imgLinks =[];
	var i = 0;
	var j = 0;

    function load() {
		bounds = new GLatLngBounds(minLatLng, maxLatLng);
		
		map = new GMap2(document.getElementById("map"));
		map.enableDoubleClickZoom();
		map.addControl(new GLargeMapControl());
		map.addControl(new GHierarchicalMapTypeControl());
		map.addMapType(G_PHYSICAL_MAP); 
		map.addControl(new GScaleControl());
		map.addControl(new GOverviewMapControl());
		
		centerPoint = bounds.getCenter();
		oZoom = map.getBoundsZoomLevel(bounds);

    	map.setCenter(centerPoint,oZoom);
		//Add kml overlay
		kml = new GGeoXml(kmlPath_boundary);
		map.addOverlay(kml);
		directions = new GDirections(map, null);
      
      // ====== Create a Client Geocoder ======
      geo = new GClientGeocoder(); 

      // ====== Array for decoding the failure codes ======
      reasons[G_GEO_SUCCESS]            = "Success";
      reasons[G_GEO_MISSING_ADDRESS]    = "Missing Address: The address was either missing or had no value.";
      reasons[G_GEO_UNKNOWN_ADDRESS]    = "Unknown Address:  No corresponding geographic location could be found for the specified address.";
      reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";
      reasons[G_GEO_BAD_KEY]            = "Bad Key: The API key is either invalid or does not match the domain for which it was given";
      reasons[G_GEO_TOO_MANY_QUERIES]   = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";
      reasons[G_GEO_SERVER_ERROR]       = "Server error: The geocoding request could not be successfully processed.";


	icon.image = "";
	icon.shadow = "../images/msmarker.png";
	icon.iconSize = new GSize(32, 32);
	icon.shadowSize = new GSize(59, 32);
	icon.iconAnchor = new GPoint(15, 30);
	icon.infoWindowAnchor = new GPoint(15, 0);

	initData();
	councilData();
	}
	
	function initData(){
	  document.getElementById("districtName").innerHTML = '<div align="center" class="wizardheader-fontforecolor">' + linkTitle + '</div>';
	  siteLinks = linkInfo + linkMain + linkSmap + linkCouncil + linkSpace;
	  document.getElementById("links").innerHTML = siteLinks + linkGmap + linkSpace;
      // Read division/ward name from divisions.xml
      var request = GXmlHttp.create();
      request.open("GET", xmlPath, true);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
         var xmlDoc = GXml.parse(request.responseText);
         // obtain the array of markers and loop through it
         var placeMark = xmlDoc.documentElement.getElementsByTagName("marker");
		 var divLength = placeMark.length;
		 count = 0;
         for (var i = 0; i < divLength; i++) {
            // obtain the attribues of each marker
            maxY[i] = parseFloat(placeMark[i].getAttribute("maxlat"));
            maxX[i] = parseFloat(placeMark[i].getAttribute("maxlng"));
            minY[i] = parseFloat(placeMark[i].getAttribute("minlat"));
            minX[i] = parseFloat(placeMark[i].getAttribute("minlng"));
			attendance[i] = parseFloat(placeMark[i].getAttribute("attendance"));
			semsName[i] = placeMark[i].getAttribute("DistrictName");
			semsDiv[i] = placeMark[i].getAttribute("Division");
			districtName[i] = semsName[i] + " " + semsDiv[i];
			overlayName[i] = districtName[i].replace(/ /g, "_");
			if (semsName[i] == pageTitle){
            maxLat[count] = maxY[i];
            maxLng[count] = maxX[i];
            minLat[count] = minY[i];
            minLng[count] = minX[i];
			att[count] = attendance[i];
			distName[count] = districtName[i];
			kmlName[count] = overlayName[i];
			divName[count] = semsDiv[i];
			semsDir[count] = semsName[i].replace(/ /g, "");
			docLabel[count]= districtName[i].replace(/ /g, "");
			count++;
			}
		 }
		 for (var i = 0; i < count; i++){
			 division_html += '<tr><td width="100">' + divName[i] + '</td><td><a href="' + docLabel[i] + '.html">interactive map</a></td></tr><tr width="100"><td>&nbsp;</td><td><a href="../maps/' + docLabel[i] + '.pdf" target=_blank>pdf map</a></td></tr>';
		 }
			 document.getElementById("pollingplaces").innerHTML = "<p class=" + "heading2" + "><strong>Division Maps: </strong>" + "</p>" + '<table width="95%">' + division_html + '</table>'; 
		}
	  }
	  request.send(null);
	}
	
	function councilData(){
      // Read the boundary coordinates data file
	  Cpoints=new Array();
      var request = GXmlHttp.create();
      request.open("GET", kmlPath_boundary, true);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
         var xmlDoc = GXml.parse(request.responseText);
         // obtain the array of markers and loop through it
         var polygon = xmlDoc.documentElement.getElementsByTagName("coordinates");
         Cpolygon = polygon.length; 
         for (var i = 0; i < Cpolygon; i++) {
         var xyz = xmlDoc.getElementsByTagName("coordinates")[i].firstChild.nodeValue;	//call coordinate-x
		 var Slatlng = xyz.replace(/,0/g, ",");
		 var latlng = Slatlng.split(",");
		 Ccoords[i] = (latlng.length-1)/2;
				 var x = [];
				 var y = [];
				 var coords = [];
			 for (var j=0; j<Ccoords[i]; j++){
				 x[j] = parseFloat(latlng[2*j]);
				 y[j] = parseFloat(latlng[2*j+1]);
				 coords[j] = new GLatLng(y[j],x[j]);
			 } //end for j=0
			 Cpoints.push(coords);
         } //end for i=0
        }
      }
	  
     request.send(null);
	}

	function boundaryData(kmlPath_bb){
      // Read the boundary coordinates data file
	  Lpoints=new Array();
      var request = GXmlHttp.create();
      request.open("GET", kmlPath_bb, false);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
         var xmlDoc = GXml.parse(request.responseText);
         // obtain the array of markers and loop through it
         var polygon = xmlDoc.documentElement.getElementsByTagName("coordinates");
         Lpolygon = polygon.length; 
         for (var i = 0; i < Lpolygon; i++) {
         var xyz = xmlDoc.getElementsByTagName("coordinates")[i].firstChild.nodeValue;	//call coordinate-x
		 var Slatlng = xyz.replace(/,0/g, ",");
		 var latlng = Slatlng.split(",");
		 var temp = [];
		 Lcoords[i] = (latlng.length-1)/2;
				 var x = [];
				 var y = [];
				 var coords = [];
			 for (var j=0; j<Lcoords[i]; j++){
				 x[j] = parseFloat(latlng[2*j]);
				 y[j] = parseFloat(latlng[2*j+1]);
				 coords[j] = new GLatLng(y[j],x[j]);
			 } //end for j=0
			 Lpoints.push(coords);
         } //end for i=0
        }
      }
	  
     request.send(null);
	}

	function boothData(kmlPath_pp){
      // Read the polling places data file
      var request = GXmlHttp.create();
      request.open("GET", kmlPath_pp, false);
      request.onreadystatechange = function() {
        if (request.readyState == 4) {
         var xmlDoc = GXml.parse(request.responseText);
         // obtain the array of markers and loop through it
         var placeMark = xmlDoc.documentElement.getElementsByTagName("Placemark");
         Lpp = placeMark.length; 
         for (var i = 0; i < Lpp; i++) {
         var xyz = xmlDoc.getElementsByTagName("coordinates")[i].firstChild.nodeValue;	//call coordinate-x
		 var latlng = xyz.split(",");
		 var point = new GLatLng(parseFloat(latlng[1]),parseFloat(latlng[0]));
         var html = xmlDoc.getElementsByTagName("description")[i].firstChild.nodeValue;
         var name = xmlDoc.getElementsByTagName("name")[i].firstChild.nodeValue;
		 var access = xmlDoc.getElementsByTagName("accessibility")[i].firstChild.nodeValue;
		 var imgLink;
		 switch(access){
			 case "F":
			 imgLink = '<img src="../images/WheelchairFullAccess.gif" alt="Full WheelChair Access" width="20" height="20" />';
			 icon.image = "../images/marker_f.png";
			 break;
			 case "A":
			 imgLink = '<img src="../images/WheelchairAssistedAccess.gif" alt="WheelChair Assisted Access" width="20" height="20"  />';
			 icon.image = "../images/marker_a.png";
			 break;
			 case "N":
			 imgLink = '<img src="../images/WheelchairNoAccess.gif" alt="No WheelChair Access" width="20" height="20"  />';
			 icon.image = "../images/marker_n.png";
			 break;
			 default:
			 imgLink ="";			 
		 }
          // call the marker
			var Pmarker = callMarker(point,name,html,icon,imgLink);
			htmls[i] = html;
			names[i] = name;
			gmarkers[i] = Pmarker;
			imgLinks[i] = imgLink;
			points[i] = point;
			// save the info we need to use later for the polling palces
			// add a line to the polling places list
			pollingPlaces_html += imgLinks[i] + ' <a href="javascript:markerClick(' + i + ')">' + names[i] + '</a><br>';
			map.addOverlay(Pmarker); 
         }
          // put the assembled pollingPlaces_html contents into the pollingPlaces div
         document.getElementById("pollingplaces").innerHTML = "<p class=" + "heading2" + "><strong>Polling Places: </strong>" + "</p>" + pollingPlaces_html ;
        }
      }
	  
     request.send(null);
	}
	
      // A function to hold the markers for the Polling Places
     function callMarker(point,name,html,icon,imgLink) {
        var Pmarker = new GMarker(point, icon);
        GEvent.addListener(Pmarker, "click", function() {
		var tb = '<table width="250" border="0"><tr><td width="25">' + imgLink + '</td><td><strong>' + name + '</strong></td></tr><tr><td>&nbsp;</td><td>' + html + '</td></tr></table>';
        Pmarker.openInfoWindowHtml(tb);
        });	
        return Pmarker;
      } 


      // This function picks up the click and opens the corresponding info window
      function markerClick(i) {
		var tbs = '<table width="250" border="0"><tr><td width="25">' + imgLinks[i] + '</td><td><strong>' + names[i] + '</strong></td></tr><tr><td>&nbsp;</td><td>' + htmls[i] + '</td></tr></table>';
		gmarkers[i].openInfoWindowHtml(tbs);
      }


      // ====== Plot a marker after positive reponse to "did you mean" ======
      function place(lat,lng,Asearch) {
        var point = new GLatLng(lat,lng);
		geoAddress(point,Asearch);
        document.getElementById("info").innerHTML = "";
      }

      // ====== Geocoding ======
      function showAddress(Asearch) {
        geo.getLocations(Asearch, function (result)
          {
            if (result.Status.code == G_GEO_SUCCESS) {
              // ===== If there was more than one result, "ask did you mean" on them all =====
              if (result.Placemark.length > 1) { 
				document.getElementById("info").innerHTML = "<p class=" + "heading4" + "><strong>Did you mean: </strong>" + "</p>";
                // Loop through the results
				var c=0;
				
                for (var i=0; i<result.Placemark.length; i++) {
                  var p = result.Placemark[i].Point.coordinates;
				  if (p[1]>=minLatLng.y && p[1]<=maxLatLng.y && p[0]>=minLatLng.x && p[0]<=maxLatLng.x) {
				  for (var k=0; k<Cpolygon; k++){	//test whether a point is inside multiple polygons
					  var oddNodes = pointInPolygon(k, p[1], p[0]);	//oddNodes=0/false - the point is outside the polygon; oddNodes=1/true - the point is inside the polygon
					  if (oddNodes == true) {
					  c++;
					  document.getElementById("info").innerHTML += c+": <a href='javascript:overlay(" +p[1]+","+p[0]+",&quot;"+result.Placemark[i].address+"&quot;"+")'>"+ result.Placemark[i].address+"</a>" + "<br>";
					  k = Cpolygon;
					  }
				  }
				  
				  }
                }				
				  if (c == 0) {
                  document.getElementById("info").innerHTML = " ";
				  alert('"' + Asearch + '"' + " is not found inside " + pageTitle + " area. \n\nFor further enquiry, please call the Voter's Helpline on 1 300 881 665.");
				  }
              }
              // ===== If there was a single marker =====
              else {
                document.getElementById("info").innerHTML = " ";
                var p = result.Placemark[0].Point.coordinates;
				
				
				  if (p[1]>=minLatLng.y && p[1]<=maxLatLng.y && p[0]>=minLatLng.x && p[0]<=maxLatLng.x) {
				  for (var k=0; k<Cpolygon; k++){	//test whether a point is inside multiple polygons
					  var oddNodes = pointInPolygon(k, p[1], p[0]);	//oddNodes=0/false - the point is outside the polygon; oddNodes=1/true - the point is inside the polygon
					  if (oddNodes == true) {
					  	overlay(p[1],p[0],Asearch);
						k=Cpolygon;
					  }
				  }				  
					  if (oddNodes == false) {
						  alert('"' + Asearch + '"' + " is not found inside " + pageTitle + " area! \n\nFor further enquiry, please call the Voter's Helpline on 1 300 881 665.");
					  }
				  }
				  else {
					  alert('"' + Asearch + '"' + " is not found inside the boundary. \n\nFor further enquiry, please call the Voter's Helpline on 1 300 881 665.");
				  }								
              }
            }
            // ====== Decode the error status ======
            else {
              var reason="Code "+result.Status.code;
              if (reasons[result.Status.code]) {
                reason = reasons[result.Status.code]
              } 
              alert('Could not find "'+Asearch+ '" ' + "\n\n" + reason);
            }
          }
        );
      }

	function overlay(lat,lng, Asearch){
			var c = 0;
			for (i = 0; i < count; i++) {
				if (lat>=minLat[i] && lat<=maxLat[i] && lng>=minLng[i] && lng<=maxLng[i]) {
					kmlLabel[c] = kmlName[i];
					pdfLabel[c] = docLabel[i];
					distLabel[c] = distName[i];
					semsLink[c] = semsDir[i];
					//sName[c] = semsName[i];
					kmlBooth[c] = att[i];
					ne[c] = new GLatLng(maxLat[i], maxLng[i]);
					sw[c] = new GLatLng(minLat[i], minLng[i]);
					c++;
				}
			}
			var s = c;
			if (c>1) {s=100;}

			switch(s){
				case 0:
				document.getElementById("info").innerHTML = "";
				alert ("Your address is not found! \n\nFor further enquiry, please call the Voter's Helpline on 1 300 881 665.");
				break;
				
				case 1:
					document.getElementById("info").innerHTML = '<img src="images/bar_.gif" alt="Loading ..." width="150" height="12" /> <br/>Loading boundary ... ';
					localPath_boundary = "kml/" + kmlLabel[0] + ".kml";
					kmlPath_bb = siteUrl + localPath_boundary;
					boundaryData(kmlPath_bb);
					var oddNodes;
					if (Lpoints[0]){
					document.getElementById("info").innerHTML = "";
					for (var k=0; k<Lpolygon; k++){	//test whether a point is inside multiple polygons
						oddNodes = pointInPolygon2(k, lat,lng);	//oddNodes=0 - the point is outside the polygon; oddNodes=1 - the point is inside the polygon
						if (oddNodes == true) {
							selectOverlay(lat, lng, 0, Asearch);
							k=Lpolygon;
						} //end if (oddNodes == true)

					}
						if (oddNodes == false) {
							alert("Your address does not belong to this council! \n\nFor further enquiry, please call the Voter's Helpline on 1 300 881 665.");
						}
					}
				break;
				
				case 100:
				for (i = 0; i < c; i++) {
					//boundary matching
					document.getElementById("info").innerHTML = '<img src="images/bar_.gif" alt="Loading ..." width="150" height="12" /> <br/>Loading boundary ... ';
					localPath_boundary = "kml/" + kmlLabel[i] + ".kml";
					kmlPath_bb = siteUrl + localPath_boundary;
					boundaryData(kmlPath_bb);
					var oddNodes;
					if(Lpoints[0]){
						document.getElementById("info").innerHTML = "";
					for (var k=0; k<Lpolygon; k++){	//test whether a point is inside multiple polygons
						oddNodes = pointInPolygon2(k, lat, lng);	//oddNodes=0 - the point is outside the polygon; oddNodes=1 - the point is inside the polygon
						if (oddNodes == true) {
							selectOverlay(lat, lng, i, Asearch);
							k=Lpolygon;
							i=c;
						} //end if (oddNodes == true)
					} //end for (var k=0; k<Cpolygon; k++)
					}
				} // end for (i = 0; i < c; i++)
				
				if (oddNodes == false) {alert("Your area search is incorrect. Please try again. \n\n If the problem persists, please call the Voter's Helpline on 1 300 881 665.");}
				break;
				
				default:
			}
			
	}

	// ====== Plot an overlay and a marker after positive reponse to "did you mean" ======
	function selectOverlay(lat, lng, i, Asearch) {
		map.clearOverlays();
		bounds = new GLatLngBounds(sw[i], ne[i]);
		centerPoint = bounds.getCenter();
		oZoom = map.getBoundsZoomLevel(bounds);
		map.setCenter(centerPoint, oZoom);
		//Lpp = 0;
		if (kmlBooth[i] == 1) {
			document.getElementById("info").innerHTML = '<img src="images/bar_.gif" alt="Loading ..." width="150" height="12" /> <br/>Loading polling place(s) ... ';
			localPath_pp = "kml/" + kmlLabel[i] + "_booth.kml";
			kmlPath_pp = siteUrl + localPath_pp;
			boothData(kmlPath_pp);
			//kml_pp = new GGeoXml(kmlPath_pp);
			//map.addOverlay(kml_pp);
			var point = new GLatLng(lat,lng);
			drawCircle(point,Asearch);
			document.getElementById("info").innerHTML = "";
			pathCalc(lat, lng);
		}
		kmlPath_bb = siteUrl + "kml/" + kmlLabel[i] + ".kml";
		kml = new GGeoXml(kmlPath_bb);
		map.addOverlay(kml);
		var point = new GLatLng(lat,lng);
			linkTitle = '<a href="' + semsUrl + semsLink[i] + '/index.html">' + distLabel[i] + '</a>';
			linkSmap = '<a href="' + siteUrl +'maps/' + pdfLabel[i] + '.pdf" target="_blank">PDF map</a><br />'; //link to PDF map
	  		siteLinks = linkInfo + linkMain + linkSmap + linkCouncil + linkGmap + linkSpace;
	  		document.getElementById("links").innerHTML = siteLinks + linkSpace;
			document.getElementById("districtName").innerHTML = '<div align="center" class="wizardheader-fontforecolor">' + linkTitle + '</div>';
			marker = new GMarker(point);
			map.addOverlay(marker);
			marker.openInfoWindowHtml("<strong>Your address is:</strong>"+"<br \>"+Asearch);
			GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml("<strong>Your address is:</strong>"+"<br \>"+Asearch);});
	}
	
	function pointInPolygon(k, lat,lng){ //Ncoords = number of points in a polygon = Ccoords[i]
		var oddNodes = false;
		var Nintersect = 0;
		var j = 0;
		for (var i=0; i<(Ccoords[k]-1); i++){
			j++;
			if (j == Ccoords[k]){j=0;}
			if (((Cpoints[k][i].y<lat && Cpoints[k][j].y>=lat) || (Cpoints[k][j].y<lat && Cpoints[k][i].y>=lat)) && (Cpoints[k][i].x+(lat-Cpoints[k][i].y)/(Cpoints[k][j].y-Cpoints[k][i].y)*(Cpoints[k][j].x-Cpoints[k][i].x))<lng) {
				oddNodes = !oddNodes;
				Nintersect++;
			}
		}
		return oddNodes;
	}

	function pointInPolygon2(k, lat,lng){ //Ncoords = number of points in a polygon = Lcoords[i]
		var oddNodes = false;
		var Nintersect = 0;
		var j = 0;
		for (var i=0; i<(Lcoords[k]-1); i++){
			j++;
			if (j == Lcoords[k]){j=0;}
			if (((Lpoints[k][i].y<lat && Lpoints[k][j].y>=lat) || (Lpoints[k][j].y<lat && Lpoints[k][i].y>=lat)) && (Lpoints[k][i].x+(lat-Lpoints[k][i].y)/(Lpoints[k][j].y-Lpoints[k][i].y)*(Lpoints[k][j].x-Lpoints[k][i].x))<lng) {
				oddNodes = !oddNodes;
				Nintersect++;
			}
		}
		return oddNodes;
	}
	
	function drawCircle(point,Asearch){
		pollingPlaces_html = "";
		var aZoom = map.getZoom();
		marker = new GMarker(point);
        map.setCenter(point,aZoom); 

			  var R = 6371;
			  var radius = 1;
			  var km = radius*(360)/(2*R*Math.PI);	//CenterPoint + 2 kilometers
			  var Lat1 = point.y;
			  var Lng1 = point.x;
			  var Lat2 = Lat1 + km;
			  var Lng2 = Lng1;
			  radiusMarker = new GLatLng(Lat2, Lng2);

		// ==== draw circle ====
			  var centerPt = normalProj.fromLatLngToPixel(point, aZoom);
			  var radiusPt = normalProj.fromLatLngToPixel(radiusMarker, aZoom);
			  var circlePoints = Array();
			  
			  with (Math) {
				var radius = floor(sqrt(pow((centerPt.x-radiusPt.x),2) + pow((centerPt.y-radiusPt.y),2)));
		
				for (var a = 0 ; a < 361 ; a+=2 ) {
					var aRad = a*(PI/180);
					y = centerPt.y + radius * sin(aRad)
					x = centerPt.x + radius * cos(aRad)
					var p = new GPoint(x,y);
					circlePoints.push(normalProj.fromPixelToLatLng(p, aZoom));
				}
		
		//		map.removeOverlay(circleLine);
				circleLine = new GPolygon(circlePoints,'#000000',2,0.5, '#000000', 0.2);
        		map.addOverlay(marker);
				map.addOverlay(circleLine);
			  	GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml("Your address is:"+"<br \>"+Asearch);
			  	});
				counter++;
			  }

	}

	function pathCalc(lat, lng){

		var minDist=[];
		var Dist=[];
		var index=[];
		var c = 0;
		document.getElementById("info").innerHTML = "<p class=" + "heading4" + "><strong>Your Nearest Polling Place(s): </strong>" + "</p>";
		for (var i=0; i<Lpp; i++) {
			minDist[i] = Math.sqrt((lat-points[i].y)*(lat-points[i].y) + (lng-points[i].x)*(lng-points[i].x));
			with (Math) {
				var GreatR = 6371;
				var ax, ay, az, bx, by, bz;
				var aRad = PI/180;
				ax = cos(aRad*lat);
				ay = 0;
				az = sin(aRad*lat);
				bx = cos(aRad*points[i].y)*cos(aRad*(lng-points[i].x));
				by = cos(aRad*points[i].y)*sin(aRad*(lng-points[i].x));
				bz = sin(aRad*points[i].y);
				var dotProd = ax*bx + ay*by + az*bz;
				Dist[i] = GreatR*sqrt(2 - 2*dotProd);
			}
		}
		for (var i=0; i<Lpp; i++) {
			if (Dist[i] <= 1) {
				document.getElementById("info").innerHTML  += imgLinks[i] + ' <a href="javascript:markerClick(' + i + ')">' + names[i] + '</a><br>';
			c++;
			}
		}
		if (c == 0) {
			document.getElementById("info").innerHTML = "<p class=" + "heading4" + "><strong>No polling place is found within 1km radius</strong>" + "</p>";
//			alert("No polling place is found within 1km radius. \n\nFor further enquiry, please call the Voter's Helpline on 1 300 881 665.");
			}
	}	
	
	function resetRoute() {
		map.clearOverlays();
		marker = null;
		radiusMarker = null;
		pollingPlaces_html = "";
		division_html = "";
		marker = null;
		radiusMarker = null;
		document.addressSearch.Asearch.value = "";
		document.getElementById("info").innerHTML = "";
		document.getElementById("pollingplaces").innerHTML = "";
		linkTitle = '<a href="' + semsUrl + pageTitle.replace(/ /g, "") + '/index.html">' + pageTitle + '</a>';
		document.getElementById("districtName").innerHTML = '<div align="center" class="wizardheader-fontforecolor">' + linkTitle + '</div>';
		linkSmap = '<a href="' + pdfUrl + '" target="_blank">PDF map</a><br />';
		load();
	}


}
    
    // display a warning if the browser was not compatible
    else {
      alert("Sorry, the Google Maps API is not compatible with this browser");
    }

    //]]>
