Index: main/trunk/greenstone3/web/interfaces/default/transform/document.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/default/transform/document.xsl	(revision 23989)
+++ main/trunk/greenstone3/web/interfaces/default/transform/document.xsl	(revision 24009)
@@ -1,626 +1,649 @@
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <xsl:stylesheet version="1.0"
-  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-  xmlns:java="http://xml.apache.org/xslt/java"
-  xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
-  extension-element-prefixes="java"
-  exclude-result-prefixes="java gsf">
-
-  <!-- style includes global params interface_name, library_name -->
-  <xsl:include href="style.xsl"/>
-  <xsl:include href="service-params.xsl"/>
-  <xsl:include href="berrytools.xsl"/>
-
-  <xsl:output method="html"/>
-  
-  <!-- the main page layout template is here -->
-  <xsl:template match="page">
-    <xsl:variable name="bookswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:variable>
-    <xsl:variable name="a"><xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/></xsl:variable>
-
-    <xsl:choose> 
-      <xsl:when test="$bookswitch = 'flashxml' and $a = 'd'">
-	<html>
-	  <xsl:call-template name="response" />
-        </html>
-      </xsl:when>
-
-      <xsl:otherwise>    
-        <html>
-	  <head>
-	    <title>
-	      <!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
-	      <xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
-	    </title>
-	    <xsl:call-template name="globalStyle"/>
-	    <xsl:call-template name="pageStyle"/>
-	  </head>
-          <body>
-	    <xsl:attribute name="dir"><xsl:call-template name="direction"/></xsl:attribute>
-	    <div id="page-wrapper">
-	      <xsl:call-template name="response" />
-	      <xsl:call-template name="greenstoneFooter"/>
-	    </div>
-          </body>
-        </html>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-  
-  
-  <xsl:variable name="berrybasketswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/></xsl:variable> 
-  <xsl:variable name="bookswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:variable>
-  
-  <xsl:template name="pageTitle">
-    <xsl:variable name="docID" select="/page/pageResponse/document/@selectedNode"/>
-    <xsl:for-each select="/page/pageResponse/document/descendant::documentNode[@nodeID=$docID]/ancestor-or-self::documentNode"><xsl:if test='position()!=1'>::</xsl:if><xsl:value-of select="metadataList/metadata[@name='Title']"/></xsl:for-each>
-  </xsl:template>
-
-  <!-- this is hard coded for GATE, should somehow do it dynamically-->
-  <xsl:template name="pageStyle">
-    <style type="text/css">
-      <xsl:text disable-output-escaping="yes">
-	span.Location {  display:inline; color : red }
-	span.Person {  display:inline; color : green }
-	span.Organization {  display:inline; color : yellow }
-	span.Date {  display:inline; color : blue }
-	span.query_term {display: inline; background-color : yellow }
-      </xsl:text>
-    </style>
-
-    <!--TODO: add berry basket switch-->
-    <!--<xsl:if test="$berryBaskets = 'true'">-->
-    <xsl:if test="$berrybasketswitch = 'on'">
-      <xsl:call-template name="berryStyleSheet"/>  
-      <xsl:call-template name="js-library"/>
-    </xsl:if>
-  </xsl:template>
-  
-  <xsl:template match="pageResponse">
-    <xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
-    <xsl:choose>
-      <xsl:when test="$bookswitch = 'on' or $bookswitch = 'off'">
-        <xsl:call-template name="standardPageBanner">
-	  <xsl:with-param name="collName" select="$collName"/>
-        </xsl:call-template>
-        <xsl:call-template name="navigationBar">
-	  <xsl:with-param name="collName" select="$collName"/>
-        </xsl:call-template>
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:java="http://xml.apache.org/xslt/java"
+	xmlns:gsf="http://www.greenstone.org/greenstone3/schema/ConfigFormat"
+	extension-element-prefixes="java"
+	exclude-result-prefixes="java gsf">
 	
-        <!--<xsl:if test="$berryBaskets = 'true'">-->
-        <xsl:if test="$berrybasketswitch = 'on'">
-          <xsl:call-template name="documentBerryBasket">
-	    <xsl:with-param name="collName" select="$collName"/>
-	    <xsl:with-param name="selectedNode" select="/page/pageResponse/document/@selectedNode"/>
-	    <xsl:with-param name="rootNode" select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
-	    <xsl:with-param name="docType" select="/page/pageResponse/document/@docType"/>
-          </xsl:call-template>
-        </xsl:if>
-      </xsl:when>
-    </xsl:choose>	
-
-    <!-- display the document -->
-    <xsl:if test="$bookswitch != 'flashxml'">
-      <xsl:text disable-output-escaping="yes">&lt;div id="content"&gt;</xsl:text>
-    </xsl:if>
-    <xsl:apply-templates select="document">
-      <xsl:with-param name="collName" select="$collName"/>
-    </xsl:apply-templates>
-    <xsl:if test="$bookswitch != 'flashxml'">
-      <xsl:text disable-output-escaping="yes">&lt;/div&gt;</xsl:text>
-    </xsl:if>
-  </xsl:template>
-  
-  <xsl:template match="document">
-    <xsl:param name="collName"/>
-    <xsl:variable name="external"><xsl:value-of select="/page/pageResponse/document/@external"/></xsl:variable>
-    <xsl:choose>
-      <xsl:when test="$external != ''">
-	<xsl:call-template name="externalPage">
-	  <xsl:with-param name="external" select="$external"/>
-	</xsl:call-template>
-      </xsl:when>
-      <xsl:otherwise>
-	<xsl:choose>
-	<xsl:when test="$bookswitch = 'flashxml'">
-	  <xsl:call-template name="xmldocumentContentPeeling">
-	    <xsl:with-param name="collName" select="$collName"/>
-	  </xsl:call-template>
-	</xsl:when>
+	<!-- style includes global params interface_name, library_name -->
+	<xsl:include href="style.xsl"/>
+	<xsl:include href="service-params.xsl"/>
+	<xsl:include href="berrytools.xsl"/>
+
+	<xsl:output method="html"/>
+  
+	<!-- the main page layout template is here -->
+	<xsl:template match="page">
+		<xsl:variable name="bookswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:variable>
+		<xsl:variable name="a"><xsl:value-of select="/page/pageRequest/paramList/param[@name='a']/@value"/></xsl:variable>
+
+		<xsl:choose> 
+			<xsl:when test="$bookswitch = 'flashxml' and $a = 'd'">
+				<html>
+					<xsl:call-template name="response" />
+				</html>
+			</xsl:when>
+			<xsl:otherwise>    
+				<html>
+					<head>
+						<title>
+							<!-- put a space in the title in case the actual value is missing - mozilla will not display a page with no title-->
+							<xsl:call-template name="pageTitle"/><xsl:text> </xsl:text>
+						</title>
+						<xsl:call-template name="globalStyle"/>
+						<xsl:call-template name="pageStyle"/>
+					</head>
+					<body>
+						<xsl:attribute name="dir"><xsl:call-template name="direction"/></xsl:attribute>
+						<div id="page-wrapper">
+							<xsl:call-template name="response" />
+							<xsl:call-template name="greenstoneFooter"/>
+						</div>
+					</body>
+				</html>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+  
+  
+	<xsl:variable name="berrybasketswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='berrybasket']/@value"/></xsl:variable> 
+	<xsl:variable name="bookswitch"><xsl:value-of select="/page/pageRequest/paramList/param[@name='book']/@value"/></xsl:variable>
+  
+	<xsl:template name="pageTitle">
+		<xsl:variable name="docID" select="/page/pageResponse/document/@selectedNode"/>
+		<xsl:for-each select="/page/pageResponse/document/descendant::documentNode[@nodeID=$docID]/ancestor-or-self::documentNode"><xsl:if test='position()!=1'>::</xsl:if><xsl:value-of select="metadataList/metadata[@name='Title']"/></xsl:for-each>
+	</xsl:template>
+
+	<!-- this is hard coded for GATE, should somehow do it dynamically-->
+	<xsl:template name="pageStyle">
+		<style type="text/css">
+			<xsl:text disable-output-escaping="yes">
+				span.Location {  display:inline; color : red }
+				span.Person {  display:inline; color : green }
+				span.Organization {  display:inline; color : yellow }
+				span.Date {  display:inline; color : blue }
+				span.query_term {display: inline; background-color : yellow }
+			</xsl:text>
+		</style>
+
+		<xsl:if test="$berrybasketswitch = 'on'">
+			<xsl:call-template name="berryStyleSheet"/>  
+			<xsl:call-template name="js-library"/>
+		</xsl:if>
+	</xsl:template>
+  
+	<xsl:template match="pageResponse">
+		<xsl:variable name="collName"><xsl:value-of select="/page/pageRequest/paramList/param[@name='c']/@value"/></xsl:variable>
+		<xsl:choose>
+			<xsl:when test="$bookswitch = 'on' or $bookswitch = 'off'">
+				<xsl:call-template name="standardPageBanner">
+					<xsl:with-param name="collName" select="$collName"/>
+				</xsl:call-template>
+				<xsl:call-template name="navigationBar">
+					<xsl:with-param name="collName" select="$collName"/>
+				</xsl:call-template>
 	
-	<xsl:when test="$bookswitch = 'on'">
-	  <xsl:call-template name="documentHeading">
-	    <xsl:with-param name="collName" select="$collName"/>
-	  </xsl:call-template>
-	  <div id="bookdiv"></div>
-	  <script type="text/javascript">
-	    <xsl:text disable-output-escaping="yes">
-	      var doc_url = document.URL; 
-	      doc_url = doc_url.replace(/(&amp;amp;|\?)book=[a-z]+/gi,'');
-	      doc_url += '&amp;amp;book=flashxml';
-
-	      var flash_plug_html = ""
-	      flash_plug_html += '&amp;lt;OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
-	      flash_plug_html += '  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \n';
-	      flash_plug_html += '  height="100%" id="Book" swLiveConnect="true" \n';
-	      flash_plug_html += '  width="100%"&amp;gt;\n';
-	      flash_plug_html += '    &amp;lt;PARAM name="allowScriptAccess" value="always" /&amp;gt;\n';
-	      flash_plug_html += '    &amp;lt;PARAM name="movie" value="Book.swf';
-	      flash_plug_html += '?src_image=' + escape(img_cover);
-	      flash_plug_html += '&amp;amp;doc_url=' + escape(doc_url)
-	      flash_plug_html += '" /&amp;gt;\n';
-	      flash_plug_html += '    &amp;lt;PARAM name="quality" value="high" /&amp;gt;\n';
-	      flash_plug_html += '    &amp;lt;PARAM name="bgcolor" value="#FFFFFF" /&amp;gt;\n';
-	      flash_plug_html += '    &amp;lt;EMBED align="middle" \n';
-	      flash_plug_html += '      allowScriptAccess="always" swLiveConnect="true" \n';
-	      flash_plug_html += '      bgcolor="#FFFFFF" height="100%" name="Book" \n';
-	      flash_plug_html += '      pluginspage="http://www.macromedia.com/go/getflashplayer" \n';
-	      flash_plug_html += '      quality="high" \n';
-	      flash_plug_html += '      src="Book.swf';
-	      flash_plug_html += '?src_image=' + escape(img_cover);
-	      flash_plug_html += '&amp;amp;doc_url=' + escape(doc_url);
-	      flash_plug_html += '"\n'; 
-	      flash_plug_html += '      type="application/x-shockwave-flash" width="100%" /&amp;gt;\n';
-	      flash_plug_html += '&amp;lt;/OBJECT&amp;gt;\n';
-	      var flash_div = document.getElementById("bookdiv");
-	      flash_div.innerHTML = flash_plug_html;
-	    </xsl:text>
-	  </script>
-	</xsl:when> 
-	<xsl:otherwise>
-	  <xsl:call-template name="documentHeading">
-	    <xsl:with-param name="collName" select="$collName"/>
-	  </xsl:call-template>
-	  
-	  <xsl:call-template name="documentArrows">
-	    <xsl:with-param name="collName" select="$collName"/>
-	  </xsl:call-template>         
-	  <xsl:call-template name="documentContent">
-	    <xsl:with-param name="collName" select="$collName"/>
-	  </xsl:call-template>
-	  <xsl:call-template name="documentArrows">
-	    <xsl:with-param name="collName" select="$collName"/>
-	  </xsl:call-template>   
-	</xsl:otherwise>
-	</xsl:choose>
+				<xsl:if test="$berrybasketswitch = 'on'">
+					<xsl:call-template name="documentBerryBasket">
+						<xsl:with-param name="collName" select="$collName"/>
+						<xsl:with-param name="selectedNode" select="/page/pageResponse/document/@selectedNode"/>
+						<xsl:with-param name="rootNode" select="/page/pageResponse/document/documentNode[@nodeType='root']/@nodeID"/>
+						<xsl:with-param name="docType" select="/page/pageResponse/document/@docType"/>
+					</xsl:call-template>
+				</xsl:if>
+			</xsl:when>
+		</xsl:choose>	
+
+		<!-- display the document -->
+		<xsl:if test="$bookswitch != 'flashxml'">
+			<xsl:text disable-output-escaping="yes">&lt;div id="content"&gt;</xsl:text>
+		</xsl:if>
+		<xsl:apply-templates select="document">
+			<xsl:with-param name="collName" select="$collName"/>
+		</xsl:apply-templates>
+		<xsl:if test="$bookswitch != 'flashxml'">
+			<xsl:text disable-output-escaping="yes">&lt;/div&gt;</xsl:text>
+		</xsl:if>
+	</xsl:template>
+  
+	<xsl:template match="document">
+		<xsl:param name="collName"/>
+		<xsl:variable name="external"><xsl:value-of select="/page/pageResponse/document/@external"/></xsl:variable>
+		<xsl:choose>
+			<xsl:when test="$external != ''">
+				<xsl:call-template name="externalPage">
+					<xsl:with-param name="external" select="$external"/>
+				</xsl:call-template>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:choose>
+					<xsl:when test="$bookswitch = 'flashxml'">
+						<xsl:call-template name="xmldocumentContentPeeling">
+							<xsl:with-param name="collName" select="$collName"/>
+						</xsl:call-template>
+					</xsl:when>	
+					<xsl:when test="$bookswitch = 'on'">
+						<xsl:call-template name="documentHeading">
+							<xsl:with-param name="collName" select="$collName"/>
+						</xsl:call-template>
+						<div id="bookdiv"></div>
+						<script type="text/javascript">
+							<xsl:text disable-output-escaping="yes">
+								var doc_url = document.URL; 
+								doc_url = doc_url.replace(/(&amp;amp;|\?)book=[a-z]+/gi,'');
+								doc_url += '&amp;amp;book=flashxml';
+
+								var flash_plug_html = ""
+								flash_plug_html += '&amp;lt;OBJECT align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" \n';
+								flash_plug_html += '  codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" \n';
+								flash_plug_html += '  height="100%" id="Book" swLiveConnect="true" \n';
+								flash_plug_html += '  width="100%"&amp;gt;\n';
+								flash_plug_html += '    &amp;lt;PARAM name="allowScriptAccess" value="always" /&amp;gt;\n';
+								flash_plug_html += '    &amp;lt;PARAM name="movie" value="Book.swf';
+								flash_plug_html += '?src_image=' + escape(img_cover);
+								flash_plug_html += '&amp;amp;doc_url=' + escape(doc_url)
+								flash_plug_html += '" /&amp;gt;\n';
+								flash_plug_html += '    &amp;lt;PARAM name="quality" value="high" /&amp;gt;\n';
+								flash_plug_html += '    &amp;lt;PARAM name="bgcolor" value="#FFFFFF" /&amp;gt;\n';
+								flash_plug_html += '    &amp;lt;EMBED align="middle" \n';
+								flash_plug_html += '      allowScriptAccess="always" swLiveConnect="true" \n';
+								flash_plug_html += '      bgcolor="#FFFFFF" height="100%" name="Book" \n';
+								flash_plug_html += '      pluginspage="http://www.macromedia.com/go/getflashplayer" \n';
+								flash_plug_html += '      quality="high" \n';
+								flash_plug_html += '      src="Book.swf';
+								flash_plug_html += '?src_image=' + escape(img_cover);
+								flash_plug_html += '&amp;amp;doc_url=' + escape(doc_url);
+								flash_plug_html += '"\n'; 
+								flash_plug_html += '      type="application/x-shockwave-flash" width="100%" /&amp;gt;\n';
+								flash_plug_html += '&amp;lt;/OBJECT&amp;gt;\n';
+								var flash_div = document.getElementById("bookdiv");
+								flash_div.innerHTML = flash_plug_html;
+							</xsl:text>
+						</script>
+					</xsl:when> 
+					<xsl:otherwise>
+						<xsl:call-template name="documentHeading">
+							<xsl:with-param name="collName" select="$collName"/>
+						</xsl:call-template>
+						NOT CLIENT!!!
+						<xsl:call-template name="documentArrows">
+							<xsl:with-param name="collName" select="$collName"/>
+						</xsl:call-template>         
+						<xsl:call-template name="documentContent">
+							<xsl:with-param name="collName" select="$collName"/>
+						</xsl:call-template>
+						<xsl:call-template name="documentArrows">
+							<xsl:with-param name="collName" select="$collName"/>
+						</xsl:call-template>   
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+
+	<xsl:template name="documentHeading">
+		<xsl:param name="collName"/>
+		<xsl:variable name="doCoverImage" select="/page/pageResponse/format/gsf:option[@name='coverImages']/@value"/>
+		<xsl:variable name="doTOC" select="/page/pageResponse/format/gsf:option[@name='documentTOC']/@value"/>
+		<xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
+		<xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
+		<xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
+		<xsl:variable name="p.c"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='p.c']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="$collName"/></xsl:otherwise></xsl:choose></xsl:variable>
+		<div id="documentheading">
+			<a href="{$library_name}?a={$p.a}&amp;amp;sa={$p.sa}&amp;amp;s={$p.s}&amp;amp;c={$p.c}&amp;amp;rt=rd">
+				<xsl:call-template name="openbookimg">
+					<xsl:with-param name="title"><xsl:value-of select="'close_book'"/></xsl:with-param>
+				</xsl:call-template>
+			</a>
+			<xsl:choose>
+				<xsl:when test="@docType='simple'">
+					<xsl:value-of select="metadataList/metadata[@name='Title']" disable-output-escaping="yes"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<xsl:value-of select="documentNode/metadataList/metadata[@name='Title']" disable-output-escaping="yes"/>
+				</xsl:otherwise>
+			</xsl:choose>
+		</div>
+    
+		<div id="docheadwrapper">
+			<div id="documentinfo">
 	
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template name="documentHeading">
-    <xsl:param name="collName"/>
-    <xsl:variable name="doCoverImage" select="/page/pageResponse/format/gsf:option[@name='coverImages']/@value"/>
-    <xsl:variable name="doTOC" select="/page/pageResponse/format/gsf:option[@name='documentTOC']/@value"/>
-    <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
-    <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
-    <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
-    <xsl:variable name="p.c"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='p.c']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="$collName"/></xsl:otherwise></xsl:choose></xsl:variable>
-    <div id="documentheading">
-      <a href="{$library_name}?a={$p.a}&amp;amp;sa={$p.sa}&amp;amp;s={$p.s}&amp;amp;c={$p.c}&amp;amp;rt=rd"><xsl:call-template name="openbookimg"><xsl:with-param name="title"><xsl:value-of select="'close_book'"/></xsl:with-param>
-	</xsl:call-template></a>
-      <xsl:choose><xsl:when test="@docType='simple'"><xsl:value-of select="metadataList/metadata[@name='Title']" disable-output-escaping="yes"/></xsl:when><xsl:otherwise><xsl:value-of select="documentNode/metadataList/metadata[@name='Title']" disable-output-escaping="yes"/></xsl:otherwise></xsl:choose>
-    </div>
-    
-    <div id="docheadwrapper">
-      <div id="documentinfo">
-	
-	<xsl:choose>
-	  <xsl:when test="$bookswitch = 'on'">
-	    <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
-	      <div id="headingimage">
-		<xsl:call-template name="coverImage"/> 
-	      </div>
-	    </xsl:if>
-	  </xsl:when>
-	  <xsl:otherwise>
-	    <xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
-	      <div id="headingimage">
-		<xsl:call-template name="coverImage"/> 
-	      </div>
-	    </xsl:if>
+				<xsl:choose>
+					<xsl:when test="$bookswitch = 'on'">
+						<xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
+							<div id="headingimage">
+								<xsl:call-template name="coverImage"/> 
+							</div>
+						</xsl:if>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:if test="string($doCoverImage) != 'false' and (@docType='paged' or @docType='hierarchy')">
+							<div id="headingimage">
+								<xsl:call-template name="coverImage"/> 
+							</div>
+						</xsl:if>
 	    
-	    <ul id="docbuttons" >
-	      <xsl:call-template name="documentButtons">
-		<xsl:with-param name="collName" select="$collName"/>
-	      </xsl:call-template>
-	    </ul>
-	  </xsl:otherwise>
-	</xsl:choose>     
-      </div>
-      <!--<div><xsl:call-template name="enrichServices">
-      <xsl:with-param name="collName" select="$collName"/>
-    </xsl:call-template></div>-->
-      <xsl:if test="$bookswitch = 'off'">
-	<xsl:if test="string($doTOC) != 'false'">
-	  <div id="toc">
-	    <xsl:call-template name="TOC">
-	      <xsl:with-param name="collName" select="$collName"/>
-	    </xsl:call-template>
-	  </div>
-	</xsl:if>
-      </xsl:if>  
-    </div>
-  </xsl:template>
-
-  <xsl:template name="coverImage">
-    <xsl:choose>
-      <xsl:when test="$bookswitch = 'on'">
-	<script type="text/javascript">
-	  <xsl:text disable-output-escaping="yes">var img_cover = '</xsl:text><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg<xsl:text disable-output-escaping="yes">';</xsl:text>
-	</script>
-      </xsl:when>
-      <xsl:otherwise>
-	<img><xsl:attribute name="src"><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-
-  <xsl:template name="documentButtons">
-    <xsl:param name="collName"/>
-    <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
-    <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
-    <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
-    <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
+						<ul id="docbuttons" >
+							<xsl:call-template name="documentButtons">
+								<xsl:with-param name="collName" select="$collName"/>
+							</xsl:call-template>
+						</ul>
+					</xsl:otherwise>
+				</xsl:choose>     
+			</div>
+			<!--<div><xsl:call-template name="enrichServices">
+				<xsl:with-param name="collName" select="$collName"/>
+				</xsl:call-template></div>-->
+			<xsl:if test="$bookswitch = 'off'">
+				<xsl:if test="string($doTOC) != 'false'">
+					<div id="toc">
+						<xsl:call-template name="TOC">
+							<xsl:with-param name="collName" select="$collName"/>
+						</xsl:call-template>
+					</div>
+				</xsl:if>
+			</xsl:if>  
+		</div>
+	</xsl:template>
+
+	<xsl:template name="coverImage">
+		<xsl:choose>
+			<xsl:when test="$bookswitch = 'on'">
+				<script type="text/javascript">
+					<xsl:text disable-output-escaping="yes">var img_cover = '</xsl:text><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg<xsl:text disable-output-escaping="yes">';</xsl:text>
+				</script>
+			</xsl:when>
+			<xsl:otherwise>
+				<img><xsl:attribute name="src"><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='archivedir']"/>/cover.jpg</xsl:attribute></img>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+
+	<xsl:template name="documentButtons">
+		<xsl:param name="collName"/>
+		<xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
+		<xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
+		<xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
+		<xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
     
     
-    <!-- expand document -->
-    <xsl:if test="@docType = 'hierarchy' or @docType = 'paged'">
-      <li>
-        <xsl:choose><xsl:when test="string($ed)='1'">
-	    <a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ed=0" class="getTextFor doc.contract_doc_b this.title.doc.contract_doc_tip"></a>
-	  </xsl:when>
-	  <xsl:otherwise>
-	    <a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ed=1" class="getTextFor doc.expand_doc_b this.title.doc.expand_doc_tip"></a>
-	  </xsl:otherwise>
-	</xsl:choose>
-      </li>
-    </xsl:if> 
+		<!-- expand document -->
+		<xsl:if test="@docType = 'hierarchy' or @docType = 'paged'">
+			<li>
+				<xsl:choose>
+					<xsl:when test="string($ed)='1'">
+						<a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ed=0" class="getTextFor doc.contract_doc_b this.title.doc.contract_doc_tip"></a>
+					</xsl:when>
+					<xsl:otherwise>
+						<a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ed=1" class="getTextFor doc.expand_doc_b this.title.doc.expand_doc_tip"></a>
+					</xsl:otherwise>
+				</xsl:choose>
+			</li>
+		</xsl:if> 
     
-    <!-- expand contents -->
-    <xsl:if test="@docType = 'hierarchy' and string(/page/pageResponse/format/gsf:option[@name='documentTOC']/@value) != 'false'">
-      <li>
-	<xsl:choose><xsl:when test="string($ec)='1'">
-	    <a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ec=0" class="getTextFor doc.contract_contents_b this.title.doc.contract_contents_tip"></a>
-	  </xsl:when>
-	  <xsl:otherwise>
-	    <a  href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ec=1" class="getTextFor doc.expand_contents_b this.title.doc.expand_contents_tip"></a>
-	  </xsl:otherwise>
-	</xsl:choose>
-      </li>
-    </xsl:if>
-
-    <!-- detach page -->
-    <xsl:variable name="paramList" select="/page/pageRequest/paramList"/>
-    <li>
-      <a target="_blank" class="getTextFor doc.detach_page_b this.title.doc.detach_page_tip"><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;amp;d=<xsl:value-of select="$docID"/>&amp;amp;c=<xsl:value-of select="$collName"/>&amp;amp;sib=<xsl:value-of select="$sib"/>&amp;amp;dt=<xsl:value-of select="$paramList/param[@name='dt']/@value"/>&amp;amp;ec=<xsl:value-of select="$paramList/param[@name='ec']/@value"/>&amp;amp;et=<xsl:value-of select="$paramList/param[@name='et']/@value"/>&amp;amp;p.a=<xsl:value-of select="$paramList/param[@name='p.a']/@value"/>&amp;amp;p.s=<xsl:value-of select="$paramList/param[@name='p.s']/@value"/>&amp;amp;p.sa=<xsl:value-of select="$paramList/param[@name='p.sa']/@value"/></xsl:attribute></a></li>
-  </xsl:template>
-
-  <xsl:template name="TOC">
-    <xsl:param name="collName"/>
-    <xsl:choose>
-      <xsl:when test="@docType='hierarchy'">
-	<xsl:call-template name="hierarchicalContents">
-	  <xsl:with-param name="collName" select="$collName"/>
-	</xsl:call-template>
-      </xsl:when>
-      <xsl:when test="@docType='paged'">
-	<xsl:call-template name="pagedContents">
-	  <xsl:with-param name="collName" select="$collName"/>
-	</xsl:call-template>
-      </xsl:when>
-    </xsl:choose>
-  </xsl:template>
-  
-  <xsl:template name="hierarchicalContents">
-    <xsl:param name="collName"/>
-    <xsl:variable name="oc" select="/page/pageRequest/paramList/param[@name='oc']/@value"/>
-    <xsl:variable name="d" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
-    <xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
-    <xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
-    <xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
-    <xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
-    <xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
-    <xsl:variable name="p.c"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='p.c']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="$collName"/></xsl:otherwise></xsl:choose></xsl:variable>
-    <script type="text/javascript">
-      <xsl:text>
-        // Load up the initial document using AJAX!
-        var initialHash = '</xsl:text>
-      <xsl:value-of select="$d" /><xsl:text>';
-      </xsl:text>
-    </script>
-    <xsl:if test="documentNode[@nodeID]">      
-      <ul id="tocnodes">
-	<li id="tocstart">
-	  <xsl:choose><xsl:when test="string($oc)='0'">
-	      <a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={$d}&amp;amp;sib={$sib}&amp;amp;oc=1&amp;amp;p.s={$p.s}&amp;amp;p.sa={$p.sa}&amp;amp;p.a={$p.a}&amp;amp;p.c={$p.c}"><xsl:call-template name="closedfolderimg"><xsl:with-param name="title"><xsl:value-of select="'doc.open_toc'"/></xsl:with-param></xsl:call-template></a>
-	    </xsl:when>
-	    <xsl:otherwise><a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={$d}&amp;amp;sib={$sib}&amp;amp;oc=0&amp;amp;p.s={$p.s}&amp;amp;p.sa={$p.sa}&amp;amp;p.a={$p.a}&amp;amp;p.c={$p.c}"><xsl:call-template name="openfolderimg"><xsl:with-param name="title"><xsl:value-of select="'doc.close_toc'"/></xsl:with-param></xsl:call-template></a></xsl:otherwise></xsl:choose><span class="getTextFor doc.table_of_contents">&amp;amp;nbsp;</span>
-	  <xsl:if test="string($oc)!='0'">
-	    <ul class="tocnode">
-	      <xsl:for-each select="documentNode/documentNode[@nodeID]">
-		<xsl:apply-templates select='.'><xsl:with-param name="collName" select="$collName"/><xsl:with-param name="ec" select="$ec"/><xsl:with-param name="p.a" select="$p.a"/><xsl:with-param name="p.s" select="$p.s"/><xsl:with-param name="p.sa" select="$p.sa"/><xsl:with-param name="p.c" select="$p.c"/></xsl:apply-templates>
-	      </xsl:for-each>
-            </ul>
-	  </xsl:if>
-        </li> 
-      </ul>
-    </xsl:if>
-  </xsl:template>
-  
-  <!-- each icon-title pair is a row in a table. children go in a table in another row -->
-  <xsl:template match="documentNode">
-    <xsl:param name="collName"/>
-    <xsl:param name="ec"/>
-    <xsl:param name="p.a"/>
-    <xsl:param name="p.s"/>
-    <xsl:param name="p.sa"/>
-    <xsl:param name="p.c"/>
-    <!-- Display the appropriate image, depending on the node type -->
-    <li>
-      <a><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;amp;c=<xsl:value-of select="$collName"/>&amp;amp;d=<xsl:value-of select="@nodeID"/><xsl:if test="documentNode">.pr</xsl:if>&amp;amp;sib=1<xsl:if test="string($ec) = '1'">&amp;amp;ec=1</xsl:if>&amp;amp;p.a=<xsl:value-of select="$p.a"/>&amp;amp;p.sa=<xsl:value-of select="$p.sa"/>&amp;amp;p.s=<xsl:value-of select="$p.s"/>&amp;amp;p.c=<xsl:value-of select="$p.c"/></xsl:attribute>
-	<xsl:apply-templates select="." mode="displayNodeIcon"/>
-      </a>
-      
-      <!-- Display associated title, bolded if the node has content -->
-      <xsl:choose>
-	<xsl:when test="nodeContent">
-	  <span class="bold"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
-	</xsl:when>
-	<xsl:otherwise>
-	  <span><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
-	</xsl:otherwise>
-      </xsl:choose>
-      <!-- Apply recursively to the children of this node -->
-      <xsl:if test="documentNode[@nodeID]">
-	<ul class="tocnode"> <xsl:apply-templates select="documentNode[@nodeID]">
-	    <xsl:with-param name="collName" select="$collName"/>
-	    <xsl:with-param name="ec" select="$ec"/>
-	    <xsl:with-param name="p.a" select="$p.a"/><xsl:with-param name="p.s" select="$p.s"/><xsl:with-param name="p.sa" select="$p.sa"/><xsl:with-param name="p.c" select="$p.c"/>
-	    <!--<xsl:with-param name="depth" select="$depth + 1"/>-->
-	  </xsl:apply-templates>
-	</ul>
-      </xsl:if>
-    </li>
-  </xsl:template>
-  
-  <!-- default content is to print the title and content of any documentNodes that have nodeContent -->
-  <xsl:template name="documentContent">
-    <div class="documenttext"> 
-      <xsl:choose>
-	<xsl:when test="@docType='simple'"><xsl:apply-templates select="nodeContent"/></xsl:when>
-	<xsl:otherwise>
-	  <!--<xsl:apply-templates select="descendant-or-self::node()/documentNode" mode="content"/>-->
-	</xsl:otherwise>
-      </xsl:choose>
-    </div>
-  </xsl:template>
-  
-  <xsl:template match="documentNode" mode="content">
-    <xsl:if test="nodeContent">
-      <xsl:if test="metadataList/metadata[@name='Title']">
-	<h3><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></h3>
-      </xsl:if>
-      <xsl:apply-templates select="nodeContent"/>
-    </xsl:if>
-  </xsl:template>
-
-  <!-- the actual text/content -->
-  <xsl:template match="nodeContent">
-    <xsl:for-each select="node()">
-      <xsl:choose>
-	<xsl:when test="not(name())">
-	  <xsl:value-of select="." disable-output-escaping="yes" />
-	</xsl:when>
-	<xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
-      </xsl:choose>
-    </xsl:for-each>
-  </xsl:template>
-  
-  <xsl:template name="xmldocumentContentPeeling">
-    <xsl:choose>
-      <xsl:when test="@docType='simple'">
-	<xsl:apply-templates select="nodeContent"/>
-      </xsl:when>
-      <xsl:otherwise>
-	<xsl:call-template name="xmlpeelingContents" />
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-  
-  <xsl:template name="xmlpeelingContents">
-    <xsl:if test="documentNode">
-      <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
-    </xsl:if>
-  </xsl:template>
-
-  <xsl:template match="documentNode" mode="xmlpeeling">
-    <!-- get title -->
-    <xsl:choose>
-      <xsl:when test="nodeContent">
-	<xsl:text disable-output-escaping="yes">
-	  &amp;lt;Section&amp;gt;
-	  &amp;lt;Description&amp;gt;
-	  &amp;lt;Metadata name="Title"&amp;gt;
-	</xsl:text>
-	<xsl:value-of select="normalize-space(metadataList/metadata[@name='Title'])"/>
-	<xsl:text disable-output-escaping="yes">
-	  &amp;lt;/Metadata&amp;gt;
-	  &amp;lt;/Description&amp;gt;
-	</xsl:text>
-	<xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
-	<xsl:text disable-output-escaping="yes">&amp;lt;/Sec&amp;gt;</xsl:text>
-      </xsl:when>
-    </xsl:choose>
-
-    <!-- recurse to the children -->
-    <xsl:if test="documentNode">
-      <xsl:apply-templates select="documentNode" mode="xmlpeeling" />
-    </xsl:if>
-
-    <!-- end the section -->
-    <xsl:text disable-output-escaping="yes">
-      &amp;lt;/Section&amp;gt;
-    </xsl:text>
-  </xsl:template>
-  
-  <!-- match any file nodes -->
-  <xsl:template match="file">
-    <xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
-    <xsl:choose>
-      <xsl:when test="starts-with(@mimeType, 'image/')">
-	<img src="{$httpPath}/{@href}"/>
-      </xsl:when>
-      <xsl:otherwise>
-	<a href="{$httpPath}/{@href}"><xsl:value-of select="@href"/></a>
-      </xsl:otherwise>
-    </xsl:choose>
-  </xsl:template>
-  
-  <!-- match any link nodes -->
-  <xsl:template match="link">
-    <xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/> 
-    <xsl:variable name="actionargs">
-      <xsl:choose>
-	<xsl:when test="@type='document'">a=d</xsl:when>
-	<xsl:when test="@type='query'">a=q&amp;amp;s=<xsl:value-of select="@service"/>&amp;amp;rt=rd</xsl:when>
-	<xsl:otherwise>
-	p
-	</xsl:otherwise>
-      </xsl:choose>
-    </xsl:variable>
-    <xsl:variable name="serviceargs">
-      <xsl:for-each select="param">&amp;amp;s1.<xsl:value-of select="@name"/>=<xsl:value-of select="@value"/></xsl:for-each>
-    </xsl:variable>
-    <a href="{$library_name}?{$actionargs}&amp;amp;c={$collName}{$serviceargs}"><xsl:value-of disable-output-escaping="yes" select="."/></a>
-  </xsl:template>
-
-  <!-- match any annotations and make them span elements -->
-  <xsl:template match="annotation">
-    <span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span>
-  </xsl:template>
-  
-  <!-- paged naviagtion : INCOMPLETE!!-->
-  <xsl:template name="pagedContents">
-    <xsl:param name="collName"/>
-    <xsl:variable name="pos" select="nodeStructureInfo/info[@name='siblingPosition']/@value"/>
-    <xsl:variable name="length" select="nodeStructureInfo/info[@name='numSiblings']/@value"/>
-    <xsl:variable name="children" select="nodeStructureInfo/info[@name='numChildren']/@value"/>
-    <table>
-      <xsl:choose>
-	<xsl:when test="$pos=-1"><!-- a doc -->
-	  <tr valign="top">
-	    <td align="left">
-	    </td>
-	    <td align="center"><center>
-		<b class="getTextFor doc.pages"></b>
-	      </center></td>
-	    <td align="right">
-	      <a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.fc"><img src="interfaces/default/images/more.gif" border="0" align="absbottom" /></a>
-	    </td>
-	  </tr>
-	</xsl:when>
-	
-	<xsl:otherwise> <!-- an internal node -->	  
-	  <tr valign="top">
-	    <td align="left">
-	      <xsl:if test=" not ( $pos = 1 )">
-		<a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.ps"><img src="interfaces/default/images/less.gif" border="0" align="absbottom" /></a>
-	      </xsl:if>
-	    </td>
-	    <td align="center"><center>
-		<b><xsl:attribute name="class"><xsl:value-of select="concat('getTextFor null this.innerText.doc.pageof|', $pos, ';', $length)"/></xsl:attribute></b>
-	      </center></td>
-	    <td align="right">
-	      <xsl:if test=" not($pos = $length)">
-		<a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.ns"><img src="interfaces/default/images/more.gif" border="0" align="absbottom" /></a>
-	      </xsl:if>
-	    </td>
-	  </tr>
-	</xsl:otherwise>
-      </xsl:choose>
-      <tr valign="middle">
-	<td align='center' valign='top' colspan='3'>
-	  <form name="GotoForm" method="get" action="{$library_name}">
-	    <input type='hidden' name='a' value='d'/>
-	    <input type='hidden' name='c' value='{$collName}'/>
-	    <input type='hidden' name='d' value='{@selectedNode}'/>
-	    <input type="text" name="gp" size="3" maxlength="4"/>
-	    <input type="submit" class="getTextFor null this.value.doc.gotopage"></input>
-	  </form>
-	</td>
-      </tr>
-    </table>
-  </xsl:template>
-  
-  <xsl:template name="enrichServices">
-    <xsl:param name="collName"/>
-    <xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
-    <xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
-    <xsl:for-each select="../serviceList/service">
-      <table border='1' cellspacing='0'>
-	<tr><td>
-	    <p /><xsl:value-of select="displayItem[@name='name']"/><p/>
-	    <form name="EnrichForm" method="get" action="{$library_name}">
-	      <xsl:apply-templates select="paramList"/>
-	      <input type="hidden" name="a" value="d"/>
-	      <input type="hidden" name="d" value="{$docID}"/>
-	      <input type="hidden" name="c" value="{$collName}"/>
-	      <xsl:if test="$request-params/param[@name='sib']">
-		<input type="hidden" name="sib"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='sib']/@value"/></xsl:attribute></input></xsl:if>
-	      <input type="hidden" name="s" value="{@name}"/>
-	      <input type="hidden" name="p.a"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='p.a']"/></xsl:attribute></input>
-	      <input type="hidden" name="p.sa"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='p.sa']"/></xsl:attribute></input>
-	      <input type="hidden" name="p.s"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='p.s']"/></xsl:attribute></input>
-	      <input type="hidden" name="end" value='1'/>
-	      <input type="submit"><xsl:attribute name="value"><xsl:value-of select="displayItem[@name='submit']"/></xsl:attribute></input>
-	    </form>
-	  </td></tr>
-      </table>
-    </xsl:for-each>
-  </xsl:template>
-
-  <xsl:template match="paramList" mode="hidden">
-    <xsl:for-each select="param">
-      <input type='hidden' name='{@name}' value='{@value}'/><xsl:text>
-      </xsl:text>
-    </xsl:for-each>
-  </xsl:template>
-  
-  <xsl:template name="documentArrows">
-    <xsl:param name="collName"/>
-    <xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
-    
-    <div class="documentarrows">
-      <xsl:if test="not(string($ed)='1')">
-	<xsl:call-template name="documentArrow">
-	  <xsl:with-param name="collName" select="$collName"/>
-	  <xsl:with-param name="direction">back</xsl:with-param>
-	</xsl:call-template>
-	<xsl:call-template name="documentArrow">
-	  <xsl:with-param name="collName" select="$collName"/>
-	  <xsl:with-param name="direction">forward</xsl:with-param>
-	</xsl:call-template>
-      </xsl:if>
-    </div>
-    
-  </xsl:template>
-  
-  <xsl:template name="documentArrow">
-    <xsl:param name="collName"/>
-    <xsl:param name="direction"/>
-    <xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
-    <xsl:if test="$request-params/param[@name='dt']/@value != 'simple'">  
-      <a><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;amp;c=<xsl:value-of select="$collName"/>&amp;amp;d=<xsl:value-of select="@selectedNode"/><xsl:choose><xsl:when test="$direction='back'">.pp</xsl:when><xsl:otherwise>.np</xsl:otherwise></xsl:choose>&amp;amp;sib=1&amp;amp;p.s=<xsl:value-of select="$request-params/param[@name='p.s']/@value"/>&amp;amp;p.sa=<xsl:value-of select="$request-params/param[@name='p.sa']/@value"/>&amp;amp;p.a=<xsl:value-of select="$request-params/param[@name='p.a']/@value"/></xsl:attribute><xsl:choose><xsl:when test="$direction='back'"><img class="lessarrow" src="interfaces/default/images/less.gif" /></xsl:when><xsl:otherwise><img class="morearrow" src="interfaces/default/images/more.gif"  /></xsl:otherwise></xsl:choose></a>
-    </xsl:if> 
-  </xsl:template>
-
-  <xsl:template name="externalPage">
-    <xsl:param name="external"/>
-    <xsl:variable name="go_forward_link"><a class="getTextfor external.go_forward"><xsl:attribute name="href"><xsl:value-of select="$external"/></xsl:attribute></a></xsl:variable>
-    <h2 class="getTextFor external.title"></h2>
-    <p><xsl:attribute name="class"><xsl:value-of select="concat('getTextFor null this.innerText.external.text|', $go_forward_link)" /></xsl:attribute>
-    </p>
-  </xsl:template>
+		<!-- expand contents -->
+		<xsl:if test="@docType = 'hierarchy' and string(/page/pageResponse/format/gsf:option[@name='documentTOC']/@value) != 'false'">
+			<li>
+				<xsl:choose>
+					<xsl:when test="string($ec)='1'">
+						<a href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ec=0" class="getTextFor doc.contract_contents_b this.title.doc.contract_contents_tip"></a>
+					</xsl:when>
+					<xsl:otherwise>
+						<a  href="{$library_name}?a=d&amp;amp;d={$docID}&amp;amp;c={$collName}&amp;amp;sib={$sib}&amp;amp;ec=1" class="getTextFor doc.expand_contents_b this.title.doc.expand_contents_tip"></a>
+					</xsl:otherwise>
+				</xsl:choose>
+			</li>
+		</xsl:if>
+
+		<!-- detach page -->
+		<xsl:variable name="paramList" select="/page/pageRequest/paramList"/>
+		<li>
+			<a target="_blank" class="getTextFor doc.detach_page_b this.title.doc.detach_page_tip">
+				<xsl:attribute name="href">
+					<xsl:value-of select="$library_name"/>?a=d&amp;amp;d=<xsl:value-of select="$docID"/>&amp;amp;c=<xsl:value-of select="$collName"/>&amp;amp;sib=<xsl:value-of select="$sib"/>&amp;amp;dt=<xsl:value-of select="$paramList/param[@name='dt']/@value"/>&amp;amp;ec=<xsl:value-of select="$paramList/param[@name='ec']/@value"/>&amp;amp;et=<xsl:value-of select="$paramList/param[@name='et']/@value"/>&amp;amp;p.a=<xsl:value-of select="$paramList/param[@name='p.a']/@value"/>&amp;amp;p.s=<xsl:value-of select="$paramList/param[@name='p.s']/@value"/>&amp;amp;p.sa=<xsl:value-of select="$paramList/param[@name='p.sa']/@value"/>
+				</xsl:attribute>
+			</a>
+		</li>
+	</xsl:template>
+
+	<xsl:template name="TOC">
+		<xsl:param name="collName"/>
+		<xsl:choose>
+			<xsl:when test="@docType='hierarchy'">
+				<xsl:call-template name="hierarchicalContents">
+					<xsl:with-param name="collName" select="$collName"/>
+				</xsl:call-template>
+			</xsl:when>
+			<xsl:when test="@docType='paged'">
+				<xsl:call-template name="pagedContents">
+					<xsl:with-param name="collName" select="$collName"/>
+				</xsl:call-template>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:template>
+  
+	<xsl:template name="hierarchicalContents">
+		<xsl:param name="collName"/>
+		<xsl:variable name="oc" select="/page/pageRequest/paramList/param[@name='oc']/@value"/>
+		<xsl:variable name="d" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
+		<xsl:variable name="sib" select="/page/pageRequest/paramList/param[@name='sib']/@value"/>
+		<xsl:variable name="ec" select="/page/pageRequest/paramList/param[@name='ec']/@value"/>
+		<xsl:variable name="p.s" select="/page/pageRequest/paramList/param[@name='p.s']/@value"/>
+		<xsl:variable name="p.sa" select="/page/pageRequest/paramList/param[@name='p.sa']/@value"/>
+		<xsl:variable name="p.a" select="/page/pageRequest/paramList/param[@name='p.a']/@value"/>
+		<xsl:variable name="p.c"><xsl:choose><xsl:when test="/page/pageRequest/paramList/param[@name='p.c']"><xsl:value-of select="/page/pageRequest/paramList/param[@name='p.c']/@value"/></xsl:when><xsl:otherwise><xsl:value-of select="$collName"/></xsl:otherwise></xsl:choose></xsl:variable>
+		<script type="text/javascript">
+			<xsl:text>
+				// Load up the initial document using AJAX!
+				var initialHash = '</xsl:text>
+				<xsl:value-of select="$d" /><xsl:text>';
+			</xsl:text>
+		</script>
+		<xsl:if test="documentNode[@nodeID]">      
+			<ul id="tocnodes">
+				<li id="tocstart">
+					<xsl:choose>
+						<xsl:when test="string($oc)='0'">
+							<a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={$d}&amp;amp;sib={$sib}&amp;amp;oc=1&amp;amp;p.s={$p.s}&amp;amp;p.sa={$p.sa}&amp;amp;p.a={$p.a}&amp;amp;p.c={$p.c}"><xsl:call-template name="closedfolderimg"><xsl:with-param name="title"><xsl:value-of select="'doc.open_toc'"/></xsl:with-param></xsl:call-template></a>
+						</xsl:when>
+						<xsl:otherwise>
+							<a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={$d}&amp;amp;sib={$sib}&amp;amp;oc=0&amp;amp;p.s={$p.s}&amp;amp;p.sa={$p.sa}&amp;amp;p.a={$p.a}&amp;amp;p.c={$p.c}"><xsl:call-template name="openfolderimg"><xsl:with-param name="title"><xsl:value-of select="'doc.close_toc'"/></xsl:with-param></xsl:call-template></a>
+						</xsl:otherwise>
+					</xsl:choose>
+					<span class="getTextFor doc.table_of_contents">&amp;amp;nbsp;</span>
+					<xsl:if test="string($oc)!='0'">
+						<ul class="tocnode">
+							<xsl:for-each select="documentNode/documentNode[@nodeID]">
+								<xsl:apply-templates select='.'><xsl:with-param name="collName" select="$collName"/><xsl:with-param name="ec" select="$ec"/><xsl:with-param name="p.a" select="$p.a"/><xsl:with-param name="p.s" select="$p.s"/><xsl:with-param name="p.sa" select="$p.sa"/><xsl:with-param name="p.c" select="$p.c"/></xsl:apply-templates>
+							</xsl:for-each>
+						</ul>
+					</xsl:if>
+				</li> 
+			</ul>
+		</xsl:if>
+	</xsl:template>
+  
+	<!-- each icon-title pair is a row in a table. children go in a table in another row -->
+	<xsl:template match="documentNode">
+		<xsl:param name="collName"/>
+		<xsl:param name="ec"/>
+		<xsl:param name="p.a"/>
+		<xsl:param name="p.s"/>
+		<xsl:param name="p.sa"/>
+		<xsl:param name="p.c"/>
+		<!-- Display the appropriate image, depending on the node type -->
+		<li>
+			<a><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;amp;c=<xsl:value-of select="$collName"/>&amp;amp;d=<xsl:value-of select="@nodeID"/><xsl:if test="documentNode">.pr</xsl:if>&amp;amp;sib=1<xsl:if test="string($ec) = '1'">&amp;amp;ec=1</xsl:if>&amp;amp;p.a=<xsl:value-of select="$p.a"/>&amp;amp;p.sa=<xsl:value-of select="$p.sa"/>&amp;amp;p.s=<xsl:value-of select="$p.s"/>&amp;amp;p.c=<xsl:value-of select="$p.c"/></xsl:attribute>
+				<xsl:apply-templates select="." mode="displayNodeIcon"/>
+			</a>
+		  
+			<!-- Display associated title, bolded if the node has content -->
+			<xsl:choose>
+				<xsl:when test="nodeContent">
+					<span class="bold"><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
+				</xsl:when>
+				<xsl:otherwise>
+					<span><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></span>
+				</xsl:otherwise>
+			</xsl:choose>
+			<!-- Apply recursively to the children of this node -->
+			<xsl:if test="documentNode[@nodeID]">
+				<ul class="tocnode"> 
+					<xsl:apply-templates select="documentNode[@nodeID]">
+						<xsl:with-param name="collName" select="$collName"/>
+						<xsl:with-param name="ec" select="$ec"/>
+						<xsl:with-param name="p.a" select="$p.a"/><xsl:with-param name="p.s" select="$p.s"/><xsl:with-param name="p.sa" select="$p.sa"/><xsl:with-param name="p.c" select="$p.c"/>
+						<!--<xsl:with-param name="depth" select="$depth + 1"/>-->
+					</xsl:apply-templates>
+				</ul>
+			</xsl:if>
+		</li>
+	</xsl:template>
+  
+	<!-- default content is to print the title and content of any documentNodes that have nodeContent -->
+	<xsl:template name="documentContent">
+		<div class="documenttext"> 
+			<xsl:choose>
+				<xsl:when test="@docType='simple'"><xsl:apply-templates select="nodeContent"/></xsl:when>
+				<xsl:otherwise>
+					<!--<xsl:apply-templates select="descendant-or-self::node()/documentNode" mode="content"/>-->
+				</xsl:otherwise>
+			</xsl:choose>
+		</div>
+	</xsl:template>
+  
+	<xsl:template match="documentNode" mode="content">
+		<xsl:if test="nodeContent">
+			<xsl:if test="metadataList/metadata[@name='Title']">
+				<h3><xsl:value-of disable-output-escaping="yes" select="metadataList/metadata[@name='Title']"/></h3>
+			</xsl:if>
+			<xsl:apply-templates select="nodeContent"/>
+		</xsl:if>
+	</xsl:template>
+
+	<!-- the actual text/content -->
+	<xsl:template match="nodeContent">
+		<xsl:for-each select="node()">
+			<xsl:choose>
+				<xsl:when test="not(name())">
+					<xsl:value-of select="." disable-output-escaping="yes" />
+				</xsl:when>
+				<xsl:otherwise><xsl:apply-templates select="."/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:for-each>
+	</xsl:template>
+  
+	<xsl:template name="xmldocumentContentPeeling">
+		<xsl:choose>
+			<xsl:when test="@docType='simple'">
+				<xsl:apply-templates select="nodeContent"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:call-template name="xmlpeelingContents" />
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+  
+	<xsl:template name="xmlpeelingContents">
+		<xsl:if test="documentNode">
+			<xsl:apply-templates select="documentNode" mode="xmlpeeling" />
+		</xsl:if>
+	</xsl:template>
+
+	<xsl:template match="documentNode" mode="xmlpeeling">
+		<!-- get title -->
+		<xsl:if test="nodeContent">
+			<xsl:text disable-output-escaping="yes">
+				&lt;Section&gt;
+				&lt;Description&gt;
+				&lt;Metadata name="Title"&gt;
+			</xsl:text>
+			<xsl:value-of select="normalize-space(metadataList/metadata[@name='Title'])"/>
+			<xsl:text disable-output-escaping="yes">
+				&lt;/Metadata&gt;
+				&lt;/Description&gt;
+			</xsl:text>
+			<xsl:value-of select="normalize-space(nodeContent)" disable-output-escaping="yes"/>
+			<xsl:text disable-output-escaping="yes">
+				&lt;/Section&gt;
+			</xsl:text>
+		</xsl:if>
+
+		<!-- recurse to the children -->
+		<xsl:if test="documentNode">
+			<xsl:apply-templates select="documentNode" mode="xmlpeeling" />
+		</xsl:if>
+
+		<xsl:if test="nodeContent">
+			<!-- end the section -->
+			<xsl:text disable-output-escaping="yes">
+		  		&amp;lt;/Section&amp;gt;
+			</xsl:text>
+		</xsl:if>
+	</xsl:template>
+  
+	<!-- match any file nodes -->
+	<xsl:template match="file">
+		<xsl:variable name="httpPath" select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>
+		<xsl:choose>
+			<xsl:when test="starts-with(@mimeType, 'image/')">
+				<img src="{$httpPath}/{@href}"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<a href="{$httpPath}/{@href}"><xsl:value-of select="@href"/></a>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+  
+	<!-- match any link nodes -->
+	<xsl:template match="link">
+		<xsl:variable name="collName" select="/page/pageRequest/paramList/param[@name='c']/@value"/> 
+		<xsl:variable name="actionargs">
+			<xsl:choose>
+				<xsl:when test="@type='document'">a=d</xsl:when>
+				<xsl:when test="@type='query'">a=q&amp;amp;s=<xsl:value-of select="@service"/>&amp;amp;rt=rd</xsl:when>
+				<xsl:otherwise>
+					p
+				</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		<xsl:variable name="serviceargs">
+			<xsl:for-each select="param">&amp;amp;s1.<xsl:value-of select="@name"/>=<xsl:value-of select="@value"/></xsl:for-each>
+		</xsl:variable>
+		<a href="{$library_name}?{$actionargs}&amp;amp;c={$collName}{$serviceargs}"><xsl:value-of disable-output-escaping="yes" select="."/></a>
+	</xsl:template>
+
+	<!-- match any annotations and make them span elements -->
+	<xsl:template match="annotation">
+		<span class="{@type}"><xsl:value-of disable-output-escaping="yes" select="."/></span>
+	</xsl:template>
+  
+	<!-- paged naviagtion : INCOMPLETE!!-->
+	<xsl:template name="pagedContents">
+		<xsl:param name="collName"/>
+		<xsl:variable name="pos" select="nodeStructureInfo/info[@name='siblingPosition']/@value"/>
+		<xsl:variable name="length" select="nodeStructureInfo/info[@name='numSiblings']/@value"/>
+		<xsl:variable name="children" select="nodeStructureInfo/info[@name='numChildren']/@value"/>
+		<table>
+			<xsl:choose>
+				<xsl:when test="$pos=-1"><!-- a doc -->
+					<tr valign="top">
+						<td align="left">
+						</td>
+						<td align="center">
+							<center>
+								<b class="getTextFor doc.pages"></b>
+							</center>
+						</td>
+						<td align="right">
+							<a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.fc"><img src="interfaces/default/images/more.gif" border="0" align="absbottom" /></a>
+						</td>
+					</tr>
+				</xsl:when>
+
+				<xsl:otherwise> <!-- an internal node -->	  
+					<tr valign="top">
+						<td align="left">
+							<xsl:if test=" not ( $pos = 1 )">
+								<a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.ps"><img src="interfaces/default/images/less.gif" border="0" align="absbottom" /></a>
+							</xsl:if>
+						</td>
+						<td align="center">
+							<center>
+								<b><xsl:attribute name="class"><xsl:value-of select="concat('getTextFor null this.innerText.doc.pageof|', $pos, ';', $length)"/></xsl:attribute></b>
+							</center>
+						</td>
+						<td align="right">
+							<xsl:if test=" not($pos = $length)">
+								<a href="{$library_name}?a=d&amp;amp;c={$collName}&amp;amp;d={@selectedNode}.ns"><img src="interfaces/default/images/more.gif" border="0" align="absbottom" /></a>
+							</xsl:if>
+						</td>
+					</tr>
+				</xsl:otherwise>
+			</xsl:choose>
+			<tr valign="middle">
+				<td align='center' valign='top' colspan='3'>
+					<form name="GotoForm" method="get" action="{$library_name}">
+						<input type='hidden' name='a' value='d'/>
+						<input type='hidden' name='c' value='{$collName}'/>
+						<input type='hidden' name='d' value='{@selectedNode}'/>
+						<input type="text" name="gp" size="3" maxlength="4"/>
+						<input type="submit" class="getTextFor null this.value.doc.gotopage"></input>
+					</form>
+				</td>
+			</tr>
+		</table>
+	</xsl:template>
+  
+	<xsl:template name="enrichServices">
+		<xsl:param name="collName"/>
+		<xsl:variable name="docID" select="/page/pageRequest/paramList/param[@name='d']/@value"/>
+		<xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
+		<xsl:for-each select="../serviceList/service">
+			 <table border='1' cellspacing='0'>
+				<tr><td>
+					<p /><xsl:value-of select="displayItem[@name='name']"/><p/>
+					<form name="EnrichForm" method="get" action="{$library_name}">
+						<xsl:apply-templates select="paramList"/>
+						<input type="hidden" name="a" value="d"/>
+						<input type="hidden" name="d" value="{$docID}"/>
+						<input type="hidden" name="c" value="{$collName}"/>
+						<xsl:if test="$request-params/param[@name='sib']">
+						<input type="hidden" name="sib"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='sib']/@value"/></xsl:attribute></input></xsl:if>
+						<input type="hidden" name="s" value="{@name}"/>
+						<input type="hidden" name="p.a"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='p.a']"/></xsl:attribute></input>
+						<input type="hidden" name="p.sa"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='p.sa']"/></xsl:attribute></input>
+						<input type="hidden" name="p.s"><xsl:attribute name="value"><xsl:value-of select="$request-params/param[@name='p.s']"/></xsl:attribute></input>
+						<input type="hidden" name="end" value='1'/>
+						<input type="submit"><xsl:attribute name="value"><xsl:value-of select="displayItem[@name='submit']"/></xsl:attribute></input>
+					</form>
+				</td></tr>
+			 </table>
+		</xsl:for-each>
+	</xsl:template>
+
+	<xsl:template match="paramList" mode="hidden">
+		<xsl:for-each select="param">
+			<input type='hidden' name='{@name}' value='{@value}'/><xsl:text>
+			</xsl:text>
+		</xsl:for-each>
+	</xsl:template>
+  
+	<xsl:template name="documentArrows">
+		<xsl:param name="collName"/>
+		<xsl:variable name="ed" select="/page/pageRequest/paramList/param[@name='ed']/@value"/>
+
+		<div class="documentarrows">
+			<xsl:if test="not(string($ed)='1')">
+				<xsl:call-template name="documentArrow">
+					<xsl:with-param name="collName" select="$collName"/>
+					<xsl:with-param name="direction">back</xsl:with-param>
+				</xsl:call-template>
+				<xsl:call-template name="documentArrow">
+					<xsl:with-param name="collName" select="$collName"/>
+					<xsl:with-param name="direction">forward</xsl:with-param>
+				</xsl:call-template>
+			</xsl:if>
+		</div>
+
+	</xsl:template>
+  
+	<xsl:template name="documentArrow">
+		<xsl:param name="collName"/>
+		<xsl:param name="direction"/>
+		<xsl:variable name="request-params" select="/page/pageRequest/paramList"/>
+		<xsl:if test="$request-params/param[@name='dt']/@value != 'simple'">  
+			<a><xsl:attribute name="href"><xsl:value-of select="$library_name"/>?a=d&amp;amp;c=<xsl:value-of select="$collName"/>&amp;amp;d=<xsl:value-of select="@selectedNode"/><xsl:choose><xsl:when test="$direction='back'">.pp</xsl:when><xsl:otherwise>.np</xsl:otherwise></xsl:choose>&amp;amp;sib=1&amp;amp;p.s=<xsl:value-of select="$request-params/param[@name='p.s']/@value"/>&amp;amp;p.sa=<xsl:value-of select="$request-params/param[@name='p.sa']/@value"/>&amp;amp;p.a=<xsl:value-of select="$request-params/param[@name='p.a']/@value"/></xsl:attribute><xsl:choose><xsl:when test="$direction='back'"><img class="lessarrow" src="interfaces/default/images/less.gif" /></xsl:when><xsl:otherwise><img class="morearrow" src="interfaces/default/images/more.gif"  /></xsl:otherwise></xsl:choose></a>
+		</xsl:if> 
+	</xsl:template>
+
+	<xsl:template name="externalPage">
+		<xsl:param name="external"/>
+		<xsl:variable name="go_forward_link"><a class="getTextfor external.go_forward"><xsl:attribute name="href"><xsl:value-of select="$external"/></xsl:attribute></a></xsl:variable>
+		<h2 class="getTextFor external.title"></h2>
+		<p><xsl:attribute name="class"><xsl:value-of select="concat('getTextFor null this.innerText.external.text|', $go_forward_link)" /></xsl:attribute>
+		</p>
+	</xsl:template>
 
 </xsl:stylesheet>
Index: main/trunk/greenstone3/web/interfaces/oran/style/core.css
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/style/core.css	(revision 23989)
+++ main/trunk/greenstone3/web/interfaces/oran/style/core.css	(revision 24009)
@@ -73,31 +73,19 @@
 }
 
+.classifierContainer {
+	padding-left:1.5em;
+}
+
 .icon{
-	background-repeat: no-repeat;
+	cursor:pointer;
+	padding:2px;
+}
+
+.emptyIcon {
 	height:16px;
 	width:16px;
-	cursor:pointer;
-}
-
-.toggleImageExpand {
-	background-image: url('../images/expand.png');
-	background-position: 2px 2px;
-}
-
-.toggleImageCollapse {
-	background-image: url('../images/collapse.png');
-	background-position: 2px 2px;
-}
-
-.toggleImagePage {
-	background-image: url('../images/page.png');
-	background-position: 2px 2px;
-}
-
-.toggleImageChapter {
-	background-image: url('../images/chapter.png');
-}
-
-.realisticBookIcon {
+}
+
+#rbOptionDiv {
 	background-repeat: no-repeat;
 	background-image: url('../images/rbook.png');
@@ -106,7 +94,51 @@
 }
 
+#highlightOptionDiv {
+	background-repeat: no-repeat;
+	background-image: url('../images/hl.png');
+	height: 32px;
+	width: 32px;
+}
+
+.optionCheckBox {
+	margin-left:35px; 
+	margin-top:10px;
+}
+
+#bookdiv {
+	
+}
+
 .backToTop {
 	font-size:0.7em;
 	padding-left: 2em;
+	text-align:center;
+}
+
+#prevArrowTD {
+	text-align:right; 
+	width:10%;
+}
+
+#nextArrowTD {
+	text-align:left; 
+	width:10%;
+}
+
+#prevTD {
+	text-align:left; 
+	width:20%;
+}
+
+#nextTD {
+	text-align:right; 
+	width:20%;
+}
+
+#searchResultNavTable {
+	width:100%;
+}
+
+#searchResultsStatusBar {
 	text-align:center;
 }
@@ -152,11 +184,9 @@
 .viewOptions {
 	width: 100%;
-	text-align:center;
 	background:#008800;
 }
 
 .viewOptions td {
-	padding-top:4px;
-	padding-bottom:4px;
+	padding: 5px;
 }
 
@@ -205,5 +235,4 @@
 	position: relative;
 	display: block;
-	height: 30px;
 	background: transparent url('../images/gsdlhead.gif') scroll no-repeat left top;
 	margin: 0 auto;
@@ -212,4 +241,6 @@
 	font-size: 70%;
 	color: #fff;
+	padding-top:5px;
+	padding-bottom:5px;
 }
 
@@ -252,5 +283,5 @@
 
 #quicksearcharea table{
-	font-size:10px; 
+	font-size:70%; 
 	margin:0; 
 	float: right;
@@ -258,5 +289,4 @@
 
 #quicksearcharea a{
-	font-size: 11px;
 	color:white; 
 	text-transform:lowercase;
@@ -416,6 +446,6 @@
 #results .document a { background-image: url('../images/book.png'); }
 #results .document a:visited { background-image: url('../images/book-visited.png'); color: #999; }
-
 #results .shelf>a { background-image: url('../images/bookshelf.png'); }
+c
 
 /* corners of the banner */
@@ -453,222 +483,4 @@
 a:link, a:hover, a:active, a:visited { color: #050; }
 
-/*
-
-ul li>select, ul li>input {
-  padding: 0;
-  margin-left:5px;
-}
-
-
-
-div#banner ul, ul#resultlist, ul#tocnodes, ul#docbuttons, ul.tocnode, ul#bannerlist, ul#navbarlist, ul#collectionlist, ul#servicelist, ul#classifierlist, ul#classifiernodelist, ul#queryitemlist{
-  list-style-type:none;
-  margin:0;
-  padding:0;
-}
-
-div#banner ul li, ul#bannerlist li, ul#navbarlist li {
-  display: inline;
-  margin:0;
-  padding:0;	
-}
-
-
-
-div#banner p {
-  margin:0;
-  padding: 0;
-  float:left;
-  font-size: 16px;
-  text-align: left;
-  overflow:hidden	
-}
-
-div#banner p a {
-  background-image: url('../images/banner_bg.png');
-  background-repeat: repeat-y;
-}
-
-
-div#banner ul{
-  margin:0;
-  padding:0; 
-  float:right; 
-  font-size: 12px;  
-}
-
-div#banner a{
-  text-decoration: none;
-  color:#000000;
-}
-
-
-
-ul#bannerlist li a {
-  padding: 0 10px 0 10px; 
-  text-decoration: none;
-}
-
-ul#bannerlist li a:link, ul#bannerlist li a:visited
-{
- background-color: #DEE79C;
- background-image: url('../images/bg_off.png');
- text-decoration: none
-}
-
-ul#bannerlist li a:hover{
- background-color: #FFFF66;
- background-image: url('../images/bg_on.png') ;
- text-decoration: none
-}
-
-
-div#navbar{
-  clear:both;
-}
-
-ul#navbarlist{
-  margin:0;
-  padding:0; 
-  list-style-type: none; 
-  text-align:center;
-  width: 100%;
-  font-size: 80%;
-  background-image: url('../images/bg_green.png');	  
-  background-color: #99CC99
- }
-
-ul#navbarlist li a {
-  padding: 0 20px 0 20px; 
-  margin: 0;
-  color: #000000; 
-  text-decoration: none;
-}
-
-ul#navbarlist li a:link, ul#navbarlist li a:visited{
-   background-image: url('../images/bg_off.png') ;
- }
-
-ul#navbarlist li a:hover{
-  background-image: url('../images/bg_on.png') ;
-}
-
-
-ul#collectionlist li, ul#servicelist li{
-  display:block;
-  padding:0;
-  margin: .2em 0 0 0;
-  overflow:hidden;
-}
-
-
-ul#collectionlist img{
-  margin:0;
-  padding:0;
-  width: 150px;
-  height: 45px;
-  border: 1px solid black;
-  background-image: url('../images/collectimg_bg.png');
-  background-repeat: repeat-y;
-  overflow:hidden
-}
-
-ul#collectionlist li a.noimage{
-  display: block;
-  margin:0;
-  width: 145px;
-  height: 40px;
-  border: 1px solid black;
-  background-image: url('../images/collectimg_bg.png');
-  background-repeat: repeat-y;
-  overflow:hidden; padding-left:5px; padding-right:0; padding-top:5px; padding-bottom:0
-
-}
-
-ul#collectionlist li a{
-  font-size: 16px;
-  color: #000000;
-  text-decoration: none;  
-  font-weight: bold;
-}
-
-ul#servicelist li a{
-  margin:0 .5em 0 0;
-}
-
-ul#queryitemlist li{
-  display:block;
-  margin: .2em 0 .2em 0;
-}
-
-ul#classifierlist li{
-  list-style: none;
-  margin: 0 0 5px 0;
-  padding: 0;
-  display: block;
-  color:#000;
-}
-
-ul#classifierlist li#activeclassifier{
-  font-weight:bold;
-  padding: 0 0 0 5px;
-  margin:0 0 5px 0;
-}
-
- ul#classifierlist li a:link, ul#classifierlist li a:visited  
-{
-   display:block;
-   margin:0;
-   background-image: url('../images/bg_off.png');
-   text-decoration: none; 
-   color:#000;
-   width:100%; padding-left:5px; padding-right:0; padding-top:2px; padding-bottom:2px
- } 
-
-ul#classifierlist li a:hover, ul#classifierlist li a:active
-{
-  display:block;
-  margin:0;
-  background-image: url('../images/bg_on.png');
-  text-decoration: none; padding-left:5px; padding-right:0; padding-top:2px; padding-bottom:2px
-  
-}
-
-ul#classifierlist{
-   float:left;
-   font-size: 14px;
-   text-align: left;
-   width: 15%;
-   margin:0;
-   padding:0;
-}
-
-div#classifiers{
-  float:left;
-  width: 75%;
-  margin:0;
-  padding:0 0 0 10px;
- }
-
-ul#classifiernodelist li{
-  list-style: none;
-  margin: 0;
-  padding: 5px 0 0 0;
-  display: block;
- }
-
-ul.childrenlist{
-  margin: 0 0 0 0;
-  padding: 0 0 0 20px;
-  display: block;
-  width: 100%;
-}
-
-div#content{
- clear: both;
- overflow: hidden;
- margin: .2em 0 0 0;
-}
-
 /* bg image set in style macro */
 div.divbar { 
@@ -703,6 +515,4 @@
   display:block;
 }
-
-
 
 div#documentheading{
Index: main/trunk/greenstone3/web/interfaces/oran/transform/document-scripts.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/transform/document-scripts.xsl	(revision 23989)
+++ main/trunk/greenstone3/web/interfaces/oran/transform/document-scripts.xsl	(revision 24009)
@@ -11,4 +11,9 @@
 		<script type="text/javascript">
 			<xsl:text disable-output-escaping="yes">
+				var collapseImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/><xsl:text disable-output-escaping="yes">";
+				var expandImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/><xsl:text disable-output-escaping="yes">";
+				var chapterImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'chapter_image')"/><xsl:text disable-output-escaping="yes">";
+				var pageImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_image')"/><xsl:text disable-output-escaping="yes">";
+				
 				function toggleSection(sectionID)
 				{
@@ -21,12 +26,10 @@
 					if(docElem.style.display == "none")
 					{
-						var imageClass = (docToggleElem.getAttribute("class").indexOf("leafNode") != -1) ? "icon toggleImageCollapse leafNode" : "icon toggleImageCollapse";
-						
 						docElem.style.display = "block";
-						docToggleElem.setAttribute("class", imageClass);
+						docToggleElem.setAttribute("src", collapseImageURL);
 						
 						if(tocToggleElem)
 						{
-							tocToggleElem.setAttribute("class", imageClass);
+							tocToggleElem.setAttribute("src", collapseImageURL);
 						}
 						
@@ -41,11 +44,9 @@
 						
 						//Use the page image if this is a leaf node and the chapter image if it not
-						//var imageClass = (docToggleElem.getAttribute("class").indexOf("leafNode") != -1) ? "icon toggleImagePage leafNode" : "icon toggleImageChapter";
-						var imageClass = (docToggleElem.getAttribute("class").indexOf("leafNode") != -1) ? "icon toggleImageExpand leafNode" : "icon toggleImageExpand";
-						docToggleElem.setAttribute("class", imageClass);
+						docToggleElem.setAttribute("src", expandImageURL);
 						
 						if(tocToggleElem)
 						{
-							tocToggleElem.setAttribute("class", imageClass);
+							tocToggleElem.setAttribute("src", expandImageURL);
 						}
 						
@@ -132,6 +133,5 @@
 					
 					var option = document.getElementById("highlightOption");
-					option.innerHTML = "No Highlighting";
-					option.setAttribute("href", "javascript:removeHighlight();");
+					option.setAttribute("onclick", "removeHighlight();");
 				}
 				
@@ -149,6 +149,5 @@
 					
 					var option = document.getElementById("highlightOption");
-					option.innerHTML = "Highlighting";
-					option.setAttribute("href", "javascript:addHighlight();");
+					option.setAttribute("onclick", "addHighlight();");
 				}
 			</xsl:text>
@@ -157,7 +156,39 @@
 	
 	<xsl:template name="realisticBooksScript">
-		<div id="bookdiv"/>
 		<script type="text/javascript">
 			<xsl:text disable-output-escaping="yes">
+				function bookInit()
+				{
+					loadBook(); 
+					hideText(); 
+					showBook(); 
+					swapLinkJavascript(false);
+				}
+				
+				function hideText()
+				{
+					var textDiv = document.getElementById("gs-document-text");
+					textDiv.style.display = "none";
+				}
+				
+				function showText()
+				{
+					var textDiv = document.getElementById("gs-document-text");
+					textDiv.style.display = "block";
+				}
+				
+				function hideBook()
+				{
+					var bookDiv = document.getElementById("bookdiv");
+					bookDiv.style.visibility = "hidden";
+					bookDiv.style.height = "0px";
+				}
+				
+				function showBook()
+				{
+					var bookDiv = document.getElementById("bookdiv");
+					bookDiv.style.visibility = "visible";
+					bookDiv.style.height = "600px";
+				}
 				
 				//Helper function to create param elements
@@ -170,48 +201,65 @@
 				}
 				
-				//Work out the URL to the cover image and the document
-				var img_cover = '</xsl:text><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='assocfilepath']"/>/cover.jpg<xsl:text disable-output-escaping="yes">';
-				var doc_url = document.URL; 
-				doc_url = doc_url.replace(/(&amp;|\?)book=[a-z]+/gi,'');
-				doc_url += '&amp;book=flashxml';	
-				
-				//The outer OBJECT element
-				var objectElem = document.createElement("OBJECT");
-				objectElem.setAttribute("align", "middle");
-				objectElem.setAttribute("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
-				objectElem.setAttribute("codebase", "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");
-				objectElem.setAttribute("height", "600px");
-				objectElem.setAttribute("width", "100%");
-				
-				//Parameter list
-				var params = new Array();
-				params[0] = createParam("allowScriptAccess", "always");
-				params[1] = createParam("movie", "Book.swf?src_image=" + escape(img_cover) + "&amp;doc_url=" + escape(doc_url));
-				params[2] = createParam("quality", "high");
-				params[3] = createParam("bgcolor", "#FFFFFF");
-				
-				//The embed element that goes into the object element
-				var embedElem = document.createElement("EMBED");
-				embedElem.setAttribute("allowScriptAccess", "always");
-				embedElem.setAttribute("swLiveConnect", "true");
-				embedElem.setAttribute("bgcolor", "#FFFFFF");
-				embedElem.setAttribute("height", "600px");
-				embedElem.setAttribute("name", "Book");
-				embedElem.setAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer");
-				embedElem.setAttribute("quality", "high");
-				embedElem.setAttribute("src", "Book.swf?src_image=" + escape(img_cover) + "&amp;doc_url=" + escape(doc_url));
-				embedElem.setAttribute("type", "application/x-shockwave-flash");
-				embedElem.setAttribute("width", "100%");
-				
-				//Append the param and embed elements to the object element
-				for(var i = 0; i &lt; params.length; i++)
-				{
-					objectElem.appendChild(params[i]);
-				}
-				objectElem.appendChild(embedElem);
-				
-				//Append the object element to the page
-				var flashDiv = document.getElementById("bookdiv");
-				flashDiv.appendChild(objectElem);
+				function swapLinkJavascript(rbOn)
+				{
+					var option = document.getElementById("rbOption");
+					if(rbOn)
+					{
+						option.setAttribute("onclick", "hideText(); showBook(); swapLinkJavascript(false);");
+					}
+					else
+					{
+						option.setAttribute("onclick", "hideBook(); showText(); swapLinkJavascript(true);");
+					}
+				}
+				
+				function loadBook()
+				{
+					//Work out the URL to the cover image and the document
+					var img_cover = '</xsl:text><xsl:value-of select="/page/pageResponse/collection/metadataList/metadata[@name='httpPath']"/>/index/assoc/<xsl:value-of select="metadataList/metadata[@name='assocfilepath']"/>/cover.jpg<xsl:text disable-output-escaping="yes">';
+					var doc_url = document.URL; 
+					doc_url = doc_url.replace(/(&amp;|\?)book=[a-z]+/gi,'');
+					doc_url += '&amp;book=flashxml';	
+					
+					//The outer OBJECT element
+					var objectElem = document.createElement("OBJECT");
+					objectElem.setAttribute("align", "middle");
+					objectElem.setAttribute("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
+					objectElem.setAttribute("codebase", "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");
+					objectElem.setAttribute("height", "600px");
+					objectElem.setAttribute("width", "70%");
+					objectElem.setAttribute("id", "bookObject");
+					
+					//Parameter list
+					var params = new Array();
+					params[0] = createParam("allowScriptAccess", "always");
+					params[1] = createParam("movie", "RealisticBook.swf?src_image=" + escape(img_cover) + "&amp;doc_url=" + escape(doc_url));
+					params[2] = createParam("quality", "high");
+					params[3] = createParam("bgcolor", "#FFFFFF");
+					
+					//The embed element that goes into the object element
+					var embedElem = document.createElement("EMBED");
+					embedElem.setAttribute("allowScriptAccess", "always");
+					embedElem.setAttribute("swLiveConnect", "true");
+					embedElem.setAttribute("bgcolor", "#FFFFFF");
+					embedElem.setAttribute("height", "600px");
+					embedElem.setAttribute("name", "Book");
+					embedElem.setAttribute("pluginspage", "http://www.macromedia.com/go/getflashplayer");
+					embedElem.setAttribute("quality", "high");
+					embedElem.setAttribute("src", "RealisticBook.swf?src_image=" + escape(img_cover) + "&amp;doc_url=" + escape(doc_url));
+					embedElem.setAttribute("type", "application/x-shockwave-flash");
+					embedElem.setAttribute("width", "70%");
+					
+					//Append the param and embed elements to the object element
+					for(var i = 0; i &lt; params.length; i++)
+					{
+						objectElem.appendChild(params[i]);
+					}
+					objectElem.appendChild(embedElem);
+					
+					//Append the object element to the page
+					var flashDiv = document.getElementById("bookdiv");
+					flashDiv.appendChild(objectElem);
+				}
 			</xsl:text>
 		</script>
Index: main/trunk/greenstone3/web/interfaces/oran/transform/layouts/header.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/transform/layouts/header.xsl	(revision 23989)
+++ main/trunk/greenstone3/web/interfaces/oran/transform/layouts/header.xsl	(revision 24009)
@@ -114,7 +114,7 @@
 				<!-- home -->
 				<li>
-					<a href="{$library_name}?a=p&amp;amp;sa=home">
+					<a href="{$library_name}?a=p&amp;amp;sa=about&amp;amp;c={$collNameChecked}">
 						<xsl:attribute name="title"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_tip')"/></xsl:attribute>
-						<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'home_b')"/>
+						<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'about_b')"/>
 					</a>
 				</li>
@@ -132,29 +132,29 @@
 					<xsl:choose>
 						<xsl:when test="string-length($pageTitleVar) &lt; 20">
-							font-size: 24px; line-height: 26px;
+							font-size: 1.5em; line-height: 1.5em;
 						</xsl:when>
 						<xsl:when test="string-length($pageTitleVar) &lt; 30">
-							font-size: 22px; line-height: 24px;
+							font-size: 1.4em; line-height: 1.4em;
 						</xsl:when>
 						<xsl:when test="string-length($pageTitleVar) &lt; 40">
-							font-size: 20px; line-height: 22px;
+							font-size: 1.3em; line-height: 1.3em;
 						</xsl:when>
 						<xsl:when test="string-length($pageTitleVar) &lt; 50">
-							font-size: 18px; line-height: 20px;
+							font-size: 1.2em; line-height: 1.2em;
 						</xsl:when>
 						<xsl:when test="string-length($pageTitleVar) &lt; 60">
-							font-size: 16px; line-height: 18px;
+							font-size: 1.1em; line-height: 1.2em;
 						</xsl:when>
 						<xsl:when test="string-length($pageTitleVar) &lt; 70">
-							font-size: 15px; line-height: 17px;
+							font-size: 1em; line-height: 1.1em;
 						</xsl:when>
 						<xsl:when test="string-length($pageTitleVar) &lt; 80">
-							font-size: 14px; line-height: 16px;
+							font-size: 0.9em; line-height: 1em;
 						</xsl:when>
 						<xsl:when test="string-length($pageTitleVar) &lt; 90">
-							font-size: 13px; line-height: 15px;
+							font-size: 0.8em; line-height: 0.9em;
 						</xsl:when>
 						<xsl:otherwise>
-							font-size: 12px; line-height: 14px;
+							font-size: 0.7em; line-height: 0.9em;
 						</xsl:otherwise>
 					</xsl:choose>
@@ -179,4 +179,29 @@
 					<input type="hidden" name="c" value="{$collNameChecked}"/>
 					<input type="hidden" name="startPage" value="1"/>
+					<xsl:choose>
+						<xsl:when test="/page/pageRequest/paramList/param[@name = 's1.maxDocs']">
+							<input type="hidden" name="s1.maxDocs">
+								<xsl:attribute name="value">
+									<xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.maxDocs']/@value"/>
+								</xsl:attribute>
+							</input>
+						</xsl:when>
+						<xsl:otherwise>
+							<input type="hidden" name="s1.maxDocs" value="100"/>
+						</xsl:otherwise>
+					</xsl:choose>
+					<xsl:choose>
+						<xsl:when test="/page/pageRequest/paramList/param[@name = 's1.hitsPerPage']">
+							<input type="hidden" name="s1.hitsPerPage">
+								<xsl:attribute name="value">
+									<xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.hitsPerPage']/@value"/>
+								</xsl:attribute>
+							</input>
+						</xsl:when>
+						<xsl:otherwise>
+							<input type="hidden" name="s1.hitsPerPage" value="20"/>
+						</xsl:otherwise>
+					</xsl:choose>
+					
 					<!-- The query text box -->
 					<span class="querybox">
Index: main/trunk/greenstone3/web/interfaces/oran/transform/pages/classifier.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/transform/pages/classifier.xsl	(revision 23989)
+++ main/trunk/greenstone3/web/interfaces/oran/transform/pages/classifier.xsl	(revision 24009)
@@ -19,17 +19,5 @@
 	<!-- the page content -->
 	<xsl:template match="/page/pageResponse">
-
-		<!-- show the classifiers if more than one (title, subject, etc.) -->
-		<!--<xsl:if test="service/classifierList/classifier[2]">
-			<div id="classifierList" class="navList">
-				<ul>
-					<xsl:for-each select="service/classifierList/classifier">
-						<li><gslib:classifierLink/></li>
-					</xsl:for-each>
-				</ul>
-				<div class="clear"><xsl:text> </xsl:text></div>
-			</div>
-		</xsl:if>-->
-
+		<xsl:call-template name="classifierLoadScript"/>
 		<!-- this right sidebar -->
 		<xsl:if test="$berryBasketOn">
@@ -78,20 +66,131 @@
 	<xsl:template match="classifierNode" priority="3">
 
-		<li class="shelf">
+		<table id="title{@nodeID}"><tr>
+			<!-- Expand/collapse button -->
+			<td class="headerTD">
+				<img id="toggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">			
+					<xsl:attribute name="src">
+						<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/>
+					</xsl:attribute>
+				</img>
+			</td>
+			<!-- Bookshelf icon -->
+			<td>
+				<img>
+					<xsl:attribute name="src"><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'bookshelf_image')"/></xsl:attribute>
+				</img>
+			</td>
+			<!-- Link title -->
+			<td>
+				<a href="javascript:toggleSection('{@nodeID}');">
+					<xsl:value-of disable-output-escaping="yes"  select="metadataList/metadata[@name='Title']"/>
+				</a>
+			</td>
+		</tr></table>
+		
+		<!-- Show any documents or sub-groups in this group -->
+		<xsl:if test="documentNode|classifierNode">
+			<div id="div{@nodeID}" class="classifierContainer" style="display:block;">
+				<xsl:apply-templates select="documentNode|classifierNode"/>
+			</div>
+		</xsl:if>
+	</xsl:template>
+	
+	<xsl:template name="classifierLoadScript">
+		<script type="text/javascript">
+			<xsl:text disable-output-escaping="yes">
+				var collapseImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/><xsl:text disable-output-escaping="yes">";
+				var expandImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'expand_image')"/><xsl:text disable-output-escaping="yes">";
+				var loadingImageURL = "</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'loading_image')"/><xsl:text disable-output-escaping="yes">";
+				var inProgress = new Array();
+			
+				function isExpanded(sectionID)
+				{
+					var divElem = document.getElementById("div" + sectionID);
+					if(divElem.style.display == "block")
+					{
+						return true;
+					}
+					return false;
+				}
+			
+				function toggleSection(sectionID)
+				{
+					var section = document.getElementById("div" + sectionID);
+					var sectionToggle = document.getElementById("toggle" + sectionID);
+					
+					if(section)
+					{
+						if(isExpanded(sectionID))
+						{
+							section.style.display = "none";
+							sectionToggle.setAttribute("src", expandImageURL);
+						}
+						else
+						{
+							section.style.display = "block";
+							sectionToggle.setAttribute("src", collapseImageURL);
+						}
+					}
+					else
+					{
+						httpRequest(sectionID);
+					}
+				}
+				
+				function httpRequest(sectionID)
+				{
+					if(!inProgress[sectionID])
+					{
+						inProgress[sectionID] = true;
+						var httpRequest;
+						if (window.XMLHttpRequest) {
+							httpRequest = new XMLHttpRequest();
+						}
+						else if (window.ActiveXObject) {
+							httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
+						}
+						
+						var sectionToggle = document.getElementById("toggle" + sectionID);
+						sectionToggle.setAttribute("src", loadingImageURL);
 
-			<a>
-				<xsl:attribute name="href">
-					<xsl:value-of select="$library_name"/>?a=b&amp;rt=r&amp;s=<xsl:value-of select="/page/pageResponse/service/@name"/>&amp;c=<xsl:value-of select="/page/pageResponse/collection/@name"/>&amp;cl=<xsl:value-of select='@nodeID'/><xsl:if test="classifierNode|documentNode">.pr</xsl:if></xsl:attribute>
-				<xsl:value-of disable-output-escaping="yes"  select="metadataList/metadata[@name='Title']"/>
-			</a>
+						var url = document.URL;
+						url = url.replace(/(&amp;|\?)cl=([a-z\.0-9]+)/gi, "$1cl=" + sectionID + "&amp;excerptid=div" + sectionID);
 
-			<!-- show any documents or sub-groups in this group -->
-			<xsl:if test="documentNode|classifierNode">
-				<ul>
-					<xsl:apply-templates select="documentNode|classifierNode"/>
-				</ul>
-			</xsl:if>
-		</li>
+						httpRequest.open('GET', url, true);
+						httpRequest.onreadystatechange = function() 
+						{
+							if (httpRequest.readyState == 4) 
+							{
+								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", collapseImageURL);
+								}
+								else
+								{
+									sectionToggle.setAttribute("src", expandImageURL);
+								}
+								inProgress[sectionID] = false;
+							}
+						}
+						httpRequest.send();
+					}
+				}
+			</xsl:text>
+		</script>
 	</xsl:template>
 
Index: main/trunk/greenstone3/web/interfaces/oran/transform/pages/document.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/transform/pages/document.xsl	(revision 23989)
+++ main/trunk/greenstone3/web/interfaces/oran/transform/pages/document.xsl	(revision 24009)
@@ -39,5 +39,5 @@
 				<gslib:documentTitle/>
 			</xsl:variable>
-			Document
+			<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.document')"/>
 		</a>
 	</xsl:template>
@@ -63,4 +63,5 @@
 	<xsl:template match="/page/pageResponse/document">
 		<xsl:if test="$bookswitch = 'off'">
+			<div id="bookdiv" style="visibility:hidden; height:0px;"><xsl:text> </xsl:text></div>
 			<!-- Add the Javascript that adds and removes highlighting ( *** in document-scripts.xsl *** ) -->
 			<xsl:call-template name="highlightingScript"/>
@@ -111,5 +112,5 @@
 				<div id="gs-document-text" class="documenttext"> 
 					<xsl:apply-templates select="documentNode" mode="document"/>
-				</div>
+				</div>	
 			</xsl:otherwise>
 		</xsl:choose>
@@ -137,12 +138,9 @@
 			<!-- Expand/collapse button -->
 			<td class="headerTD">
-				<div id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');">			
-					<xsl:attribute name="class">
-					<xsl:choose>
-						<xsl:when test="nodeContent and not(documentNode)">icon leafNode toggleImageCollapse</xsl:when>
-						<xsl:otherwise>icon toggleImageCollapse</xsl:otherwise>
-					</xsl:choose>
+				<img id="dtoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">			
+					<xsl:attribute name="src">
+						<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
 					</xsl:attribute>
-				</div>
+				</img>
 			</td>
 			
@@ -166,5 +164,5 @@
 				<td class="backToTop headerTD">
 					<a href="#top">
-						<xsl:text disable-output-escaping="yes">&#9650;back to top</xsl:text>
+						<xsl:text disable-output-escaping="yes">&#9650;</xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'doc.back_to_top')"/>
 					</a>
 				</td>
@@ -211,8 +209,12 @@
 						<xsl:choose>
 							<xsl:when test="not(nodeContent and not(documentNode))">
-								<div id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon toggleImageCollapse"/>
+								<img id="ttoggle{@nodeID}" onclick="toggleSection('{@nodeID}');" class="icon">
+									<xsl:attribute name="src">
+										<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'collapse_image')"/>
+									</xsl:attribute>
+								</img>
 							</xsl:when>
 							<xsl:otherwise>
-								<div class="icon"/>
+								<xsl:attribute name="class">emptyIcon</xsl:attribute>
 							</xsl:otherwise>
 						</xsl:choose>
@@ -222,22 +224,24 @@
 				<!-- The chapter/page icon -->
 				<td>
-					<div>
-						<xsl:attribute name="class">
+					<img>
+						<xsl:if test="nodeContent and not(documentNode)">
+							<xsl:attribute name="class">leafNode</xsl:attribute>
+						</xsl:if>
+						
+						<xsl:attribute name="src">
 							<xsl:choose>
 								<xsl:when test="nodeContent and not(documentNode)">
-									icon leafNode toggleImagePage
+									<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'page_image')"/> 
 								</xsl:when>
 								<xsl:otherwise>
-									icon toggleImageChapter
+									<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'chapter_image')"/>
 								</xsl:otherwise>
 							</xsl:choose>
 						</xsl:attribute>
-					</div>
+					</img>
 				</td>
 				
 				<!-- The section name, links to the section in the document -->
 				<td>				
-					<!-- display this item from the table of contents -->
-					<xsl:if test="$isCurrent"><xsl:attribute name="class">current</xsl:attribute></xsl:if>
 					<a>
 						<xsl:attribute name="href">#<xsl:value-of select="@nodeID"/></xsl:attribute>
@@ -302,33 +306,34 @@
 	
 	<xsl:template name="viewOptions">
+		<xsl:call-template name="realisticBooksScript"/>
 		<table class="viewOptions"><tr>
+			<!-- Realistic books link -->
+			<xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
+				<td>
+					<!-- old url = {$library_name}?a=d&amp;c={$collName}&amp;d={/page/pageResponse/document/documentNode[1]/@nodeID}&amp;dt={/page/pageResponse/document/documentNode/@docType}&amp;p.a=b&amp;p.s={/page/pageResponse/service/@name}&amp;book=on&amp;ed=1 -->
+					<div title="Realistic book view" id="rbOptionDiv"><input id="rbOption" type="checkbox" onclick="bookInit();" class="optionCheckBox"/></div>
+				</td>
+			</xsl:if>
+			
 			<!-- Highlight on/off button -->
 			<xsl:if test="/page/pageRequest/paramList/param[@name = 'p.a']/@value = 'q'">
 				<td>
-					<a id="highlightOption">
-						<xsl:choose>
-							<xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'on'">
-								<xsl:attribute name="href">
-									<xsl:text>javascript:removeHighlight();</xsl:text>
-								</xsl:attribute>
-								<xsl:text>No Highlighting</xsl:text>
-							</xsl:when>
-							<xsl:otherwise>
-								<xsl:attribute name="href">
-									<xsl:text>javascript:addHighlight();</xsl:text>
-								</xsl:attribute>
-								<xsl:text>Highlighting</xsl:text>
-							</xsl:otherwise>
-						</xsl:choose>
-					</a>
-				</td>
-			</xsl:if>
-			
-			<!-- Realistic books link -->
-			<xsl:if test="/page/pageResponse/collection[@name = $collName]/metadataList/metadata[@name = 'tidyoption'] = 'tidy'">
-				<td>
-					<a title="Realistic book view" href="{$library_name}?a=d&amp;c={$collName}&amp;d={/page/pageResponse/document/documentNode[1]/@nodeID}&amp;dt={/page/pageResponse/document/documentNode/@docType}&amp;p.a=b&amp;p.s={/page/pageResponse/service/@name}&amp;book=on&amp;ed=1">
-						<img src="interfaces/oran/images/rbook.png"/>
-					</a>
+					<div id="highlightOptionDiv" title="Search term highlighting">
+						<input id="highlightOption" type="checkbox" class="optionCheckBox">
+							<xsl:choose>
+								<xsl:when test="/page/pageRequest/paramList/param[@name = 'hl']/@value = 'on'">
+									<xsl:attribute name="onclick">
+										<xsl:text>removeHighlight();</xsl:text>
+									</xsl:attribute>
+									<xsl:attribute name="checked">true</xsl:attribute>
+								</xsl:when>
+								<xsl:otherwise>
+									<xsl:attribute name="onclick">
+										<xsl:text>addHighlight();</xsl:text>
+									</xsl:attribute>
+								</xsl:otherwise>
+							</xsl:choose>
+						</input>
+					</div>
 				</td>
 			</xsl:if>
Index: main/trunk/greenstone3/web/interfaces/oran/transform/pages/pref.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/transform/pages/pref.xsl	(revision 23989)
+++ main/trunk/greenstone3/web/interfaces/oran/transform/pages/pref.xsl	(revision 24009)
@@ -186,4 +186,7 @@
 								<xsl:value-of select="/page/pageRequest/paramList/param[@name='hitsPerPage']/@value"/>
 							</xsl:when>
+							<xsl:when test="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']">
+								<xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']/@value"/>
+							</xsl:when>
 							<xsl:otherwise>
 								20
@@ -195,5 +198,5 @@
 					</div>
 					<div class="paramValue">
-						<select name="hitsPerPage">
+						<select name="s1.hitsPerPage">
 							<option value="20">
 								<xsl:if test="$hits=20">
@@ -230,4 +233,7 @@
 								<xsl:value-of select="/page/pageRequest/paramList/param[@name='maxDocs']/@value"/>
 							</xsl:when>
+							<xsl:when test="/page/pageRequest/paramList/param[@name='s1.maxDocs']">
+								<xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.maxDocs']/@value"/>
+							</xsl:when>
 							<xsl:otherwise>100</xsl:otherwise>
 						</xsl:choose>
@@ -237,5 +243,5 @@
 					</div>
 					<div class="paramValue">
-						<input name="maxDocs" size="3" value="{$mdocs}" />
+						<input name="s1.maxDocs" size="3" value="{$mdocs}" />
 					</div>
 					
Index: main/trunk/greenstone3/web/interfaces/oran/transform/pages/query.xsl
===================================================================
--- main/trunk/greenstone3/web/interfaces/oran/transform/pages/query.xsl	(revision 23989)
+++ main/trunk/greenstone3/web/interfaces/oran/transform/pages/query.xsl	(revision 24009)
@@ -32,4 +32,28 @@
 								<input type="hidden" name="startPage" value="1"/>
 							</xsl:if>
+							<xsl:choose>
+								<xsl:when test="/page/pageRequest/paramList/param[@name = 's1.maxDocs']">
+									<input type="hidden" name="s1.maxDocs">
+										<xsl:attribute name="value">
+											<xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.maxDocs']/@value"/>
+										</xsl:attribute>
+									</input>
+								</xsl:when>
+								<xsl:otherwise>
+									<input type="hidden" name="s1.maxDocs" value="100"/>
+								</xsl:otherwise>
+							</xsl:choose>
+							<xsl:choose>
+								<xsl:when test="/page/pageRequest/paramList/param[@name = 's1.hitsPerPage']">
+									<input type="hidden" name="s1.hitsPerPage">
+										<xsl:attribute name="value">
+											<xsl:value-of select="/page/pageRequest/paramList/param[@name = 's1.hitsPerPage']/@value"/>
+										</xsl:attribute>
+									</input>
+								</xsl:when>
+								<xsl:otherwise>
+									<input type="hidden" name="s1.hitsPerPage" value="20"/>
+								</xsl:otherwise>
+							</xsl:choose>
 
 							<xsl:variable name="ns">s1.</xsl:variable>
@@ -63,18 +87,40 @@
 					</form>
 				</xsl:for-each>
-
 			</xsl:when>
 
 			<xsl:otherwise>
+				<!-- The list of search terms with their frequency and document count -->
 				<p class="termList">
 					<xsl:choose>
+						<!-- If there is only one or two search terms then show the expanded information -->
 						<xsl:when test="count(/page/pageResponse/termList/term) &lt; 3">
 							<xsl:for-each select="/page/pageResponse/termList/term">
-								<span style="font-style:italic;"><xsl:value-of select="@name"/></span> occurs <xsl:value-of select="@freq"/> times in <xsl:value-of select="@numDocsMatch"/> document(s) <br />
+								<span style="font-style:italic;"><xsl:value-of select="@name"/></span>
+								<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.occurs')"/><xsl:text> </xsl:text>
+								<xsl:value-of select="@freq"/>
+								<xsl:choose>
+									<xsl:when test="@freq = 1">
+										<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.time')"/>
+									</xsl:when>
+									<xsl:otherwise>
+										<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.time_plural')"/>
+									</xsl:otherwise>
+								</xsl:choose>
+								<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.in')"/><xsl:text> </xsl:text>
+								<xsl:value-of select="@numDocsMatch"/>
+								<xsl:choose>
+									<xsl:when test="@numDocsMatch = 1">
+										<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document')"/>
+									</xsl:when>
+									<xsl:otherwise>
+										<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
+									</xsl:otherwise>
+								</xsl:choose>
+								<br />
 							</xsl:for-each>
 						</xsl:when>
 						<xsl:otherwise>
 							<xsl:for-each select="/page/pageResponse/termList/term">
-								<span style="font-style:italic;"><xsl:value-of select="@name"/></span> (<xsl:value-of select="@freq"/>);
+								<span style="font-style:italic;"><xsl:value-of select="@name"/></span> (<xsl:value-of select="@freq"/>)
 							</xsl:for-each>
 						</xsl:otherwise>
@@ -110,12 +156,120 @@
 						</li>
 					</xsl:for-each>
+					<br/>
+					
+					<!-- Previous/Next buttons-->
+					<xsl:call-template name="prevNextButtons"/>
 				</ul>
 			</xsl:otherwise>
-
+			
 		</xsl:choose>
 
 	</xsl:template>
-
- 
+	
+	<xsl:template name="prevNextButtons">	
+		<!-- Current page -->
+		<xsl:variable name="currentPage">
+			<xsl:choose>
+				<xsl:when test="/page/pageRequest/paramList/param[@name='startPage']/@value">
+					<xsl:value-of select="/page/pageRequest/paramList/param[@name='startPage']/@value" />
+				</xsl:when>
+				<xsl:when test="/page/pageRequest/paramList/param[@name='s1.startPage']/@value">
+					<xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.startPage']/@value" />
+				</xsl:when>
+				<xsl:otherwise>1</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+	
+		<!-- Find the total number of documents returned -->
+		<xsl:variable name="docMax">
+			<xsl:choose>
+				<xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']">
+					<xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsReturned']"/>
+				</xsl:when>
+				<xsl:when test="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']">
+					<xsl:value-of select="/page/pageResponse/metadataList/metadata[@name = 'numDocsMatched']"/>
+				</xsl:when>
+				<xsl:otherwise><xsl:value-of select="count(/page/pageResponse/documentNodeList/documentNode)"/></xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		
+		<!-- Find the number of documents displayed per page -->
+		<xsl:variable name="docsPerPage">
+			<xsl:choose>
+				<xsl:when test="/page/pageRequest/paramList/param[@name='hitsPerPage']">
+					<xsl:value-of select="/page/pageRequest/paramList/param[@name='hitsPerPage']/@value" />
+				</xsl:when>
+				<xsl:when test="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']">
+					<xsl:value-of select="/page/pageRequest/paramList/param[@name='s1.hitsPerPage']/@value" />
+				</xsl:when>
+				<xsl:otherwise>20</xsl:otherwise>
+			</xsl:choose>
+		</xsl:variable>
+		
+			<table id="searchResultNavTable"><tr>
+				<!-- Previous button -->
+				<td id="prevArrowTD">
+					<xsl:if test="$currentPage != 1">
+						<a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage - 1}">
+							<img src="interfaces/oran/images/previous.png"/>
+						</a>
+					</xsl:if>
+				</td>
+				<td id="prevTD">
+					<xsl:if test="$currentPage != 1">
+						<a href="{$library_name}?a=q&amp;sa={/page/pageRequest/@subaction}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage - 1}">Previous</a>
+					</xsl:if>
+				</td>
+				
+				<!-- Search result status bar (in english it reads "Displaying X to Y of Z documents") -->
+				<xsl:if test="$docMax &gt; 0">
+					<td id="searchResultsStatusBar">
+						<!-- "Displaying" -->
+						<xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.displaying')"/><xsl:text> </xsl:text>
+						<!-- "X" -->
+						<xsl:value-of select="($currentPage - 1) * $docsPerPage + 1"/>
+						<!-- "to" -->
+						<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.to')"/><xsl:text> </xsl:text>
+						<!-- "Y" -->
+						<xsl:choose>
+							<xsl:when test="($currentPage * $docsPerPage + 1) &gt; $docMax">
+								<xsl:value-of select="$docMax"/>
+							</xsl:when>
+							<xsl:otherwise>
+								<xsl:value-of select="$currentPage * $docsPerPage"/>
+							</xsl:otherwise>
+						</xsl:choose>
+						<!-- "of" -->
+						<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.of')"/><xsl:text> </xsl:text>
+						<!-- "Z" -->
+						<xsl:value-of select="$docMax"/>
+						<!-- "document[s]"-->
+						<xsl:choose>
+							<xsl:when test="$docMax = 1">
+								<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document')"/>
+							</xsl:when>
+							<xsl:otherwise>
+								<xsl:text> </xsl:text><xsl:value-of select="util:getInterfaceText($interface_name, /page/@lang, 'query.document_plural')"/>
+							</xsl:otherwise>
+						</xsl:choose>
+					</td>
+				</xsl:if>
+				
+				<!-- Next button -->
+				<td id="nextTD">
+					<xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
+						<a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage + 1}">Next</a>
+					</xsl:if>
+				</td>
+				<td id="nextArrowTD">
+					<xsl:if test="($currentPage * $docsPerPage + 1) &lt; $docMax">
+						<a href="{$library_name}?a=q&amp;sa={/page/pageRequest/paramList/param[@name = 'sa']/@value}&amp;c={$collName}&amp;s={/page/pageResponse/service/@name}&amp;rt=rd&amp;startPage={$currentPage + 1}">
+							<img src="interfaces/oran/images/next.png"/>
+						</a>
+					</xsl:if>
+				</td>
+			</tr></table>
+	</xsl:template>
+
 	<!-- puts all the params into a=p&p=h type form - need to change this if use 
 	multi params  -->
