changeset 110:489f61d9feac

XUL Buttons in chrome
author engler
date Wed, 14 May 2003 12:00:40 +0200
parents 200584e60a0b
children d6a76e2fcb21
files client/digitallibrary/digilib.jsp client/digitallibrary/modules/pagesTotal.js client/digitallibrary/navigation_n6.js
diffstat 3 files changed, 354 insertions(+), 108 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/digilib.jsp	Wed May 14 00:11:15 2003 +0200
+++ b/client/digitallibrary/digilib.jsp	Wed May 14 12:00:40 2003 +0200
@@ -1,6 +1,25 @@
 <%@ 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
@@ -17,23 +36,202 @@
 }
 %>
 
+
+
+
 <%
+
 // parsing the query
 // -----------------
 
-digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request);
+//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);
 
-// add number of pages
-dlRequest.setPt(docBean.getNumPages(dlRequest));
-// retrieve request in new paramter format 
-String query = "dlImage.jsp?" + dlRequest.getAsString();
+%>
+
+<%
+
+// 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>
-<title>Digital Document Library</title>
+<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">
@@ -44,4 +242,11 @@
   </frameset>
 </frameset>
 
-</html>
\ No newline at end of file
+</html>
+
+<%
+    break; // level 2
+
+} // end switch
+
+%>
--- a/client/digitallibrary/modules/pagesTotal.js	Wed May 14 00:11:15 2003 +0200
+++ b/client/digitallibrary/modules/pagesTotal.js	Wed May 14 12:00:40 2003 +0200
@@ -1,3 +1,22 @@
+/*
+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                                              *
  *                                                                          *
@@ -13,7 +32,7 @@
 	// calling original init
 	init(pu, pn, ws, mo, mk, wx, wy, ww, wh);
 
-	att[9] = parseInt(pt);
+	att.pt = parseInt(pt);
 	
 	pagesTotal();
 
@@ -33,7 +52,7 @@
 		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[1] + '<b> of </b>' + att[9] + '</p></body></html>');
+		parent.pageFrame.document.write(att.pn + '<b> of </b>' + att.pt + '</p></body></html>');
 		parent.pageFrame.document.close();
 	}
 }
@@ -44,12 +63,12 @@
  */
 function nextPage(keepArea) {
 
-    att[1] = parseInt(att[1]) + 1;
+    att.pn = parseInt(att.pn) + 1;
 
-    if (att[1] <= att[9] || isNaN(att[9])) {
+    if (att.pn <= att.pt || isNaN(att.pt)) {
         loadPicture(0, keepArea);
     } else {
-	    att[1] = parseInt(att[1]) - 1;
+	    att.pn = parseInt(att.pn) - 1;
         alert("You are already on the last page!");
     }
 }
@@ -61,12 +80,12 @@
 function page(keepArea) {
 
 	do {
-    	var page = prompt("Goto Page (1 - " + att[9] + "):", 1);
+    	var page = prompt("Goto Page (1 - " + att.pt + "):", 1);
     	
-	} while ((page != null) && ((isNaN(page)) || (page < 1) || (page > att[9])));
+	} while ((page != null) && ((isNaN(page)) || (page < 1) || (page > att.pt)));
 
-   	if ((page != null) && (page != att[1])) {
-		att[1] = page;
+   	if ((page != null) && (page != att.pn)) {
+		att.pn = page;
 		loadPicture(0, keepArea);
 	}
 }
@@ -82,20 +101,20 @@
 	//		1 -> zoomout
 	//		2 -> zoomarea, zoompoint, moveto, scaledef
 
-	var newQuery = "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&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;
 	}
 
-	newQuery += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
+	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);
@@ -103,10 +122,11 @@
 		newQuery += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
 	}
 	
-	newQuery += "&pt=" + att[9];
+	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.pathname + "?" + newQuery;
-}
\ No newline at end of file
+	location.href = location.protocol + "//" + location.host + location.pathname + "?" + newQuery;
+}
--- a/client/digitallibrary/navigation_n6.js	Wed May 14 00:11:15 2003 +0200
+++ b/client/digitallibrary/navigation_n6.js	Wed May 14 12:00:40 2003 +0200
@@ -1,7 +1,26 @@
+/*
+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 Array();
+var att = new Object();
 
 // fill in the values of the "att"-array
 function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) {
@@ -10,27 +29,28 @@
 	//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);
+	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
-	if (att[3].indexOf("f") > -1) {
-		att[3] = "fit";
-	}
+// dangerous at the time - lugi
+//	if (att.mo.indexOf("f") > -1) {
+//		att.mo = "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(";");
+	if (att.mk != "0/0" && att.mk != "") {
+		var tmp = att.mk.split(";");
 		
-		att[4] = "";
+		att.mk = "";
 		
 		for (i = 0; i < tmp.length; i++) {
 			tmp[i] = tmp[i].split("/");
@@ -40,9 +60,9 @@
 				tmp[i][1] /= 1000;
 			}
 			
-			att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
+			att.mk += tmp[i][0] + "/" + tmp[i][1] + ";";
 		}
-		att[4] = att[4].slice(0, -1);
+		att.mk = att.mk.slice(0, -1);
 	}
 
 	// initialisation stuff
@@ -67,26 +87,27 @@
 
 function loadPicture(detailGrade, keepArea) {
 
-	var newQuery = "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&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;
 	}
 
-	newQuery += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
+	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"
+
 	// debug window - checking the parameters passed to the next image
-	//alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
+	alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
 
-	location.href = location.pathname + "?" + newQuery;
+	location.href = location.protocol + "//" + location.host + location.pathname + "?" + newQuery;
 }
 
 
@@ -99,8 +120,8 @@
 	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));
+	this.relX = cropFloat(att.wx+(att.ww*this.x/document.pic.offsetWidth));
+	this.relY = cropFloat(att.wy+(att.wh*this.y/document.pic.offsetHeight));
 
 	return this;
 }
@@ -108,12 +129,12 @@
 
 function backPage(keepArea) {
 
-    att[1] = parseInt(att[1]) - 1;
+    att.pn = parseInt(att.pn) - 1;
 
-    if (att[1] > 0) {
+    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!");
     }
 }
@@ -121,7 +142,7 @@
 
 function nextPage(keepArea) {
 
-    att[1] = parseInt(att[1]) + 1;
+    att.pn = parseInt(att.pn) + 1;
 
 	loadPicture(0, keepArea);
 }
@@ -133,15 +154,15 @@
     	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 = "digicat.html?" + att[0] + "+" + att[1];
+	var url = baseUrl + "/digicat.jsp?" + att.fn + "+" + att.pn;
 	win = window.open(url, "digicat");
 	win.focus();
 }
@@ -150,10 +171,10 @@
 function ref(refselect) {
 
 	var hyperlinkRef = baseUrl + "/digilib.jsp?";
-	hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4];
+	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) {
@@ -166,20 +187,20 @@
 
 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) {
-	    var point = new Point(event);
-
-		if ((att[4] != "") && (att[4] != "0/0")) {
-			att[4] += ";";
+    var point = new Point(event);
+    
+		if ((att.mk != "") && (att.mk != "0/0")) {
+			att.mk += ";";
 		} else {
-			att[4] = "";
+			att.mk = "";
 		}
-		att[4] += point.relX + "/" + point.relY;
+		att.mk += point.relX + "/" + point.relY;
 
 		document.getElementById("lay1").removeEventListener("mousedown", markEvent, true);		
 		setMarks();
@@ -233,13 +254,13 @@
 			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.wx = parseFloat(Math.min(pt1.relX, pt2.relX));
+			att.wy = parseFloat(Math.min(pt1.relY, pt2.relY));
 
-			att[7] = Math.abs(pt1.relX-pt2.relX);
-			att[8] = Math.abs(pt1.relY-pt2.relY);
+			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);
 			}
 		}
@@ -269,23 +290,23 @@
 	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.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;
 		}
 
 		document.getElementById("lay1").removeEventListener("mousedown", zoomPointEvent, true);
@@ -309,20 +330,20 @@
 
 	    var point = new Point(event);
 
-		att[5] = cropFloat(point.relX-0.5*att[7]);
-		att[6] = cropFloat(point.relY-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;
 		}
 
 		document.getElementById("lay1").removeEventListener("mousedown", moveToEvent, true);		
@@ -336,15 +357,15 @@
 
 function scale(scaledef) {
 
-	att[2] = scaledef;
+	att.ws = scaledef;
 	loadPicture(2);
 }
 
 
 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;
 		
@@ -364,10 +385,10 @@
 			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);
 
 
 					document.getElementById("dot" + i).style.left = mark[i][0]-5;
@@ -385,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();
 	}
 }