function googleMapsInitialise(gMap){

	/* get all the data from the map - we need to store these as follows:
	
		there should be one of the following for each of these:
		.gMap-lat
		.gMap-lng
		.gMap-zoom
		
		there can be multiple markers and popups:
		.gMap-marker
		.gMap-marker-popup
		
	*/	

	var gLatLng = new google.maps.LatLng(gMap.getElement('.gMap-lat').get('text'), gMap.getElement('.gMap-lng').get('text'));
	////console.log(gLatLng);
	var gOptions = {
	  zoom: parseInt(gMap.getElement('.gMap-zoom').get('text')),
	  center: gLatLng,
	  mapTypeId: google.maps.MapTypeId.TERRAIN
	};
	
	
	//grab all the marker data from the div before Google Maps destroys it		
	gMarkers = new Array();		
	gMap.getElements('.gMap-marker').each(function(gMarker){
		//console.log(gMarker);
		gMarkers.push(new Array(gMarker.getElement('.gMap-marker-popup').get('html'), gMarker.getElement('.gMap-marker-lat').get('text'), gMarker.getElement('.gMap-marker-lng').get('text')));		
	});
	//console.log(gMarkers);
	
	//set up map
	var map = new google.maps.Map(gMap,gOptions);
	var infowindow = new google.maps.InfoWindow();

	//loop through markers array and add to the map
	gMarkers.each(function(gMarker){
		
		var mLatLng = new google.maps.LatLng(gMarker[1], gMarker[2]);
		//console.log(mLatLng);	
		var marker = new google.maps.Marker({
		    position: mLatLng,
		    map: map
		});
		
		google.maps.event.addListener(marker, 'click', function() {
		  map.setZoom(4);
		  //map.setCenter(marker);
		  infowindow.setContent(gMarker[0]);
		  infowindow.open(map,marker);
		});

	});
	
	
	
};

window.addEvent('domready', function() {
	
 	$$('.gMap').each(function(gMap){
		googleMapsInitialise(gMap);
	});
	
});


