changeset 107:85126da2ae21 vendor start

XUL: Digilib Buttons in chrome
author engler
date Tue, 13 May 2003 21:02:22 +0200
parents ecee3ff2f4d0
children a1dd1d324d7d
files client/digitallibrary/CHANGES client/digitallibrary/WEB-INF/digilib-auth.xml client/digitallibrary/WEB-INF/digilib-config.xml client/digitallibrary/WEB-INF/lib/DigilibServlet.jar client/digitallibrary/WEB-INF/lib/clibwrapper_jiio.jar client/digitallibrary/WEB-INF/lib/jai_codec.jar client/digitallibrary/WEB-INF/lib/jai_core.jar client/digitallibrary/WEB-INF/lib/jai_imageio.jar client/digitallibrary/WEB-INF/lib/mlibwrapper_jai.jar client/digitallibrary/WEB-INF/web.xml client/digitallibrary/buttons/menu.js client/digitallibrary/digicat.html client/digitallibrary/digicat.jsp client/digitallibrary/digilib.html client/digitallibrary/digilib.jsp client/digitallibrary/dlImage.jsp client/digitallibrary/dlInfo-js.jsp client/digitallibrary/dlMenu.html client/digitallibrary/modules/cm_separator.gif client/digitallibrary/modules/contextMenu.js client/digitallibrary/modules/fitGIFs.js client/digitallibrary/modules/imago.js client/digitallibrary/modules/pagesTotal.js client/digitallibrary/modules/pdfMaker.js client/digitallibrary/navcat_ie.js client/digitallibrary/navcat_n4.js client/digitallibrary/navcat_n6.js client/digitallibrary/navigation_ie.js client/digitallibrary/navigation_n4.js client/digitallibrary/navigation_n6.js client/digitallibrary/navigation_o6.js client/digitallibrary/server/dlConfig.jsp client/doc/digilib_client.html
diffstat 33 files changed, 2776 insertions(+), 1001 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/CHANGES	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,50 @@
+changes document for digilib-client
+-----------------------------------
+
+
+CURRENT SYMLINKS
+
+navigation_XX.js  ->  navigation14_XX.js
+digilib.jsp       ->  digilib19.jsp
+
+
+CHANGES
+
+24.1.2003 - [different files] : roc
+- New Servlet version 1.5b with internal cleanup and new Request and
+  Configuration classes.
+- New JSPs dlInfo-js.jsp and server/dlConfig.jsp to show the request parameter
+  as JavaScript and the configuration settings as HTML.
+
+8.1.2003 - DigilibServlet.jar : roc
+- New servlet and classes for JAI ImageIO (currently not used).
+
+27.8.2002 - digilib.jsp, digicat.jsp, dlImage.jsp : roc
+
+- Initialization of docBean only once in jspInit.
+- Use of new DigilibRequest object for translation of +++-style requests
+  into parameter-style requests and processing of baseURL.
+
+13.8.2002 - [different files] : roc
+
+- changed all hardcoded occurrences of /docuserver/digitallibrary to
+  work relative or take the path from the request URL. Introduced a
+  variable baseURL to hold the URL path (up to digilib.jsp etc.). Now
+  it should be possible to install digilib in other directories.
+
+20.05.2002 - navigation_o6.js : luginbuehl
+
+- Opera browser support done. the 'b'-key does not work currently, beause
+  Opera uses this key on its own - have to work something out...
+
+18.05.2002 - [different files] : luginbuehl
+
+- works on Opera browser support (functionality is getting better, menu 
+  still has lots of errors)
+- working on a Opera version that does work independantly of the http
+  browser imitation set (though!)
+
+18.05.2002 - modules/pagesTotal.js : luginbuehl
+
+- fixied an error in function page(keepArea) which did not work on all 
+  browsers correctly.
--- a/client/digitallibrary/WEB-INF/digilib-auth.xml	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/WEB-INF/digilib-auth.xml	Tue May 13 21:02:22 2003 +0200
@@ -1,5 +1,4 @@
-<!--
--->
+<!-- Authentication configuration file for Digital Document Library -->
 <auth-config>
 
   <digilib-paths>
--- a/client/digitallibrary/WEB-INF/digilib-config.xml	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/WEB-INF/digilib-config.xml	Tue May 13 21:02:22 2003 +0200
@@ -13,6 +13,12 @@
        Directories with low-resolution images are first in list. -->
   <parameter name="basedir-list" value="/docuserver/scaled/small:/docuserver/images:/docuserver/scans/quellen" />
 
+  <!-- Java class to use for image operations -->
+  <parameter name="docuimage-class" value="digilib.image.JAIDocuImage" />
+
+  <!-- is sending whole image files with mo=file allowed? -->
+  <parameter name="sendfile-allowed" value="true" />
+
   <!-- Restrict access to authorized users.
        User authentication and roles are provided by the servlet container 
        (see tomcat-users.xml).
Binary file client/digitallibrary/WEB-INF/lib/DigilibServlet.jar has changed
Binary file client/digitallibrary/WEB-INF/lib/clibwrapper_jiio.jar has changed
Binary file client/digitallibrary/WEB-INF/lib/jai_codec.jar has changed
Binary file client/digitallibrary/WEB-INF/lib/jai_core.jar has changed
Binary file client/digitallibrary/WEB-INF/lib/jai_imageio.jar has changed
Binary file client/digitallibrary/WEB-INF/lib/mlibwrapper_jai.jar has changed
--- a/client/digitallibrary/WEB-INF/web.xml	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/WEB-INF/web.xml	Tue May 13 21:02:22 2003 +0200
@@ -3,81 +3,117 @@
     "http://java.sun.com/dtd/web-app_2_3.dtd">
 
 <web-app>
-
-
-    <!-- General description of your web application -->
-
-    <display-name>Docuserver</display-name>
-    <description>
-      This is the web frontend of Docuserver.
-    </description>
-
-
-    <servlet>
-      <servlet-name>Scaler</servlet-name>
-      <description>
-	The servlet to scale the digilib images.
-      </description>
-      <servlet-class>digilib.servlet.Scaler</servlet-class>
-      <!-- parameters to the servlet -->
-      <init-param>
-        <param-name>config-file</param-name>
-	<param-value>
-	  /docuserver/www/digitallibrary/WEB-INF/digilib-config.xml
-	</param-value>
-      </init-param>
-      <!-- Load this servlet at server startup time -->
-      <load-on-startup>5</load-on-startup>
-    </servlet>
-
+  <!-- General description of your web application -->
+  <display-name>
+        digilib
+  </display-name>
+  <description>
+        This is the web frontend of the Digital Document Library.
+  </description>
+  <!-- The Scaler servlet -->
+  <servlet>
+        <servlet-name>
+            Scaler
+        </servlet-name>
+        <description>
+            The servlet to scale the digilib images.
+        </description>
+        <servlet-class>
+            digilib.servlet.Scaler
+        </servlet-class>
+        <!-- parameters to the servlet -->
+        <init-param>
+            <param-name>
+                config-file
+            </param-name>
+            <param-value>
+                /docuserver/www/digitallibrary/WEB-INF/digilib-config.xml
+            </param-value>
+        </init-param>
+        <!-- Load this servlet at server startup time -->
+        <load-on-startup>
+            5
+        </load-on-startup>
+  </servlet>
   <!-- We want to finger around with the default JSP servlet... -->
   <servlet>
-    <servlet-name>doc-jsp</servlet-name>
-    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
-    <init-param>
-      <param-name>logVerbosityLevel</param-name>
-      <param-value>WARNING</param-value>
-    </init-param>
-      <!-- parameters to the servlet -->
-      <init-param>
-        <param-name>config-file</param-name>
-	<param-value>
-	  /docuserver/www/digitallibrary/WEB-INF/digilib-config.xml
-	</param-value>
-      </init-param>
-    <load-on-startup>3</load-on-startup>
+        <servlet-name>
+            doc-jsp
+        </servlet-name>
+        <servlet-class>
+            org.apache.jasper.servlet.JspServlet
+        </servlet-class>
+        <!-- parameters to the JSP servlet -->
+        <init-param>
+            <param-name>
+                logVerbosityLevel
+            </param-name>
+            <param-value>
+                WARNING
+            </param-value>
+        </init-param>
+        <init-param>
+            <param-name>
+                config-file
+            </param-name>
+            <param-value>
+                /docuserver/www/digitallibrary/WEB-INF/digilib-config.xml
+            </param-value>
+        </init-param>
+        <load-on-startup>
+            3
+        </load-on-startup>
   </servlet>
-
-
+  <!-- The mapping for the Scaler servlet -->
+  <servlet-mapping>
+        <servlet-name>
+            Scaler
+        </servlet-name>
+        <url-pattern>
+            /servlet/Scaler/*
+        </url-pattern>
+  </servlet-mapping>
   <!-- The mapping for the JSP servlet -->
   <servlet-mapping>
-    <servlet-name>doc-jsp</servlet-name>
-    <url-pattern>*.jsp</url-pattern>
+        <servlet-name>
+            doc-jsp
+        </servlet-name>
+        <url-pattern>
+            *.jsp
+        </url-pattern>
   </servlet-mapping>
-
-
   <!-- region for authenticated access -->
-    <security-constraint>
-      <web-resource-collection>
-        <web-resource-name>Authenticated Digilib</web-resource-name>
-	<url-pattern>/authenticated/*</url-pattern>
-      </web-resource-collection>
-      <auth-constraint>
-        <role-name>user</role-name>
-      </auth-constraint>
-   </security-constraint>
-
-    <login-config>
-<!--
-      <auth-method>BASIC</auth-method>
-      <realm-name>digilib</realm-name> 
--->
-      <auth-method>FORM</auth-method>
-      <form-login-config>
-        <form-login-page>/digilib-login.html</form-login-page>
-	<form-error-page>/digilib-fail.html</form-error-page>
-      </form-login-config>
-
-    </login-config>
-
+  <security-constraint>
+        <web-resource-collection>
+            <web-resource-name>
+                Authenticated Digilib
+            </web-resource-name>
+            <url-pattern>
+                /authenticated/*
+            </url-pattern>
+        </web-resource-collection>
+        <!-- we need a default user -->
+        <auth-constraint>
+            <role-name>
+                user
+            </role-name>
+        </auth-constraint>
+  </security-constraint>
+  <login-config>
+  <!--
+        <auth-method>BASIC</auth-method>
+        <realm-name>digilib</realm-name> 
+        -->
+        <auth-method>
+            FORM
+        </auth-method>
+        <form-login-config>
+            <form-login-page>
+                /digilib-login.html
+            </form-login-page>
+            <form-error-page>
+                /digilib-fail.html
+            </form-error-page>
+        </form-login-config>
+  </login-config>
 </web-app>
--- a/client/digitallibrary/buttons/menu.js	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/buttons/menu.js	Tue May 13 21:02:22 2003 +0200
@@ -1,13 +1,19 @@
-function checkBrowser(){
-	this.ver = navigator.appVersion;
-	this.dom = document.getElementById ? 1 : 0;
-	this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom) ? 1 : 0;
-	this.ie4 = (document.all && !this.dom) ? 1 : 0;
-	this.ns5 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0;
-	this.ns4 = (document.layers && !this.dom) ? 1 : 0;
-	this.ie = (this.ie4 || this.ie5);
-	return this;
-}
+function checkBrowser() {
+
+	this.ua    = navigator.userAgent;
+	this.ver   = navigator.appVersion;
+	this.dom   = ( document.getElementById );
+	this.opera = ( this.dom ) && ( this.ua.toLowerCase().indexOf("opera") > -1 );
+	this.ie4   = ( document.all ) && ( !this.dom );
+	this.ie5   = ( this.ver.indexOf("MSIE 5") > -1 ) && ( this.dom );
+	this.ie6   = ( this.ver.indexOf("MSIE 6") > -1 ) && ( this.dom );
+	this.ns4   = ( document.layers ) && ( !this.dom );
+	this.ns6   = ( this.dom ) && ( parseInt(this.ver) >= 5 ) && ( !this.opera );
+	this.ns    = this.ns4 || this.ns6;
+	this.ie    = this.ie4 || this.ie5 || this.ie6;
+
+	return this;
+}
 
 browser = new checkBrowser();
 
@@ -63,7 +69,7 @@
 }
 
 function awayItem(obj) {
-	changeBc("menu" + obj, '');
+	changeBc("menu" + obj, '#666666');
 	timeID = setTimeout("hideMenu()", 700);
 }
 
@@ -138,10 +144,17 @@
 		helpWindow.document.close();	
 
 		// stupid workaround because of netscape 6, that doesen't know the opener property
-		// this workaround is still ok cause netscape 6 has eventbuffer checks so no overflow
-    	if (browser.ns5) {
+		// this workaround is still ok because netscape 6 has eventbuffer checks so no overflow
+    	if (browser.ns6) {
         	semaphor = true;
 		}
+
+		// next stupid workaround because of opera 6, that somehow don't start the 'onLoad'-
+		// attribute in the body tag (the helpwindow does not finish loading)
+    	if (browser.opera) {
+        	setTimeout("semaphor = true;", 50);
+		}
+
 	}
 	
 }
--- a/client/digitallibrary/digicat.html	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/digicat.html	Tue May 13 21:02:22 2003 +0200
@@ -8,7 +8,9 @@
 
 <!-- Beginning of JavaScript --------
 
-this.location = "http://"+location.host+"/docuserver/digitallibrary/digicat.jsp"+location.search;
+//this.location = "http://"+location.host+"/docuserver/digitallibrary/digicat.jsp"+location.search;
+
+this.location.replace(this.location.href.replace(/\.html/, ".jsp"));
 
 // -- End of JavaScript code -------------- -->
 
@@ -17,9 +19,12 @@
 <body>
 <h1>Digital Library Redirect</h1>
 
-<p>You should automatically be redirected to the Digital Library page.</p>
+<p>You should automatically be redirected to the Digital Library page.
+    (<tt>digicat.<b>jsp</b></tt>)</p>
 
-<p>If this doesn't happen please <a href="digicat.jsp">click here</a>.</p>
+<p>If this doesn't happen make shure JavaScript is enabled in your browser. 
+    The Digital Library pages need JavaScript to work. If your problem still 
+    remains, please contact the administrator.</p>
 
 <hr>
 <address>robert.casties@philo.unibe.ch</address>
--- a/client/digitallibrary/digicat.jsp	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/digicat.jsp	Tue May 13 21:02:22 2003 +0200
@@ -1,28 +1,47 @@
+<%@ page language="java" %>
+
+<%!
+// authentication stuff - robert
+// -----------------------------
+// create DocumentBean instance for all JSP requests
+digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean();
+
+// initialize DocumentBean instance in JSP init
+public void jspInit() {
+    try {
+        // set servlet init-parameter
+        docBean.setConfig(getServletConfig());
+    } catch (javax.servlet.ServletException e) {
+        System.out.println(e);
+    }
+}
+%>
+
+<%
+// set up request object for base URL
+digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request);
+// check if authentication is needed and redirect if necessary
+docBean.doAuthentication(dlRequest, response);
+
+// add number of pages
+dlRequest.setPt(docBean.getNumPages(dlRequest));
+%>
+
 <html>
 <head>
 
-<jsp:useBean id="DB" scope="page" class="digilib.servlet.DocumentBean" />
-
-<%
-// set servlet init-parameter
-DB.setConfig(getServletConfig());
-// check if authentication is needed and redirect if necessary
-DB.doAuthentication(request, response);
-%>
-
 <script language="JavaScript">
 
-// DEBUG
-//alert('DIR: <%= DB.getDocuPath(request) %> PAGES: <%= DB.getNumPages(request) %>');
+var baseUrl = "<%= dlRequest.getBaseURL() %>";
 
 // the document's query string (minus "?")
 var query = location.search.substring(1);
 
 // first page number
-var firstPage = <%= DB.getFirstPage(request) %>;
+var firstPage = <%= docBean.getFirstPage(dlRequest) %>;
 
 // number of pages of the document
-var numPages = <%= DB.getNumPages(request) %>;
+var numPages = <%= docBean.getNumPages(dlRequest) %>;
 
     // browser version test to include the corresponding navigation-file
     if ((navigator.appName.toLowerCase() == "netscape") && (parseFloat(navigator.appVersion) < 5.0)) {
--- a/client/digitallibrary/digilib.html	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/digilib.html	Tue May 13 21:02:22 2003 +0200
@@ -5,20 +5,24 @@
 </head>
 
 <script LANGUAGE="JavaScript">
-
 <!-- Beginning of JavaScript --------
 
-this.location = "http://"+location.host+"/docuserver/digitallibrary/digilib.jsp"+location.search;
+// this.location = "http://"+location.host+"/docuserver/digitallibrary/digilib.jsp"+location.search;
+
+this.location.replace(this.location.href.replace(/\.html/, ".jsp"));
 
 // -- End of JavaScript code -------------- -->
+</script>
 
-</SCRIPT>
 <body>
 <h1>Digital Library Redirect</h1>
 
-<p>You should automatically be redirected to the Digital Library page.</p>
+<p>You should automatically be redirected to the Digital Library page. 
+    (<tt>digilib.<b>jsp</b></tt>)</p>
 
-<p>If this doesn't happen please <a href="digilib.jsp">click here</a>.</p>
+<p>If this doesn't happen make shure JavaScript is enabled in your browser. 
+    The Digital Library pages need JavaScript to work. If your problem still 
+    remains, please contact the administrator.</p>
 
 <hr>
 <address>robert.casties@philo.unibe.ch</address>
--- a/client/digitallibrary/digilib.jsp	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/digilib.jsp	Tue May 13 21:02:22 2003 +0200
@@ -1,49 +1,252 @@
-<html>
-<title>Digital Document Library</title>
-<head>
-<jsp:useBean id="DB" scope="page" class="digilib.servlet.DocumentBean" />
-
-<%
-// set servlet init-parameter
-DB.setConfig(getServletConfig());
-// check if authentication is needed and redirect if necessary
-DB.doAuthentication(request, response);
-%>
-
-<script language="JavaScript">
-
-// the document's query string (minus "?")
-var query = location.search.substring(1);
-
-// feel free to uncomment - i have never seen a problem so...
-// // DEBUG 
-// alert('DIR: <%= DB.getDocuPath(request) %> PAGES: <%= DB.getNumPages(request) %>');
-
-// number of pages of the document
-var numPages = <%= DB.getNumPages(request) %>;
-
-// browser version test to include the corresponding navigation-file
-if ((navigator.appName.toLowerCase() == "netscape") && (parseFloat(navigator.appVersion) < 5.0)) {
-	top.document.write('<script src="navigation_n4.js"><\/script>');
-} else if (navigator.appName.toLowerCase() == "netscape") {
-	top.document.write('<script src="navigation_n6.js"><\/script>');
-} else if ((navigator.appName.toLowerCase() == "microsoft internet explorer") && (parseFloat(navigator.appVersion) >= 4.0)) {
-	top.document.write('<script src="navigation11_ie.js"><\/script>');
-} else {
-	alert('Your browser is not directly supported by this client right now.\n\nLoading now the optimised version for Netscape 6, that sticks the most to the w3c specifications.');
-	top.document.write('<script src="navigation_n6.js"><\/script>');
-}
-
-</script>
-
-</head>
-
-<frameset cols="*,90" border="0" onLoad="whichFrame = parent.mainFrame; initPicture(query); loadPicture(2); initScripts();">
-  <frame name="mainFrame" src="about:blank" scrolling="auto">
-  <frameset rows="20,*" border="0">
-    <frame name="pageFrame" src="about:blank" scrolling="no" noresize>
-    <frame name="rightFrame" src="navigation.html" scrolling="no" noresize>
-  </frameset>
-</frameset>
-
-</html>
+<%@ page language="java" %>
+
+<%!
+/*
+Copyright (C) 2003 WTWG, Uni Bern
+ 
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+ 
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+ 
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ 
+Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3
+*/
+// authentication stuff - robert
+// -----------------------------
+// create DocumentBean instance for all JSP requests
+digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean();
+
+// initialize DocumentBean instance in JSP init
+public void jspInit() {
+    try {
+        // set servlet init-parameter
+        docBean.setConfig(getServletConfig());
+    } catch (javax.servlet.ServletException e) {
+        System.out.println(e);
+    }
+}
+%>
+
+
+
+
+<%
+
+// parsing the query
+// -----------------
+
+//digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request);
+digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest();
+dlRequest.setWithRequest(request);
+// check if authentication is needed and redirect if necessary
+docBean.doAuthentication(dlRequest, response);
+
+%>
+
+<%
+
+// the different levels of presentation
+// ------------------------------------
+
+
+// level 3 representation hack - lugi
+      // it would be musch more interesting to check
+      // if the sidebar is actually installed and in
+      // the case it isn't - automatically do it.
+      // however this requires client-side tests and
+      // so slows down everything.
+      // we might want to talk about it for a future
+      // release
+
+if (dlRequest.getLv() == 3) {
+  String userAgent = request.getHeader("User-Agent").toLowerCase();
+  
+  if (userAgent.indexOf("mozilla/5.0") == 0) {
+
+    // mozilla 5 that does not support xul-sidebars
+    if (userAgent.indexOf("opera")     > -1) dlRequest.setLv(2);
+    if (userAgent.indexOf("chimera")   > -1) dlRequest.setLv(2);
+    if (userAgent.indexOf("camino")    > -1) dlRequest.setLv(2);
+    if (userAgent.indexOf("konqueror") > -1) dlRequest.setLv(2);
+    if (userAgent.indexOf("safari")    > -1) dlRequest.setLv(2);
+    if (userAgent.indexOf("galeon")    > -1) dlRequest.setLv(2);
+    if (userAgent.indexOf("skipstone") > -1) dlRequest.setLv(2);
+    if (userAgent.indexOf("k-meleon")  > -1) dlRequest.setLv(2);
+    if (userAgent.indexOf("firebird")  > -1) dlRequest.setLv(2);
+
+    // the chance is quite big, that the browser supports xul-sidebars
+    dlRequest.setLv(1);
+  
+  } else {
+
+    // redirect to level 2 because of definitive lack of sidebar support
+    dlRequest.setLv(2);
+  }
+}
+
+
+
+switch (dlRequest.getLv()) {
+
+  // LEVEL 0 --------------------------------------------------------------
+
+  case 0:
+%>
+
+<%
+    break; // level 0
+
+
+
+
+  // LEVEL 1 --------------------------------------------------------------
+
+  case 1:
+%>
+
+<%
+    // checking if the height and width of this client is already known
+    if ((dlRequest.getDw() == 0) || (dlRequest.getDh() == 0)) {
+%>
+
+<html>
+<head>
+<script language="Javascript">
+
+function redirect() {
+
+  if (document.body) {
+
+    // internet explorer + opera
+    client = "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
+
+  } else {
+
+    // mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.)
+    client = "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
+
+  }
+
+  location.replace(document.URL + client);
+}
+
+</script>
+</head>
+<body bgcolor="#666666" onload="redirect()">
+</body>
+</html>
+
+<%
+    } else {
+
+      // add number of pages
+      dlRequest.setPt(docBean.getNumPages(dlRequest));
+
+      String imageLocation = dlRequest.getBaseURL() + "/servlet/Scaler/?" + dlRequest.getAsString();
+%>
+
+<html>
+<head>
+<title>Digital Document Library - Alcatraz (Level 1)</title>
+
+<script language="JavaScript">
+
+var baseUrl = "<%= dlRequest.getBaseURL() %>";
+
+// browser version test to include the corresponding navigation-file
+if (navigator.userAgent.toLowerCase().indexOf("opera") > -1) {
+  document.write('<script src="navigation_o6.js"><\/script>');
+} else if (navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
+  document.write('<script src="navigation_ie.js"><\/script>');
+} else if (navigator.userAgent.toLowerCase().indexOf("mozilla\/4") > -1) {
+  document.write('<script src="navigation_n4.js"><\/script>');
+} else if (navigator.userAgent.toLowerCase().indexOf("mozilla\/5") > -1) {
+  document.write('<script src="navigation_n6.js"><\/script>');
+} else {
+  alert('Your browser is not directly supported by this client right now.\n\nLoading now the optimised version for Netscape 6, that sticks the most to the w3c specifications.');
+  document.write('<script src="navigation_n6.js"><\/script>');
+}
+
+// add module to show the total number of pages (not browser dependant!)
+document.write('<script src="modules\/pagesTotal.js"><\/script>\n');
+document.write('<script src="modules\/mirror.js"><\/script>\n');
+document.write('<script src="modules\/imago.js"><\/script>\n');
+document.write('<script src="modules\/pixelByPixel.js"><\/script>\n');
+document.write('<script src="modules\/newReferences.js"><\/script>\n');
+document.write('<script src="modules\/fitGIFs.js"><\/script>\n');
+
+</script>
+
+</head>
+
+<body bgcolor="#666666" onload='init_imago("<%= dlRequest.getFilePath() %>", "<%= dlRequest.getPn() %>", "<%= dlRequest.getWs() %>", "<%= dlRequest.getMo() %>", "<%= dlRequest.getMk() %>", "<%= dlRequest.getWx() %>", "<%= dlRequest.getWy() %>", "<%= dlRequest.getWw() %>", "<%= dlRequest.getWh() %>", "<%= dlRequest.getPt() %>", "<%= dlRequest.getBrgt() %>", "<%= dlRequest.getCont() %>", "<%= dlRequest.getRot() %>", "<%= dlRequest.getRgba_s() %>", "<%= dlRequest.getRgbm_s() %>")'>
+
+ <div id="lay1" style="position: absolute; left: 10px; top: 10px; visibility: visible"><img name="pic" src="<%= imageLocation %>" border="0"></div>
+
+ <div id="dot0" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark1.gif" border="0"></div>
+ <div id="dot1" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark2.gif" border="0"></div>
+ <div id="dot2" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark3.gif" border="0"></div>
+ <div id="dot3" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark4.gif" border="0"></div>
+ <div id="dot4" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark5.gif" border="0"></div>
+ <div id="dot5" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark6.gif" border="0"></div>
+ <div id="dot6" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark7.gif" border="0"></div>
+ <div id="dot7" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark8.gif" border="0"></div>
+ <div id="eck1" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="olinks.gif" border="0"></div>
+ <div id="eck2" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="orechts.gif" border="0"></div>
+ <div id="eck3" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="ulinks.gif" border="0"></div>
+ <div id="eck4" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="urechts.gif" border="0"></div>
+
+</body>
+
+</html>
+<%
+    }
+%>
+
+<%
+    break; // level 1
+
+
+
+
+  // LEVEL 2 --------------------------------------------------------------
+
+  case 2:
+%>
+
+<%
+    // retrieve request in new paramter format and redirect to level 1
+    dlRequest.setLv(1);
+    String query = "digilib.jsp?" + dlRequest.getAsString();
+%>
+
+<html>
+<head>
+<title>Digital Document Library - Alcatraz (Level 2)</title>
+</head>
+
+<frameset cols="*,90" border="0">
+  <frame name="mainFrame" src="<%= query %>" scrolling="auto">
+  <frameset rows="20,*" border="0">
+    <frame name="pageFrame" src="about:blank" scrolling="no" noresize>
+    <frame name="rightFrame" src="dlMenu.html" scrolling="no" noresize>
+  </frameset>
+</frameset>
+
+</html>
+
+<%
+    break; // level 2
+
+} // end switch
+
+%>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/dlImage.jsp	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,94 @@
+<%
+// checking if the height and width of this client is already known
+if ((request.getParameter("dw") == null) || (request.getParameter("dh") == null)) {
+%>
+
+<html>
+<head>
+<script language="Javascript">
+
+function redirect() {
+
+	if (navigator.appName.toLowerCase() == "netscape") {	// mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.)
+		client = "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
+	} else {												// ie
+		client = "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
+	}
+
+	location.replace("dlImage.jsp?<%= request.getQueryString() %>" + client);
+}
+
+</script>
+</head>
+<body bgcolor="#666666" onload="redirect()">
+</body>
+</html>
+
+<%
+} else {
+
+digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest();
+/* default values for parameters
+dlRequest.setFn("/");					// url of the page/document
+dlRequest.setPn(1);					// page number
+dlRequest.setWs(1);					// scale factor
+dlRequest.setMo("");					// special options like 'fit' for gifs
+dlRequest.setMk("0/0");					// marks
+dlRequest.setWx(0);					// left edge of image (float from 0 to 1)
+dlRequest.setWy(0);					// top edge in image (float from 0 to 1)
+dlRequest.setWw(1);					// width of image (float from 0 to 1)
+dlRequest.setWh(1);					// height of image (float from 0 to 1)
+*/
+// overrriding default parameters with provided parameters from query-string
+dlRequest.setWithRequest(request);
+
+String imageLocation = dlRequest.getBaseURL() + "/servlet/Scaler/?" + dlRequest.getAsString();
+%>
+
+<html>
+<head>
+<script language="JavaScript">
+
+var baseUrl = "<%= dlRequest.getBaseURL() %>";
+
+// browser version test to include the corresponding navigation-file
+if (navigator.userAgent.toLowerCase().indexOf("opera") > -1) {
+	document.write('<script src="navigation_o6.js"><\/script>');
+} else if (navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
+	document.write('<script src="navigation_ie.js"><\/script>');
+} else if (navigator.userAgent.toLowerCase().indexOf("mozilla\/4") > -1) {
+	document.write('<script src="navigation_n4.js"><\/script>');
+} else if (navigator.userAgent.toLowerCase().indexOf("mozilla\/5") > -1) {
+	document.write('<script src="navigation_n6.js"><\/script>');
+} else {
+	alert('Your browser is not directly supported by this client right now.\n\nLoading now the optimised version for Netscape 6, that sticks the most to the w3c specifications.');
+	document.write('<script src="navigation_n6.js"><\/script>');
+}
+
+// add module to show the total number of pages (not browser dependant!)
+document.write('<script src="modules\/pagesTotal.js"><\/script>');
+// document.write('<script src="modules\/pdfMaker.js"><\/script>');
+
+</script>
+</head>
+<body bgcolor="#666666" onload='init_pagesTotal("<%= dlRequest.getFilePath() %>", "<%= dlRequest.getPn() %>", "<%= dlRequest.getWs() %>", "<%= dlRequest.getMo() %>", "<%= dlRequest.getMk() %>", "<%= dlRequest.getWx() %>", "<%= dlRequest.getWy() %>", "<%= dlRequest.getWw() %>", "<%= dlRequest.getWh() %>", "<%= dlRequest.getPt() %>")'>
+
+<div id="lay1" style="position: absolute; left: 10px; top: 10px; visibility: visible"><img name="pic" src="<%= imageLocation %>" border="0"></div>
+
+<div id="dot0" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark1.gif" border="0"></div>
+<div id="dot1" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark2.gif" border="0"></div>
+<div id="dot2" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark3.gif" border="0"></div>
+<div id="dot3" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark4.gif" border="0"></div>
+<div id="dot4" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark5.gif" border="0"></div>
+<div id="dot5" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark6.gif" border="0"></div>
+<div id="dot6" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark7.gif" border="0"></div>
+<div id="dot7" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark8.gif" border="0"></div>
+<div id="eck1" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="olinks.gif" border="0"></div>
+<div id="eck2" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="orechts.gif" border="0"></div>
+<div id="eck3" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="ulinks.gif" border="0"></div>
+<div id="eck4" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="urechts.gif" border="0"></div>
+</body>
+</html>
+<%
+}
+%>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/dlInfo-js.jsp	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,44 @@
+<%@ page language="java" %>
+
+<%!
+// authentication stuff - robert
+// -----------------------------
+// create DocumentBean instance for all JSP requests
+digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean();
+
+// initialize DocumentBean instance in JSP init
+public void jspInit() {
+    try {
+        // set servlet init-parameter
+        docBean.setConfig(getServletConfig());
+    } catch (javax.servlet.ServletException e) {
+        System.out.println(e);
+    }
+}
+%>
+
+<%
+// parse the query
+digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request);
+// add number of pages from DocBean
+dlRequest.setPt(docBean.getNumPages(dlRequest));
+%>
+
+// Automatically generated JavaScript snippet with parameters
+
+var dlreqPt = <%= dlRequest.getPt() %>; // total number of pages (generated by sevlet)
+
+var dlreqRequestPath = "<%= dlRequest.getRequestPath() %>";  // url of the page/document			
+var dlreqFn = "<%= dlRequest.getFn() %>"; // url of the page/document
+var dlreqFilePath = "<%= dlRequest.getFilePath() %>"; // effective path of the page/document
+var dlreqPn = "<%= dlRequest.getPn() %>"; // page number
+var dlreqDw = "<%= dlRequest.getDw() %>"; // width of client in pixels
+var dlreqDh = "<%= dlRequest.getDh() %>"; // height of client in pixels
+var dlreqWx = "<%= dlRequest.getWx() %>"; // left edge of image (float from 0 to 1)
+var dlreqWy = "<%= dlRequest.getWy() %>"; // top edge in image (float from 0 to 1)
+var dlreqWw = "<%= dlRequest.getWw() %>"; // width of image (float from 0 to 1)
+var dlreqWh = "<%= dlRequest.getWh() %>"; // height of image (float from 0 to 1)
+var dlreqWs = "<%= dlRequest.getWs() %>"; // scale factor
+var dlreqMo = "<%= dlRequest.getMo() %>"; // special options like 'fit' for gifs
+var dlreqMk = "<%= dlRequest.getMk() %>"; // marks
+var dlreqBaseURL = "<%= dlRequest.getBaseURL() %>"; // base URL (from http:// to below /servlet)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/dlMenu.html	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,108 @@
+<html>
+<head>
+<style type="text/css">
+.menu {position:absolute; visibility:hidden}
+
+.item1 {position:absolute; left:33; width:50; height:14; clip:rect(0,50,14,0); visibility:hidden}
+.item2 {position:absolute; left:43; width:40; height:14; clip:rect(0,40,14,0); visibility:hidden}
+.item3 {position:absolute; left:3; width:80; height:14; clip:rect(0,80,14,0); visibility:hidden}
+
+.text {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF; text-decoration: none}
+</style>
+<script language="JavaScript" src="buttons/menu.js"></script>
+<script language="JavaScript">
+// because on a netscape 4.xx bug (messing up with layers on resize) we cache the window
+// resize event and redisplay the navigation frame
+if (document.layers && !document.getElementById) {
+	window.onresize = function() {parent.rightFrame.location.reload();}
+}
+
+
+// variable that store the texts for contexthelp
+var helpText = new Array();
+
+helpText[0]  = "'back'-button|Click on this button to load the previous image (usually the next page from a manuscript).";
+helpText[1]  = "'next'-button|Click on this button to load the next image (usually the next page from a manuscript).";
+helpText[2]  = "'page'-button|After clicking 'page' you will be prompted for a specific page you want to see.<br>Note that the page number refers to the same serie you are in now.";
+helpText[3]  = "'digicat'-button|Click here to open a new window containing thumbnails of the current series pages to navigate.";
+helpText[4]  = "'mark'-button|You can set marks into the picture. After hitting 'mark' you have to click on the desired picures location, a numbered mark appears.<br>Check out 'reference' to make these marks (up to 8) visible for others.";
+helpText[5]  = "'reference'-button|Choose LaTeX or HTML mode to get a link for the actual (zoomed) picture with all set marks.<br>This link can easily be included in a TeX- or HTML-formatted document/page.";
+helpText[6]  = "'zoom area'-button|With 'zoom area' you can zoom into any rectangular field for the current picture.<br>After clicking on the button click on the image to set any corner (ex. topleft), release the mousebutton and move the mouse until you have the desired size, then click again.";
+helpText[7]  = "'zoom point'-button|Click on 'zoom point' then click into a point of the picture. This gives you a zoomed picture centered around your clicked point.";
+helpText[8]  = "'zoom out'-button|To gain the original unzoomed picture, click on 'zoom out'.<br>Note that any set marks are still saved at their positions.";
+helpText[9]  = "'move to'-button|This button allows you change the center of a zoomed picture, while not changing the current zoom-factor.<br>Use: Click on the point in the picture you want to be the new center of the image.";
+helpText[10] = "'scale'-button|By clicking on one of the menu entries you can select the factor the currently displayed picture will be scaled.<br>Note: a scale factor of '1.0' means that the picture fits right into the working area, while '2.0' means that it will be twice as high and large.";
+//helpText[11] = "'make pdf'-button|You can make a PDF with several pictures from this directory in it. Click the button and follow the instructions.";
+helpText[12] = "'?'-button|In its menu you are able change options like the visibility of this contextsensitive help, with 'Keep area' the program keeps its current area when changing to another page or with 'Fit GIFs' you can force to program to adjust the size of GIF-images to the working area.";
+
+
+// boolean variable to eighter show or not show the additional help
+// change in the menuitem its original mark
+var showHelp = false;
+
+// variable to tell if while changing to another page it should keep the area
+// change in the menuitem its original mark
+var keepArea = true;
+
+// changes to the correct mark of menu33 (fit GIFs)
+// I know it is not very nice to do it this way
+function checkAtt3() {
+	if (parent.mainFrame && parent.mainFrame.att) {
+		if (parent.mainFrame.att.length >= 3) {
+			if (parent.mainFrame.att[3].indexOf('f') > -1) changeMark(33);
+		}
+	} else {
+		setTimeout("checkAtt3()", 100);
+	}
+}
+
+</script>
+</head>
+
+<body bgcolor="#CCCCCC" leftmargin="8" marginwidth="8" topmargin="5" marginheight="5" onload="preloadImages();" onunload="closeContextHelp()">
+<a href="javascript:parent.mainFrame.backPage(keepArea)" onmouseover="overButton(0)" onmouseout="awayButton(0)"><img src="buttons/back0.gif" width="73" height="30" border="0"></a><br>
+<a href="javascript:parent.mainFrame.nextPage(keepArea)" onmouseover="overButton(1)" onmouseout="awayButton(1)"><img src="buttons/next0.gif" width="73" height="30" border="0"></a><br>
+<a href="javascript:parent.mainFrame.page(keepArea)" onmouseover="overButton(2)" onmouseout="awayButton(2)"><img src="buttons/page0.gif" width="73" height="30" border="0"></a><br>
+<a href="javascript:parent.mainFrame.digicat()" onmouseover="overButton(3)" onmouseout="awayButton(3)"><img src="buttons/digicat0.gif" width="73" height="30" border="0"></a><br><br>
+<a href="javascript:parent.mainFrame.mark()" onmouseover="overButton(4)" onmouseout="awayButton(4)"><img src="buttons/mark0.gif" width="73" height="30" border="0"></a><br>
+<a href="javascript:hideMenu(); showMenu(1)" onmouseover="overButton(5)" onmouseout="awayButton(5)"><img src="buttons/reference0.gif" width="73" height="30" border="0"></a><br><br>
+<a href="javascript:parent.mainFrame.zoomArea()" onmouseover="overButton(6)" onmouseout="awayButton(6)"><img src="buttons/zoomarea0.gif" width="73" height="30" border="0"></a><br>
+<a href="javascript:parent.mainFrame.zoomPoint()" onmouseover="overButton(7)" onmouseout="awayButton(7)"><img src="buttons/zoompoint0.gif" width="73" height="30" border="0"></a><br>
+<a href="javascript:parent.mainFrame.zoomOut()" onmouseover="overButton(8)" onmouseout="awayButton(8)"><img src="buttons/zoomout0.gif" width="73" height="30" border="0"></a><br>
+<a href="javascript:parent.mainFrame.moveTo()" onmouseover="overButton(9)" onmouseout="awayButton(9)"><img src="buttons/moveto0.gif" width="73" height="30" border="0"></a><br><br>
+<a href="javascript:hideMenu(); showMenu(2)" onmouseover="overButton(10)" onmouseout="awayButton(10)"><img src="buttons/scale0.gif" width="73" height="30" border="0"></a><br><br>
+<!-- 
+<a href="javascript:parent.mainFrame.makePDF()" onmouseover="overButton(11)" onmouseout="awayButton(11)"><img src="buttons/makepdf0.gif" width="73" height="30" border="0"></a><br><br>
+-->
+<a href="javascript:hideMenu(); showMenu(3)" onmouseover="overButton(12)" onmouseout="awayButton(12)"><img src="buttons/questionmark0.gif" width="73" height="30" border="0"></a>
+
+<div id="menu1" class="menu" style="top:201; left:31; width:54; height:33; clip:rect(0,54,33,0)"></div>
+ <div id="menu11" class="item1" style="top:203"><center><a href="#" class="text" onClick="hideMenu(); parent.mainFrame.ref(0); return false;" onmouseover="overItem(11)" onmouseout="awayItem(11)">LaTeX</a></center></div>
+ <div id="menu12" class="item1" style="top:218"><center><a href="#" class="text" onClick="hideMenu(); parent.mainFrame.ref(1); return false;" onmouseover="overItem(12)" onmouseout="awayItem(12)">HTML</a></center></div>
+
+<div id="menu2" class="menu" style="top:379; left:41; width:44; height:93; clip:rect(0,44,93,0)"></div>
+ <div id="menu21" class="item2" style="top:381"><center><a href="#" class="text" onClick="hideMenu(); parent.mainFrame.scale(0.7); return false;" onmouseover="overItem(21)" onmouseout="awayItem(21)">0.7</a></center></div>
+ <div id="menu22" class="item2" style="top:396"><center><a href="#" class="text" onClick="hideMenu(); parent.mainFrame.scale(1.0); return false;" onmouseover="overItem(22)" onmouseout="awayItem(22)">1.0</a></center></div>
+ <div id="menu23" class="item2" style="top:411"><center><a href="#" class="text" onClick="hideMenu(); parent.mainFrame.scale(1.5); return false;" onmouseover="overItem(23)" onmouseout="awayItem(23)">1.5</a></center></div>
+ <div id="menu24" class="item2" style="top:426"><center><a href="#" class="text" onClick="hideMenu(); parent.mainFrame.scale(2.0); return false;" onmouseover="overItem(24)" onmouseout="awayItem(24)">2.0</a></center></div>
+ <div id="menu25" class="item2" style="top:441"><center><a href="#" class="text" onClick="hideMenu(); parent.mainFrame.scale(2.5); return false;" onmouseover="overItem(25)" onmouseout="awayItem(25)">2.5</a></center></div>
+ <div id="menu26" class="item2" style="top:456"><center><a href="#" class="text" onClick="hideMenu(); parent.mainFrame.scale(3.0); return false;" onmouseover="overItem(26)" onmouseout="awayItem(26)">3.0</a></center></div>
+
+<div id="menu3" class="menu" style="top:430; left:1; width:84; height:48; clip:rect(0,84,48,0)"></div>
+ <div id="menu31" class="item3" style="top:432"><center><a href="#" class="text" onclick="changeMark(31); hideMenu(); changeHelp(); return false;" onmouseover="overItem(31)" onmouseout="awayItem(31)"><img id="mark31" src="buttons/nomark.gif" border="0">Contexthelp</a></center></div>
+ <div id="menu32" class="item3" style="top:447"><center><a href="#" class="text" onclick="changeMark(32); keepArea = !keepArea; return false;" onmouseover="overItem(32)" onmouseout="awayItem(32)"><img id="mark32" src="buttons/mark.gif" border="0">Keep&nbsp;area</a></center></div>
+ <div id="menu33" class="item3" style="top:462"><center><a href="#" class="text" onclick="changeMark(33); (parent.mainFrame.att[3].indexOf('f') > -1) ? parent.mainFrame.att[3] = '' : parent.mainFrame.att[3] = 'fit'; parent.mainFrame.loadPicture(2, keepArea); return false;" onmouseover="overItem(33)" onmouseout="awayItem(33)"><img id="mark33" src="buttons/nomark.gif" border="0">Fit&nbsp;GIFs</a></center></div>
+
+
+<script language="Javascript">
+// initial background color of the menues (has to be done like this, 
+// otherwise menues in ns4 you will have wrong dimensions)
+changeBc("menu1", "#666666");
+changeBc("menu2", "#666666");
+changeBc("menu3", "#666666");
+
+// launch the initial check of att[3] (fit gifs) and change to the correct mark
+checkAtt3();
+</script>
+</body>
+</html>
Binary file client/digitallibrary/modules/cm_separator.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/modules/contextMenu.js	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,117 @@
+/****************************************************************************
+ * - module for digilib: adds a menu for digilib functionality              *
+ *                                                                          *
+ *   pressing [ctrl] + [left mousebutton] to bring it up                    *
+ *                                                                          *
+ *   to install this module, you do not just have to load it in             *
+ *   dlImage.jsp (like every module), but you also have to put the          *
+ *   following three lines in the <body> of dlImage.jsp:                    *
+ *                                                                          *
+ *      <script language="JavaScript">                                      *
+ *        cm_htmlCode();                                                    *
+ *      </script>                                                           *
+ *                                                                          *
+ *                       christian luginbuehl (luginbuehl@student.unibe.ch) *
+ ****************************************************************************/
+
+browser = new checkBrowser();
+
+var menu = false;
+
+if (browser.ns4) {
+	document.captureEvents(Event.MOUSEDOWN);
+	document.onmousedown = showmenu;
+} else if (browser.ns6) {
+	document.addEventListener("mousedown", showmenu, true);
+} else {
+	document.onmousedown = showmenu;
+}
+
+
+function checkBrowser() {
+
+	this.ua    = navigator.userAgent;
+	this.ver   = navigator.appVersion;
+	this.dom   = ( document.getElementById );
+	this.opera = ( this.dom ) && ( this.ua.toLowerCase().indexOf("opera") > -1 );
+	this.ie4   = ( document.all ) && ( !this.dom );
+	this.ie5   = ( this.ver.indexOf("MSIE 5") > -1 ) && ( this.dom );
+	this.ie6   = ( this.ver.indexOf("MSIE 6") > -1 ) && ( this.dom );
+	this.ns4   = ( document.layers ) && ( !this.dom );
+	this.ns6   = ( this.dom ) && ( parseInt(this.ver) >= 5 ) && ( !this.opera );
+	this.ns    = ( this.ns4 ) || ( this.ns6 );
+	this.ie    = ( this.ie4 ) || ( this.ie5 ) || ( this.ie6 );
+
+	return this;
+}
+
+
+function showmenu(event) {
+
+	if (browser.ns4) {
+		if (event.which == 1 && (event.modifiers == Event.CONTROL_MASK) && !menu) {
+			menu = true;
+			document.layers["menu"].left = Math.min(event.pageX + 3, innerWidth - 160 + pageXOffset);
+			document.layers["menu"].top  = Math.min(event.pageY + 3, innerHeight - 180 + pageYOffset);
+			document.layers["menu"].clip.width = 140;
+			document.layers["menu"].bgColor = "#DDDDDD";
+			document.layers["menu"].margin = 4;
+			document.layers["menu"].visibility = "show";
+		} else if (menu) {
+			menu = false;
+			document.layers["menu"].visibility = "hide";
+		}
+
+	} else if (browser.ns6) {
+		if (event.which == 1 && event.ctrlKey && !menu) {
+			menu = true;
+			document.getElementById("menu").style.left = Math.min(event.pageX + 3, innerWidth - 160 + pageXOffset);
+			document.getElementById("menu").style.top  = Math.min(event.pageY + 3, innerHeight - 160 + pageYOffset);
+			document.getElementById("menu").style.visibility = "visible";
+		} else if (menu) {
+			menu = false;
+			document.getElementById("menu").style.visibility = "hidden";
+		}
+	} else {
+		event = window.event;
+
+		if (event.button == 1 && event.ctrlKey && !menu) {
+			menu = true;
+			document.all["menu"].style.left = event.x + 3;
+			document.all["menu"].style.top  = event.y + 3;
+			document.all["menu"].style.visibility = "visible";
+		} else if (menu) {
+			menu = false;
+			document.all["menu"].style.visibility = "hidden";
+		}
+	}
+}
+
+
+function cm_htmlCode() {
+	
+	document.write('<style type="text/css">\n');
+	document.write(' table                       {border-left: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-right: 1px solid #000000; border-bottom: 1px solid #000000; }\n');
+	document.write(' td                          {font-family: verdana; color: #666666; font-size: 11px; text-decoration: none}\n');
+	document.write(' a:link, a:visited, a:active {font-family: verdana; color: #666666; font-size: 11px; font-weight: bold; text-decoration: none}\n');
+	document.write(' a:hover                     {font-family: verdana; color: #000000; font-size: 11px; text-decoration: none}\n');
+	document.write('</style>\n');
+	document.write('<div ID="menu" style="position:absolute; width: 140px; background-color: #DDDDDD; visibility:hidden">\n');
+  	document.write(' <table width="140" align="center" cellspacing="0" cellpadding="0">\n');
+   	document.write('  <tr><td><a href="#" onmousedown="backPage(false)">&nbsp;&nbsp;prev</a></td></tr>\n');
+   	document.write('  <tr><td><a href="#" onmousedown="nextPage(false)">&nbsp;&nbsp;next</a></td></tr>\n');
+   	document.write('  <tr><td><a href="#" onmousedown="page(false)">&nbsp;&nbsp;page #</a></td></tr>\n');
+   	document.write('  <tr><td align="center"><img src="modules/cm_separator.gif" width="136" height="3"></td></tr>\n');
+   	document.write('  <tr><td><a href="#" onmousedown="mark()">&nbsp;&nbsp;mark</a></td></tr>\n');
+   	document.write('  <tr><td>&nbsp;&nbsp;reference <a href="#" onmousedown="ref(1)">html</a> <a href="#" onmousedown="ref(0)">latex</a></td></tr>\n');
+   	document.write('  <tr><td align="center"><img src="modules/cm_separator.gif" width="136" height="3"></td></tr>\n');
+   	document.write('  <tr><td><a href="#" onmousedown="zoomArea()">&nbsp;&nbsp;zoom area</a></td></tr>\n');
+   	document.write('  <tr><td><a href="#" onmousedown="zoomPoint()">&nbsp;&nbsp;zoom point</a></td></tr>\n');
+   	document.write('  <tr><td><a href="#" onmousedown="moveTo()">&nbsp;&nbsp;move to</a></td></tr>\n');
+   	document.write('  <tr><td><a href="#" onmousedown="zoomOut()">&nbsp;&nbsp;zoom out</a></td></tr>\n');
+   	document.write('  <tr><td align="center"><img src="modules/cm_separator.gif" width="136" height="3"></td></tr>\n');
+   	document.write('  <tr><td>&nbsp;&nbsp;scale <a href="#" onmousedown="scale(0.7)">0.7</a> <a href="#" onmousedown="scale(1.0)">1.0</a> <a href="#" onmousedown="scale(2.0)">2.0</a> <a href="#" onmousedown="scale(3.0)">3.0</a></td></tr>\n');
+  	document.write(' </table>\n');
+	document.write('</div>\n');
+	
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/modules/fitGIFs.js	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,54 @@
+/*
+Copyright (C) 2003 WTWG, Uni Bern
+ 
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+ 
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+ 
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ 
+Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3
+*/
+/****************************************************************************
+ * - fitGIFs module for digilib                                             *
+ *                                                                          *
+ *                       christian luginbuehl (luginbuehl@student.unibe.ch) *
+ ****************************************************************************/
+
+
+
+/**
+ * fitGIFs
+ */
+function fitGIFs() {
+
+  if (att.mo != "") {
+
+    idx_plus_after  = att.mo.indexOf("fit,");
+    idx_plus_before = att.mo.indexOf(",fit");
+    idx_noplus      = att.mo.indexOf("fit");
+      
+    if (idx_plus_after > -1) {
+      att.mo = att.mo.slice(0, idx_plus_after) + att.mo.slice(idx_plus_after+5);
+    } else if (idx_plus_before > -1) {
+      att.mo = att.mo.slice(0, idx_plus_before) + att.mo.slice(idx_plus_before+5);
+    } else if (idx_noplus > -1) {
+      att.mo = att.mo.slice(0, idx_noplus) + att.mo.slice(idx_noplus+4);
+    } else {
+      att.mo += ",fit";
+    }
+  } else {
+    att.mo = "fit";
+  }
+  
+  loadPicture(2);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/modules/imago.js	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,181 @@
+/*
+Copyright (C) 2003 WTWG, Uni Bern
+ 
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+ 
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+ 
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ 
+Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3
+*/
+/****************************************************************************
+ * - imago module for digilib                                               *
+ *                                                                          *
+ *  adds brightness and color manipulation to digilib                       *
+ *                                                                          *
+ *                       christian luginbuehl (luginbuehl@student.unibe.ch) *
+ ****************************************************************************/
+
+// overriding (some kind of inheriting) init in navigation_XX.js
+function init_imago(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt, brgt, cont, rot, rgba, rgbm) {
+
+	// debug window to check the parameters passed
+	//alert ("DEBUG message (parameters in init imago.js):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh + "\npt = " + pt + "\nbrgt = " + brgt + "\ncont = " + cont + "\nrot = " + rot + "\nrgba = " + rgba + "\nrgbm = " + rgbm);
+
+	// calling original init
+	init_pagesTotal(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt);
+
+	att.brgt = parseInt(brgt);
+	att.cont = parseFloat(cont);
+	att.rot  = parseFloat(rot);
+	att.rgba = rgba;
+	att.rgbm = rgbm;
+	
+	focus();
+}
+
+
+/**
+ * overriding 'loadPicture' in navigation
+ */
+function loadPicture(detailGrade, keepArea) {
+
+	// the different detailGrades:
+	// 		0 -> back, next, page
+	//		1 -> zoomout
+	//		2 -> zoomarea, zoompoint, moveto, scaledef
+
+	var newQuery = "fn=" + att.fn + "&pn=" + att.pn + "&ws=" + att.ws + "&mo=" + att.mo;
+
+	if (detailGrade == 0) {
+		att.mk = "0/0";
+		att.brgt = 0;
+		att.cont = 0;
+	}
+
+	if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) {
+		att.wx = 0;
+		att.wy = 0;
+		att.ww = 1;
+		att.wh = 1;
+	}
+
+	newQuery += "&mk=" + att.mk + "&wx=" + att.wx + "&wy=" + att.wy + "&ww=" + att.ww + "&wh=" + att.wh;
+
+	if (navigator.appName.toLowerCase() == "netscape") {	// mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.)
+		newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
+	} else {												// ie, opera
+		newQuery += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
+	}
+	
+	newQuery += "&pt=" + att.pt;
+
+	newQuery += "&brgt=" + att.brgt;
+	newQuery += "&cont=" + att.cont;
+	newQuery += "&rot=" + att.rot;
+	newQuery += "&rgba=" + att.rgba;
+	newQuery += "&rgbm=" + att.rgbm;
+
+	newQuery += "&lv=1";
+
+	// debug window - checking the parameters passed to the next image
+	//alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
+        //alert(location.host + ":" + location.port + location.pathname);
+	location.href = location.protocol + "//" + location.host + location.pathname + "?" + newQuery;
+}
+
+
+/**
+ * brightness (value of brightness between -255 - +255)
+ */
+function brightness(value) {
+
+  if ((value < -255) || (value > 255)) {
+
+    alert ("Illegal brightness value (-255 to +255)");
+    
+  } else {
+    
+    att.brgt = value;
+
+    loadPicture(2);
+  }
+
+}
+
+/**
+ * contrast (value of contrast - range?)
+ */
+function contrast(value) {
+
+  att.cont = parseFloat(value);
+
+  loadPicture(2);
+
+}
+
+/**
+ * rotation (value from 0 to 360 degrees)
+ */
+function rotation(value) {
+
+  value = parseFloat(value) % 360;
+  
+  if (value < 0) {
+    value += 360;
+  }
+
+  att.rot = value;
+
+  loadPicture(2);
+
+}
+
+/**
+ * rgb add (r/g/b, each value from -255 to +255)
+ */
+function rgba(value) {
+
+  values = value.split("/");
+  
+  if (values.length != 3) {
+    alert ("Illegal parameter format (r/g/b)");
+  } else if ((values[0] < -255) || (values[0] > 255)) {
+    alert ("Illegal red additioner (-255 to 255)");
+  } else if ((values[1] < -255) || (values[1] > 255)) {
+    alert ("Illegal green additioner (-255 to 255)");
+  } else if ((values[2] < -255) || (values[2] > 255)) {
+    alert ("Illegal blue additioner (-255 to 255)");
+  } else {
+ 
+    att.rgba = value;
+    loadPicture(2);
+
+  }
+}
+
+/**
+ * rgb multiply (r/g/b, each value from ??? )
+ */
+function rgbm(value) {
+
+  values = value.split("/");
+  
+  if (values.length != 3) {
+    alert ("Illegal parameter format (r/g/b)");
+  } else {
+ 
+    att.rgbm = value;
+    loadPicture(2);
+
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/modules/pagesTotal.js	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,132 @@
+/*
+Copyright (C) 2003 WTWG, Uni Bern
+ 
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+ 
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+ 
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ 
+Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3
+*/
+/****************************************************************************
+ * - sample module for digilib                                              *
+ *                                                                          *
+ *                       christian luginbuehl (luginbuehl@student.unibe.ch) *
+ ****************************************************************************/
+
+// overriding (some kind of inheriting) init in navigation13_XX.js
+function init_pagesTotal(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt) {
+
+	// debug window to check the parameters passed
+	//alert ("DEBUG message (parameters in init pagesTotal.js):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh + "\npt = " + pt);
+
+	// calling original init
+	init(pu, pn, ws, mo, mk, wx, wy, ww, wh);
+
+	att.pt = parseInt(pt);
+	
+	pagesTotal();
+
+	focus();
+}
+
+
+/**
+ * shows page XX of YY in a dedicated frame
+ *
+ * ATTENTION: some stuff is still to do, because of some incompatibilities between servlet and client
+ *            i should be able to read the total number of pages in dlImage.jsp
+ */
+function pagesTotal() {
+
+	if (parent.pageFrame) {
+		parent.pageFrame.document.open();
+		parent.pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">');
+		parent.pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: 11px">');
+		parent.pageFrame.document.write(att.pn + '<b> of </b>' + att.pt + '</p></body></html>');
+		parent.pageFrame.document.close();
+	}
+}
+
+
+/**
+ * overriding nextPage in navigation
+ */
+function nextPage(keepArea) {
+
+    att.pn = parseInt(att.pn) + 1;
+
+    if (att.pn <= att.pt || isNaN(att.pt)) {
+        loadPicture(0, keepArea);
+    } else {
+	    att.pn = parseInt(att.pn) - 1;
+        alert("You are already on the last page!");
+    }
+}
+
+
+/**
+ * overriding 'page' in navigation
+ */
+function page(keepArea) {
+
+	do {
+    	var page = prompt("Goto Page (1 - " + att.pt + "):", 1);
+    	
+	} while ((page != null) && ((isNaN(page)) || (page < 1) || (page > att.pt)));
+
+   	if ((page != null) && (page != att.pn)) {
+		att.pn = page;
+		loadPicture(0, keepArea);
+	}
+}
+
+
+/**
+ * overriding 'loadPicture' in navigation
+ */
+function loadPicture(detailGrade, keepArea) {
+
+	// the different detailGrades:
+	// 		0 -> back, next, page
+	//		1 -> zoomout
+	//		2 -> zoomarea, zoompoint, moveto, scaledef
+
+	var newQuery = "fn=" + att.fn + "&pn=" + att.pn + "&ws=" + att.ws + "&mo=" + att.mo;
+
+	if (detailGrade == 0) {
+		att.mk = "0/0";
+	}
+
+	if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) {
+		att.wx = 0;
+		att.wy = 0;
+		att.ww = 1;
+		att.wh = 1;
+	}
+
+	newQuery += "&mk=" + att.mk + "&wx=" + att.wx + "&wy=" + att.wy + "&ww=" + att.ww + "&wh=" + att.wh;
+
+	if (navigator.appName.toLowerCase() == "netscape") {	// mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.)
+		newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
+	} else {												// ie, opera
+		newQuery += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
+	}
+	
+	newQuery += "&pt=" + att.pt;
+	newQuery += "&lv=1";
+
+	// debug window - checking the parameters passed to the next image
+	//alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
+
+	location.href = location.protocol + "//" + location.host + location.pathname + "?" + newQuery;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/modules/pdfMaker.js	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,17 @@
+/****************************************************************************
+ * - sample module for digilib                                              *
+ *                                                                          *
+ *                       christian luginbuehl (luginbuehl@student.unibe.ch) *
+ ****************************************************************************/
+
+/**
+ * generates a pdf-file using a perl-script called makepdf
+ *
+ * ATTENTION: the script and this function are only in alpha stadium
+ */
+function makePDF() {
+	var pages = prompt("Enter the pages you like to make a PDF of:", att[1]);
+	if (pages != null && pages != "") {
+		top.location = "http://penelope.unibe.ch/cgi-bin/cgiwrap/luginbul/makepdf.cgi?dir=" + att[0] + "&pages=" + pages;
+	}
+}
--- a/client/digitallibrary/navcat_ie.js	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/navcat_ie.js	Tue May 13 21:02:22 2003 +0200
@@ -1,23 +1,3 @@
-/* navcat_ie -- JS library for digilib (IE version)
-
-  Digital Image Library servlet components
-
-  Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch)
-
-  This program is free software; you can redistribute  it and/or modify it
-  under  the terms of  the GNU General  Public License as published by the
-  Free Software Foundation;  either version 2 of the  License, or (at your
-  option) any later version.
-   
-  Please read license.txt for the full details. A copy of the GPL
-  may be found at http://www.gnu.org/copyleft/lgpl.html
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
 // these two global variables have to be initialised before the frist use of the functions below
 // to fill in the attributes you can use the function initPicture provided below
 // - array with all attributes
@@ -44,7 +24,7 @@
 	whichFrame.document.write('<style type="text/css">.myFont {font-family: sans-serif, Arial; font-size: 11px; color: #FFFFFF}</style>');
 	whichFrame.document.write('<script language="Javascript">');
 	whichFrame.document.write('function loadDigilib(idx) {');
-	whichFrame.document.write('linkRef = "http://' + location.host + '/docuserver/digitallibrary/digilib.html?' + parent.att[0] + '+" + idx;');
+	whichFrame.document.write('linkRef = "' + parent.baseUrl + '/digilib.jsp?' + parent.att[0] + '+" + idx;');
 	whichFrame.document.write('win = window.open(linkRef, "digilib");');
 	whichFrame.document.write('win.focus();');	
 	whichFrame.document.write('}');	
@@ -57,7 +37,7 @@
 		whichFrame.document.write('<tr>');
 		for (j = 0; j < att[3]; j++) {
 			indexNr = parseInt(att[1])+i*parseInt(att[3])+j;
-			thumb  = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/"
+			thumb  = parent.baseUrl + "/servlet/Scaler/";
 			thumb += att[0] + "?" + "pn=" + indexNr + "&ws=1.0&mo=fit&dw=" + cellWidth + "&dh=" + (cellHeight-25);
 			whichFrame.document.write('<td align="center" valign="middle" width="' + cellWidth + '" height="' + cellHeight + '" class="myFont">');
 			whichFrame.document.write('<a href="javascript:loadDigilib(' + indexNr + ')">');
--- a/client/digitallibrary/navcat_n4.js	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/navcat_n4.js	Tue May 13 21:02:22 2003 +0200
@@ -1,23 +1,3 @@
-/* navcat_n4 -- JS library for digilib (Netscape4 version)
-
-  Digital Image Library servlet components
-
-  Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch)
-
-  This program is free software; you can redistribute  it and/or modify it
-  under  the terms of  the GNU General  Public License as published by the
-  Free Software Foundation;  either version 2 of the  License, or (at your
-  option) any later version.
-   
-  Please read license.txt for the full details. A copy of the GPL
-  may be found at http://www.gnu.org/copyleft/lgpl.html
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
 // these two global variables have to be initialised before the frist use of the functions below
 // to fill in the attributes you can use the function initPicture provided below
 // - array with all attributes
@@ -44,7 +24,7 @@
 	whichFrame.document.write('<style type="text/css">.myFont {font-family: sans-serif, Arial; font-size: 11px; color: #FFFFFF}</style>');
 	whichFrame.document.write('<script language="Javascript">');
 	whichFrame.document.write('function loadDigilib(idx) {');
-	whichFrame.document.write('linkRef = "http://' + location.host + '/docuserver/digitallibrary/digilib.html?' + parent.att[0] + '+" + idx;');
+	whichFrame.document.write('linkRef = "' + parent.baseUrl + '/digilib.jsp?' + parent.att[0] + '+" + idx;');
 	whichFrame.document.write('win = window.open(linkRef, "digilib");');
 	whichFrame.document.write('win.focus();');	
 	whichFrame.document.write('}');	
@@ -57,7 +37,7 @@
 		whichFrame.document.write('<tr>');
 		for (j = 0; j < att[3]; j++) {
 			indexNr = parseInt(att[1])+i*parseInt(att[3])+j;
-			thumb  = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/"
+			thumb  = parent.baseUrl + "/servlet/Scaler/";
 			thumb += att[0] + "?" + "pn=" + indexNr + "&ws=1.0&mo=fit&dw=" + cellWidth + "&dh=" + (cellHeight-25);
 			whichFrame.document.write('<td align="center" valign="middle" width="' + cellWidth + '" height="' + cellHeight + '" class="myFont">');
 			whichFrame.document.write('<a href="javascript:loadDigilib(' + indexNr + ')">');
--- a/client/digitallibrary/navcat_n6.js	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/navcat_n6.js	Tue May 13 21:02:22 2003 +0200
@@ -1,23 +1,3 @@
-/* navcat_n6 -- JS library for digilib (Mozilla version)
-
-  Digital Image Library servlet components
-
-  Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch)
-
-  This program is free software; you can redistribute  it and/or modify it
-  under  the terms of  the GNU General  Public License as published by the
-  Free Software Foundation;  either version 2 of the  License, or (at your
-  option) any later version.
-   
-  Please read license.txt for the full details. A copy of the GPL
-  may be found at http://www.gnu.org/copyleft/lgpl.html
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
 // these two global variables have to be initialised before the frist use of the functions below
 // to fill in the attributes you can use the function initPicture provided below
 // - array with all attributes
@@ -44,7 +24,7 @@
 	whichFrame.document.write('<style type="text/css">.myFont {font-family: sans-serif, Arial; font-size: 11px; color: #FFFFFF}</style>');
 	whichFrame.document.write('<script language="Javascript">');
 	whichFrame.document.write('function loadDigilib(idx) {');
-	whichFrame.document.write('linkRef = "http://' + location.host + '/docuserver/digitallibrary/digilib.html?' + parent.att[0] + '+" + idx;');
+	whichFrame.document.write('linkRef = "' + parent.baseUrl + '/digilib.jsp?' + parent.att[0] + '+" + idx;');
 	whichFrame.document.write('win = window.open(linkRef, "digilib");');
 	whichFrame.document.write('win.focus();');	
 	whichFrame.document.write('}');	
@@ -57,7 +37,7 @@
 		whichFrame.document.write('<tr>');
 		for (j = 0; j < att[3]; j++) {
 			indexNr = parseInt(att[1])+i*parseInt(att[3])+j;
-			thumb  = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/"
+			thumb  = parent.baseUrl + "/servlet/Scaler/";
 			thumb += att[0] + "?" + "pn=" + indexNr + "&ws=1.0&mo=fit&dw=" + cellWidth + "&dh=" + (cellHeight-25);
 			whichFrame.document.write('<td align="center" valign="middle" width="' + cellWidth + '" height="' + cellHeight + '" class="myFont">');
 			whichFrame.document.write('<a href="javascript:loadDigilib(' + indexNr + ')">');
--- a/client/digitallibrary/navigation_ie.js	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/navigation_ie.js	Tue May 13 21:02:22 2003 +0200
@@ -1,34 +1,63 @@
-/* navigation_ie -- JS library for digilib (IE version)
-
-  Digital Image Library servlet components
-
-  Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch)
-
-  This program is free software; you can redistribute  it and/or modify it
-  under  the terms of  the GNU General  Public License as published by the
-  Free Software Foundation;  either version 2 of the  License, or (at your
-  option) any later version.
-   
-  Please read license.txt for the full details. A copy of the GPL
-  may be found at http://www.gnu.org/copyleft/lgpl.html
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// these two global variables have to be initialised before the frist use of the functions below
-// to fill in the attributes you can use the function initPicture provided below
+// this global variable has to be initialised before the frist use of the functions below
+// to fill in the attributes you can use the function init provided below
 // - array with all attributes
 var att = new Array();
 
-// - variable to store the path to the frame, in which the pictures should be created
-var whichFrame = parent.mainFrame;
+// fill in the values of the "att"-array
+function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) {
+
+	// debug window to check the parameters passed
+	//alert ("DEBUG message (parameters in init):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh);
+
+	// attaching the values to the att-array
+	att[0] = fn;
+	att[1] = parseInt(pn);
+	att[2] = parseFloat(ws);
+	att[3] = mo;
+	att[4] = mk;
+	att[5] = parseFloat(wx);
+	att[6] = parseFloat(wy);
+	att[7] = parseFloat(ww);
+	att[8] = parseFloat(wh);
+	
+	// compatablility issue
+	if (att[3].indexOf("f") > -1) {
+		att[3] = "fit";
+	}
 
-// give a name to the window containing digilib - this way one can test if there is already a
-// digilib-window open and replace the contents of it (ex. digicat)
-window.name = "digilib";
+	// converts the old mark format (0-1000) to new format(0.0 - 1.0)
+	// could even be useless now
+	if (att[4] != "0/0") {
+		var tmp = att[4].split(";");
+		
+		att[4] = "";
+		
+		for (i = 0; i < tmp.length; i++) {
+			tmp[i] = tmp[i].split("/");
+
+			if (tmp[i][0] > 1 && tmp[i][1] > 1) {
+				tmp[i][0] /= 1000;
+				tmp[i][1] /= 1000;
+			}
+			
+			att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
+		}
+		att[4] = att[4].slice(0, -1);
+	}
+
+	// initialisation stuff
+	// ====================
+	
+	setMarks();
+
+	this.document.onkeypress = parseKeypress;
+	focus();
+	
+	// give a name to the window containing digilib - this way one can test if there is already a
+	// digilib-window open and replace the contents of it (ex. digicat)
+	top.window.name = "digilib";
+}
+
 
 // function that launches the ScaleServlet
 // the different detailGrades:
@@ -38,16 +67,7 @@
 
 function loadPicture(detailGrade, keepArea) {
 
-//	alert("wx: " + att[5] + "\tww: " + att[7] + "\nwy: " + att[6] + "\twh: " + att[8]);
-
-	// sorry about that, but IE needs to have a document body to calc the frames width and height
-	whichFrame.document.open();
-	whichFrame.document.write('<html><head></head><body bgcolor="#666666" topmargin="10" leftmargin="10" marginwidth="10" magrinheight="10">');
-
-	var newPicture  = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/"
-	newPicture += att[0] + "?" + "pn=" + att[1] + "&ws=" + att[2];
-	newPicture += "&dw=" + (whichFrame.document.body.clientWidth-30) + "&dh=" + (whichFrame.document.body.clientHeight-30);
-	newPicture += "&mo=" + att[3];
+	var newQuery = "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3];
 
 	if (detailGrade == 0) {
 		att[4] = "0/0";
@@ -59,35 +79,34 @@
 		att[7] = 1;
 		att[8] = 1;
 	}
-	newPicture += "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
+
+	newQuery += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
+	newQuery += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
 
-	whichFrame.document.write('<div ID="lay1" style="position:absolute; left:10;  top:10;  visibility:visible"><img name="pic" src="' + newPicture + '"></div>');
-	whichFrame.document.write('<div ID="dot0" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark1.gif"></div>');
-	whichFrame.document.write('<div ID="dot1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark2.gif"></div>');
-	whichFrame.document.write('<div ID="dot2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark3.gif"></div>');
-	whichFrame.document.write('<div ID="dot3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark4.gif"></div>');
-	whichFrame.document.write('<div ID="dot4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark5.gif"></div>');
-	whichFrame.document.write('<div ID="dot5" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark6.gif"></div>');
-	whichFrame.document.write('<div ID="dot6" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark7.gif"></div>');
-	whichFrame.document.write('<div ID="dot7" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark8.gif"></div>');
-	whichFrame.document.write('<div ID="eck1" style="position:absolute; left:-20; top:120; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/olinks.gif"></div>');
-	whichFrame.document.write('<div ID="eck2" style="position:absolute; left:-20; top:140; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/orechts.gif"></div>');
-	whichFrame.document.write('<div ID="eck3" style="position:absolute; left:-20; top:160; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/ulinks.gif"></div>');
-	whichFrame.document.write('<div ID="eck4" style="position:absolute; left:-20; top:180; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/urechts.gif"></div>');
+	// debug window - checking the parameters passed to the next image
+	//alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
 
-	whichFrame.document.write('</body></html>');
-	
-	whichFrame.document.close();
-
-	initScripts();
-	
-	pageInfo();
-
-	setmark();
+	location.href = location.pathname + "?" + newQuery;
 }
 
 
-function Backpage(keepArea) {
+// constructor holding different values of a point
+function Point(event) {
+
+	this.pageX = parseInt(document.body.scrollLeft+event.x);
+	this.pageY = parseInt(document.body.scrollTop+event.y);
+	
+	this.x = this.pageX-parseInt(document.all.lay1.style.left);
+	this.y = this.pageY-parseInt(document.all.lay1.style.top);
+	
+	this.relX = cropFloat(att[5]+(att[7]*this.x/document.all.lay1.offsetWidth));
+	this.relY = cropFloat(att[6]+(att[8]*this.y/document.all.lay1.offsetHeight));
+
+	return this;
+}
+
+
+function backPage(keepArea) {
 
     att[1] = parseInt(att[1]) - 1;
 
@@ -100,24 +119,19 @@
 }
 
 
-function Nextpage(keepArea) {
+function nextPage(keepArea) {
 
     att[1] = parseInt(att[1]) + 1;
 
-    if (att[1] <= parent.numPages) {
-        loadPicture(0, keepArea);
-    } else {
-	    att[1] = parseInt(att[1]) - 1;
-        alert("You are already on the last page!");
-    }
+	loadPicture(0, keepArea);
 }
 
 
-function Page(keepArea) {
+function page(keepArea) {
 
 	do {
-    	page = prompt("Goto Page (1 - " + parent.numPages + "):", 1);
-	} while ((page != null) && ((page < 1) || (page > parent.numPages)));
+    	page = prompt("Goto Page:", 1);
+	} while ((page != null) && (page < 1));
 
    	if (page != null && page != att[1]) {
 		att[1] = page;
@@ -126,16 +140,16 @@
 }
 
 
-function Digicat() {
-	var url = "http://" + location.host + "/docuserver/digitallibrary/digicat.html?" + att[0] + "+" + att[1];
+function digicat() {
+	var url = "digicat.html?" + att[0] + "+" + att[1];
 	win = window.open(url, "digicat");
 	win.focus();
 }
 
 
-function Ref(refselect) {
+function ref(refselect) {
 
-	var hyperlinkRef = "http://" + location.host + "/docuserver/digitallibrary/digilib.jsp?";
+	var hyperlinkRef = baseUrl + "/digilib.jsp?";
 	hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4];
 	
 	if ((att[5] != 0) || (att[6] != 0) || (att[7] != 1) || (att[8] != 1)) {
@@ -150,15 +164,15 @@
 }
 
 
-function Mark(refselect) {
+function mark(refselect) {
+
+    document.all.lay1.onmousedown = function() {
+		var point = new Point(event);
 
-	if (att[4].split(";").length > 7) {
-		alert("Only 8 marks are possible at the moment!");
-		return;
-	}
-
-    whichFrame.document.all.lay1.onmousedown = function() {
-		e = whichFrame.event;
+		if (att[4].split(";").length > 7) {
+			alert("Only 8 marks are possible at the moment!");
+			return;
+		}
 
         if ((att[4] != "") && (att[4] != "0/0")) {
             att[4] += ";";
@@ -166,71 +180,59 @@
             att[4] = "";
         }
 
-		markX = cropFloat(att[5]+att[7]*(whichFrame.document.body.scrollLeft+e.x-parseInt(whichFrame.document.all.lay1.style.left))/whichFrame.document.all.lay1.offsetWidth);
-		markY = cropFloat(att[6]+att[8]*(whichFrame.document.body.scrollTop+e.y-parseInt(whichFrame.document.all.lay1.style.top))/whichFrame.document.all.lay1.offsetHeight);
+        att[4] += point.relX + "/" + point.relY;
 
-        att[4] += markX + "/" + markY;
-
-        whichFrame.document.all.lay1.cancleBubble = true;
+        document.all.lay1.onmousedown = function() {}
         
-        setmark();
+        setMarks();
     }
 }
 
 
-function Zoomrect() {
+function zoomArea() {
     var state = 0;
-    var x1, y1, x2, y2;
+    var pt1, pt2;
         
-    function Click() {
-		e = whichFrame.event;
-
+    function click() {
         if (state == 0) {
             state = 1;
             
-            x1 = whichFrame.document.body.scrollLeft+e.x;
-            y1 = whichFrame.document.body.scrollTop+e.y;           
-            x2 = x1;
-            y2 = y1;
+			pt1 = new Point(event);
+			pt2 = pt1;
 
-			whichFrame.document.all.eck1.style.left = x1;
-			whichFrame.document.all.eck1.style.top = y1;
-			whichFrame.document.all.eck2.style.left = x2-12;
-			whichFrame.document.all.eck2.style.top = y1;
-			whichFrame.document.all.eck3.style.left = x1;
-			whichFrame.document.all.eck3.style.top = y2-12;
-			whichFrame.document.all.eck4.style.left = x2-12;
-			whichFrame.document.all.eck4.style.top = y2-12;
+			document.all.eck1.style.left = pt1.pageX;
+			document.all.eck1.style.top = pt1.pageY;
+			document.all.eck2.style.left = pt2.pageX-12;
+			document.all.eck2.style.top = pt1.pageY;
+			document.all.eck3.style.left = pt1.pageX;
+			document.all.eck3.style.top = pt2.pageY-12;
+			document.all.eck4.style.left = pt2.pageX-12;
+			document.all.eck4.style.top = pt2.pageY-12;
 
-			whichFrame.document.all.eck1.style.visibility="visible";
-			whichFrame.document.all.eck2.style.visibility="visible";
-			whichFrame.document.all.eck3.style.visibility="visible";
-			whichFrame.document.all.eck4.style.visibility="visible";
+			document.all.eck1.style.visibility="visible";
+			document.all.eck2.style.visibility="visible";
+			document.all.eck3.style.visibility="visible";
+			document.all.eck4.style.visibility="visible";
             
-            whichFrame.document.all.lay1.onmousemove = Move;
-            whichFrame.document.all.eck4.onmousemove = Move;
+            document.all.lay1.onmousemove = move;
+            document.all.eck4.onmousemove = move;
             
         } else {
+			pt2 = new Point(event);
 
-			x1 -= parseInt(whichFrame.document.all.lay1.style.left);
-			y1 -= parseInt(whichFrame.document.all.lay1.style.top);			
-
-            x2 = whichFrame.document.body.scrollLeft+e.x-parseInt(whichFrame.document.all.lay1.style.left);
-            y2 = whichFrame.document.body.scrollTop+e.y-parseInt(whichFrame.document.all.lay1.style.left);         
+            document.all.eck1.visibility="hidden";
+            document.all.eck2.visibility="hidden";
+            document.all.eck3.visibility="hidden";
+            document.all.eck4.visibility="hidden";
 
-            whichFrame.document.all.eck1.visibility="hidden";
-            whichFrame.document.all.eck2.visibility="hidden";
-            whichFrame.document.all.eck3.visibility="hidden";
-            whichFrame.document.all.eck4.visibility="hidden";
+			document.all.lay1.cancleBubble = true;
+			document.all.eck4.cancleBubble = true;
 
-			whichFrame.document.all.lay1.cancleBubble = true;
-			whichFrame.document.all.eck4.cancleBubble = true;
+            att[5] = Math.min(pt1.relX, pt2.relX);
+            att[6] = Math.min(pt1.relY, pt2.relY);
 
-            att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/whichFrame.document.all.lay1.offsetWidth);
-            att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/whichFrame.document.all.lay1.offsetHeight);
-
-            att[7] = cropFloat(att[7]*Math.abs(x1-x2)/whichFrame.document.all.lay1.offsetWidth);
-            att[8] = cropFloat(att[8]*Math.abs(y1-y2)/whichFrame.document.all.lay1.offsetHeight);
+            att[7] = Math.abs(pt1.relX-pt2.relX);
+            att[8] = Math.abs(pt1.relY-pt2.relY);
                         
             if (att[7] != 0 && att[8] != 0) {
               loadPicture(2);
@@ -238,34 +240,31 @@
         }
     }
 
-    function Move() {
-		e = whichFrame.event;
-
-        x2 = whichFrame.document.body.scrollLeft+e.x;
-        y2 = whichFrame.document.body.scrollTop+e.y;           
+    function move() {
+		pt2 = new Point(event);
 
-		whichFrame.document.all.eck1.style.left = ((x1 < x2) ? x1 : x2);
-		whichFrame.document.all.eck1.style.top = ((y1 < y2) ? y1 : y2);
-		whichFrame.document.all.eck2.style.left = ((x1 < x2) ? x2 : x1)-12;
-		whichFrame.document.all.eck2.style.top = ((y1 < y2) ? y1 : y2);
-		whichFrame.document.all.eck3.style.left = ((x1 < x2) ? x1 : x2);
-		whichFrame.document.all.eck3.style.top = ((y1 < y2) ? y2 : y1)-12;
-		whichFrame.document.all.eck4.style.left = ((x1 < x2) ? x2 : x1)-12;
-		whichFrame.document.all.eck4.style.top = ((y1 < y2) ? y2 : y1)-12;
+		document.all.eck1.style.left = ((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX);
+		document.all.eck1.style.top = ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY);
+		document.all.eck2.style.left = ((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12;
+		document.all.eck2.style.top = ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY);
+		document.all.eck3.style.left = ((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX);
+		document.all.eck3.style.top = ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12;
+		document.all.eck4.style.left = ((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12;
+		document.all.eck4.style.top = ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12;
     }
 
-    whichFrame.document.all.lay1.onmousedown = Click;
-    whichFrame.document.all.eck4.onmousedown = Click;
+    document.all.lay1.onmousedown = click;
+    document.all.eck4.onmousedown = click;
 }
 
 
-function Zoomin() {
+function zoomPoint() {
 
-    whichFrame.document.all.lay1.onmousedown = function() {
-		e = whichFrame.event;
+    document.all.lay1.onmousedown = function() {
+		var point = new Point(event);
 
-		att[5] = cropFloat(att[5]+att[7]*(whichFrame.document.body.scrollLeft+e.x-parseInt(whichFrame.document.all.lay1.style.left))/whichFrame.document.all.lay1.offsetWidth-0.5*att[7]*0.7);
-		att[6] = cropFloat(att[6]+att[8]*(whichFrame.document.body.scrollTop+e.y-parseInt(whichFrame.document.all.lay1.style.top))/whichFrame.document.all.lay1.offsetHeight-0.5*att[8]*0.7);
+		att[5] = cropFloat(point.relX-0.5*att[7]*0.7);
+		att[6] = cropFloat(point.relY-0.5*att[8]*0.7);
 
 		att[7] = cropFloat(att[7]*0.7);
 		att[8] = cropFloat(att[8]*0.7);
@@ -283,25 +282,25 @@
 			att[6] = 1-att[8];
 		}
 
-	    whichFrame.document.all.lay1.cancleBubble = true;
+	    document.all.lay1.cancleBubble = true;
 
 		loadPicture(2);
 	}
 }
 
 
-function Zoomout() {
+function zoomOut() {
     loadPicture(1);
 }
 
 
-function Moveto() {
+function moveTo() {
 
-    whichFrame.document.all.lay1.onmousedown = function() {
-		e = whichFrame.event;
+    document.all.lay1.onmousedown = function() {
+		var point = new Point(event);
 
-		att[5] = cropFloat(att[5]+att[7]*(whichFrame.document.body.scrollLeft+e.x-parseInt(whichFrame.document.all.lay1.style.left))/whichFrame.document.all.lay1.offsetWidth-0.5*att[7]);
-		att[6] = cropFloat(att[6]+att[8]*(whichFrame.document.body.scrollTop+e.y-parseInt(whichFrame.document.all.lay1.style.top))/whichFrame.document.all.lay1.offsetHeight-0.5*att[8]);
+		att[5] = cropFloat(point.relX-0.5*att[7]);
+		att[6] = cropFloat(point.relY-0.5*att[8]);
 
 		if (att[5] < 0) {
 			att[5] = 0;
@@ -316,21 +315,21 @@
 			att[6] = 1-att[8];
 		}
 
-	    whichFrame.document.all.lay1.cancleBubble = true;
+	    document.all.lay1.cancleBubble = true;
 
         loadPicture(2);
 	}
 }
 
 
-function Scaledef(scaledef) {
+function scale(scaledef) {
 
     att[2] = scaledef;
     loadPicture(2);
 }
 
 
-function setmark() {
+function setMarks() {
 	if ((att[4] != "") && (att[4] != "0/0")) {
 		var mark = att[4].split(";");
 
@@ -340,15 +339,15 @@
 		// we do not report this error because this is already done in func. "Mark"
 		if (countMarks > 8) countMarks = 8;
 
-		var picWidth  = whichFrame.document.all.lay1.offsetWidth;
-		var picHeight = whichFrame.document.all.lay1.offsetHeight;
+		var picWidth  = document.all.lay1.offsetWidth;
+		var picHeight = document.all.lay1.offsetHeight;
 
 		// catch the cases where the picture had not been loaded already and
 		// make a timeout so that the coordinates are calculated with the real dimensions
 		if (picWidth > 30) {
 
-			var xoffset = parseInt(whichFrame.document.all.lay1.style.left);
-			var yoffset = parseInt(whichFrame.document.all.lay1.style.top);
+			var xoffset = parseInt(document.all.lay1.style.left);
+			var yoffset = parseInt(document.all.lay1.style.top);
 
 			for (var i = 0; i < countMarks; i++) {
 				mark[i] = mark[i].split("/");
@@ -358,13 +357,13 @@
 					mark[i][0] = parseInt(xoffset+picWidth*(mark[i][0]-att[5])/att[7]);
 					mark[i][1] = parseInt(yoffset+picHeight*(mark[i][1]-att[6])/att[8]);
 
-					whichFrame.document.getElementById("dot" + i).style.left = mark[i][0]-5;
-					whichFrame.document.getElementById("dot" + i).style.top = mark[i][1]-5;
-					whichFrame.document.getElementById("dot" + i).style.visibility = "visible";
+					document.getElementById("dot" + i).style.left = mark[i][0]-5;
+					document.getElementById("dot" + i).style.top = mark[i][1]-5;
+					document.getElementById("dot" + i).style.visibility = "visible";
 				}
 			}
 		} else {
-			setTimeout("setmark()", 100);
+			setTimeout("setMarks()", 100);
 		}
 	}
 }
@@ -372,7 +371,7 @@
 
 // capturing keypresses for next and previous page
 function parseKeypress() {
-	e = whichFrame.event;
+	e = event;
 
 	if (e.keyCode == 110) {
 		Nextpage();
@@ -380,7 +379,7 @@
 	if (e.keyCode == 98) {
 		Backpage();
 	}
-	whichFrame.document.cancleBubble = true;
+	document.cancleBubble = true;
 }
 
 
@@ -388,85 +387,3 @@
 function cropFloat(tmp) {
 	return parseInt(10000*tmp)/10000;
 }
-
-
-// initialize browser specific things (keypress caputring)
-function initScripts() {
-	whichFrame.document.onkeypress = parseKeypress;
-	whichFrame.focus();
-}
-
-
-// fill in the values of the "att"-array
-function initPicture(picURL) {
-	att = picURL.split("+");
-
-	if (att[0].lastIndexOf("/") == att[0].length-1) {
-		att[0] = att[0].substring(0, att[0].length-1);
-	}
-	
-	if (att.length < 2 || att[1] == "") {
-		att[1] = 1;
-	}
-	if (att.length < 3 || att[2] == "") {
-		att[2] = "1.0";
-	}
-
-	if (att.length < 4) {
-		att[3] = "";
-	}
-
-	if (att[3].indexOf("f") > -1) {
-		att[3] = "fit";
-	}
-
-	if (att.length < 5 || att[4] == "") {
-		att[4] = "0/0";
-	}
-
-	// converts the old mark format (0-1000) to new format(0.0 - 1.0)
-	if (att[4] != "0/0") {
-		var tmp = att[4].split(";");
-		
-		att[4] = "";
-		
-		for (i = 0; i < tmp.length; i++) {
-			tmp[i] = tmp[i].split("/");
-
-			if (tmp[i][0] > 1 && tmp[i][1] > 1) {
-				tmp[i][0] /= 1000;
-				tmp[i][1] /= 1000;
-			}
-			
-			att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
-		}
-		att[4] = att[4].slice(0, -1);
-	}
-	
-	if (att.length < 7) {
-		att[5] = 0;
-		att[6] = 0;
-		att[7] = 1;
-		att[8] = 1;
-	} else {
-		att[5] = parseFloat(att[5]);
-		att[6] = parseFloat(att[6]);
-		att[7] = parseFloat(att[7]);
-		att[8] = parseFloat(att[8]);
-	}
-}
-
-
-function pageInfo() {
-	
-	// bug in netscape 4.xx (confunding px and pt)
-	var fontsize = document.layers ? "11pt" : "11px";
-
-	if (window.pageFrame) {
-		pageFrame.document.open();
-		pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">');
-		pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: ' + fontsize + '">');
-		pageFrame.document.write(att[1] + '<b> of </b>' + numPages + '</p></body></html>');
-		pageFrame.document.close();
-	}
-}
--- a/client/digitallibrary/navigation_n4.js	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/navigation_n4.js	Tue May 13 21:02:22 2003 +0200
@@ -1,34 +1,63 @@
-/* navigation_ie -- JS library for digilib (Netscape4 version)
-
-  Digital Image Library servlet components
-
-  Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch)
-
-  This program is free software; you can redistribute  it and/or modify it
-  under  the terms of  the GNU General  Public License as published by the
-  Free Software Foundation;  either version 2 of the  License, or (at your
-  option) any later version.
-   
-  Please read license.txt for the full details. A copy of the GPL
-  may be found at http://www.gnu.org/copyleft/lgpl.html
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// these two global variables have to be initialised before the frist use of the functions below
-// to fill in the attributes you can use the function initPicture provided below
-// - array with all attributes
+// this global variable has to be initialised before the frist use of the functions below
+// to fill in the attributes you can use the function init provided below
+// array with all attributes
 var att = new Array();
 
-// - variable to store the path to the frame, in which the pictures should be created
-var whichFrame = parent.mainFrame;
+// fill in the values of the "att"-array
+function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) {
+
+	// debug window to check the parameters passed
+	//alert ("DEBUG message (parameters in init):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh);
+
+	// attaching the values to the att-array
+	att[0] = fn;
+	att[1] = parseInt(pn);
+	att[2] = parseFloat(ws);
+	att[3] = mo;
+	att[4] = mk;
+	att[5] = parseFloat(wx);
+	att[6] = parseFloat(wy);
+	att[7] = parseFloat(ww);
+	att[8] = parseFloat(wh);
+	
+	// compatablility issue
+	if (att[3].indexOf("f") > -1) {
+		att[3] = "fit";
+	}
 
-// give a name to the window containing digilib - this way one can test if there is already a
-// digilib-window open and replace the contents of it (ex. digicat)
-window.name = "digilib";
+	// converts the old mark format (0-1000) to new format(0.0 - 1.0)
+	// could even be useless now
+	if (att[4] != "0/0") {
+		var tmp = att[4].split(";");
+		
+		att[4] = "";
+		
+		for (i = 0; i < tmp.length; i++) {
+			tmp[i] = tmp[i].split("/");
+
+			if (tmp[i][0] > 1 && tmp[i][1] > 1) {
+				tmp[i][0] /= 1000;
+				tmp[i][1] /= 1000;
+			}
+			
+			att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
+		}
+		att[4] = att[4].slice(0, -1);
+	}
+
+	// initialisation stuff
+	// ====================
+	
+	setMarks();
+
+	window.captureEvents(Event.KEYDOWN);
+	window.onkeydown = parseKeypress;
+
+	// give a name to the window containing digilib - this way one can test if there is already a
+	// digilib-window open and replace the contents of it (ex. digicat)
+	top.window.name = "digilib";
+}
+
 
 // function that launches the ScaleServlet
 // the different detailGrades:
@@ -38,12 +67,7 @@
 
 function loadPicture(detailGrade, keepArea) {
 
-//	alert("wx: " + att[5] + "\tww: " + att[7] + "\nwy: " + att[6] + "\twh: " + att[8]);
-
-	var newPicture  = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/"
-	newPicture += att[0] + "?" + "pn=" + att[1] + "&ws=" + att[2];
-	newPicture += "&dw=" + (whichFrame.innerWidth-30) + "&dh=" + (whichFrame.innerHeight-30);
-	newPicture += "&mo=" + att[3];
+	var newQuery = "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3];
 
 	if (detailGrade == 0) {
 		att[4] = "0/0";
@@ -55,35 +79,34 @@
 		att[7] = 1;
 		att[8] = 1;
 	}
-	newPicture += "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
+
+	newQuery += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
+	newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
 
-	whichFrame.document.open();
-	
-	whichFrame.document.write('<html><head></head><body bgcolor="#666666">');
-	whichFrame.document.write('<div ID="lay1" style="position:absolute; left:10;  top:10;  visibility:visible"><img src="' + newPicture + '"></div>');
-	whichFrame.document.write('<div ID="dot0" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark1.gif"></div>');
-	whichFrame.document.write('<div ID="dot1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark2.gif"></div>');
-	whichFrame.document.write('<div ID="dot2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark3.gif"></div>');
-	whichFrame.document.write('<div ID="dot3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark4.gif"></div>');
-	whichFrame.document.write('<div ID="dot4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark5.gif"></div>');
-	whichFrame.document.write('<div ID="dot5" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark6.gif"></div>');
-	whichFrame.document.write('<div ID="dot6" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark7.gif"></div>');
-	whichFrame.document.write('<div ID="dot7" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark8.gif"></div>');
-	whichFrame.document.write('<div ID="eck1" style="position:absolute; left:-20; top:120; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/olinks.gif"></div>');
-	whichFrame.document.write('<div ID="eck2" style="position:absolute; left:-20; top:140; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/orechts.gif"></div>');
-	whichFrame.document.write('<div ID="eck3" style="position:absolute; left:-20; top:160; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/ulinks.gif"></div>');
-	whichFrame.document.write('<div ID="eck4" style="position:absolute; left:-20; top:180; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/urechts.gif"></div>');
-	whichFrame.document.write('</body></html>');
-	
-	whichFrame.document.close();
-	
-	pageInfo();
+	// debug window - checking the parameters passed to the next image
+	//alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
 
-	setmark();
+	location.href = location.pathname + "?" + newQuery;
 }
 
 
-function Backpage(keepArea) {
+// constructor holding different values of a point
+function Point(event) {
+
+	this.pageX = parseInt(event.pageX);
+	this.pageY = parseInt(event.pageY);
+	
+	this.x = this.pageX-document.lay1.left;
+	this.y = this.pageY-document.lay1.top;
+	
+	this.relX = cropFloat(att[5]+(att[7]*this.x/document.lay1.clip.width));
+	this.relY = cropFloat(att[6]+(att[8]*this.y/document.lay1.clip.height));
+
+	return this;
+}
+
+
+function backPage(keepArea) {
 
     att[1] = parseInt(att[1]) - 1;
 
@@ -96,24 +119,19 @@
 }
 
 
-function Nextpage(keepArea) {
+function nextPage(keepArea) {
 
     att[1] = parseInt(att[1]) + 1;
 
-    if (att[1] <= parent.numPages) {
-        loadPicture(0, keepArea);
-    } else {
-	    att[1] = parseInt(att[1]) - 1;
-        alert("You are already on the last page!");
-    }
+	loadPicture(0, keepArea);
 }
 
 
-function Page(keepArea) {
+function page(keepArea) {
 
 	do {
-    	page = prompt("Goto Page (1 - " + parent.numPages + "):", 1);
-	} while ((page != null) && ((page < 1) || (page > parent.numPages)));
+    	page = prompt("Goto Page:", 1);
+	} while ((page != null) && (page < 1));
 
    	if (page != null && page != att[1]) {
 		att[1] = page;
@@ -122,16 +140,16 @@
 }
 
 
-function Digicat() {
-	var url = "http://" + location.host + "/docuserver/digitallibrary/digicat.html?" + att[0] + "+" + att[1];
+function digicat() {
+	var url = "digicat.html?" + att[0] + "+" + att[1];
 	win = window.open(url, "digicat");
 	win.focus();
 }
 
 
-function Ref(refselect) {
+function ref(refselect) {
 
-	var hyperlinkRef = "http://" + location.host + "/docuserver/digitallibrary/digilib.jsp?";
+	var hyperlinkRef = baseUrl + "/digilib.jsp?";
 	hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4];
 	
 	if ((att[5] != 0) || (att[6] != 0) || (att[7] != 1) || (att[8] != 1)) {
@@ -146,15 +164,11 @@
 }
 
 
-function Mark(refselect) {
+function mark(refselect) {
 
-	if (att[4].split(";").length > 7) {
-		alert("Only 8 marks are possible at the moment!");
-		return;
-	}
-
-    whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN);
-    whichFrame.document.lay1.onmousedown = function(event) {
+    document.lay1.captureEvents(Event.MOUSEDOWN);
+    document.lay1.onmousedown = function(event) {
+	    var point = new Point(event);
 
         if ((att[4] != "") && (att[4] != "0/0")) {
             att[4] += ";";
@@ -162,68 +176,59 @@
             att[4] = "";
         }
 
-		var markX = cropFloat(att[5]+(att[7]*event.x/whichFrame.document.lay1.clip.width));
-		var markY = cropFloat(att[6]+(att[8]*event.y/whichFrame.document.lay1.clip.height));
-		
-        att[4] += markX + "/" + markY;
+        att[4] += point.relX + "/" + point.relY;
 
-        whichFrame.document.lay1.releaseEvents(Event.MOUSEDOWN);
-        setmark();
-    }
+        document.lay1.releaseEvents(Event.MOUSEDOWN);
+        setMarks();
+	}
 }
 
 
-function Zoomrect() {
+function zoomArea() {
     var state = 0;
-    var x1, y1, x2, y2;
+    var pt1, pt2;
         
-    function Click(event) {
+    function click(event) {
 
         if (state == 0) {
             state = 1;
             
-            x1 = event.pageX;
-            y1 = event.pageY;           
-            x2 = x1;
-            y2 = y1;
+			pt1 = new Point(event);
+			pt2 = pt1;
 
-            whichFrame.document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2));
-            whichFrame.document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2));
-            whichFrame.document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12);
-            whichFrame.document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12);
+            document.eck1.moveTo(pt1.pageX, pt1.pageY);
+            document.eck2.moveTo(pt2.pageX-12, pt1.pageY);
+            document.eck3.moveTo(pt1.pageX, pt2.pageY-12);
+            document.eck4.moveTo(pt2.pageX-12, pt2.pageY-12);
 
-            whichFrame.document.eck1.visibility="show";
-            whichFrame.document.eck2.visibility="show";
-            whichFrame.document.eck3.visibility="show";
-            whichFrame.document.eck4.visibility="show";
+            document.eck1.visibility="show";
+            document.eck2.visibility="show";
+            document.eck3.visibility="show";
+            document.eck4.visibility="show";
             
-            whichFrame.document.lay1.captureEvents(Event.MOUSEMOVE);
-            whichFrame.document.eck4.captureEvents(Event.MOUSEMOVE);
+            document.lay1.captureEvents(Event.MOUSEMOVE);
+            document.eck4.captureEvents(Event.MOUSEMOVE);
 
-            whichFrame.document.lay1.onmousemove = Move;
-            whichFrame.document.eck4.onmousemove = Move;
+            document.lay1.onmousemove = move;
+            document.eck4.onmousemove = move;
             
         } else {
 
-            x1 -= whichFrame.document.lay1.x;
-            y1 -= whichFrame.document.lay1.y;            
+			pt2 = new Point(event);
 
-            x2 = event.pageX-whichFrame.document.lay1.x;
-            y2 = event.pageY-whichFrame.document.lay1.y;         
-
-            whichFrame.document.lay1.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
-            whichFrame.document.eck4.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
+            document.lay1.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
+            document.eck4.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
 
-            whichFrame.document.eck1.visibility="hide";
-            whichFrame.document.eck2.visibility="hide";
-            whichFrame.document.eck3.visibility="hide";
-            whichFrame.document.eck4.visibility="hide";
+            document.eck1.visibility="hide";
+            document.eck2.visibility="hide";
+            document.eck3.visibility="hide";
+            document.eck4.visibility="hide";
 
-            att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/whichFrame.document.lay1.clip.width);
-            att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/whichFrame.document.lay1.clip.height);
+			att[5] = Math.min(pt1.relX, pt2.relX);
+			att[6] = Math.min(pt1.relY, pt2.relY);
 
-            att[7] = cropFloat(att[7]*Math.abs(x1-x2)/whichFrame.document.lay1.clip.width);
-            att[8] = cropFloat(att[8]*Math.abs(y1-y2)/whichFrame.document.lay1.clip.height);
+            att[7] = Math.abs(pt1.relX-pt2.relX);
+            att[8] = Math.abs(pt1.relY-pt2.relY);
                         
             if (att[7] != 0 && att[8] != 0) {
               loadPicture(2);
@@ -231,32 +236,32 @@
         }
     }
 
-    function Move(event) {
+    function move(event) {
 
-        x2 = event.pageX;
-        y2 = event.pageY;           
+		pt2 = new Point(event);           
 
-        whichFrame.document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2));
-        whichFrame.document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2));
-        whichFrame.document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12);
-        whichFrame.document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12);
+            document.eck1.moveTo(((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX), ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY));
+            document.eck2.moveTo(((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12, ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY));
+            document.eck3.moveTo(((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX), ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12);
+            document.eck4.moveTo(((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12, ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12);
     }
 
-    whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN);
-    whichFrame.document.eck4.captureEvents(Event.MOUSEDOWN);
+    document.lay1.captureEvents(Event.MOUSEDOWN);
+    document.eck4.captureEvents(Event.MOUSEDOWN);
 
-    whichFrame.document.lay1.onmousedown = Click;
-    whichFrame.document.eck4.onmousedown = Click;
+    document.lay1.onmousedown = click;
+    document.eck4.onmousedown = click;
 }
 
 
-function Zoomin() {
+function zoomPoint() {
 
-    whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN);
-    whichFrame.document.lay1.onmousedown = function(event) {
-
-		att[5] = cropFloat(att[5]+(att[7]*event.x/whichFrame.document.lay1.clip.width-0.5*att[7]*0.7));
-		att[6] = cropFloat(att[6]+(att[8]*event.y/whichFrame.document.lay1.clip.height-0.5*att[8]*0.7));
+    document.lay1.captureEvents(Event.MOUSEDOWN);
+    document.lay1.onmousedown = function(event) {
+		var point = new Point(event);
+		
+		att[5] = cropFloat(point.relX-0.5*att[7]*0.7);
+		att[6] = cropFloat(point.relY-0.5*att[8]*0.7);
 
         att[7] = cropFloat(att[7]*0.7);
         att[8] = cropFloat(att[8]*0.7);
@@ -281,18 +286,19 @@
 }
 
 
-function Zoomout() {
+function zoomOut() {
     loadPicture(1);
 }
 
 
-function Moveto() {
+function moveTo() {
 
-    whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN);
-    whichFrame.document.lay1.onmousedown = function(event) {
+    document.lay1.captureEvents(Event.MOUSEDOWN);
+    document.lay1.onmousedown = function(event) {
+		var point = new Point(event);
 
-		att[5] = cropFloat(att[5]+(att[7]*event.x/whichFrame.document.lay1.clip.width-0.5*att[7]));
-		att[6] = cropFloat(att[6]+(att[8]*event.y/whichFrame.document.lay1.clip.height-0.5*att[8]));
+		att[5] = cropFloat(point.relX-0.5*att[7]);
+		att[6] = cropFloat(point.relY-0.5*att[8]);
 
 		if (att[5] < 0) {
 			att[5] = 0;
@@ -314,14 +320,14 @@
 }
 
 
-function Scaledef(scaledef) {
+function scale(scaledef) {
 
     att[2] = scaledef;
     loadPicture(2);
 }
 
 
-function setmark() {
+function setMarks() {
 	if ((att[4] != "") && (att[4] != "0/0")) {
 		var mark = att[4].split(";");
 
@@ -331,19 +337,19 @@
 		// we do not report this error because this is already done in func. "Mark"
 		if (countMarks > 8) countMarks = 8;
 
-		var picWidth  = whichFrame.document.lay1.clip.width;
-		var picHeight = whichFrame.document.lay1.clip.height;
+		var picWidth  = document.lay1.clip.width;
+		var picHeight = document.lay1.clip.height;
 
 		for (var i = 0; i < countMarks; i++) {
 			mark[i] = mark[i].split("/");
 
 			if ((mark[i][0] > att[5]) && (mark[i][1] > att[6]) && (mark[i][0] < (att[5]+att[7])) && (mark[i][1] < (att[6]+att[8]))) {
 
-				mark[i][0] = parseInt(whichFrame.document.lay1.x + (picWidth*(mark[i][0]-att[5]))/att[7]);
-				mark[i][1] = parseInt(whichFrame.document.lay1.y + (picHeight*(mark[i][1]-att[6]))/att[8]);
+				mark[i][0] = parseInt(document.lay1.x + (picWidth*(mark[i][0]-att[5]))/att[7]);
+				mark[i][1] = parseInt(document.lay1.y + (picHeight*(mark[i][1]-att[6]))/att[8]);
 
-				whichFrame.document.layers[i+1].moveTo(mark[i][0]-5, mark[i][1]-5);
-				whichFrame.document.layers[i+1].visibility = "show";
+				document.layers[i+1].moveTo(mark[i][0]-5, mark[i][1]-5);
+				document.layers[i+1].visibility = "show";
 			}
 		}
 	}
@@ -354,10 +360,10 @@
 function parseKeypress(event) {
 	var whichCode = (window.Event) ? event.which : event.keyCode;
 	if (String.fromCharCode(whichCode) == "n") {
-		Nextpage();
+		nextPage();
 	}
 	if (String.fromCharCode(whichCode) == "b") {
-		Backpage();
+		backPage();
 	}
 }
 
@@ -366,85 +372,3 @@
 function cropFloat(tmp) {
 	return parseInt(10000*tmp)/10000;
 }
-
-
-// initialize browser specific things (keypress caputring)
-function initScripts() {
-	window.captureEvents(Event.KEYDOWN);
-	window.onkeydown = parseKeypress;
-}
-
-
-// fill in the values of the "att"-array
-function initPicture(picURL) {
-	att = picURL.split("+");
-
-	if (att[0].lastIndexOf("/") == att[0].length-1) {
-		att[0] = att[0].substring(0, att[0].length-1);
-	}
-	
-	if (att.length < 2 || att[1] == "") {
-		att[1] = 1;
-	}
-	if (att.length < 3 || att[2] == "") {
-		att[2] = "1.0";
-	}
-
-	if (att.length < 4) {
-		att[3] = "";
-	}
-
-	if (att[3].indexOf("f") > -1) {
-		att[3] = "fit";
-	}
-
-	if (att.length < 5 || att[4] == "") {
-		att[4] = "0/0";
-	}
-
-	// converts the old mark format (0-1000) to new format(0.0 - 1.0)
-	if (att[4] != "0/0") {
-		var tmp = att[4].split(";");
-		
-		att[4] = "";
-		
-		for (i = 0; i < tmp.length; i++) {
-			tmp[i] = tmp[i].split("/");
-
-			if (tmp[i][0] > 1 && tmp[i][1] > 1) {
-				tmp[i][0] /= 1000;
-				tmp[i][1] /= 1000;
-			}
-			
-			att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
-		}
-		att[4] = att[4].slice(0, -1);
-	}
-	
-	if (att.length < 7) {
-		att[5] = 0;
-		att[6] = 0;
-		att[7] = 1;
-		att[8] = 1;
-	} else {
-		att[5] = parseFloat(att[5]);
-		att[6] = parseFloat(att[6]);
-		att[7] = parseFloat(att[7]);
-		att[8] = parseFloat(att[8]);
-	}
-}
-
-function pageInfo() {
-	
-	// bug in netscape 4.xx (confunding px and pt)
-	var fontsize = document.layers ? "11pt" : "11px";
-
-	if (window.pageFrame) {
-		pageFrame.document.open();
-		pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">');
-		pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: ' + fontsize + '">');
-		pageFrame.document.write(att[1] + '<b> of </b>' + numPages + '</p></body></html>');
-		pageFrame.document.close();
-	}
-}
-
--- a/client/digitallibrary/navigation_n6.js	Tue May 13 20:59:47 2003 +0200
+++ b/client/digitallibrary/navigation_n6.js	Tue May 13 21:02:22 2003 +0200
@@ -1,34 +1,83 @@
-/* navigation_ie -- JS library for digilib (Mozilla version)
-
-  Digital Image Library servlet components
-
-  Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch)
+/*
+Copyright (C) 2003 WTWG, Uni Bern
+ 
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+ 
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+ 
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+ 
+Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3
+*/
+// this global variable has to be initialised before the frist use of the functions below
+// to fill in the attributes you can use the function init provided below
+// - array with all attributes
+var att = new Object();
 
-  This program is free software; you can redistribute  it and/or modify it
-  under  the terms of  the GNU General  Public License as published by the
-  Free Software Foundation;  either version 2 of the  License, or (at your
-  option) any later version.
-   
-  Please read license.txt for the full details. A copy of the GPL
-  may be found at http://www.gnu.org/copyleft/lgpl.html
+// fill in the values of the "att"-array
+function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) {
+
+	// debug window to check the parameters passed
+	//alert ("DEBUG message (parameters in init):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh);
 
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software
-  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
+	// attaching the values to the att-array
+	att.fn = fn;
+	att.pn = parseInt(pn);
+	att.ws = parseFloat(ws);
+	att.mo = mo;
+	att.mk = mk;
+	att.wx = parseFloat(wx);
+	att.wy = parseFloat(wy);
+	att.ww = parseFloat(ww);
+	att.wh = parseFloat(wh);
+	
+	// compatablility issue
+// dangerous at the time - lugi
+//	if (att.mo.indexOf("f") > -1) {
+//		att.mo = "fit";
+//	}
 
-// these two global variables have to be initialised before the frist use of the functions below
-// to fill in the attributes you can use the function initPicture provided below
-// - array with all attributes
-var att = new Array();
+	// converts the old mark format (0-1000) to new format(0.0 - 1.0)
+	// could even be useless now
+	if (att.mk != "0/0" && att.mk != "") {
+		var tmp = att.mk.split(";");
+		
+		att.mk = "";
+		
+		for (i = 0; i < tmp.length; i++) {
+			tmp[i] = tmp[i].split("/");
 
-// - variable to store the path to the frame, in which the pictures should be created
-var whichFrame = parent.mainFrame;
+			if (tmp[i][0] > 1 && tmp[i][1] > 1) {
+				tmp[i][0] /= 1000;
+				tmp[i][1] /= 1000;
+			}
+			
+			att.mk += tmp[i][0] + "/" + tmp[i][1] + ";";
+		}
+		att.mk = att.mk.slice(0, -1);
+	}
 
-// give a name to the window containing digilib - this way one can test if there is already a
-// digilib-window open and replace the contents of it (ex. digicat)
-window.name = "digilib";
+	// initialisation stuff
+	// ====================
+	
+	setMarks();
+
+	this.document.addEventListener('keypress', parseKeypress, true);
+	focus();
+	
+	// give a name to the window containing digilib - this way one can test if there is already a
+	// digilib-window open and replace the contents of it (ex. digicat)
+	top.window.name = "digilib";
+}
+
 
 // function that launches the ScaleServlet
 // the different detailGrades:
@@ -38,110 +87,94 @@
 
 function loadPicture(detailGrade, keepArea) {
 
-//	alert("wx: " + att[5] + "\tww: " + att[7] + "\nwy: " + att[6] + "\twh: " + att[8]);
-
-	// sorry about that, but Mozilla needs to have a document body to calc the frames width and height
-	whichFrame.document.open();
-	whichFrame.document.write('<html><head></head><body bgcolor="#666666" topmargin="10" leftmargin="10" marginwidth="10" magrinheight="10">');
-
-//	alert(whichFrame.innerWidth);
-
-	var newPicture  = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/"
-	newPicture += att[0] + "?" + "pn=" + att[1] + "&ws=" + att[2];
-	newPicture += "&dw=" + (whichFrame.innerWidth-30) + "&dh=" + (whichFrame.innerHeight-30);
-	newPicture += "&mo=" + att[3];
+	var newQuery = "fn=" + att.fn + "&pn=" + att.pn + "&ws=" + att.ws + "&mo=" + att.mo;
 
 	if (detailGrade == 0) {
-		att[4] = "0/0";
+		att.mk = "0/0";
 	}
 
 	if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) {
-		att[5] = 0;
-		att[6] = 0;
-		att[7] = 1;
-		att[8] = 1;
+		att.wx = 0;
+		att.wy = 0;
+		att.ww = 1;
+		att.wh = 1;
 	}
-	newPicture += "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
-	
-	whichFrame.document.write('<div ID="lay1" style="position:absolute; left:10;  top:10;  visibility:visible"><img name="pic" src="' + newPicture + '"></div>');
-	whichFrame.document.write('<div ID="dot0" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark1.gif"></div>');
-	whichFrame.document.write('<div ID="dot1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark2.gif"></div>');
-	whichFrame.document.write('<div ID="dot2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark3.gif"></div>');
-	whichFrame.document.write('<div ID="dot3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark4.gif"></div>');
-	whichFrame.document.write('<div ID="dot4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark5.gif"></div>');
-	whichFrame.document.write('<div ID="dot5" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark6.gif"></div>');
-	whichFrame.document.write('<div ID="dot6" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark7.gif"></div>');
-	whichFrame.document.write('<div ID="dot7" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/mark8.gif"></div>');
-	whichFrame.document.write('<div ID="eck1" style="position:absolute; left:-20; top:120; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/olinks.gif"></div>');
-	whichFrame.document.write('<div ID="eck2" style="position:absolute; left:-20; top:140; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/orechts.gif"></div>');
-	whichFrame.document.write('<div ID="eck3" style="position:absolute; left:-20; top:160; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/ulinks.gif"></div>');
-	whichFrame.document.write('<div ID="eck4" style="position:absolute; left:-20; top:180; visibility:hidden"><img src="http://' + location.host + '/docuserver/digitallibrary/urechts.gif"></div>');
+
+	newQuery += "&mk=" + att.mk + "&wx=" + att.wx + "&wy=" + att.wy + "&ww=" + att.ww + "&wh=" + att.wh;
+	newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
+	newQuery += "&lv=1"
 
-	whichFrame.document.write('</body></html>');
-
-	whichFrame.document.close();
+	// debug window - checking the parameters passed to the next image
+	alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
 
-	initScripts();
-	
-	pageInfo();
-
-	setmark();
+	location.href = location.protocol + "//" + location.host + location.pathname + "?" + newQuery;
 }
 
 
-function Backpage(keepArea) {
+// constructor holding different values of a point
+function Point(event) {
 
-    att[1] = parseInt(att[1]) - 1;
+	this.pageX = parseInt(event.pageX);
+	this.pageY = parseInt(event.pageY);
+	
+	this.x = this.pageX-parseInt(document.getElementById("lay1").style.left);
+	this.y = this.pageY-parseInt(document.getElementById("lay1").style.top);
+	
+	this.relX = cropFloat(att.wx+(att.ww*this.x/document.pic.offsetWidth));
+	this.relY = cropFloat(att.wy+(att.wh*this.y/document.pic.offsetHeight));
 
-    if (att[1] > 0) {
+	return this;
+}
+
+
+function backPage(keepArea) {
+
+    att.pn = parseInt(att.pn) - 1;
+
+    if (att.pn > 0) {
         loadPicture(0, keepArea);
     } else {
-	    att[1] = parseInt(att[1]) + 1;
+	    att.pn = parseInt(att.pn) + 1;
         alert("You are already on the first page!");
     }
 }
 
 
-function Nextpage(keepArea) {
-
-    att[1] = parseInt(att[1]) + 1;
+function nextPage(keepArea) {
 
-    if (att[1] <= parent.numPages) {
-        loadPicture(0, keepArea);
-    } else {
-	    att[1] = parseInt(att[1]) - 1;
-        alert("You are already on the last page!");
-    }
+    att.pn = parseInt(att.pn) + 1;
+
+	loadPicture(0, keepArea);
 }
 
 
-function Page(keepArea) {
+function page(keepArea) {
 
 	do {
-    	page = prompt("Goto Page (1 - " + parent.numPages + "):", 1);
-	} while ((page != null) && ((page < 1) || (page > parent.numPages)));
+    	page = prompt("Goto Page:", 1);
+	} while ((page != null) && (page < 1));
 
-   	if (page != null && page != att[1]) {
-		att[1] = page;
+   	if (page != null && page != att.pn) {
+		att.pn = page;
 		loadPicture(0, keepArea);
 	}
 }
 
 
-function Digicat() {
-	var url = "http://" + location.host + "/docuserver/digitallibrary/digicat.html?" + att[0] + "+" + att[1];
+function digicat() {
+	var url = baseUrl + "/digicat.jsp?" + att.fn + "+" + att.pn;
 	win = window.open(url, "digicat");
 	win.focus();
 }
 
 
-function Ref(refselect) {
+function ref(refselect) {
 
-	var hyperlinkRef = "http://" + location.host + "/docuserver/digitallibrary/digilib.jsp?";
-	hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4];
+	var hyperlinkRef = baseUrl + "/digilib.jsp?";
+	hyperlinkRef += att.fn + "+" + att.pn + "+" + att.ws + "+" + att.mo + "+" + att.mk;
 	
-	if ((att[5] != 0) || (att[6] != 0) || (att[7] != 1) || (att[8] != 1)) {
-		hyperlinkRef += "+" + att[5] + "+" + att[6] + "+" + att[7] + "+" + att[8];
+	if ((att.wx != 0) || (att.wy != 0) || (att.ww != 1) || (att.wh != 1)) {
+		hyperlinkRef += "+" + att.wx + "+" + att.wy + "+" + att.ww + "+" + att.wh;
 	}
 
 	if (refselect == 1) {
@@ -152,194 +185,187 @@
 }
 
 
-function Mark() {
+function mark() {
 
-	if (att[4].split(";").length > 7) {
+	if (att.mk.split(";").length > 7) {
 		alert("Only 8 marks are possible at the moment!");
 		return;
 	}
 
-	function MarkEvent(event) {
-
-		if ((att[4] != "") && (att[4] != "0/0")) {
-			att[4] += ";";
+	function markEvent(event) {
+    var point = new Point(event);
+    
+		if ((att.mk != "") && (att.mk != "0/0")) {
+			att.mk += ";";
 		} else {
-			att[4] = "";
+			att.mk = "";
 		}
+		att.mk += point.relX + "/" + point.relY;
 
-		var markX = cropFloat(att[5]+att[7]*(event.pageX-parseInt(whichFrame.document.getElementById("lay1").style.left))/whichFrame.document.pic.offsetWidth);
-		var markY = cropFloat(att[6]+att[8]*(event.pageY-parseInt(whichFrame.document.getElementById("lay1").style.top))/whichFrame.document.pic.offsetHeight);
-
-		att[4] += markX + "/" + markY;
-
-		whichFrame.document.getElementById("lay1").removeEventListener("mousedown", MarkEvent, true);		
-		setmark();
+		document.getElementById("lay1").removeEventListener("mousedown", markEvent, true);		
+		setMarks();
 	}
 
-	whichFrame.document.getElementById("lay1").addEventListener("mousedown", MarkEvent, true);		
+	document.getElementById("lay1").addEventListener("mousedown", markEvent, true);		
 }
 
 
-function Zoomrect() {
+function zoomArea() {
 	var state = 0;
-	var x1, y1, x2, y2;
+	var pt1, pt2;
 
-	function Click(event) {
+	function click(event) {
 
 		if (state == 0) {
 			state = 1;
 			
-			x1 = event.pageX;
-			y1 = event.pageY;			
-			x2 = x1;
-			y2 = y1;
+			pt1 = new Point(event);
+			pt2 = pt1;
 			
-			whichFrame.document.getElementById("eck1").style.left = x1;
-			whichFrame.document.getElementById("eck1").style.top = y1;
-			whichFrame.document.getElementById("eck2").style.left = x2-12;
-			whichFrame.document.getElementById("eck2").style.top = y1;
-			whichFrame.document.getElementById("eck3").style.left = x1;
-			whichFrame.document.getElementById("eck3").style.top = y2-12;
-			whichFrame.document.getElementById("eck4").style.left = x2-12;
-			whichFrame.document.getElementById("eck4").style.top = y2-12;
+			document.getElementById("eck1").style.left = pt1.pageX;
+			document.getElementById("eck1").style.top = pt1.pageY;
+			document.getElementById("eck2").style.left = pt2.pageX-12;
+			document.getElementById("eck2").style.top = pt1.pageY;
+			document.getElementById("eck3").style.left = pt1.pageX;
+			document.getElementById("eck3").style.top = pt2.pageY-12;
+			document.getElementById("eck4").style.left = pt2.pageX-12;
+			document.getElementById("eck4").style.top = pt2.pageY-12;
 
-			whichFrame.document.getElementById("eck1").style.visibility="visible";
-			whichFrame.document.getElementById("eck2").style.visibility="visible";
-			whichFrame.document.getElementById("eck3").style.visibility="visible";
-			whichFrame.document.getElementById("eck4").style.visibility="visible";
+			document.getElementById("eck1").style.visibility="visible";
+			document.getElementById("eck2").style.visibility="visible";
+			document.getElementById("eck3").style.visibility="visible";
+			document.getElementById("eck4").style.visibility="visible";
 			
-			whichFrame.document.getElementById("lay1").addEventListener("mousemove", Move, true);		
-			whichFrame.document.getElementById("eck4").addEventListener("mousemove", Move, true);		
+			document.getElementById("lay1").addEventListener("mousemove", move, true);		
+			document.getElementById("eck4").addEventListener("mousemove", move, true);		
 
 		} else {
 
-			x1 -= parseInt(whichFrame.document.getElementById("lay1").style.left);
-			y1 -= parseInt(whichFrame.document.getElementById("lay1").style.top);			
-
-			x2 = event.pageX-parseInt(whichFrame.document.getElementById("lay1").style.left);
-			y2 = event.pageY-parseInt(whichFrame.document.getElementById("lay1").style.top);			
-
-			whichFrame.document.getElementById("lay1").removeEventListener("mousedown", Click, true);		
-			whichFrame.document.getElementById("eck4").removeEventListener("mousedown", Click, true);		
+			pt2 = new Point(event);
 			
-			whichFrame.document.getElementById("lay1").removeEventListener("mousemove", Move, true);		
-			whichFrame.document.getElementById("eck4").removeEventListener("mousemove", Move, true);		
+			document.getElementById("lay1").removeEventListener("mousedown", click, true);		
+			document.getElementById("eck4").removeEventListener("mousedown", click, true);		
+			
+			document.getElementById("lay1").removeEventListener("mousemove", move, true);		
+			document.getElementById("eck4").removeEventListener("mousemove", move, true);		
 
-			whichFrame.document.getElementById("eck1").style.visibility="hidden";
-			whichFrame.document.getElementById("eck2").style.visibility="hidden";
-			whichFrame.document.getElementById("eck3").style.visibility="hidden";
-			whichFrame.document.getElementById("eck4").style.visibility="hidden";
+			document.getElementById("eck1").style.visibility="hidden";
+			document.getElementById("eck2").style.visibility="hidden";
+			document.getElementById("eck3").style.visibility="hidden";
+			document.getElementById("eck4").style.visibility="hidden";
 
-			att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/whichFrame.document.pic.offsetWidth);
-			att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/whichFrame.document.pic.offsetHeight);
+			att.wx = parseFloat(Math.min(pt1.relX, pt2.relX));
+			att.wy = parseFloat(Math.min(pt1.relY, pt2.relY));
 
-			att[7] = cropFloat(att[7]*Math.abs(x1-x2)/whichFrame.document.pic.offsetWidth);
-			att[8] = cropFloat(att[8]*Math.abs(y1-y2)/whichFrame.document.pic.offsetHeight);
+			att.ww = parseFloat(Math.abs(pt1.relX-pt2.relX));
+			att.wh = parseFloat(Math.abs(pt1.relY-pt2.relY));
 
-			if (att[7] != 0 && att[8] != 0) {
+			if (att.ww != 0 && att.wh != 0) {
 				loadPicture(2);
 			}
 		}
 	}
 
-	function Move(event) {
+	function move(event) {
 
-		x2 = event.pageX;
-		y2 = event.pageY;
+		pt2 = new Point(event);
 
-		whichFrame.document.getElementById("eck1").style.left = ((x1 < x2) ? x1 : x2);
-		whichFrame.document.getElementById("eck1").style.top = ((y1 < y2) ? y1 : y2);
-		whichFrame.document.getElementById("eck2").style.left = ((x1 < x2) ? x2 : x1)-12;
-		whichFrame.document.getElementById("eck2").style.top = ((y1 < y2) ? y1 : y2);
-		whichFrame.document.getElementById("eck3").style.left = ((x1 < x2) ? x1 : x2);
-		whichFrame.document.getElementById("eck3").style.top = ((y1 < y2) ? y2 : y1)-12;
-		whichFrame.document.getElementById("eck4").style.left = ((x1 < x2) ? x2 : x1)-12;
-		whichFrame.document.getElementById("eck4").style.top = ((y1 < y2) ? y2 : y1)-12;
+		document.getElementById("eck1").style.left = ((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX);
+		document.getElementById("eck1").style.top = ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY);
+		document.getElementById("eck2").style.left = ((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12;
+		document.getElementById("eck2").style.top = ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY);
+		document.getElementById("eck3").style.left = ((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX);
+		document.getElementById("eck3").style.top = ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12;
+		document.getElementById("eck4").style.left = ((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12;
+		document.getElementById("eck4").style.top = ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12;
 	}
 
-	whichFrame.document.getElementById("lay1").addEventListener("mousedown", Click, true);		
-	whichFrame.document.getElementById("eck4").addEventListener("mousedown", Click, true);		
+	document.getElementById("lay1").addEventListener("mousedown", click, true);		
+	document.getElementById("eck4").addEventListener("mousedown", click, true);		
 }
 
 
-function Zoomin() {
+function zoomPoint() {
 
-	function ZoominEvent(event) {
+	function zoomPointEvent(event) {
+	    var point = new Point(event);
 
-		att[5] = cropFloat(att[5]+att[7]*(event.pageX-parseInt(whichFrame.document.getElementById("lay1").style.left))/whichFrame.document.pic.offsetWidth-0.5*att[7]*0.7);
-		att[6] = cropFloat(att[6]+att[8]*(event.pageY-parseInt(whichFrame.document.getElementById("lay1").style.top))/whichFrame.document.pic.offsetHeight-0.5*att[8]*0.7);
+		att.wx = cropFloat(point.relX-0.5*att.ww*0.7);
+		att.wy = cropFloat(point.relY-0.5*att.wh*0.7);
 
-		att[7] = cropFloat(att[7]*0.7);
-		att[8] = cropFloat(att[8]*0.7);
+		att.ww = cropFloat(att.ww*0.7);
+		att.wh = cropFloat(att.wh*0.7);
 
-		if (att[5] < 0) {
-			att[5] = 0;
+		if (att.wx < 0) {
+			att.wx = 0;
 		}
-		if (att[6] < 0) {
-			att[6] = 0;
+		if (att.wy < 0) {
+			att.wy = 0;
 		}
-		if (att[5]+att[7] > 1) {
-			att[5] = 1-att[7];
+		if (att.wx+att.ww > 1) {
+			att.wx = 1-att.ww;
 		}
-		if (att[6]+att[8] > 1) {
-			att[6] = 1-att[8];
+		if (att.wy+att.wh > 1) {
+			att.wy = 1-att.wh;
 		}
 
-		whichFrame.document.getElementById("lay1").removeEventListener("mousedown", ZoominEvent, true);
+		document.getElementById("lay1").removeEventListener("mousedown", zoomPointEvent, true);
 		
 		loadPicture(2);
 	}
 
-	whichFrame.document.getElementById("lay1").addEventListener("mousedown", ZoominEvent, true);
+	document.getElementById("lay1").addEventListener("mousedown", zoomPointEvent, true);
 }
 
 
-function Zoomout() {
+function zoomOut() {
 
 	loadPicture(1);
 }
 
 
-function Moveto() {
+function moveTo() {
+
+	function moveToEvent(event) {
 
-	function MovetoEvent(event) {
+	    var point = new Point(event);
 
-		att[5] = cropFloat(att[5]+att[7]*(event.pageX-parseInt(whichFrame.document.getElementById("lay1").style.left))/whichFrame.document.pic.offsetWidth-0.5*att[7]);
-		att[6] = cropFloat(att[6]+att[8]*(event.pageY-parseInt(whichFrame.document.getElementById("lay1").style.top))/whichFrame.document.pic.offsetHeight-0.5*att[8]);
+		att.wx = cropFloat(point.relX-0.5*att.ww);
+		att.wy = cropFloat(point.relY-0.5*att.wh);
 
-		if (att[5] < 0) {
-			att[5] = 0;
+		if (att.wx < 0) {
+			att.wx = 0;
 		}
-		if (att[6] < 0) {
-			att[6] = 0;
+		if (att.wy < 0) {
+			att.wy = 0;
 		}
-		if (att[5]+att[7] > 1) {
-			att[5] = 1-att[7];
+		if (att.wx+att.ww > 1) {
+			att.wx = 1-att.ww;
 		}
-		if (att[6]+att[8] > 1) {
-			att[6] = 1-att[8];
+		if (att.wy+att.wh > 1) {
+			att.wy = 1-att.wh;
 		}
 
-		whichFrame.document.getElementById("lay1").removeEventListener("mousedown", MovetoEvent, true);		
+		document.getElementById("lay1").removeEventListener("mousedown", moveToEvent, true);		
 		
 		loadPicture(2);
 	}
 
-	whichFrame.document.getElementById("lay1").addEventListener("mousedown", MovetoEvent, true);
+	document.getElementById("lay1").addEventListener("mousedown", moveToEvent, true);
 }
 
 
-function Scaledef(scaledef) {
+function scale(scaledef) {
 
-	att[2] = scaledef;
+	att.ws = scaledef;
 	loadPicture(2);
 }
 
 
-function setmark() {
+function setMarks() {
 
-	if (att[4] != "" && att[4] != "0/0") {
-		var mark = att[4].split(";");
+	if (att.mk != "" && att.mk != "0/0") {
+		var mark = att.mk.split(";");
 
 		var countMarks = mark.length;
 		
@@ -347,31 +373,31 @@
 		// we do not report this error because this is already done in func. "Mark"
 		if (countMarks > 8) countMarks = 8;
 
-		var picWidth = whichFrame.document.pic.offsetWidth;
-		var picHeight = whichFrame.document.pic.offsetHeight;
+		var picWidth = document.pic.offsetWidth;
+		var picHeight = document.pic.offsetHeight;
 
 		// catch the cases where the picture had not been loaded already and
 		// make a timeout so that the coordinates are calculated with the real dimensions
-		if (whichFrame.document.pic.complete) {
-			var xoffset = parseInt(whichFrame.document.getElementById("lay1").style.left);
-			var yoffset = parseInt(whichFrame.document.getElementById("lay1").style.top);
+		if (document.pic.complete) {
+			var xoffset = parseInt(document.getElementById("lay1").style.left);
+			var yoffset = parseInt(document.getElementById("lay1").style.top);
 
 			for (var i = 0; i < countMarks; i++) {
 				mark[i] = mark[i].split("/");
 
-				if ((mark[i][0] > att[5]) && (mark[i][1] > att[6]) && (mark[i][0] < (att[5]+att[7])) && (mark[i][1] < (att[6]+att[8]))) {
+				if ((mark[i][0] >= att.wx) && (mark[i][1] >= att.wy) && (mark[i][0] <= (att.wx+att.ww)) && (mark[i][1] <= (att.wy+att.wh))) {
 
-					mark[i][0] = parseInt(xoffset+picWidth*(mark[i][0]-att[5])/att[7]);
-					mark[i][1] = parseInt(yoffset+picHeight*(mark[i][1]-att[6])/att[8]);
+					mark[i][0] = parseInt(xoffset+picWidth*(mark[i][0]-att.wx)/att.ww);
+					mark[i][1] = parseInt(yoffset+picHeight*(mark[i][1]-att.wy)/att.wh);
 
 
-					whichFrame.document.getElementById("dot" + i).style.left = mark[i][0]-5;
-					whichFrame.document.getElementById("dot" + i).style.top = mark[i][1]-5;
-					whichFrame.document.getElementById("dot" + i).style.visibility = "visible";
+					document.getElementById("dot" + i).style.left = mark[i][0]-5;
+					document.getElementById("dot" + i).style.top = mark[i][1]-5;
+					document.getElementById("dot" + i).style.visibility = "visible";
 				}
 			}
 		} else {
-			setTimeout("setmark()", 100);
+			setTimeout("setMarks()", 100);
 		}
 	}
 }
@@ -380,10 +406,10 @@
 // ascii-values of n = 110, b = 98
 function parseKeypress (event) {
 	if (event.charCode == 110) {
-		Nextpage();
+		nextPage();
 	}
 	if (event.charCode == 98) {
-		Backpage();
+		backPage();
 	}
 }
 
@@ -392,88 +418,3 @@
 function cropFloat(tmp) {
 	return parseInt(10000*tmp)/10000;
 }
-
-
-// initialize browser specific things (keypress caputring)
-function initScripts() {
-//	for (var f = 0; f < window.frames.length; f++) {
-//		window.frames[f].document.addEventListener('keypress', parseKeypress, true);
-//	}
-	whichFrame.document.addEventListener('keypress', parseKeypress, true);
-	whichFrame.focus();
-}
-
-
-// fill in the values of the "att"-array
-function initPicture(picURL) {
-	att = picURL.split("+");
-
-	if (att[0].lastIndexOf("/") == att[0].length-1) {
-		att[0] = att[0].substring(0, att[0].length-1);
-	}
-	
-	if (att.length < 2 || att[1] == "") {
-		att[1] = 1;
-	}
-	if (att.length < 3 || att[2] == "") {
-		att[2] = "1.0";
-	}
-
-	if (att.length < 4) {
-		att[3] = "";
-	}
-
-	if (att[3].indexOf("f") > -1) {
-		att[3] = "fit";
-	}
-
-	if (att.length < 5 || att[4] == "") {
-		att[4] = "0/0";
-	}
-
-	// converts the old mark format (0-1000) to new format(0.0 - 1.0)
-	if (att[4] != "0/0") {
-		var tmp = att[4].split(";");
-		
-		att[4] = "";
-		
-		for (i = 0; i < tmp.length; i++) {
-			tmp[i] = tmp[i].split("/");
-
-			if (tmp[i][0] > 1 && tmp[i][1] > 1) {
-				tmp[i][0] /= 1000;
-				tmp[i][1] /= 1000;
-			}
-			
-			att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
-		}
-		att[4] = att[4].slice(0, -1);
-	}
-	
-	if (att.length < 7) {
-		att[5] = 0;
-		att[6] = 0;
-		att[7] = 1;
-		att[8] = 1;
-	} else {
-		att[5] = parseFloat(att[5]);
-		att[6] = parseFloat(att[6]);
-		att[7] = parseFloat(att[7]);
-		att[8] = parseFloat(att[8]);
-	}
-}
-
-
-function pageInfo() {
-	
-	// bug in netscape 4.xx (confunding px and pt)
-	var fontsize = document.layers ? "11pt" : "11px";
-
-	if (window.pageFrame) {
-		pageFrame.document.open();
-		pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">');
-		pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: ' + fontsize + '">');
-		pageFrame.document.write(att[1] + '<b> of </b>' + numPages + '</p></body></html>');
-		pageFrame.document.close();
-	}
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/navigation_o6.js	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,402 @@
+// this global variable has to be initialised before the frist use of the functions below
+// to fill in the attributes you can use the function init provided below
+// - array with all attributes
+var att = new Array();
+
+// fill in the values of the "att"-array
+function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) {
+
+	// debug window to check the parameters passed
+	//alert ("DEBUG message (parameters in init):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh);
+
+	// attaching the values to the att-array
+	att[0] = fn;
+	att[1] = parseInt(pn);
+	att[2] = parseFloat(ws);
+	att[3] = mo;
+	att[4] = mk;
+	att[5] = parseFloat(wx);
+	att[6] = parseFloat(wy);
+	att[7] = parseFloat(ww);
+	att[8] = parseFloat(wh);
+	
+	// compatablility issue
+	if (att[3].indexOf("f") > -1) {
+		att[3] = "fit";
+	}
+
+	// converts the old mark format (0-1000) to new format(0.0 - 1.0)
+	// could even be useless now
+	if (att[4] != "0/0") {
+		var tmp = att[4].split(";");
+		
+		att[4] = "";
+		
+		for (i = 0; i < tmp.length; i++) {
+			tmp[i] = tmp[i].split("/");
+
+			if (tmp[i][0] > 1 && tmp[i][1] > 1) {
+				tmp[i][0] /= 1000;
+				tmp[i][1] /= 1000;
+			}
+			
+			att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
+		}
+		att[4] = att[4].slice(0, -1);
+	}
+
+	// initialisation stuff
+	// ====================
+	
+	setMarks();
+
+	this.document.onkeypress = parseKeypress;
+	focus();
+	
+	// give a name to the window containing digilib - this way one can test if there is already a
+	// digilib-window open and replace the contents of it (ex. digicat)
+	top.window.name = "digilib";
+}
+
+
+// function that launches the ScaleServlet
+// the different detailGrades:
+// 		0 -> back, next, page
+//		1 -> zoomout
+//		2 -> zoomarea, zoompoint, moveto, scaledef
+
+function loadPicture(detailGrade, keepArea) {
+
+	var newQuery = "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3];
+
+	if (detailGrade == 0) {
+		att[4] = "0/0";
+	}
+
+	if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) {
+		att[5] = 0;
+		att[6] = 0;
+		att[7] = 1;
+		att[8] = 1;
+	}
+
+	newQuery += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
+	newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
+	
+	// debug window - checking the parameters passed to the next image
+	//alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
+
+	location.href = location.pathname + "?" + newQuery;
+}
+
+
+// constructor holding different values of a point
+function Point(event) {
+
+	this.pageX = parseInt(event.clientX);
+	this.pageY = parseInt(event.clientY);
+	
+	this.x = this.pageX-parseInt(document.getElementById("lay1").style.left);
+	this.y = this.pageY-parseInt(document.getElementById("lay1").style.top);
+	
+	this.relX = cropFloat(att[5]+(att[7]*this.x/document.pic.offsetWidth));
+	this.relY = cropFloat(att[6]+(att[8]*this.y/document.pic.offsetHeight));
+
+//	alert ("page:\t" + this.pageX + "\t" + this.pageY + "\npic:\t" + this.x + "\t" + this.y + "\nrel:\t" + this.relX + "\t" + this.relY);
+
+	return this;
+}
+
+
+function backPage(keepArea) {
+
+    att[1] = parseInt(att[1]) - 1;
+
+    if (att[1] > 0) {
+        loadPicture(0, keepArea);
+    } else {
+	    att[1] = parseInt(att[1]) + 1;
+        alert("You are already on the first page!");
+    }
+}
+
+
+function nextPage(keepArea) {
+
+    att[1] = parseInt(att[1]) + 1;
+
+	loadPicture(0, keepArea);
+}
+
+
+function page(keepArea) {
+
+	do {
+    	page = prompt("Goto Page:", 1);
+	} while ((page != null) && (page < 1));
+
+   	if (page != null && page != att[1]) {
+		att[1] = page;
+		loadPicture(0, keepArea);
+	}
+}
+
+
+function digicat() {
+	var url = "digicat.html?" + att[0] + "+" + att[1];
+	win = window.open(url, "digicat");
+	win.focus();
+}
+
+
+function ref(refselect) {
+
+	var hyperlinkRef = baseUrl + "digilib.jsp?";
+	hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4];
+	
+	if ((att[5] != 0) || (att[6] != 0) || (att[7] != 1) || (att[8] != 1)) {
+		hyperlinkRef += "+" + att[5] + "+" + att[6] + "+" + att[7] + "+" + att[8];
+	}
+
+	if (refselect == 1) {
+		prompt("Link for HTML--documents", hyperlinkRef);
+	} else {
+		prompt("Link for LaTeX--documents", "\\href{" + hyperlinkRef + "}{TEXT}");
+	}
+}
+
+
+function mark() {
+
+	if (att[4].split(";").length > 7) {
+		alert("Only 8 marks are possible at the moment!");
+		return;
+	}
+
+	function markEvent(event) {
+	    var point = new Point(event);
+
+		if ((att[4] != "") && (att[4] != "0/0")) {
+			att[4] += ";";
+		} else {
+			att[4] = "";
+		}
+		att[4] += point.relX + "/" + point.relY;
+
+		document.getElementById("lay1").onmousedown = false;
+		setMarks();
+	}
+
+	document.getElementById("lay1").onmousedown = markEvent;		
+}
+
+
+function zoomArea() {
+	var state = 0;
+	var pt1, pt2;
+
+	function click(event) {
+
+		if (state == 0) {
+			state = 1;
+			
+			pt1 = new Point(event);
+			pt2 = pt1;
+			
+			document.getElementById("eck1").style.left = pt1.pageX;
+			document.getElementById("eck1").style.top = pt1.pageY;
+			document.getElementById("eck2").style.left = pt2.pageX-12;
+			document.getElementById("eck2").style.top = pt1.pageY;
+			document.getElementById("eck3").style.left = pt1.pageX;
+			document.getElementById("eck3").style.top = pt2.pageY-12;
+			document.getElementById("eck4").style.left = pt2.pageX-12;
+			document.getElementById("eck4").style.top = pt2.pageY-12;
+
+			document.getElementById("eck1").style.visibility="visible";
+			document.getElementById("eck2").style.visibility="visible";
+			document.getElementById("eck3").style.visibility="visible";
+			document.getElementById("eck4").style.visibility="visible";
+			
+			document.getElementById("lay1").onmousemove = move;		
+			document.getElementById("eck4").onmousemove = move;		
+
+		} else {
+
+			pt2 = new Point(event);
+			
+			document.getElementById("lay1").onmousedown = false;
+			document.getElementById("eck4").onmousedown = false;
+
+			document.getElementById("eck1").style.visibility="hidden";
+			document.getElementById("eck2").style.visibility="hidden";
+			document.getElementById("eck3").style.visibility="hidden";
+			document.getElementById("eck4").style.visibility="hidden";
+
+			att[5] = Math.min(pt1.relX, pt2.relX);
+			att[6] = Math.min(pt1.relY, pt2.relY);
+
+			att[7] = Math.abs(pt1.relX-pt2.relX);
+			att[8] = Math.abs(pt1.relY-pt2.relY);
+
+			if (att[7] != 0 && att[8] != 0) {
+				loadPicture(2);
+			}
+		}
+	}
+
+	function move(event) {
+
+		pt2 = new Point(event);
+
+		document.getElementById("eck1").style.left = ((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX);
+		document.getElementById("eck1").style.top = ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY);
+		document.getElementById("eck2").style.left = ((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12;
+		document.getElementById("eck2").style.top = ((pt1.pageY < pt2.pageY) ? pt1.pageY : pt2.pageY);
+		document.getElementById("eck3").style.left = ((pt1.pageX < pt2.pageX) ? pt1.pageX : pt2.pageX);
+		document.getElementById("eck3").style.top = ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12;
+		document.getElementById("eck4").style.left = ((pt1.pageX < pt2.pageX) ? pt2.pageX : pt1.pageX)-12;
+		document.getElementById("eck4").style.top = ((pt1.pageY < pt2.pageY) ? pt2.pageY : pt1.pageY)-12;
+	}
+
+	document.getElementById("lay1").onmousedown = click;		
+	document.getElementById("eck4").onmousedown = click;
+}
+
+
+function zoomPoint() {
+
+	function zoomPointEvent(event) {
+	    var point = new Point(event);
+
+		att[5] = cropFloat(point.relX-0.5*att[7]*0.7);
+		att[6] = cropFloat(point.relY-0.5*att[8]*0.7);
+
+		att[7] = cropFloat(att[7]*0.7);
+		att[8] = cropFloat(att[8]*0.7);
+
+		if (att[5] < 0) {
+			att[5] = 0;
+		}
+		if (att[6] < 0) {
+			att[6] = 0;
+		}
+		if (att[5]+att[7] > 1) {
+			att[5] = 1-att[7];
+		}
+		if (att[6]+att[8] > 1) {
+			att[6] = 1-att[8];
+		}
+
+		document.getElementById("lay1").onmousedown = false;
+		
+		loadPicture(2);
+	}
+
+	document.getElementById("lay1").onmousedown = zoomPointEvent;
+}
+
+
+function zoomOut() {
+
+	loadPicture(1);
+}
+
+
+function moveTo() {
+
+	function moveToEvent(event) {
+
+	    var point = new Point(event);
+
+		att[5] = cropFloat(point.relX-0.5*att[7]);
+		att[6] = cropFloat(point.relY-0.5*att[8]);
+
+		if (att[5] < 0) {
+			att[5] = 0;
+		}
+		if (att[6] < 0) {
+			att[6] = 0;
+		}
+		if (att[5]+att[7] > 1) {
+			att[5] = 1-att[7];
+		}
+		if (att[6]+att[8] > 1) {
+			att[6] = 1-att[8];
+		}
+
+		document.getElementById("lay1").onmousedown = false;
+		
+		loadPicture(2);
+	}
+
+	document.getElementById("lay1").onmousedown = moveToEvent;
+}
+
+
+function scale(scaledef) {
+
+	att[2] = scaledef;
+	loadPicture(2);
+}
+
+
+function setMarks() {
+
+	if (att[4] != "" && att[4] != "0/0") {
+		var mark = att[4].split(";");
+
+		var countMarks = mark.length;
+		
+		// maximum of marks is 8
+		// we do not report this error because this is already done in func. "Mark"
+		if (countMarks > 8) countMarks = 8;
+
+		var picWidth = document.pic.offsetWidth;
+		var picHeight = document.pic.offsetHeight;
+
+		// catch the cases where the picture had not been loaded already and
+		// make a timeout so that the coordinates are calculated with the real dimensions
+		if (document.pic.complete) {
+			var xoffset = parseInt(document.getElementById("lay1").style.left);
+			var yoffset = parseInt(document.getElementById("lay1").style.top);
+
+			for (var i = 0; i < countMarks; i++) {
+				mark[i] = mark[i].split("/");
+
+				if ((mark[i][0] > att[5]) && (mark[i][1] > att[6]) && (mark[i][0] < (att[5]+att[7])) && (mark[i][1] < (att[6]+att[8]))) {
+
+					mark[i][0] = parseInt(xoffset+picWidth*(mark[i][0]-att[5])/att[7]);
+					mark[i][1] = parseInt(yoffset+picHeight*(mark[i][1]-att[6])/att[8]);
+
+
+					document.getElementById("dot" + i).style.left = mark[i][0]-5;
+					document.getElementById("dot" + i).style.top = mark[i][1]-5;
+					document.getElementById("dot" + i).style.visibility = "visible";
+				}
+			}
+		} else {
+			setTimeout("setMarks()", 100);
+		}
+	}
+}
+
+// capturing keypresses for next and previous page
+// ascii-values of n = 110, b = 98
+function parseKeypress (event) {
+
+	if (String.fromCharCode(event.which) == "n") {
+		nextPage();
+	}
+	
+	// does not work currently, because Opera catches this key on it's own
+	// have to change the key or find another way - luginbuehl
+	if (String.fromCharCode(event.which) == "b") {
+		backPage();
+	}
+}
+
+
+// auxiliary function to crop senseless precicsion
+function cropFloat(tmp) {
+	return parseInt(10000*tmp)/10000;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/server/dlConfig.jsp	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,141 @@
+<%@ page language="java" %>
+
+<%!
+// authentication stuff - robert
+// -----------------------------
+// create DocumentBean instance for all JSP requests
+digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean();
+
+// initialize DocumentBean instance in JSP init
+public void jspInit() {
+    try {
+        // set servlet init-parameter
+        docBean.setConfig(getServletConfig());
+    } catch (javax.servlet.ServletException e) {
+        System.out.println(e);
+    }
+}
+%>
+
+<%
+// get digilib config
+digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig();
+// parsing the query
+digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request);
+// add number of pages
+dlRequest.setPt(docBean.getNumPages(dlRequest));
+%>
+
+<html>
+<head>
+<title>Digilib configuration page</title>
+</head>
+
+<body>
+<h1>Local request information</h1>
+
+<table>
+  <tr>
+    <td>Pt</td><td><b><%= dlRequest.getPt() %></b></td>
+    <td><i>total number of pages (generated by servlet)</i></td>
+  </tr>
+  <tr>
+    <td>RequestPath</td><td><b><%= dlRequest.getRequestPath() %></b></td>
+    <td><i>url of the page/document</i></td>
+  </tr>
+  <tr>
+    <td>Fn</td><td><b><b><%= dlRequest.getFn() %></b></td><td><i>url of the page/document</i></td>
+  </tr>
+  <tr>
+    <td>FilePath</td><td><b><%= dlRequest.getFilePath() %></b></td><td><i>effective path of the page/document</i></td>
+  </tr>
+  <tr>
+    <td>Pn</td><td><b><%= dlRequest.getPn() %></b></td><td><i>page number</i></td>
+  </tr>
+  <tr>
+    <td>Dw</td><td><b><%= dlRequest.getDw() %></b></td><td><i>width of client in pixels</i></td>
+  </tr>
+  <tr>
+    <td>Dh</td><td><b><%= dlRequest.getDh() %></b></td><td><i>height of client in pixels</i></td>
+  </tr>
+  <tr>
+    <td>Wx</td><td><b><%= dlRequest.getWx() %></b></td><td><i>left edge of image (float from 0 to 1)</i></td>
+  </tr>
+  <tr>
+    <td>Wy</td><td><b><%= dlRequest.getWy() %></b></td><td><i>top edge in image (float from 0 to 1)</i></td>
+  </tr>
+  <tr>
+    <td>Ww</td><td><b><%= dlRequest.getWw() %></b></td><td><i>width of image (float from 0 to 1)</i></td>
+  </tr>
+  <tr>
+    <td>Wh</td><td><b><%= dlRequest.getWh() %></b></td><td><i>height of image (float from 0 to 1)</i></td>
+  </tr>
+  <tr>
+    <td>Ws</td><td><b><%= dlRequest.getWs() %></b></td><td><i>scale factor</i></td>
+  </tr>
+  <tr>
+    <td>Mo</td><td><b><%= dlRequest.getMo() %></b></td><td><i>special options like 'fit' for gifs</i></td>
+  </tr>
+  <tr>
+    <td>Mk</td><td><b><%= dlRequest.getMk() %></b></td><td><i>marks</i></td>
+  </tr>
+  <tr>
+    <td>BaseURL</td><td colspan="2"><b><%= dlRequest.getBaseURL() %></b></td>
+  </tr>
+  <tr>
+    <td></td><td></td><td><i>base URL (from http:// to below /servlet)</i></td>
+  </tr>
+</table>
+
+
+<h1>Global servlet configuration</h1>
+
+<table>
+  <tr>
+    <td>ServletVersion</td><td><b><%= dlConfig.getServletVersion() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>AuthConfPath</td><td><b><%= dlConfig.getAuthConfPath() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>AuthURLPath</td><td><b><%= dlConfig.getAuthURLPath() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>BaseDirs</td><td><b><%= dlConfig.getBaseDirList() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>DebugLevel</td><td><b><%= dlConfig.getDebugLevel() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>DenyImgFileName</td><td><b><%= dlConfig.getDenyImgFileName() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>DLConfPath</td><td><b><%= dlConfig.getDlConfPath() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>DocuImageType</td><td><b><%= dlConfig.getDocuImageType() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>ErrorImgFileName</td><td><b><%= dlConfig.getErrorImgFileName() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>SendFileAllowed</td><td><b><%= dlConfig.isSendFileAllowed() %></b></td>
+    <td></td>
+  </tr>
+  <tr>
+    <td>UseAuthentication</td><td><b><%= dlConfig.isUseAuthentication() %></b></td>
+    <td></td>
+  </tr>
+</table>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/doc/digilib_client.html	Tue May 13 21:02:22 2003 +0200
@@ -0,0 +1,428 @@
+<html>
+<head>
+<title>Documentation: digilib-client</title>
+</head>
+<body bgcolor="#FFFFFF">
+<h1>Dokumentation: digilib-client</h1>
+
+<h3>Table of contents</h3>
+
+<h4>1 Introduction</h4>
+
+<h4>2 Files</h4>
+
+<b>&nbsp;&nbsp;2.1 digilib.jsp<br>
+&nbsp;&nbsp;2.2 dlImage.jsp<br>
+&nbsp;&nbsp;2.3 navigation_XX.js<br>
+&nbsp;&nbsp;2.4 dlMenu.html<br>
+&nbsp;&nbsp;2.5 Modules<br></b>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.5.1 pdfMaker.js<br>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2.5.2 pagesTotal.js
+
+<h4>3 Future</h4>
+
+<h4>4 Information</h4>
+
+<b>&nbsp;&nbsp;4.1 Supported browsers and platforms<br>&nbsp;</b>
+
+<hr>
+
+<h3>1 Introduction</h3>
+
+<p>
+Digilib is a client-server-software that transforms high-resolution images to
+formats that are acceptable for internet network connetions. the client software
+is based on HTML and JavaScript so that everybody can use it with a normal
+browser. To see in full detail which browsers and platforms are supported check
+chapter 4.1. This software provides lots of features like zooming areas of
+pictures, setting marks to the pictures, jumping to different pictures while
+always being able to generate URLs so that people can distibute these and
+everybody can see the same picture with ist marks.<br>
+It has been put lots of attention providing files that are as intependant of
+each other as possible so that embedding it in other kind of pages will be as
+simple as it can be. Stuff like providing modules or a different menubar are
+just some of the stuff you can easily do without having to change the files
+provided.
+</p>
+<p>
+Some of the the client-files contain JSP code, to do some serverside
+configuration. Because of the fact that the serverside software has to use a
+java module for the web-server there is no need to install more stuff than what
+is needed by the server-scripts.
+</p>
+<p>
+This software is still work in progress and it is quite probable that lots of
+stuff will change in the future, so check this file with every new version of
+software you downloaded.
+</p>
+
+<h3>2 Files</h3>
+
+<p>
+There are quite some files the client software needs to run all the interactive
+user-interface. To give you a detailed view of the files there is a subsection
+provided in this document explaining what each file does and how it interacts
+with the others.
+</p>
+
+<h4>2.1 digilib.jsp</h4>
+
+<p>
+This is the file you will request from the server and which will call the
+other files. The main purposes of this file are:
+</p>
+
+<ul>
+ <li>User authentication when wanting to access restriced documents. Check out
+     the serverside documentation for detailed explanation of how to set it
+     up.</li>
+ <li>Converting the query-string to the servlet style parameters (because of some 
+     historical reasons the two parameter-sets are not equal and a project at the 
+     Univerity of Berne based on digilib requires the first kind of parameters. So
+     for the moment we have to live with it...)</li>
+ <li>Building the frameset for the different frames like the one actually holding
+     the image, one for navigation, etc.. It's up to the developer of a certain
+     application to change it to its needs.</li>
+</ul>
+
+<p>
+The crutial point in this file is the way the query on the URL (get-method) is
+made. After <kbd>digilib.jsp?</kbd> there is a comma-separated list of parameters. It is
+to say that principally all of them are optional, but the first of them
+describing the url of the image-directory should really be set.<br>
+Here is the list of the diffenent attributes in
+<kbd>digilib.jsp?[att0]+[att1]+[att2]+[att3]+[att4]+ ... +[att8]</kbd>: 
+</p>
+
+<table border="0" align="center" width="95%">
+ <tr>
+  <td width="8%" valign="top">[att0]</td>
+  <td>Directory where the image can be found (check the documentation for
+      serverside).</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">[att1]</td>
+  <td>The page number (equals the index of the image in the sorted directory).</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">[att2]</td>
+  <td>The dimension relative to the visible height/width in the frame (1.0 means
+      that the image fits exactly into the frame, while 2.0 means twice that
+      size).</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">[att3]</td>
+  <td>Attribute to pass extra options to the servlet (for example 'fit' means
+      that normally not resized gif-images will be scaled).</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">[att4]</td>
+  <td>Here are the marks passed separated by ';', while the coordinates are
+      separated with '/'. The cooridnates are in a relative format (0.0 -
+      1.0).<br>
+      Example ... +0.33/0.5;0.25/0.25+ ... means that there are two marks one a
+      third from the left and half down the image and the second a quarter from
+      left and top of the image.</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">[att5]</td>
+  <td>Relative (0.0 - 1.0) value giving the most left pixels visible in the
+      zoomed image.</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">[att6]</td>
+  <td>Dito with the topmost pixels.</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">[att7]</td>
+  <td>Gives the visible width of the image (also 0.0 - 1.0).</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">[att8]</td>
+  <td>Same with the height.</td>
+ </tr>
+</table>
+
+<p>
+It is important to understand that all cooridnates that are used by digilib are
+passed as relative values where the width/height of an image is 1. This way it
+is possible that the images are displayed the same way on all kind of different
+screen-sizes and so making opening the possibility of sharing a url between
+people that will see the same on their screens.
+</p>
+
+<h4>2.2 dlImage.jsp</h4>
+
+<p>
+The parameterlist in dlImage.jsp is quite the same as in digilib.jsp but is
+represented in another format. As in chapter 2.1 we are discussing here the
+parameterlist. The parameters are no longer separated with the plus-sign put
+with an ampersand '&', which is the official way of passing different parameters
+through the URL. The parameters have all a name followed by a value, like <kbd>
+.../dlImage.jsp?fn=histbot/botany&pn=3& ... </kbd>. I will give you now a list of
+parameters dlImage.jsp understands by default by indication the name and its
+equivalent in digilib.jsp and if needed some special comments. It is possible
+and the somehow the aim of dlImage to pass more parameters to this file for
+additional functionality. Check out section 2.5.1 where is a good example of how
+to modify dlImage.jsp for adding new functionality.
+</p>
+
+<table border="0" align="center" width="95%">
+ <tr>
+  <td width="8%" valign="top">fn</td>
+  <td>= att0</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">pn</td>
+  <td>= att1</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">ws</td>
+  <td>= att2</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">mo</td>
+  <td>= att3</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">mk</td>
+  <td>= att4</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">wx</td>
+  <td>= att5</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">wy</td>
+  <td>= att6</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">ww</td>
+  <td>= att7</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">wh</td>
+  <td>= att8</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">dx</td>
+  <td>Width of the frame containing the to be displayed image in pixels.</td>
+ </tr>
+ <tr>
+  <td width="8%" valign="top">dy</td>
+  <td>Dito with the height.</td>
+ </tr>
+</table>
+
+<p>
+DlImage.jsp can react in two completely different ways on a request. When
+requesting the file it checks whether the width and height of the frame are
+passed as parameters in the URL. This is not the case on every first view of a
+session. If the dimensions are not set, then dlImage sends a dummy page to the
+client, calculates the width and height of the frame (which is only possible
+with a correct html-file) and resends the request to dlImage.jsp this time with
+the indicated dimensions.
+</p>
+<p>
+The other way dlImage.jsp reacts is its noraml reaction. This means that it
+parses the parameterslist and fills in some default values if they are missing
+(check out the source-code to see them). Then the file is going to include some
+script files that do offer the functionality. Part of these JavaScript-files are
+browser dependant, some are not. The most important files are named with
+navigation_XX.js where XX is a shortcut for the browser. The other files (the
+ones not browser-dependant) are some sample modules that are discussed in
+section 2.5.<br>
+Then it is time to build the actual HTML for the frame. There is one layer
+holding the picture (the way the parameters should be passed is described in the
+serverside dokumentaion). The layers named 'dotX' are the layers holding the
+marks, the ones named 'eckX' are the corners when zooming a rectangle.<br>
+Last but not least the parameters are passed to the navigation-script or the the
+module using them (<kbd>&lt;body bgcolor="#666666" onload='init_XXXXX("&lt;%= fn ...
+")'&gt;</kbd>).
+</p>
+
+<h4>2.3 navigation_XX.js</h4>
+
+<p>
+Let's look at the crucail points about navigation_XX.js-files. Most important is
+that the parameters passed to the init-function are stored in an array globally
+accesible (the code in init shows this). The name of the array is 'att'. There
+is also a function called 'loadPicture' that puts together a new URL
+(dlImage.jsp?...) for loading a new picture or another part of the same. Then we
+have lots of functions dealing with different parts of the digilib
+functionality:
+</p>
+
+<table border="0" align="center" width="95%">
+ <tr>
+  <td width="10%" valign="top">backPage</td>
+  <td>Loading the previous picture in the directory.</td>
+ </tr>
+ <tr>
+  <td width="10%" valign="top">nextPage</td>
+  <td>Loading the next picture in the directory.</td>
+ </tr>
+ <tr>
+  <td width="10%" valign="top">page</td>
+  <td>Loading a picture in the same directory by index.</td>
+ </tr>
+ <tr>
+  <td width="10%" valign="top">digicat</td>
+  <td>Loading a new window containing thumbnails of images in the directoy (some
+      closely related project called 'digicat').</td>
+ </tr>
+ <tr>
+  <td width="10%" valign="top">ref</td>
+  <td>Generating HTML- or LaTeX-style links for the special part of picture
+      including marks to build into other documents. The URL is made with
+      <kbd>digilib.jsp?...+... </kbd>.</td>
+ </tr>
+ <tr>
+  <td width="10%" valign="top">mark</td>
+  <td>Sets a mark to the current picture.</td>
+ </tr>
+ <tr>
+  <td width="10%" valign="top">zoomArea</td>
+  <td>Zooms an area of the current picture.</td>
+ </tr>
+ <tr>
+  <td width="10%" valign="top">zoomPoint</td>
+  <td>Zooms in around the selected point on the picture.</td>
+ </tr>
+ <tr>
+  <td width="10%" valign="top">moveTo</td>
+  <td>Moves the center of a image area to this point while maintaining the same
+      zooming grade (sometimes this is known as 'pan').</td>
+ </tr>
+ <tr>
+  <td width="10%" valign="top">scale</td>
+  <td>Scales an image relative to the dimensions of the image-frame (normally
+      the image fits right into it).</td>
+ </tr>
+</table>
+
+<p>
+The other functions are helpers that are should not be directly accessed from
+outside the frame.
+</p>
+
+<h4>2.4 dlMenu.html</h4>
+
+<p>
+This file generates the navigation-frame with buttons and menus. From this point
+the calls are made to navigation_XX.js. Please consider this frame as a sample
+the we at the University of Berne are currently using. If you are good in
+graphics design feel free to create your own buttons.<br>
+The files related to dlMenu.html are in a subdirectory called 'buttons' where
+the gif-images are stored and also the menu.js-scripts handling the menus.
+</p>
+
+<h4>2.5 Modules</h4>
+
+<p>
+The modules form a very important part of the whole project. This software aims
+to be easy to upgrade with new functionality. Because of the fact that
+JavaScript is not a full featured programming language modularisation  in so
+that intuitive and simple. Still we have found a way of providing enough freedom
+to build new modules and adding features to digilib. The example of two sample
+modules (that are nevertheless useful), we would like to show how we think one
+should implement another module to add new functionality.
+</p>
+
+<h5>2.5.1 pdfMaker.js</h5>
+
+<p>
+In the subdirectory 'modules' is a very simple module called pdfMaker.js. This
+very basic module only has one function (makePDF) that does nothing more than
+giving a prompt where one can enter a number of image-indices and call a
+serverside script that creates a PDF-file with the different picures. To make
+this module work it has first to be loaded by dlImage.jsp. Because it is
+browser-independant there is only one version of it. Aften being loaded it has
+access to the whole 'att'-array which is quite stupidely shown in makePDF by
+giving the index of the currently displayed image as default value.<br>
+One other thing that has to be done is to enter a new button to navigation.html
+so that the new function can be called... quite logic i know.
+</p>
+
+<h5>2.5.2 pagesTotal.js</h5>
+
+<p>
+'pagesTotal.js' is a lot more complicated than the first module and shows some
+more things to think of when making a module. It aims to show the current
+pagenumber (index) and the total number of images in the directory in a
+separated frame. The first thing that has to be done is implementing a new frame
+in diglib.jsp to provide space to write down the information.<br>
+As we know the current index is stored in the parameter 'pn' in dlImage.jsp and
+easily accessible in the scripts with 'att[1]', where as the total number of
+pages is only known by the server. To get this information one has to make a
+call to a server function. This is done in digilib.jsp (query += "&pt=" +
+DB.getNumPages(request);) the resulting number that should not cheange during a
+session is stored in a new parameter 'pt' that is sent in the parameter-list to
+dlImage.jsp.<br>
+In dlImage we have to load the module (configure 2.5.1). Next thing is to make
+the 'pt' accessible through all the scripts (adding a new cell to the
+'att'-array) by creating an init'function in the module. While the original
+function is called 'init' the one in pagesTotal is called 'init_pagesTotal' and
+acception the additional parameter 'pt'. In 'init_pagesTotal' there is a call to
+the original 'init' with all parameters but 'pt' and so filling the first nine
+cells of the att-array. Then it's time to add a new cell with 'pt' as its value.
+Further on there is a call to function 'pagesTotal' that writes the data into
+the new frame.<br>
+As you can see there are some functions overriding the original ones.
+'nextPage', 'page' and 'loadPicture' are rewritten in the module to make use of
+the new functionality. In the first two functions we can make now some
+additional checks that we cannot run past the last image. 'loadPicture' has to
+be improved so that 'pt' will be in the URL sent when loading a new picture or
+area.
+</p>
+
+
+<h3>3 Future</h3>
+
+<p>
+There are some future plans concerning the cilent software. While there is no
+actual list of things that have to be done, but some vague ideas of
+improvements:
+</p>
+
+<ul>
+ <li>Cleaning up the different stiles of holding the parameters.</li>
+ <li>Makeing some handy generic functions like mouseclicks or mousemoves so that
+     they can be used in modules.</li>
+ <li>Makeing the implementation of modules clearer, easier and safer than it is
+     now. In JavaScript there are some (rudimentary?) object-oriented ideas that
+     might help improving it - but I didn't got it until now.</li>
+ <li>Make it work on more platforms/browsers.</li>
+ <li>You can always make the code clearer, smaller, better, faster, ... :-)</li>
+</ul>
+
+
+<h3>4 Information</h3>
+
+<h4>4.1 Supported browsers and platforms</h4>
+
+<p>
+Here is a very incomplete list of browsers and platforms known to work with
+digilib. We provide three different navigation-scripts to work with different
+implementations of JavaScript in different browsers. These are Netscape 4,
+Internet Explorer (working on versions 4 - 6), Opera 6 and the Mozilla5-engine. Due to
+some bugs in the browsers and special behaviours of different platforms we
+cannot garantee that digilib works on every platform supported by for example
+the Mozilla5-engine. Anyone having success on a different platform than the ones
+indicated below, please send a note.
+</p>
+
+<ul>
+ <li>Netscape 4.7x (Windows, MacOS 9.0/9.1, MacOS X, Linux, Solaris)</li>
+ <li>Mozilla 0.9.x (Windows, Linux, MacOS X)</li>
+ <li>Internet Explorer 4.01+ (Windows)</li>
+ <li>Internet Explorer 5 (MacOS 9.0/9.1, MacOS X)</li>
+ <li>Opera 6 (Windows, possibly other platforms)</li>
+</ul>
+
+<hr>
+<address>
+University of Berne - Switzerland : History and Philosophy of Science<br>
+18.02.2002 - Christian Luginbuehl 
+(<a href="mailto:luginbuehl@student.unibe.ch">luginbuehl@student.unibe.ch</a>)
+</address>