Index: SrvTxtUtils.py
===================================================================
--- SrvTxtUtils.py	(revision 553)
+++ SrvTxtUtils.py	(revision 585)
@@ -12,5 +12,5 @@
 
 
-srvTxtUtilsVersion = "1.5.1"
+srvTxtUtilsVersion = "1.6"
 
 def getInt(number, default=0):
@@ -133,2 +133,31 @@
     return ImageFile.index_html(self, REQUEST, RESPONSE)
 
+
+def getBrowserType(self):
+    """check the browsers request to find out the browser type"""
+    bt = {}
+    ua = self.REQUEST.get_header("HTTP_USER_AGENT")
+    bt['ua'] = ua
+    bt['isIE'] = False
+    bt['isN4'] = False
+    if string.find(ua, 'MSIE') > -1:
+        bt['isIE'] = True
+    else:
+        bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1)
+        
+    try:
+        nav = ua[string.find(ua, '('):]
+        ie = string.split(nav, "; ")[1]
+        if string.find(ie, "MSIE") > -1:
+            bt['versIE'] = string.split(ie, " ")[1]
+    except: pass
+    
+    bt['isMac'] = string.find(ua, 'Macintosh') > -1
+    bt['isWin'] = string.find(ua, 'Windows') > -1
+    bt['isIEWin'] = bt['isIE'] and bt['isWin']
+    bt['isIEMac'] = bt['isIE'] and bt['isMac']
+    bt['staticHTML'] = False
+
+    return bt
+
+
Index: documentViewer.py
===================================================================
--- documentViewer.py	(revision 584)
+++ documentViewer.py	(revision 585)
@@ -41,65 +41,4 @@
     return node
 
-def browserCheck(self):
-    """check the browsers request to find out the browser type"""
-    bt = {}
-    ua = self.REQUEST.get_header("HTTP_USER_AGENT")
-    bt['ua'] = ua
-    bt['isIE'] = False
-    bt['isN4'] = False
-    bt['versFirefox']=""
-    bt['versIE']=""
-    bt['versSafariChrome']=""
-    bt['versOpera']=""
-    
-    if string.find(ua, 'MSIE') > -1:
-        bt['isIE'] = True
-    else:
-        bt['isN4'] = (string.find(ua, 'Mozilla/4.') > -1)
-    # Safari oder Chrome identification    
-    try:
-        nav = ua[string.find(ua, '('):]
-        nav1=ua[string.find(ua,')'):]
-        nav2=nav1[string.find(nav1,'('):]
-        nav3=nav2[string.find(nav2,')'):]
-        ie = string.split(nav, "; ")[1]
-        ie1 =string.split(nav1, " ")[2]
-        ie2 =string.split(nav3, " ")[1]
-        ie3 =string.split(nav3, " ")[2]
-        if string.find(ie3, "Safari") >-1:
-            bt['versSafariChrome']=string.split(ie2, "/")[1]
-    except: pass
-    # IE identification
-    try:
-        nav = ua[string.find(ua, '('):]
-        ie = string.split(nav, "; ")[1]
-        if string.find(ie, "MSIE") > -1:
-            bt['versIE'] = string.split(ie, " ")[1]
-    except:pass
-    # Firefox identification
-    try:
-        nav = ua[string.find(ua, '('):]
-        nav1=ua[string.find(ua,')'):]
-        if string.find(ie1, "Firefox") >-1:
-            nav5= string.split(ie1, "/")[1]
-            logging.debug("FIREFOX: %s"%(nav5))
-            bt['versFirefox']=nav5[0:3]                   
-    except:pass
-    #Opera identification
-    try:
-        if string.find(ua,"Opera") >-1:
-            nav = ua[string.find(ua, '('):]
-            nav1=nav[string.find(nav,')'):]
-            bt['versOpera']=string.split(nav1,"/")[2]
-    except:pass
-    
-    bt['isMac'] = string.find(ua, 'Macintosh') > -1
-    bt['isWin'] = string.find(ua, 'Windows') > -1
-    bt['isIEWin'] = bt['isIE'] and bt['isWin']
-    bt['isIEMac'] = bt['isIE'] and bt['isMac']
-    bt['staticHTML'] = False
-
-    return bt
-
 def getParentPath(path, cnt=1):
     """returns pathname shortened by cnt"""
@@ -108,4 +47,5 @@
     # split by /, shorten, and reassemble
     return '/'.join(path.split('/')[0:-cnt])
+
 
 ##
@@ -145,4 +85,5 @@
     layer_text_gis = PageTemplateFile('zpt/layer_text_gis', globals())
     layer_text_pundit = PageTemplateFile('zpt/layer_text_pundit', globals())
+    layer_images_annotator = PageTemplateFile('zpt/layer_images_annotator', globals())
     layer_index_extended = PageTemplateFile('zpt/layer_index_extended', globals())
     # toc templates
@@ -161,5 +102,5 @@
     docuviewer_ie_css = ImageFile('css/docuviewer_ie.css',globals())
     # make docuviewer_ie_css refreshable for development
-    docuviewer_ie_css.index_html = refreshingImageFileIndexHtml
+    #docuviewer_ie_css.index_html = refreshingImageFileIndexHtml
     jquery_js = ImageFile('js/jquery.js',globals())
     
@@ -347,10 +288,4 @@
         return self.availableLayers
     
-    def getBrowser(self):
-        """getBrowser the version of browser """
-        bt = browserCheck(self)
-        logging.debug("BROWSER VERSION: %s"%(bt))
-        return bt
-        
     def findDigilibUrl(self):
         """try to get the digilib URL from zogilib"""
Index: zpt/layer_images_annotator.zpt
===================================================================
--- zpt/layer_images_annotator.zpt	(revision 585)
+++ zpt/layer_images_annotator.zpt	(revision 585)
@@ -0,0 +1,83 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<metal:block metal:define-macro="html_head" tal:condition="python:'annotator' in viewLayers">
+  <!--  annotator for digilib -->
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/showdown.js"></script>
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/annotator-dl.js"></script>
+  <script type="text/javascript" tal:attributes="src string:$dlBaseUrl/jquery/jquery.digilib.annotator.js"></script>
+  <link rel="stylesheet" type="text/css" tal:attributes="href string:$dlBaseUrl/jquery/annotator.min.css"/>
+
+  <script type="text/javascript" 
+    tal:define="global annServerUrl string:http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager/annotator;
+    global annTokenUrl string:$viewerUrl/template/token/getLoginToken;
+    annUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s?pn=%s'%(docinfo['documentPath'],pageinfo['pn']);
+    resUrl python:'http://echo.mpiwg-berlin.mpg.de/documents%s'%(docinfo['documentPath']);
+    global annUser python:here.getAuthenticatedUser(anon='anonymous');
+    global annGroup python:request.get('annotator_group', None);
+    permUser python:test(annGroup, 'group:%s'%annGroup, annUser);"
+    tal:content="structure string:
+    dlOpts.digilibFrontendPath='/jquery/digilib-ann.html';
+    dlOpts.annotationServerUrl='$annServerUrl';
+    dlOpts.annotationTokenUrl='$annTokenUrl';
+    dlOpts.annotationUser='$annUser';
+    dlOpts.annotatorPlugins=['Auth','Permissions','Store','Markdown','DigilibIntegrator'];
+    dlOpts.annotatorPluginSettings={'Store':{'annotationData':{'uri':'$annUrl','resource':'$resUrl'},'loadFromSearch':{'uri':'$annUrl'}},
+        'Permissions':{'read':[],'update':['$permUser'],'delete':['$permUser'],'admin':['$permUser']}};
+    "></script>
+</metal:block>
+
+</head>
+<body>
+  <!-- right-side options -->
+  <div class="col buttons">
+    <!-- LAYER DISPLAY OPTION  -->
+    <ul>
+      <li metal:define-macro="layer_select_li">
+        <input type="checkbox" class="autosubmit" name="viewLayer" value="annotator"
+          tal:attributes="checked python:'annotator' in viewLayers" /> Annotator
+      </li>
+    </ul>
+  </div>
+
+  <metal:block metal:define-macro="options_box" tal:condition="python:'annotator' in viewLayers">
+    <!-- BEGIN ANNOTATIONS -->
+    <div class="options">
+      <h4>Annotator</h4>
+      <ul>
+        <li><a href="javascript:$digilib.digilib('setAnnotationMark')"> <img tal:condition="exists:here/template/annotation-mark.png"
+            tal:attributes="src here/template/annotation-mark.png/absolute_url" /> annotate point
+        </a></li>
+        <li><a href="javascript:$digilib.digilib('setAnnotationRegion')"> <img tal:condition="exists:here/template/annotation-region.png"
+            tal:attributes="src here/template/annotation-region.png/absolute_url" /> annotate region
+        </a></li>
+      </ul>
+      <p>
+        User "<span tal:replace="annUser" />"<span tal:condition="annGroup" tal:content="string: ($annGroup)"/>.
+      </p>
+      <!-- TODO: login button -->
+      <form class="autosubmit" tal:attributes="action viewerUrl">
+        <input type="hidden" tal:define="params python:here.getParams(params={'annotator_group':None});" tal:repeat="param params"
+          tal:attributes="name param; value python:params[param]" />
+        <p>
+          In group
+          <select class="autosubmit" name="annotator_group">
+            <option value="" tal:attributes="selected not:annGroup;"> </option>
+            <option
+              tal:repeat="group python:here.getAnnotatorGroupsForUser(user=annUser,annotationServerUrl=annServerUrl)"
+              tal:attributes="value group/id; selected python:group['id']==annGroup;" tal:content="group/name" />
+          </select> <br /> 
+          <input type="submit" value="Go!" />
+        </p>
+      </form>
+      <p tal:define="std modules/Products.PythonScripts.standard">
+        <a class="button" tal:attributes="href python:'%s/login/login?came_from=%s'%(viewerUrl,std.url_quote(here.getLink()))">log in</a>
+      </p>
+    </div>
+    <!-- END ANNOTATIONS -->
+  </metal:block>
+
+</body>
+
+</html>
Index: zpt/viewer_images.zpt
===================================================================
--- zpt/viewer_images.zpt	(revision 543)
+++ zpt/viewer_images.zpt	(revision 585)
@@ -3,4 +3,6 @@
 <html xmlns="http://www.w3.org/1999/xhtml"
   tal:define="docinfo options/docinfo; pageinfo options/pageinfo; viewMode pageinfo/viewMode;
+              viewLayer pageinfo/viewLayer; viewLayers pageinfo/viewLayers;
+              availableLayers python:here.getAvailableLayers().get('images', None);
               tocMode pageinfo/tocMode; viewerUrl docinfo/viewerUrl;
               numPages docinfo/numPages | nothing; dlBaseUrl docinfo/digilibBaseUrl | nothing;">
@@ -27,4 +29,11 @@
             'scalerInsets' : {'x':300, 'y':100}\n
         };\n'''%(dlBaseUrl,docinfo.get('imagePath',''),pageinfo.get('pn','1'))"></script>
+
+<!--  layer headers (rendered always) -->
+<tal:block tal:repeat="layer availableLayers">
+  <tal:block tal:define="mpath string:here/template/layer_images_${layer}/macros/html_head" tal:condition="python:exists(mpath)">
+    <metal:block metal:use-macro="python:path(mpath)" />
+  </tal:block>
+</tal:block>
 
 <script type="text/javascript">
@@ -57,5 +66,5 @@
         <metal:block metal:use-macro="python:path('here/template/toc_%s/macros/main'%tocMode)" />
       </div>
-      <!-- col-main: text page -->
+      <!-- col-main: document page -->
       <div class="col main">
         <div class="ruler top">
@@ -70,5 +79,26 @@
       </div>
       <!-- /col-main -->
+      
       <div class="col buttons">
+        <!-- layer switcher -->
+        <div class="options" tal:condition="availableLayers">
+          <h4>Image layer</h4>
+          <form tal:attributes="action viewerUrl" class="autosubmit">
+            <input type="hidden" tal:define="params python:here.getParams(params={'viewLayer':None})"
+              tal:repeat="param params" tal:attributes="name param; value python:params[param]" />
+            <ul>
+              <!-- layer select buttons (rendered always) -->
+              <tal:block tal:repeat="layer availableLayers">
+                <tal:block tal:define="mpath string:here/template/layer_images_${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>
+
+        <!-- digilib options -->
         <div class="options digilib">
           <ul>
@@ -105,7 +135,15 @@
           </ul>
         </div>
+
+        <!--  layer option boxes (rendered if active) -->
+        <tal:block tal:repeat="layer availableLayers">
+          <tal:block tal:define="mpath string:here/template/layer_images_${layer}/macros/options_box"
+            tal:condition="python:exists(mpath)">
+            <metal:block metal:use-macro="python:path(mpath)" />
+          </tal:block>
+        </tal:block>
       </div>
-    </div>
-    <!-- page-body -->
+    </div><!-- /page-body -->
+    
     <div class="page-body" tal:condition="python:not here.isAccessible(docinfo)">
       <div class="errortext">Sorry, access to this document is restricted.</div>
Index: zpt/viewer_text.zpt
===================================================================
--- zpt/viewer_text.zpt	(revision 571)
+++ zpt/viewer_text.zpt	(revision 585)
@@ -74,5 +74,5 @@
       <!-- right-side options -->
       <div class="col buttons">
-        <!--"BEGIN TEXT DISPLAY"  -->
+        <!--BEGIN TEXT LAYERS -->
         <div class="options" tal:condition="availableLayers">
           <h4>Text layer</h4>
@@ -92,5 +92,5 @@
           </form>
         </div>
-        <!--"END TEXT DISPLAY"-->
+        <!--END TEXT LAYERS-->
 
         <!--"BEGIN TEXT SIZE"-->
