Index: main/trunk/greenstone3/web/interfaces/default/js/classifier_scripts.js
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/js/classifier_scripts.js	(revision 33144)
+++ main/trunk/greenstone3/web/interfaces/default/js/classifier_scripts.js	(revision 33145)
@@ -37,5 +37,8 @@
 	
 	//If the div exists
-	if(section.length)
+	// Test if 'section' exists.  
+	// ==> Because we're using jQuery to do this we need to test the length of the object returned
+	// http://stackoverflow.com/questions/920236/how-can-i-detect-if-a-selector-returns-null
+	if(section.length !== 0)
 	{
 		if(isExpanded(sectionID))
@@ -44,5 +47,5 @@
 			sectionToggle.attr("src", gs.imageURLs.expand);
 
-			if(openClassifiers[sectionID] != undefined)
+			if(openClassifiers[sectionID].length !== 0) //if(openClassifiers[sectionID] != undefined)
 			{
 				delete openClassifiers[sectionID];
Index: main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js	(revision 33144)
+++ main/trunk/greenstone3/web/interfaces/default/js/map-scripts.js	(revision 33145)
@@ -346,5 +346,5 @@
 				doc.marker.setVisible(true);
 			}
-			markersOnMap++; // TODO: what do we do with this when we have shapes. This variable may be connected with centring the map?
+			markersOnMap++;
 		}
 
@@ -364,5 +364,4 @@
 	if(markersOnMap > 1)
     {
-		//alert("@@@@ fitting bounds, current zoom is: " + _map.getZoom());			
 	_map.fitBounds(bounds);
     } else if (markersOnMap == 1) {
@@ -404,5 +403,5 @@
 	for(var i = 0; i < _docList.ids.length; i++)
 	{
-		var doc = _docList.getDocByIndex(i);
+	    var doc = _docList.getDocByIndex(i);
 		if(doc.marker.getVisible())
 		{
@@ -439,39 +438,4 @@
 }
 
-// Unused at present, called by draggableCreateMarker
-// Map used to have editable markers. Now editable markers are restricted to the map-editor.
-function attachDraggableClickHandler(marker, nodeID)
-{	
-	google.maps.event.addListener(marker, 'click', function()
-	{
-		document.location.href = gs.xsltParams.library_name + "?a=d&ed=1&c=" + gs.cgiParams.c + "&d=" + nodeID + "&dt=hierarchy&p.a=b&p.sa=&p.s=ClassifierBrowse";
-		
-	});
-	
-	if (("docEdit" in gs.cgiParams) && (gs.cgiParams['docEdit'])) {
-		google.maps.event.addListener(marker, 'mouseup', function()
-		{
-			var lat = marker.getPosition().lat();
-			var lng = marker.getPosition().lng();
-			var collection = gs.cgiParams.c;
-			var site_name = gs.xsltParams.site_name;
-			
-			if (nodeID == "") {
-				nodeID = gs.cgiParams.d;
-			}
-			console.log("GPS Click handler in collection:" + collection + " in site: " + site_name + " for Doc: " + nodeID + "(" + lat + "," + lng + ")");
-			
-			var callbackFunction = function(){console.log("Completed saving metadata changes. You must rebuild the collection for the changes to take effect.");};
-	
-			// set 5th parameter, metapos (metadata position) or 7th param prevMetaValue (previous metadata value) to non-null if you want metamode=override to work
-			// if neither of these 2 are set, then metamode is changed to 'accumulate' instead.
-			gs.functions.setArchivesMetadata(collection, site_name, nodeID, "Latitude", null, lat, null, "override", function(){callbackFunction();});
-			gs.functions.setArchivesMetadata(collection, site_name, nodeID, "Longitude", null, lng, null, "override", function(){callbackFunction();});
-			gs.functions.setArchivesMetadata(collection, site_name, nodeID, "Coordinate", null, lat + " " + lng, null, "override", function(){callbackFunction();});
-			console.log("NodeID: " + nodeID);
-			console.log("GPS Click handler in collection:" + collection + " in site: " + site_name + " for Doc: " + nodeID + "(" + lat + "," + lng + ")");
-		});
-	}
-}
 
 function focusDocument(id)
@@ -673,97 +637,4 @@
 		document.location.href = gs.xsltParams.library_name + "?a=d&ed=1&c=" + gs.cgiParams.c + "&d=" + nodeID + "&dt=hierarchy&p.a=b&p.sa=&p.s=ClassifierBrowse";
 	});
-}
-
-// TODO:
-// Version of createMarker function containing Zeddy's modifications (pre-mapeditor?) to make markers
-// on the public *map* (not on map-editor) draggable/editable and to save these edits/rebuild with them.
-// Do we want to continue supporting editing on the main map? I thought we weren't going to and that editing
-// was exclusive to the map-editor, with the public map only displaying the saved features?
-function draggableCreateMarker(doc, pos, mainMarker)
-{
-	var docEdit = (("docEdit" in gs.cgiParams) && (gs.cgiParams['docEdit']));
-	//var draggable_val = (docEdit) ? true : false;
-	
-	// When user logs out, the very first page they're returned to has logout set
-	// If the user logged out when leaving docEdit on, then the very first page has docEdit=1 AND logout.
-	// In that case, don't allow editing. Subsequent pages in logged out mode have neither logout nor docEdit=1 set.
-	var loggedOutVar = ("logout" in gs.cgiParams);
-	
-	// Don't allow dragging if either 1. docEdit not on OR 2. logout is in the cgiParams
-	var draggable_val = (!docEdit || loggedOutVar) ? false : true;
-	
-	var marker;
-	if(mainMarker)
-	{
-		marker = new google.maps.Marker
-		({
-			position: pos,
-			title:doc.title,
-			map:_map,
-			draggable: draggable_val
-		});
-	}
-	else
-	{
-		marker = new google.maps.Marker
-		({
-			position: pos,
-			title:doc.title,
-			map:_map,
-			icon:"interfaces/" + gs.xsltParams.interface_name + "/images/bluemarker.png",
-			draggable: draggable_val
-		});
-	}
-	
-	var docElement = gs.jqGet("div" + doc.nodeID);
-	var parent;
-	if(docElement)
-	{
-		parent = docElement.parentNode;
-	}
-
-	while(parent && parent.nodeName != "BODY")
-	{
-		if($(parent).attr("id") && $(parent).attr("id").search("divCL") != -1)
-		{
-			doc.parentCL = parent;
-			break;
-		}
-		
-		parent = parent.parentNode;
-	}
-
-	var info = new google.maps.InfoWindow({content:doc.title});
-	marker.markerInfo = info;
-	doc.marker = marker;
-	attachDraggableClickHandler(marker, doc.nodeID);
-
-	////////////////////////////////////////////////////// TEST
-	
-	newLat = marker.getPosition().lat();
-	newLng = marker.getPosition().lng();
-	//console.log("Latitude " + newLat);
-	//console.log("Longitude " + newLng);
-	//NewLatLng(newLat, newLng);
-	
-//	// Define the LatLng coordinates for the polygon's path.
-//        var triangleCoords = [
-//          {lat: 18.774, lng: -80.190},
-//          {lat: 18.466, lng: -64.600},
-//          {lat: 32.321, lng: -64.757},
-//          {lat: 32.300, lng: -80.190},
-//		  {lat: 28.300, lng: -90.190}
-//        ];
-//
-//        // Construct the polygon.
-//        var bermudaTriangle = new google.maps.Polygon({
-//          paths: triangleCoords,
-//          strokeColor: '#FF0000',
-//          strokeOpacity: 0.8,
-//          strokeWeight: 2,
-//          fillColor: '#FF0000',
-//          fillOpacity: 0.35
-//        });
-//        bermudaTriangle.setMap(map);
 }
 
@@ -1006,10 +877,10 @@
 }
 
+// This function "overrides" (or rather, redefines) 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.
 function modifyFunctions()
-{
-	// 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)
 	{
@@ -1024,4 +895,5 @@
 		}		
 		
+		//If the div exists
 		// Test if 'section' exists.  
 		// ==> Because we're using jQuery to do this we need to test the length of the object returned
@@ -1091,8 +963,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?
+				else if(gs.cgiParams.documentbasket == "on")
 				{
 					dmcheckout();
-				}*/
+				}
 				updateOpenClassifiers();
 				getSubClassifier(sectionID);
