Index: main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js	(revision 33127)
+++ main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js	(revision 33128)
@@ -24,5 +24,5 @@
 	if(jsonNodeDiv.length)
 	{
-		console.log("@@@ JSON node div html: " + jsonNodeDiv.html());
+		//console.log("@@@ JSON node div html: " + jsonNodeDiv.html());
 		var jsonNodes = eval(jsonNodeDiv.html());
 		
@@ -32,7 +32,6 @@
 			{
 				_docList[jsonNodes[i].nodeID] = jsonNodes[i];
-				_docList.ids.push(jsonNodes[i].nodeID);
-				console.log("@@@ JSON node: " + jsonNodes[i]);
-				createMarker(jsonNodes[i], true);
+				_docList.ids.push(jsonNodes[i].nodeID);				
+				createMarkers(jsonNodes[i], true);
 			}
 			updateMap();
@@ -40,7 +39,7 @@
 		else
 		{
+			//hiding the map
 			//$("#map_canvas").css({visibility:"hidden", height:"0px"});
-			$("#map_canvas").css({visibility:"hidden"});
-			//console.log("suppressing hiding the map");
+			$("#map_canvas").css({visibility:"hidden"}); // if you comment this out, add a log message saying "suppressing hiding map"
 		}
 	}
@@ -97,5 +96,4 @@
 	
 	if ($map_canvas.length > 0) {
-		console.log("### map-scripts::setUpMap: map_canvas.exists");
 		_map = new google.maps.Map($map_canvas[0], myOptions);
 		google.maps.event.addListener(_map, 'bounds_changed', performSearchForMarkers);
@@ -254,5 +252,5 @@
 			var endIndex = responseText.indexOf("</");
 
-			console.log("@@@@ performSearch, got response: " + responseText);
+			//console.log("@@@@ performSearch, got response: " + responseText);
 
 			var jsonNodes = eval(responseText.substring(startIndex+1, endIndex));
@@ -271,5 +269,5 @@
 						_docList.ids.push(doc.nodeID);
 
-						createMarker(doc, false);
+						createMarkers(doc, false);
 					}
 				}
@@ -337,7 +335,11 @@
 		}
 
-		if(doc.coord) {
-			var coordInfo = getLatLngForCoord(doc.coord);
-			bounds.extend(new google.maps.LatLng(coordInfo.lat, coordInfo.lng));
+		
+		if(doc.coords) {
+			for(var x = 0; x < doc.coords.length; x++) {
+				var coord = doc.coords[x];
+				var coordInfo = getLatLngForCoord(doc.coords[x]);
+				bounds.extend(new google.maps.LatLng(coordInfo.lat, coordInfo.lng));
+			}
 		}
 		else {
@@ -463,7 +465,10 @@
 		clearInterval(_intervalHandle);
 		_intervalHandle = null;
-		if(doc.coord) {
-			var coordInfo = getLatLngForCoord(doc.coord);
-			_map.panTo(new google.maps.LatLng(coordInfo.lat, coordInfo.lng));
+		if(doc.coords) {
+			for(var x = 0; x < doc.coords.length; x++) {
+				var coord = doc.coords[x];
+				var coordInfo = getLatLngForCoord(doc.coords[x]);
+				_map.panTo(new google.maps.LatLng(coordInfo.lat, coordInfo.lng));
+			}
 		} else {
 			_map.panTo(new google.maps.LatLng(doc.lat, doc.lng));
@@ -488,15 +493,22 @@
 }
 
-function createMarker(doc, mainMarker)
-{
-	var pos;
-	if(doc.coord) {
-		var coordInfo = getLatLngForCoord(doc.coord);			
-		pos = new google.maps.LatLng(coordInfo.lat,coordInfo.lng);		
+function createMarkers(doc, mainMarker) {
+	if(doc.coords) {
+		for(var x = 0; x < doc.coords.length; x++) {
+			var coord = doc.coords[x];
+			var coordInfo = getLatLngForCoord(doc.coords[x]);
+			pos = new google.maps.LatLng(coordInfo.lat,coordInfo.lng);			
+			createMarker(doc, pos, mainMarker);
+		}
 	} else {
 		pos = new google.maps.LatLng(doc.lat,doc.lng);
-	}
-	
-	
+		createMarker(doc, pos, mainMarker);
+	}
+}
+
+
+// Param mainMarker: if set to true, marker is red. If false, marker is blue
+function createMarker(doc, pos, mainMarker)
+{
 	var docEdit = (("docEdit" in gs.cgiParams) && (gs.cgiParams['docEdit']));
 	//var draggable_val = (docEdit) ? true : false;
@@ -609,5 +621,5 @@
 				_docList.ids.push(doc.nodeID);
 
-				createMarker(doc, false);
+				createMarkers(doc, false);
 			}
 			
@@ -825,13 +837,19 @@
 function modifyFunctions()
 {
-	toggleSection = function(sectionID)
-	{
+	// This function "overrides" toggleSection in both classifier_scripts.js and document_scripts.js
+	// However, classifier_scripts.js::toggleSection() only took one parameter, sectionID, whereas
+	// document_scripts.js::toggleSection() took 3 params (sectionID, callback, tocDisabled).
+	// So to be compatible with both, need map-scripts::toggleSection() here to support all 3 in that order.
+	toggleSection = function(sectionID, callback, tocDisabled)
+	{
+		_basicToggleSection(sectionID, callback, tocDisabled);
+		
 		var section = gs.jqGet("div" + sectionID);
-		var sectionToggle = gs.jqGet("toggle" + sectionID);
-		
+		var sectionToggle = gs.jqGet("toggle" + sectionID);		
+				
 		if(sectionToggle == undefined)
-		{
+		{			
 			return;
-		}
+		}		
 		
 		// Test if 'section' exists.  
@@ -839,5 +857,5 @@
 		// http://stackoverflow.com/questions/920236/how-can-i-detect-if-a-selector-returns-null
 		if(section.length !== 0)
-		{			
+		{				
 			if(isExpanded(sectionID))
 			{
@@ -862,5 +880,6 @@
 		{
 			httpRequest(sectionID);
-		}
+		}		
+		
 	}
 	
@@ -901,4 +920,8 @@
 					checkout();
 				}
+				/*else if(gs.cgiParams.documentbasket == "on") // TODO: copied from classifier_scripts.js - should this else block be included here (and happen when mapEnabled) or not?
+				{
+					dmcheckout();
+				}*/
 				updateOpenClassifiers();
 				getSubClassifier(sectionID);
