Index: main/trunk/greenstone3/web/interfaces/default/js/classifier_scripts.js
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/js/classifier_scripts.js	(revision 26395)
+++ main/trunk/greenstone3/web/interfaces/default/js/classifier_scripts.js	(revision 26396)
@@ -5,6 +5,6 @@
 function isExpanded(sectionID)
 {
-	var divElem = document.getElementById("div" + sectionID);
-	if(!divElem.style.display || divElem.style.display == "block")
+	var divElem = gs.jqGet("div" + sectionID);
+	if(!divElem.css("display") || divElem.css("display") != "none")
 	{
 		return true;
@@ -15,6 +15,6 @@
 function toggleSection(sectionID)
 {
-	var section = document.getElementById("div" + sectionID);
-	var sectionToggle = document.getElementById("toggle" + sectionID);
+	var section = gs.jqGet("div" + sectionID);
+	var sectionToggle = gs.jqGet("toggle" + sectionID);
 	
 	if(sectionToggle == undefined)
@@ -23,11 +23,12 @@
 	}
 	
-	if(section)
+	//If the div exists
+	if(section.length)
 	{
 		if(isExpanded(sectionID))
 		{
-			section.style.display = "none";
-			sectionToggle.setAttribute("src", gs.imageURLs.expand);
-			
+			section.css("display", "none");
+			sectionToggle.attr("src", gs.imageURLs.expand);
+
 			if(openClassifiers[sectionID] != undefined)
 			{
@@ -37,6 +38,6 @@
 		else
 		{
-			section.style.display = "block";
-			sectionToggle.setAttribute("src", gs.imageURLs.collapse);
+			section.css("display", "block");
+			sectionToggle.attr("src", gs.imageURLs.collapse);
 			openClassifiers[sectionID] = true;	
 		}
@@ -113,6 +114,6 @@
 		var httpRequest = new gs.functions.ajaxRequest();
 		
-		var sectionToggle = document.getElementById("toggle" + sectionID);
-		sectionToggle.setAttribute("src", gs.imageURLs.loading);
+		var sectionToggle = gs.jqGet("toggle" + sectionID);
+		sectionToggle.attr("src", gs.imageURLs.loading);
 		
 		var url = gs.xsltParams.library_name + "/collection/" + gs.cgiParams.c + "/browse/" + sectionID.replace(/\./g, "/") + "?excerptid=div" + sectionID;
@@ -127,46 +128,35 @@
 			url = url.substring(0, url.indexOf("#"));
 		}
-		httpRequest.open('GET', url, true);
-		httpRequest.onreadystatechange = function() 
+		
+		$.ajax(url)
+		.success(function(data)
 		{
-			if (httpRequest.readyState == 4) 
+			var newDiv = $("<div>");										
+			var sibling = gs.jqGet("title" + sectionID);
+			sibling.after(newDiv);
+			
+			newDiv.html(data);
+			sectionToggle.attr("src", gs.imageURLs.collapse);
+			openClassifiers[sectionID] = true;	
+			
+			if(gs.cgiParams.berryBasket == "on")
 			{
-				if (httpRequest.status == 200) 
-				{
-					var newDiv = document.createElement("div");										
-					var sibling = document.getElementById("title" + sectionID);
-					var parent = sibling.parentNode;
-					if(sibling.nextSibling)
-					{
-						parent.insertBefore(newDiv, sibling.nextSibling);
-					}
-					else
-					{
-						parent.appendChild(newDiv);
-					}
-					
-					newDiv.innerHTML = httpRequest.responseText;
-					sectionToggle.setAttribute("src", gs.imageURLs.collapse);
-					openClassifiers[sectionID] = true;	
-					
-					if(gs.cgiParams.berryBasket == "on")
-					{
-						checkout();
-					}
-					else if(gs.cgiParams.documentbasket == "on")
-					{
-						dmcheckout();
-					}
-					updateOpenClassifiers();
-				}
-				else
-				{
-					sectionToggle.setAttribute("src", gs.imageURLs.expand);
-				}
-				inProgress[sectionID] = false;
-				busy = false;
+				checkout();
 			}
-		}
-		httpRequest.send();
+			else if(gs.cgiParams.documentbasket == "on")
+			{
+				dmcheckout();
+			}
+			updateOpenClassifiers();
+		})
+		.error(function()
+		{
+			sectionToggle.attr("src", gs.imageURLs.expand);
+		})
+		.complete(function()
+		{
+			inProgress[sectionID] = false;
+			busy = false;
+		});
 	}
 }
Index: main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js	(revision 26395)
+++ main/trunk/greenstone3/web/interfaces/default/js/javascript-global-functions.js	(revision 26396)
@@ -1,3 +1,8 @@
 gs.functions = new Array();
+
+gs.jqGet = function(id)
+{
+	return $("#" + id.replace(/\./g, "\\."));
+}
 
 gs.functions.ajaxRequest = function()
