Index: gs3-installations/whakatohea-dl/trunk/sites/wmtb/collect/tipple-waiata/etc/collectionConfig.xml
===================================================================
--- gs3-installations/whakatohea-dl/trunk/sites/wmtb/collect/tipple-waiata/etc/collectionConfig.xml	(revision 37180)
+++ gs3-installations/whakatohea-dl/trunk/sites/wmtb/collect/tipple-waiata/etc/collectionConfig.xml	(revision 37181)
@@ -274,4 +274,6 @@
 
 			<gsf:template name="documentContent">
+			  <script type="text/javascript" src="sites/{$site_name}/collect/{$collName}/script/document_extra.js"><xsl:text> </xsl:text></script>
+			    
 			  <div id="gs-document">
 			    <xsl:call-template name="documentPre"/>
@@ -280,33 +282,79 @@
 			      <gsf:when name="Type" test="equals">
 				<gsf:div>Type: <gsf:metadata name="Type"/></gsf:div>
-				<gsf:div>Lang: <xsl:value-of select="$lang"/></gsf:div>
-
+				
 				<xsl:choose>
 				  <xsl:when test="$lang = 'mi'">
-				    <gsf:div> <gsf:metadata name="mi_NZ_TEASER_caption"/></gsf:div>
-				    <gsf:div> <gsf:metadata name="mi_NZ_TEASER_content"/></gsf:div>
+
+				    <gsf:div>
+				      Metadata in: Te reo MÄori (or switch to <a href="{$library_name}/collection/{$collName}/document/{$docID}?l=en">English</a>)
+				    </gsf:div>
 				    <hr />
-				    <gsf:div> <gsf:metadata name="mi_NZ_DESCRIPTION_caption" separator="; "/></gsf:div>
-				    <gsf:div> <gsf:metadata name="mi_NZ_DESCRIPTION_content" separator="; "/></gsf:div>
+
+				    <gsf:script>
+				      $(document).ready(function() {
+				          displayMetadataDiv("In brief:", ["caption","content"], ["mi_NZ_TEASER_caption", "mi_NZ_TEASER_content"], "tipple-metadata");
+				      });
+				    </gsf:script>
+				    
+				    <gsf:metadata hidden="true" name="mi_NZ_TEASER_caption"/>
+				    <gsf:metadata hidden="true" name="mi_NZ_TEASER_content"/>
+				    
+				    <gsf:script>
+				      $(document).ready(function() {
+				          displayMetadataDiv("In more detail:", ["caption","content"], ["mi_NZ_DESCRIPTION_caption", "mi_NZ_DESCRIPTION_content"], "tipple-metadata");
+				      });
+				    </gsf:script>
+				    
+				    <gsf:metadata hidden="true" name="mi_NZ_DESCRIPTION_caption"/>
+				    <gsf:metadata hidden="true" name="mi_NZ_DESCRIPTION_content"/>
+				    
 				  </xsl:when>
 				  <xsl:otherwise>
-				    <gsf:div> <gsf:metadata name="en_TEASER_caption"/></gsf:div>
-				    <gsf:div> <gsf:metadata name="en_TEASER_content"/></gsf:div>
+				    <gsf:div>
+				      Metadata in : English (or switch to <a href="{$library_name}/collection/{$collName}/document/{$docID}?l=mi">Te Reo MÄori</a>)
+				    </gsf:div>
 				    <hr />
-				    <gsf:div> <gsf:metadata name="en_DESCRIPTION_caption" separator="; "/></gsf:div>
-				    <gsf:div> <gsf:metadata name="en_DESCRIPTION_content" separator="; "/></gsf:div>
+
+				    <gsf:script>
+				      $(document).ready(function() {
+				          displayMetadataDiv("In brief:", ["caption","content"], ["en_TEASER_caption", "en_TEASER_content"], "tipple-metadata");
+				      });
+				    </gsf:script>
+				    
+				    <gsf:metadata hidden="true" name="en_TEASER_caption"/>
+				    <gsf:metadata hidden="true" name="en_TEASER_content"/>
+
+				    <gsf:script>
+				      $(document).ready(function() {
+				          displayMetadataDiv("In more detail:", ["caption","content"], ["en_DESCRIPTION_caption", "en_DESCRIPTION_content"], "tipple-metadata");
+				      });
+				    </gsf:script>				    
+				    <gsf:metadata hidden="true" name="en_DESCRIPTION_caption"/>
+				    <gsf:metadata hidden="true" name="en_DESCRIPTION_content"/>
 				  </xsl:otherwise>
 				</xsl:choose>
-				
+				<gsf:div id="tipple-metadata"/>
 			      </gsf:when>
 			    </gsf:switch>
-			    
+
+			    <gsf:div id="tipple-assocfiles"/>
+			    <gsf:metadata hidden="true" name="contentType"/>
+			    <gsf:metadata hidden="true" name="sourceUri"/>			    
+
+			    <gsf:script>
+			      $(document).ready(function() {
+			          displayAssocfilesDiv("Media elements:", "tipple-assocfiles");
+			      });
+			    </gsf:script>				    
+
 			    <!--
 			    <xsl:call-template name="wrappedSectionImage"/>
 			    -->
-			    <div id="gs-document-text" style="font-size: 65%; line-height: 140%">
+			    <div id="gs-document-text" style="font-size: 75%; line-height: 120%; display: none;">
 				<xsl:call-template name="documentNodeText"/>
 			    </div>
 		          </div>
+
+			  
 			  <xsl:call-template name="documentPost"/>			  			    
 
Index: gs3-installations/whakatohea-dl/trunk/sites/wmtb/collect/tipple-waiata/script/document_extra.js
===================================================================
--- gs3-installations/whakatohea-dl/trunk/sites/wmtb/collect/tipple-waiata/script/document_extra.js	(revision 37181)
+++ gs3-installations/whakatohea-dl/trunk/sites/wmtb/collect/tipple-waiata/script/document_extra.js	(revision 37181)
@@ -0,0 +1,101 @@
+
+function displayMetadataDiv(preamble_text, md_label_array, md_name_array, divID)
+{
+    // Assumes that argument arrays have at least one element in them
+
+    var $outer_div = $('#'+divID);
+
+    var max_num_md_vals = 0;
+    for (var i=0; i<md_name_array.length; i++) {
+	var md_vals = gs.documentMetadata[md_name_array[i]];
+	if (md_vals) {
+	    var num_md_vals = (Array.isArray(md_vals)) ? md_vals.length : 1;
+
+	    if (num_md_vals>max_num_md_vals) {
+		max_num_md_vals = num_md_vals;
+	    }
+	}
+    }
+    
+    if (max_num_md_vals > 0) {
+	$outer_div.append('<div style="font-style: italic">'+preamble_text+'</div>');
+	
+	for (var mdv=0; mdv<max_num_md_vals; mdv++) {
+	    
+	    for (var i=0; i<md_label_array.length; i++) {
+		
+		var md_label = md_label_array[i];
+		var md_name  = md_name_array[i];
+
+		var md_vals = gs.documentMetadata[md_name];
+		if (md_vals) {
+		    var md_val = (Array.isArray(md_vals)) ? md_vals[mdv] : md_vals;
+		
+		    //console.log(md_label + "[" + mdv + "] : " + md_val);
+		    $md_div = $('<div>').append(md_label + ": " + md_val)
+		    $outer_div.append($md_div);
+		}
+	    }
+	    $outer_div.append("<br/>");
+	}
+    }
+}
+
+		   
+
+
+function displayAssocfilesDiv(preamble_text, divID)
+{
+    // Assumes that argument arrays have at least one element in them
+
+    var $outer_div = $('#'+divID);
+
+    var content_type_md_vals = gs.documentMetadata['contentType'];
+    var source_uri_md_vals   = gs.documentMetadata['sourceUri'];
+
+    // To simplify subsequent coding, upgrade a single metadata value
+    // (represented as a string) to be an array with one entry in it
+    
+    if (content_type_md_vals && !Array.isArray(content_type_md_vals)) {
+	content_type_md_vals = [ content_type_md_vals ];
+    }
+    if (source_uri_md_vals && !Array.isArray(source_uri_md_vals)) {
+	source_uri_md_vals = [ source_uri_md_vals ];
+    }
+	
+    // Assume content_type_md_vals and source_uri_md_vals are arrays of the same length
+    var num_md_vals = content_type_md_vals.length
+    
+    
+    if (num_md_vals > 0) {
+	$outer_div.append('<hr/><div style="font-style: italic">'+preamble_text+'</div>');
+	
+	for (var mdv=0; mdv<num_md_vals; mdv++) {
+
+	    var content_type_md_val = content_type_md_vals[mdv];
+	    var source_uri_md_val   = source_uri_md_vals[mdv];
+
+	    //console.log("Processing [" + mdv + "]: " + source_uri_md_val + "("+content_type_md_val+")");
+
+	    var $media_elem;
+	    if ((content_type_md_val == "image/png") || (content_type_md_val == "image/jpeg") || (content_type_md_val == "image/gif")) {
+		$media_elem = $('<img>').attr("src",source_uri_md_val).append(source_uri_md_val);
+	    }
+	    else if (content_type_md_val == "audio/mp3") {
+		$media_elem = $('<audio>').attr("controls","controls").attr("src",source_uri_md_val).append(source_uri_md_val);
+	    }
+	    else if (content_type_md_val == "video/mp4") {
+		$media_elem = $('<video>').attr("controls","controls").attr("src",source_uri_md_val).append(source_uri_md_val);
+	    }
+	    else {
+		var $a_elem = $('<a>').attr("href",source_uri_md_val).append(source_uri_md_val);
+		$media_elem.append(content_type_md_val + ": ").append($a_elem);
+	    }
+	    
+	    var $md_div = $('<div>').append($media_elem);
+	    $outer_div.append($md_div);
+	}
+    }
+}
+
+		   
