function GetMap(postcode) {

    var geocoder = new google.maps.Geocoder();
    var address = postcode + ',UK';
    var map;

    // Our global state for LocalSearch
    var gInfoWindow;
    var gSelectedResults = [];
    var gCurrentResults = [];

    if (geocoder) {
        geocoder.geocode({ 'address': address }, function (results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                //alert(results[0].geometry.location.lat())
                //alert(results[0].geometry.location.lng())

                //Create the Map and center to geocode results latlong
                var latlng = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng());
                var myOptions = {
                    zoom: 17,
                    center: latlng,
                    mapTypeId: google.maps.MapTypeId.HYBRID
                };

                map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
                
            } 
            else {
                alert('No results found. Check console.log()');
            }
        });
    }
};



function GetMultiMap(markers) {
  var myOptions = {
    zoom: 6,
    center: new google.maps.LatLng(53.735716,-2.922363),
    mapTypeId: google.maps.MapTypeId.HYBRID
  }
  var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

  setMarkers(map, markers);
}




function GetLatLng(postcode) {

    var geocoder = new google.maps.Geocoder();
    var address = postcode + ',UK';
    var map;

    // Our global state for LocalSearch
    var gInfoWindow;
    var gSelectedResults = [];
    var gCurrentResults = [];

    if (geocoder) {
        geocoder.geocode({ 'address': address }, function (results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                //alert(results[0].geometry.location.lat())
                //alert(results[0].geometry.location.lng())

                //Create the Map and center to geocode results latlong
                var myLatLng = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng());
                return myLatLng;
            } 
            else {
                return "Error - GetLatLng";
            }
        });
    }
};




function setMarkers(map, markers) {
  // Add markers to the map

  // Marker sizes are expressed as a Size of X,Y
  // where the origin of the image (0,0) is located
  // in the top left of the image.

  // Origins, anchor positions and coordinates of the marker
  // increase in the X direction to the right and in
  // the Y direction down.
 /*  var image = new google.maps.MarkerImage('images/beachflag.png',
      // This marker is 20 pixels wide by 32 pixels tall.
      new google.maps.Size(20, 32),
      // The origin for this image is 0,0.
      new google.maps.Point(0,0),
      // The anchor for this image is the base of the flagpole at 0,32.
      new google.maps.Point(0, 32));
  var shadow = new google.maps.MarkerImage('images/beachflag_shadow.png',
      // The shadow image is larger in the horizontal dimension
      // while the position and offset are the same as for the main image.
      new google.maps.Size(37, 32),
      new google.maps.Point(0,0),
      new google.maps.Point(0, 32)); 
      // Shapes define the clickable region of the icon.
      // The type defines an HTML <area> element 'poly' which
      // traces out a polygon as a series of X,Y points. The final
      // coordinate closes the poly by connecting to the first
      // coordinate.
  var shape = {
      coord: [1, 1, 1, 20, 18, 20, 18 , 1],
      type: 'poly'
  };  
  for (var i = 0; i < markers.length; i++) {
    var point = markers[i];
   
    var marker = new google.maps.Marker({
        position: GetLatLng(point[1]),
        map: map,
        title: point[0]
    }); */

  for (var i = 0; i < markers.length; i++) {
    var point = markers[i];
   
		// Create a Clusterer object  
		var clusterer = new Clusterer(map);  
		// Create marker  
		var arrow = new GMarker(GetLatLng(point[1]));  
		// Add marker to the map  
		clusterer.AddMarker(arrow,'text to infobox');

    };
}


/*
// Create a new instance of the MarkerManager  
var mgr = new MarkerManager(map);  
// Create marker array  
var markers = [points];
// Loop to create markers and adding them to the MarkerManager  
  for (var i = 0; i < markers.length; i++) {
  
    var marker = new GMarker(new GLatLng(GetLatLng(point[1])));  

    markers.push(marker);
}  
// Add the array to the MarkerManager  
mgr.addMarkers(markers);  
// Refresh the MarkerManager to make the markers appear on the map  
mgr.refresh();     
    
/*	google.maps.event.addListener(marker, 'click', function() {
		alert("You clicked the map.");
		window.location = 'http://google.co.uk';
	}); 
	
  }
}*/
    
    







/**
 * Data for the markers consisting of a name, a LatLng and a zIndex for
 * the order in which these markers should display on top of each
 * other.
 */
// var locations = markers;    
    
    
    
    
    
    
    
    
