Index: zpt/viewer_index.zpt
===================================================================
--- zpt/viewer_index.zpt	(revision 550)
+++ zpt/viewer_index.zpt	(revision 558)
@@ -4,4 +4,6 @@
   tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode;
                   tocMode pageinfo/tocMode; viewerUrl docinfo/viewerUrl;
+                  viewLayer pageinfo/viewLayer; viewLayers pageinfo/viewLayers;
+                  availableLayers python:here.getAvailableLayers().get('index', None);
                   docpath docinfo/textURLPath | nothing;
                   query nothing;
@@ -11,4 +13,10 @@
 <title tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
 <link rel="stylesheet" href="template/docuviewer_css" type="text/css" />
+<!--  layer headers (rendered always) -->
+<tal:block tal:repeat="layer availableLayers">
+  <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/html_head" tal:condition="python:exists(mpath)">
+    <metal:block metal:use-macro="python:path(mpath)" />
+  </tal:block>
+</tal:block>
 </head>
 <body tal:condition="numPages">
@@ -109,7 +117,25 @@
     <div class="col buttons">
       <div class="options">
+        <h4>Metadata</h4>
+        <form tal:attributes="action viewerUrl" class="autosubmit">
+          <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None,'viewMode':None})"
+            tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
+          <ul>
+            <!-- text layer select buttons (rendered always) -->
+            <tal:block tal:repeat="layer availableLayers">
+              <tal:block tal:define="mpath string:here/template/layer_text_${layer}/macros/layer_select_li"
+                tal:condition="python:exists(mpath)">
+                <li metal:use-macro="python:path(mpath)" />
+              </tal:block>
+            </tal:block>
+          </ul>
+          <input type="submit" value="Go!" />
+        </form>
+      </div>
+
+      <div class="options">
         <h4>Browse</h4>
         <ul class="list">
-        <li><a class="openbutton" tal:attributes="href python:context.getLink('viewMode','auto')">View full document</a></li>
+          <li><a class="openbutton" tal:attributes="href python:context.getLink('viewMode','auto')">View full document</a></li>
         </ul>
       </div>
@@ -123,5 +149,6 @@
             target="_blank">as HTML</a></li>
           <li><a target="_blank"
-            tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath)" target="_blank">as XML</a></li>
+            tal:attributes="href python:'http://mpdl-system.mpiwg-berlin.mpg.de/mpdl/getDoc?doc=%s'%(docpath)" target="_blank">as
+              XML</a></li>
         </ul>
         (copyright and license see below)
@@ -131,5 +158,6 @@
         <h4>Search</h4>
         <form tal:define="queryType string:fulltextMorph" tal:condition="docpath" tal:attributes="action viewerUrl">
-          <input type="hidden" tal:define="params python:here.getParams(params={'query':None,'queryType':None,'viewMode':None,'viewLayer':'search'})"
+          <input type="hidden"
+            tal:define="params python:here.getParams(params={'query':None,'queryType':None,'viewMode':None,'viewLayer':'search'})"
             tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
           <!-- query text -->
@@ -153,7 +181,7 @@
   <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     <!-- footer -->
-    <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
+    <metal:block metal:use-macro="here/template/site_template.pt/macros/footer" />
   </tal:block>
-  
+
 </body>
 <body tal:condition="not:numPages">
@@ -161,5 +189,5 @@
   <tal:block tal:condition="exists:here/template/site_template.pt/macros/footer">
     <!-- footer -->
-    <metal:block metal:use-macro="here/template/site_template.pt/macros/footer"/>
+    <metal:block metal:use-macro="here/template/site_template.pt/macros/footer" />
   </tal:block>
 </body>
