comparison client/digitallibrary/navigation_n4.js @ 34:84a481a388bb

first update of new client-version
author luginbue
date Thu, 21 Feb 2002 02:27:06 +0100
parents d407cb901df4
children 930413351738
comparison
equal deleted inserted replaced
33:054ebc851059 34:84a481a388bb
1 /* navigation_ie -- JS library for digilib (Netscape4 version) 1 // this global variable has to be initialised before the frist use of the functions below
2 2 // to fill in the attributes you can use the function init provided below
3 Digital Image Library servlet components
4
5 Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch)
6
7 This program is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2 of the License, or (at your
10 option) any later version.
11
12 Please read license.txt for the full details. A copy of the GPL
13 may be found at http://www.gnu.org/copyleft/lgpl.html
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 */
20
21 // these two global variables have to be initialised before the frist use of the functions below
22 // to fill in the attributes you can use the function initPicture provided below
23 // - array with all attributes 3 // - array with all attributes
24 var att = new Array(); 4 var att = new Array();
25 5
26 // - variable to store the path to the frame, in which the pictures should be created 6 // fill in the values of the "att"-array
27 var whichFrame = parent.mainFrame; 7 function init(fn, pn, ws, mo, mk, wx, wy, ww, wh) {
28 8
29 // give a name to the window containing digilib - this way one can test if there is already a 9 // debug window to check the parameters passed
30 // digilib-window open and replace the contents of it (ex. digicat) 10 //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);
31 window.name = "digilib"; 11
12 // attaching the values to the att-array
13 att[0] = fn;
14 att[1] = parseInt(pn);
15 att[2] = parseFloat(ws);
16 att[3] = mo;
17 att[4] = mk;
18 att[5] = parseFloat(wx);
19 att[6] = parseFloat(wy);
20 att[7] = parseFloat(ww);
21 att[8] = parseFloat(wh);
22
23 // compatablility issue
24 if (att[3].indexOf("f") > -1) {
25 att[3] = "fit";
26 }
27
28 // converts the old mark format (0-1000) to new format(0.0 - 1.0)
29 // could even be useless now
30 if (att[4] != "0/0") {
31 var tmp = att[4].split(";");
32
33 att[4] = "";
34
35 for (i = 0; i < tmp.length; i++) {
36 tmp[i] = tmp[i].split("/");
37
38 if (tmp[i][0] > 1 && tmp[i][1] > 1) {
39 tmp[i][0] /= 1000;
40 tmp[i][1] /= 1000;
41 }
42
43 att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
44 }
45 att[4] = att[4].slice(0, -1);
46 }
47
48 // initialisation stuff
49 // ====================
50
51 setMarks();
52
53 window.captureEvents(Event.KEYDOWN);
54 window.onkeydown = parseKeypress;
55
56 focus();
57
58 // give a name to the window containing digilib - this way one can test if there is already a
59 // digilib-window open and replace the contents of it (ex. digicat)
60 top.window.name = "digilib";
61 }
62
32 63
33 // function that launches the ScaleServlet 64 // function that launches the ScaleServlet
34 // the different detailGrades: 65 // the different detailGrades:
35 // 0 -> back, next, page 66 // 0 -> back, next, page
36 // 1 -> zoomout 67 // 1 -> zoomout
37 // 2 -> zoomarea, zoompoint, moveto, scaledef 68 // 2 -> zoomarea, zoompoint, moveto, scaledef
38 69
39 function loadPicture(detailGrade, keepArea) { 70 function loadPicture(detailGrade, keepArea) {
40 71
41 // alert("wx: " + att[5] + "\tww: " + att[7] + "\nwy: " + att[6] + "\twh: " + att[8]); 72 var newURL = "dlImage.jsp?"
42 73 newURL += "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3];
43 var newPicture = "http://" + location.host + "/docuserver/digitallibrary/servlet/Scaler/"
44 newPicture += att[0] + "?" + "pn=" + att[1] + "&ws=" + att[2];
45 newPicture += "&dw=" + (whichFrame.innerWidth-30) + "&dh=" + (whichFrame.innerHeight-30);
46 newPicture += "&mo=" + att[3];
47 74
48 if (detailGrade == 0) { 75 if (detailGrade == 0) {
49 att[4] = "0/0"; 76 att[4] = "0/0";
50 } 77 }
51 78
53 att[5] = 0; 80 att[5] = 0;
54 att[6] = 0; 81 att[6] = 0;
55 att[7] = 1; 82 att[7] = 1;
56 att[8] = 1; 83 att[8] = 1;
57 } 84 }
58 newPicture += "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8]; 85
59 86 newURL += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
60 whichFrame.document.open(); 87 newURL += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
61 88
62 whichFrame.document.write('<html><head></head><body bgcolor="#666666">'); 89 // debug window - checking the parameters passed to the next image
63 whichFrame.document.write('<div ID="lay1" style="position:absolute; left:10; top:10; visibility:visible"><img src="' + newPicture + '"></div>'); 90 //alert ("DEBUG MESSAGE (complete URL in loadPicture):\n\n" + newURL);
64 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>'); 91
65 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>'); 92 location.href = newURL;
66 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>'); 93 }
67 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>'); 94
68 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>'); 95
69 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>'); 96 function backPage(keepArea) {
70 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>');
71 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>');
72 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>');
73 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>');
74 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>');
75 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>');
76 whichFrame.document.write('</body></html>');
77
78 whichFrame.document.close();
79
80 pageInfo();
81
82 setmark();
83 }
84
85
86 function Backpage(keepArea) {
87 97
88 att[1] = parseInt(att[1]) - 1; 98 att[1] = parseInt(att[1]) - 1;
89 99
90 if (att[1] > 0) { 100 if (att[1] > 0) {
91 loadPicture(0, keepArea); 101 loadPicture(0, keepArea);
94 alert("You are already on the first page!"); 104 alert("You are already on the first page!");
95 } 105 }
96 } 106 }
97 107
98 108
99 function Nextpage(keepArea) { 109 function nextPage(keepArea) {
100 110
101 att[1] = parseInt(att[1]) + 1; 111 att[1] = parseInt(att[1]) + 1;
102 112
103 if (att[1] <= parent.numPages) { 113 loadPicture(0, keepArea);
104 loadPicture(0, keepArea); 114 }
105 } else { 115
106 att[1] = parseInt(att[1]) - 1; 116
107 alert("You are already on the last page!"); 117 function page(keepArea) {
108 }
109 }
110
111
112 function Page(keepArea) {
113 118
114 do { 119 do {
115 page = prompt("Goto Page (1 - " + parent.numPages + "):", 1); 120 page = prompt("Goto Page:", 1);
116 } while ((page != null) && ((page < 1) || (page > parent.numPages))); 121 } while ((page != null) && (page < 1));
117 122
118 if (page != null && page != att[1]) { 123 if (page != null && page != att[1]) {
119 att[1] = page; 124 att[1] = page;
120 loadPicture(0, keepArea); 125 loadPicture(0, keepArea);
121 } 126 }
122 } 127 }
123 128
124 129
125 function Digicat() { 130 function digicat() {
126 var url = "http://" + location.host + "/docuserver/digitallibrary/digicat.html?" + att[0] + "+" + att[1]; 131 var url = "http://" + location.host + "/docuserver/digitallibrary/digicat.html?" + att[0] + "+" + att[1];
127 win = window.open(url, "digicat"); 132 win = window.open(url, "digicat");
128 win.focus(); 133 win.focus();
129 } 134 }
130 135
131 136
132 function Ref(refselect) { 137 function ref(refselect) {
133 138
134 var hyperlinkRef = "http://" + location.host + "/docuserver/digitallibrary/digilib.jsp?"; 139 var hyperlinkRef = "http://" + location.host + "/docuserver/digitallibrary/digilib.jsp?";
135 hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4]; 140 hyperlinkRef += att[0] + "+" + att[1] + "+" + att[2] + "+" + att[3] + "+" + att[4];
136 141
137 if ((att[5] != 0) || (att[6] != 0) || (att[7] != 1) || (att[8] != 1)) { 142 if ((att[5] != 0) || (att[6] != 0) || (att[7] != 1) || (att[8] != 1)) {
144 prompt("Link for LaTeX--documents", "\\href{" + hyperlinkRef + "}{TEXT}"); 149 prompt("Link for LaTeX--documents", "\\href{" + hyperlinkRef + "}{TEXT}");
145 } 150 }
146 } 151 }
147 152
148 153
149 function Mark(refselect) { 154 function mark(refselect) {
150 155
151 if (att[4].split(";").length > 7) { 156 if (att[4].split(";").length > 7) {
152 alert("Only 8 marks are possible at the moment!"); 157 alert("Only 8 marks are possible at the moment!");
153 return; 158 return;
154 } 159 }
155 160
156 whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN); 161 document.lay1.captureEvents(Event.MOUSEDOWN);
157 whichFrame.document.lay1.onmousedown = function(event) { 162 document.lay1.onmousedown = function(event) {
158 163
159 if ((att[4] != "") && (att[4] != "0/0")) { 164 if ((att[4] != "") && (att[4] != "0/0")) {
160 att[4] += ";"; 165 att[4] += ";";
161 } else { 166 } else {
162 att[4] = ""; 167 att[4] = "";
163 } 168 }
164 169
165 var markX = cropFloat(att[5]+(att[7]*event.x/whichFrame.document.lay1.clip.width)); 170 var markX = cropFloat(att[5]+(att[7]*event.x/document.lay1.clip.width));
166 var markY = cropFloat(att[6]+(att[8]*event.y/whichFrame.document.lay1.clip.height)); 171 var markY = cropFloat(att[6]+(att[8]*event.y/document.lay1.clip.height));
167 172
168 att[4] += markX + "/" + markY; 173 att[4] += markX + "/" + markY;
169 174
170 whichFrame.document.lay1.releaseEvents(Event.MOUSEDOWN); 175 document.lay1.releaseEvents(Event.MOUSEDOWN);
171 setmark(); 176 setMarks();
172 } 177 }
173 } 178 }
174 179
175 180
176 function Zoomrect() { 181 function zoomArea() {
177 var state = 0; 182 var state = 0;
178 var x1, y1, x2, y2; 183 var x1, y1, x2, y2;
179 184
180 function Click(event) { 185 function click(event) {
181 186
182 if (state == 0) { 187 if (state == 0) {
183 state = 1; 188 state = 1;
184 189
185 x1 = event.pageX; 190 x1 = event.pageX;
186 y1 = event.pageY; 191 y1 = event.pageY;
187 x2 = x1; 192 x2 = x1;
188 y2 = y1; 193 y2 = y1;
189 194
190 whichFrame.document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2)); 195 document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2));
191 whichFrame.document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2)); 196 document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2));
192 whichFrame.document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12); 197 document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12);
193 whichFrame.document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12); 198 document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12);
194 199
195 whichFrame.document.eck1.visibility="show"; 200 document.eck1.visibility="show";
196 whichFrame.document.eck2.visibility="show"; 201 document.eck2.visibility="show";
197 whichFrame.document.eck3.visibility="show"; 202 document.eck3.visibility="show";
198 whichFrame.document.eck4.visibility="show"; 203 document.eck4.visibility="show";
199 204
200 whichFrame.document.lay1.captureEvents(Event.MOUSEMOVE); 205 document.lay1.captureEvents(Event.MOUSEMOVE);
201 whichFrame.document.eck4.captureEvents(Event.MOUSEMOVE); 206 document.eck4.captureEvents(Event.MOUSEMOVE);
202 207
203 whichFrame.document.lay1.onmousemove = Move; 208 document.lay1.onmousemove = move;
204 whichFrame.document.eck4.onmousemove = Move; 209 document.eck4.onmousemove = move;
205 210
206 } else { 211 } else {
207 212
208 x1 -= whichFrame.document.lay1.x; 213 x1 -= document.lay1.x;
209 y1 -= whichFrame.document.lay1.y; 214 y1 -= document.lay1.y;
210 215
211 x2 = event.pageX-whichFrame.document.lay1.x; 216 x2 = event.pageX-document.lay1.x;
212 y2 = event.pageY-whichFrame.document.lay1.y; 217 y2 = event.pageY-document.lay1.y;
213 218
214 whichFrame.document.lay1.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); 219 document.lay1.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
215 whichFrame.document.eck4.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE); 220 document.eck4.releaseEvents(Event.MOUSEDOWN | Event.MOUSEMOVE);
216 221
217 whichFrame.document.eck1.visibility="hide"; 222 document.eck1.visibility="hide";
218 whichFrame.document.eck2.visibility="hide"; 223 document.eck2.visibility="hide";
219 whichFrame.document.eck3.visibility="hide"; 224 document.eck3.visibility="hide";
220 whichFrame.document.eck4.visibility="hide"; 225 document.eck4.visibility="hide";
221 226
222 att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/whichFrame.document.lay1.clip.width); 227 att[5] = cropFloat(att[5]+att[7]*((x1 < x2) ? x1 : x2)/document.lay1.clip.width);
223 att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/whichFrame.document.lay1.clip.height); 228 att[6] = cropFloat(att[6]+att[8]*((y1 < y2) ? y1 : y2)/document.lay1.clip.height);
224 229
225 att[7] = cropFloat(att[7]*Math.abs(x1-x2)/whichFrame.document.lay1.clip.width); 230 att[7] = cropFloat(att[7]*Math.abs(x1-x2)/document.lay1.clip.width);
226 att[8] = cropFloat(att[8]*Math.abs(y1-y2)/whichFrame.document.lay1.clip.height); 231 att[8] = cropFloat(att[8]*Math.abs(y1-y2)/document.lay1.clip.height);
227 232
228 if (att[7] != 0 && att[8] != 0) { 233 if (att[7] != 0 && att[8] != 0) {
229 loadPicture(2); 234 loadPicture(2);
230 } 235 }
231 } 236 }
232 } 237 }
233 238
234 function Move(event) { 239 function move(event) {
235 240
236 x2 = event.pageX; 241 x2 = event.pageX;
237 y2 = event.pageY; 242 y2 = event.pageY;
238 243
239 whichFrame.document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2)); 244 document.eck1.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y1 : y2));
240 whichFrame.document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2)); 245 document.eck2.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y1 : y2));
241 whichFrame.document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12); 246 document.eck3.moveTo(((x1 < x2) ? x1 : x2), ((y1 < y2) ? y2 : y1)-12);
242 whichFrame.document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12); 247 document.eck4.moveTo(((x1 < x2) ? x2 : x1)-12, ((y1 < y2) ? y2 : y1)-12);
243 } 248 }
244 249
245 whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN); 250 document.lay1.captureEvents(Event.MOUSEDOWN);
246 whichFrame.document.eck4.captureEvents(Event.MOUSEDOWN); 251 document.eck4.captureEvents(Event.MOUSEDOWN);
247 252
248 whichFrame.document.lay1.onmousedown = Click; 253 document.lay1.onmousedown = click;
249 whichFrame.document.eck4.onmousedown = Click; 254 document.eck4.onmousedown = click;
250 } 255 }
251 256
252 257
253 function Zoomin() { 258 function zoomPoint() {
254 259
255 whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN); 260 document.lay1.captureEvents(Event.MOUSEDOWN);
256 whichFrame.document.lay1.onmousedown = function(event) { 261 document.lay1.onmousedown = function(event) {
257 262
258 att[5] = cropFloat(att[5]+(att[7]*event.x/whichFrame.document.lay1.clip.width-0.5*att[7]*0.7)); 263 att[5] = cropFloat(att[5]+(att[7]*event.x/document.lay1.clip.width-0.5*att[7]*0.7));
259 att[6] = cropFloat(att[6]+(att[8]*event.y/whichFrame.document.lay1.clip.height-0.5*att[8]*0.7)); 264 att[6] = cropFloat(att[6]+(att[8]*event.y/document.lay1.clip.height-0.5*att[8]*0.7));
260 265
261 att[7] = cropFloat(att[7]*0.7); 266 att[7] = cropFloat(att[7]*0.7);
262 att[8] = cropFloat(att[8]*0.7); 267 att[8] = cropFloat(att[8]*0.7);
263 268
264 if (att[5] < 0) { 269 if (att[5] < 0) {
279 loadPicture(2); 284 loadPicture(2);
280 } 285 }
281 } 286 }
282 287
283 288
284 function Zoomout() { 289 function zoomOut() {
285 loadPicture(1); 290 loadPicture(1);
286 } 291 }
287 292
288 293
289 function Moveto() { 294 function moveTo() {
290 295
291 whichFrame.document.lay1.captureEvents(Event.MOUSEDOWN); 296 document.lay1.captureEvents(Event.MOUSEDOWN);
292 whichFrame.document.lay1.onmousedown = function(event) { 297 document.lay1.onmousedown = function(event) {
293 298
294 att[5] = cropFloat(att[5]+(att[7]*event.x/whichFrame.document.lay1.clip.width-0.5*att[7])); 299 att[5] = cropFloat(att[5]+(att[7]*event.x/document.lay1.clip.width-0.5*att[7]));
295 att[6] = cropFloat(att[6]+(att[8]*event.y/whichFrame.document.lay1.clip.height-0.5*att[8])); 300 att[6] = cropFloat(att[6]+(att[8]*event.y/document.lay1.clip.height-0.5*att[8]));
296 301
297 if (att[5] < 0) { 302 if (att[5] < 0) {
298 att[5] = 0; 303 att[5] = 0;
299 } 304 }
300 if (att[6] < 0) { 305 if (att[6] < 0) {
312 loadPicture(2); 317 loadPicture(2);
313 } 318 }
314 } 319 }
315 320
316 321
317 function Scaledef(scaledef) { 322 function scale(scaledef) {
318 323
319 att[2] = scaledef; 324 att[2] = scaledef;
320 loadPicture(2); 325 loadPicture(2);
321 } 326 }
322 327
323 328
324 function setmark() { 329 function setMarks() {
325 if ((att[4] != "") && (att[4] != "0/0")) { 330 if ((att[4] != "") && (att[4] != "0/0")) {
326 var mark = att[4].split(";"); 331 var mark = att[4].split(";");
327 332
328 var countMarks = mark.length; 333 var countMarks = mark.length;
329 334
330 // maximum of marks is 8 335 // maximum of marks is 8
331 // we do not report this error because this is already done in func. "Mark" 336 // we do not report this error because this is already done in func. "Mark"
332 if (countMarks > 8) countMarks = 8; 337 if (countMarks > 8) countMarks = 8;
333 338
334 var picWidth = whichFrame.document.lay1.clip.width; 339 var picWidth = document.lay1.clip.width;
335 var picHeight = whichFrame.document.lay1.clip.height; 340 var picHeight = document.lay1.clip.height;
336 341
337 for (var i = 0; i < countMarks; i++) { 342 for (var i = 0; i < countMarks; i++) {
338 mark[i] = mark[i].split("/"); 343 mark[i] = mark[i].split("/");
339 344
340 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]))) { 345 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]))) {
341 346
342 mark[i][0] = parseInt(whichFrame.document.lay1.x + (picWidth*(mark[i][0]-att[5]))/att[7]); 347 mark[i][0] = parseInt(document.lay1.x + (picWidth*(mark[i][0]-att[5]))/att[7]);
343 mark[i][1] = parseInt(whichFrame.document.lay1.y + (picHeight*(mark[i][1]-att[6]))/att[8]); 348 mark[i][1] = parseInt(document.lay1.y + (picHeight*(mark[i][1]-att[6]))/att[8]);
344 349
345 whichFrame.document.layers[i+1].moveTo(mark[i][0]-5, mark[i][1]-5); 350 document.layers[i+1].moveTo(mark[i][0]-5, mark[i][1]-5);
346 whichFrame.document.layers[i+1].visibility = "show"; 351 document.layers[i+1].visibility = "show";
347 } 352 }
348 } 353 }
349 } 354 }
350 } 355 }
351 356
364 369
365 // auxiliary function to crop senseless precicsion 370 // auxiliary function to crop senseless precicsion
366 function cropFloat(tmp) { 371 function cropFloat(tmp) {
367 return parseInt(10000*tmp)/10000; 372 return parseInt(10000*tmp)/10000;
368 } 373 }
369
370
371 // initialize browser specific things (keypress caputring)
372 function initScripts() {
373 window.captureEvents(Event.KEYDOWN);
374 window.onkeydown = parseKeypress;
375 }
376
377
378 // fill in the values of the "att"-array
379 function initPicture(picURL) {
380 att = picURL.split("+");
381
382 if (att[0].lastIndexOf("/") == att[0].length-1) {
383 att[0] = att[0].substring(0, att[0].length-1);
384 }
385
386 if (att.length < 2 || att[1] == "") {
387 att[1] = 1;
388 }
389 if (att.length < 3 || att[2] == "") {
390 att[2] = "1.0";
391 }
392
393 if (att.length < 4) {
394 att[3] = "";
395 }
396
397 if (att[3].indexOf("f") > -1) {
398 att[3] = "fit";
399 }
400
401 if (att.length < 5 || att[4] == "") {
402 att[4] = "0/0";
403 }
404
405 // converts the old mark format (0-1000) to new format(0.0 - 1.0)
406 if (att[4] != "0/0") {
407 var tmp = att[4].split(";");
408
409 att[4] = "";
410
411 for (i = 0; i < tmp.length; i++) {
412 tmp[i] = tmp[i].split("/");
413
414 if (tmp[i][0] > 1 && tmp[i][1] > 1) {
415 tmp[i][0] /= 1000;
416 tmp[i][1] /= 1000;
417 }
418
419 att[4] += tmp[i][0] + "/" + tmp[i][1] + ";";
420 }
421 att[4] = att[4].slice(0, -1);
422 }
423
424 if (att.length < 7) {
425 att[5] = 0;
426 att[6] = 0;
427 att[7] = 1;
428 att[8] = 1;
429 } else {
430 att[5] = parseFloat(att[5]);
431 att[6] = parseFloat(att[6]);
432 att[7] = parseFloat(att[7]);
433 att[8] = parseFloat(att[8]);
434 }
435 }
436
437 function pageInfo() {
438
439 // bug in netscape 4.xx (confunding px and pt)
440 var fontsize = document.layers ? "11pt" : "11px";
441
442 if (window.pageFrame) {
443 pageFrame.document.open();
444 pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">');
445 pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: ' + fontsize + '">');
446 pageFrame.document.write(att[1] + '<b> of </b>' + numPages + '</p></body></html>');
447 pageFrame.document.close();
448 }
449 }
450