Index: main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js	(revision 33171)
+++ main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js	(revision 33172)
@@ -367,5 +367,5 @@
 		}
 		
-		if(doc.coords) {
+		/*if(doc.coords) {
 			//console.log("@@@@ HERE IN doc.coords");
 			for(var x = 0; x < doc.coords.length; x++) {
@@ -374,5 +374,5 @@
 				bounds.extend(new google.maps.LatLng(coordInfo.lat, coordInfo.lng));
 			}
-		}
+		}*/
 		
 		if(doc.mapoverlay) {
@@ -495,5 +495,5 @@
 
 function focusDocument(id)
-{
+{	
 	var doc = _docList[id];
 	if(doc)
@@ -501,5 +501,5 @@
 		clearInterval(_intervalHandle);
 		_intervalHandle = null;
-		if(doc.coords) {
+		 /*if(doc.coords) {
 			for(var x = 0; x < doc.coords.length; x++) {
 				var coord = doc.coords[x];
@@ -507,9 +507,27 @@
 				_map.panTo(new google.maps.LatLng(coordInfo.lat, coordInfo.lng));
 			}
+		}*/
+		if(doc.shapes) {			
+			var docShapesBounds = ShapesUtil.overlayBounds(doc.shapes);
+			_map.panToBounds(docShapesBounds); // https://developers.google.com/maps/documentation/javascript/reference/map#Map.panToBounds
 		} else {
 			_map.panTo(new google.maps.LatLng(doc.lat, doc.lng));
 		}
+		
 		clearAllInfoBoxes();
-		doc.marker.markerInfo.open(_map, doc.marker);
+		if(doc.shapes) { // TODO		
+			//console.log("Opening infowindow for doc " + doc.nodeID);
+			for(var x = 0; x < doc.shapes.length; x++) {
+				if(doc.shapes[x].markerInfo) {					
+					doc.shapes[x].markerInfo.open(_map); // label
+				}
+				else {
+					console.log("No infowindow for doc " + doc.nodeID + "'s shape " + doc.shapes[x].type);
+				}
+			}
+			//openInfoBoxes(doc);
+		} else { // only Lat and Lng meta, so we have just one marker per doc, which will have the doc title not label
+			doc.marker.markerInfo.open(_map, doc.marker); // doc title
+		}
 		var scrollCheckbox = $("#scrollCheckbox");
 		if(scrollCheckbox.checked)
@@ -525,5 +543,16 @@
 	{
 		var doc = _docList.getDocByIndex(i);
-		doc.marker.markerInfo.close();
+		
+		if(doc.shapes) {
+			for(var x = 0; x < doc.shapes.length; x++) {
+				if(doc.shapes[x].markerInfo) {
+					//console.log("Closing infowindow for doc " + _docList.ids[i]);
+					doc.shapes[x].markerInfo.close();					
+				}
+			}
+		}
+		else { // only Lat and Lng meta, so we have just one marker per doc
+			doc.marker.markerInfo.close();
+		}
 	}
 }
@@ -556,5 +585,7 @@
 	
 	if(shape.type === google.maps.drawing.OverlayType.MARKER) {
-		var marker = shape;		
+		var marker = shape;
+		console.log("Coord for marker is " + coord.toString());
+		
 		marker.addListener('mouseover', function() {
           infoWindow.open(_map, marker);
@@ -578,4 +609,5 @@
 	}
 	shape.markerInfo = infoWindow;
+	console.log("######## Added markerInfo object to shape");	
 }
 
@@ -623,8 +655,8 @@
 		shape.draggable = false;
 		
-		
+		console.log("#### calling addInfoMarker");
 		// doc[i]'s label = doc.shapes[i].description
 		addInfoMarker(doc, shape);
-	}	
+	}
 	
 	var docElement = gs.jqGet("div" + doc.nodeID);
Index: main/trunk/greenstone3/web/interfaces/default/transform/map-tools.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/transform/map-tools.xsl	(revision 33171)
+++ main/trunk/greenstone3/web/interfaces/default/transform/map-tools.xsl	(revision 33172)
@@ -18,5 +18,5 @@
   
   <xsl:template name="mapFeaturesJSONNodes">
-    <div id="jsonNodes" style="display:none;">
+    <div id="jsonNodes" style="display:none;" debug="true">
       <xsl:text>[</xsl:text>
       <xsl:for-each select="//documentNode">
@@ -37,4 +37,5 @@
 		  <xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
 	  </xsl:if>
+	  <!--
 	  <xsl:if test="metadataList/metadata[@name = 'Coordinate']">
 		<xsl:text disable-output-escaping="yes">,</xsl:text>
@@ -49,5 +50,5 @@
 		<xsl:text>]</xsl:text>
 	  </xsl:if>
-	  
+	  -->
 	  <xsl:if test="metadataList/metadata[@name = 'GPS.mapOverlay']">
 		<xsl:text disable-output-escaping="yes">,</xsl:text>
Index: main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl	(revision 33171)
+++ main/trunk/greenstone3/web/interfaces/default/transform/pages/document.xsl	(revision 33172)
@@ -854,4 +854,5 @@
 								<xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
 							</xsl:if>
+							<!--
 							<xsl:if test="metadataList/metadata[@name = 'Coordinate']">
 								<xsl:text disable-output-escaping="yes">,</xsl:text>
@@ -861,14 +862,10 @@
 									<xsl:text disable-output-escaping="yes">"</xsl:text>
 									<xsl:value-of disable-output-escaping="yes" select="current()"/>
-									<xsl:text disable-output-escaping="yes">"</xsl:text>
-									<!--<xsl:if test="not(position() = count(metadataList/metadata[@name = 'Coordinate'])">
-										<xsl:text>,</xsl:text>
-									</xsl:if>				
-									-->
+									<xsl:text disable-output-escaping="yes">"</xsl:text>							
 									<xsl:text disable-output-escaping="yes">,</xsl:text>
 								</xsl:for-each>
 								<xsl:text>]</xsl:text>
 							</xsl:if>						
-							
+							-->
 							<xsl:if test="metadataList/metadata[@name = 'GPS.mapOverlay']">
 								<xsl:text disable-output-escaping="yes">,</xsl:text>
@@ -899,4 +896,5 @@
 								<xsl:text disable-output-escaping="yes">"lng":</xsl:text><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name = 'Longitude']"/>
 							</xsl:if>
+							<!--
 							<xsl:if test="metadataList/metadata[@name = 'Coordinate']">
 								<xsl:text disable-output-escaping="yes">,</xsl:text>
@@ -911,5 +909,5 @@
 								<xsl:text>]</xsl:text>
 							</xsl:if>
-							
+							-->
 							<xsl:if test="metadataList/metadata[@name = 'GPS.mapOverlay']">
 								<xsl:text disable-output-escaping="yes">,</xsl:text>
