jablonka.czprosek.czf

mapstats

Subversion Repositories:
[/] [mapstats.js] - Blame information for rev 5

 

Line No. Rev Author Line
11unreal// --------------------------------------------------------
2// This script made JKLIR as. Unreal][ [http://jklir.net]
34unreal// Map engine originally from Emcee Lam [http://sjsutech.com]
41unreal// Licence: GNU/GPL
5// (c) 2008 All rights reserved
6// --------------------------------------------------------
7 
8 var mainMap;
9 var magnifier;
105unreal if (navigator.appName=="Microsoft Internet Explorer") {
11 var imgon = new Image();
12 imgon.src = 'on.png';
13 var imgoff = new Image();
14 imgoff.src = 'off.png';
15 var imginfo = new Image();
16 imginfo.src = 'info.png';
17 var imgap = new Image();
18 imgap.src = 'ap.png';
19 var imgcn = new Image();
20 imgcn.src = 'client.png';
21 var imgsw = new Image();
22 imgsw.src = 'switch.png';
23 }
241unreal 
25 var node = new Array();
265unreal var nodecount;
271unreal var pozdrav8 = new Array();
28 var pomocna = new Array();
29 var pomocna1 = new Array();
30 var pomocna2 = new Array();
31 var pomocna3 = new Array();
32 var pomocna4 = new Array();
33 var ann;
34 var m1;
35 var m2;
36 var m3;
37 var m4;
38 var m5;
39 var m6;
40 var m7;
41 var m8;
42 var m9;
43 var m1_a;
44 var m2_a;
45 var m3_a;
46 var m4_a;
47 var m5_a;
48 var m6_a;
49 var m7_a;
50 var m8_a;
51 var m9_a;
52 var cntm;
53 
54 function mapInit(startzoom) {
55 magnifier = new Magnifier();
56 mainMap = new MainMap(startzoom);
57 
58 var miniMapDiv = document.getElementById("miniMapInner");
59 miniMapDiv.onmousedown
60 = function (event) { return magnifier.startMove(event) };
61 miniMapDiv.onmousemove
62 = function (event) { return magnifier.processMove(event) };
63 miniMapDiv.onmouseup
64 = function (event) { return magnifier.stopMove(event) };
65 miniMapDiv.ondragstart = function() { return false; } // for IE
66 }
67 
68 function Magnifier () {
69 var this1 = this;
70 this.f_dragging = false;
71 this.div = document.getElementById("magnifier");
72 this.div.ondragstart = function() { return false; } // for IE
73 this.div.onmousedown
74 = function (event) { return this1.startMove(event) };
75 this.div.onmousemove
76 = function (event) { return this1.processMove(event) };
77 this.div.onmouseup
78 = function (event) { return this1.stopMove(event) };
79 }
80 
81 Magnifier.prototype.startMove =
82 function (event) {
83 // for IE
84 if (!event)
85 event = window.event;
86 
874unreal var magnifierDiv = document.getElementById("magnifier");
88 //var magnifierDiv = this.div;
891unreal this.dragStartLeft = event.clientX;
90 this.dragStartTop = event.clientY;
914unreal //magnifierDiv.style.cursor = "move";
921unreal 
93 this.top = magnifierDiv.offsetTop;
94 this.left = magnifierDiv.offsetLeft;
95 
96 this.f_dragging = true;
97 return false;
98 }
99 
100 /* As you drag the mouse in the mini map, the magnifier responds by
101 moving. Likewise, the main map will show the current area
102 enclosed by the magnifier. */
103 Magnifier.prototype.processMove =
104 function (event) {
105 var magnifierDiv = this.div;
106 
107 if (!event) event = window.event; // for IE
108 if (this.f_dragging) {
109 
110 var minX = 0;
111 var maxX = magres_x - magnifierDiv.offsetWidth;
112 var minY = 0;
113 var maxY = magres_y - magnifierDiv.offsetHeight;
114 
115 var shiftedLeft = this.left + (event.clientX - this.dragStartLeft);
116 if (shiftedLeft < minX) shiftedLeft = minX; // map is not infinite
117 if (shiftedLeft > maxX) shiftedLeft = maxX;
118 magnifierDiv.style.left = shiftedLeft + "px";
119 
120 var shiftedTop = this.top + (event.clientY - this.dragStartTop);
121 if (shiftedTop < minY) shiftedTop = minY; // map is not infinite
122 if (shiftedTop > maxY) shiftedTop = maxY;
123 magnifierDiv.style.top = shiftedTop + "px";
124 
125 mainMap.setViewPort();
126 }
127 }
128 
129 Magnifier.prototype.stopMove =
130 function (event) {
1314unreal //this.div.style.cursor = "";
1321unreal this.f_dragging = false;
133 }
134 
135 Magnifier.prototype.setSize =
136 function (innerDivWidth, innerDivHeight) {
137 var magnifierWidth = Math.round((magres_x * inres_x) / innerDivWidth) - 2; // 200 * 700px
138 /* We subtract 2 because the borders are 1 pixel each */
139 var magnifierHeight = Math.round((magres_y * inres_y) / innerDivHeight) - 2; // 141 * 500px
140 /* We subtract 2 because the borders are 1 pixel each */
141 var magnifierDiv = document.getElementById("magnifier");
142 magnifierDiv.style.width = magnifierWidth + "px";
143 magnifierDiv.style.height = magnifierHeight + "px";
144 }
145 
146 Magnifier.prototype.setPosition =
147 function () {
148 var innerDiv = document.getElementById("innerDiv");
149 var innerDivWidth = innerDiv.clientWidth;
150 var innerDivHeight = innerDiv.clientHeight;
151 var innerDivLeft = innerDiv.offsetLeft;
152 var innerDivTop = innerDiv.offsetTop;
153 this.left
154 = Math.round(Math.abs(innerDivLeft) * magres_x / innerDivWidth);
155 this.top
156 = Math.round(Math.abs(innerDivTop) * magres_y / innerDivHeight);
157 
158 // alter magnifier
159 var magnifierDiv = this.div;
160 magnifierDiv.style.left = this.left + "px";
161 magnifierDiv.style.top = this.top + "px";
162 }
163 
164 function MainMap (zoomfirst) {
165 var this1 = this;
166 
167 // constants
168 // view port is the visible portion of the main map
169 this.viewPortWidth = inres_x; //500
170 this.viewPortHeight = inres_y; //400
171 
172 this.tileSize = 256;
173 this.f_dragging = false;
174 this.innerDiv = document.getElementById("innerDiv");
1754unreal this.innerDiv.style.cursor = "url(grab.cur), default";
1761unreal 
177 var outerDiv = document.getElementById("outerDiv");
178 this.outerDiv = outerDiv;
179 outerDiv.style.width = inres_x + "px";
180 outerDiv.style.height = inres_y + "px";
181 var underMap = document.getElementById("underMap");
182 underMap.style.width = (inres_x - 4) + "px";
183 
184 outerDiv.onmousedown
185 = function(event) { return this1.startMove(event) };
186 outerDiv.onmousemove
187 = function(event) { return this1.processMove(event) };
188 outerDiv.onmouseup
189 = function(event) { return this1.stopMove(event) };
190 outerDiv.ondblclick
191 = function(event) { return this1.doubleClick() };
192 outerDiv.ondragstart = function() { return false; } // for IE
193 
194 var zf = 0;
195 if(zoomfirst==eq_mini) { zf = 0; }
196 if(zoomfirst==eq_medi) { zf = 1; }
197 if(zoomfirst==eq_high) { zf = 2; }
198 if(zoomfirst==eq_orig) { zf = 3; }
199 
200 this.zoom = zf;
201 this.zoomDim = [
202 {
203 width:parseInt(full_x * eq_mini),
204 height:parseInt(full_y * eq_mini),
205 size:1
206 },
207 {
208 width:parseInt(full_x * eq_medi),
209 height:parseInt(full_y * eq_medi),
210 size:2
211 },
212 {
213 width:parseInt(full_x * eq_high),
214 height:parseInt(full_y * eq_high),
215 size:3
216 },
217 {
218 width:parseInt(full_x * eq_orig),
219 height:parseInt(full_y * eq_orig),
220 size:4
221 },
222 ]
223 
224 var zoomElt = this.zoomDim[this.zoom];
2255unreal this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(zoomfirst*1000)/10));
2261unreal 
227 var innerDiv = document.getElementById("innerDiv");
228 innerDiv.style.left = -(start_left) + "px";
229 innerDiv.style.top = -(start_top) + "px";
230 
231 magnifier.setPosition();
232 this.checkTiles();
233 }
234 
235 MainMap.prototype.startMove =
236 function (event) {
237 // for IE
238 if (!event) event = window.event;
239 
240 this.dragStartLeft = event.clientX;
241 this.dragStartTop = event.clientY;
242 var innerDiv = this.innerDiv;
2434unreal innerDiv.style.cursor = "url(grabbing.cur), default";
2441unreal 
245 this.top = innerDiv.offsetTop;
246 this.left = innerDiv.offsetLeft;
247 
248 this.f_dragging = true;
249 return false;
250 }
251 
252 MainMap.prototype.processMove =
253 function (event) {
254 var zoomElt = this.zoomDim[this.zoom];
255 var maxY = 0;
256 var minY = -(zoomElt.height - this.viewPortHeight);
257 var maxX = 0;
258 var minX = -(zoomElt.width - this.viewPortWidth);
259 
260 if (!event) event = window.event; // for IE
261 var innerDiv = this.innerDiv;
262 if (this.f_dragging) {
263 var shiftedTop = this.top + (event.clientY - this.dragStartTop);
264 if (shiftedTop > maxY) shiftedTop = maxY; // map is not infinite
265 if (shiftedTop < minY) shiftedTop = minY;
266 innerDiv.style.top = shiftedTop + "px";
267 
268 var shiftedLeft = this.left + (event.clientX - this.dragStartLeft);
269 if (shiftedLeft > maxX) shiftedLeft = maxX; // map is not infinite
270 if (shiftedLeft < minX) shiftedLeft = minX;
271 innerDiv.style.left = shiftedLeft + "px";
272 
273 this.checkTiles();
274 magnifier.setPosition();
275 }
276 
277 var nasobek;
278 var konst = 0;
279 if(this.zoom==0) { nasobek = eq_mini; }
280 if(this.zoom==1) { nasobek = eq_medi; }
281 if(this.zoom==2) { nasobek = eq_high; }
282 if(this.zoom==3) { nasobek = eq_orig; }
283 if (navigator.appName=="Microsoft Internet Explorer") { konst = -2; }
284 var outerDiv = document.getElementById("outerDiv");
285 var infoDiv = document.getElementById("infoDiv");
286 infoDiv.innerHTML = parseInt((Math.abs(parseInt(innerDiv.style.left)) + event.clientX - outerDiv.offsetLeft + konst)/nasobek) + " x " + parseInt((Math.abs(parseInt(innerDiv.style.top)) + event.clientY - outerDiv.offsetTop + konst)/nasobek);
287 }
288 
289 MainMap.prototype.checkZoom =
290 function () {
291 var zoomElt = this.zoomDim[this.zoom];
292 var maxY = 0;
293 var minY = -(zoomElt.height - this.viewPortHeight);
294 var maxX = 0;
295 var minX = -(zoomElt.width - this.viewPortWidth);
296 var chcky = 0;
297 var chckx = 0;
298 
299 var innerDiv = this.innerDiv;
300 var shiftedTop = innerDiv.offsetTop;
301 if (shiftedTop > maxY) { shiftedTop = maxY; chcky = 1; } // map is not infinite
302 if (shiftedTop < minY) { shiftedTop = minY; chcky = 1; }
303 if (chcky == 1) innerDiv.style.top = shiftedTop + "px";
304 
305 var shiftedLeft = innerDiv.offsetLeft;
306 if (shiftedLeft > maxX) { shiftedLeft = maxX; chckx = 1; }// map is not infinite
307 if (shiftedLeft < minX) { shiftedLeft = minX; chckx = 1; }
308 if (chcky == 1) innerDiv.style.left = shiftedLeft + "px";
309 
310 magnifier.setPosition();
311 }
312 
313 MainMap.prototype.checkTiles =
314 function () {
315 var innerDiv = this.innerDiv;
316 var tileSize = this.tileSize;
317 var visibleTiles = this.getVisibleTiles();
318 var visibleTilesMap = {};
319 var i;
320 
321 var size = this.zoomDim[this.zoom].size;
322 for (i=0;i<visibleTiles.length; i++) {
323 var tile = visibleTiles[i];
324 var xy = "x" + tile.x + "y" + tile.y;
325 var tileName
326 = xy + "z" + this.zoom;
327 visibleTilesMap[tileName] = true;
328 var img = document.getElementById (tileName);
329 if (!img) {
330 img = document.createElement("img");
331 img.src
332 = "size" + size + "/" + xy + ".jpg";
333 img.style.position = "absolute";
334 img.style.left = (tile.x * tileSize) + "px";
335 img.style.top = (tile.y * tileSize) + "px";
336 img.setAttribute("id", tileName);
337 img.setAttribute("galleryimg", "no");
338 innerDiv.appendChild(img);
339 }
340 }
341 
342 var imgs = innerDiv.getElementsByTagName("img");
343 for (i = 0; i < imgs.length; i++) {
344 var id = imgs[i].getAttribute("id");
345 if (!visibleTilesMap[id]) {
346 innerDiv.removeChild(imgs[i]);
347 i--;
348 }
349 }
350 }
351 
352 MainMap.prototype.getVisibleTiles =
353 function () {
354 var innerDiv = this.innerDiv;
355 var mapX = innerDiv.offsetLeft;
356 var mapY = innerDiv.offsetTop;
357 var tileSize = this.tileSize;
358 
359 var startX = Math.abs(Math.floor(mapX / tileSize)) - 1;
360 if (startX < 0) startX = 0;
361 var startY = Math.abs(Math.floor(mapY / tileSize)) - 1;
362 if (startY < 0) startY = 0;
363 var tilesX = Math.ceil(this.viewPortWidth / tileSize) + 1;
364 var tilesY = Math.ceil(this.viewPortHeight / tileSize) + 1;
365 
366 var visibleTiles = [];
367 var counter = 0;
368 for (x = startX; x < (tilesX + startX); x++) {
369 for (y = startY; y < (tilesY + startY); y++) {
370 var tile = {};
371 tile.x = x;
372 tile.y = y;
373 visibleTiles[counter++] = tile;
374 }
375 }
376 return visibleTiles;
377 }
378 
379 MainMap.prototype.stopMove =
380 function (event) {
3814unreal this.innerDiv.style.cursor = "url(grab.cur), default";
3821unreal this.f_dragging = false;
383 }
384 
385 // movement in the magnifier moves main map's view port
386 MainMap.prototype.setViewPort =
387 function () {
388 var magDiv = document.getElementById("magnifier");
389 var innerDiv = this.innerDiv;
390 var magLeft = magDiv.offsetLeft;
391 var magTop = magDiv.offsetTop;
392 var innerDivWidth = innerDiv.clientWidth;
393 var innerDivHeight = innerDiv.clientHeight;
394 
395 /* set innerDivLeft */
396 var innerDivLeftMin = inres_x - innerDivWidth; //500
397 var innerDivLeft
398 = Math.round((-magLeft) * innerDivWidth / magres_x);
399 if (innerDivLeft < innerDivLeftMin) innerDivLeft = innerDivLeftMin;
400 innerDiv.style.left = innerDivLeft + "px";
401 
402 /* set innerDivTop */
403 var innerDivTopMin = inres_y - innerDivHeight; //400
404 var innerDivTop
405 = Math.round((-magTop) * innerDivHeight / magres_y);
406 if (innerDivTop < innerDivTopMin) innerDivTop = innerDivTopMin;
407 innerDiv.style.top = innerDivTop + "px";
408 
409 this.checkTiles();
410 }
411 
412 MainMap.prototype.setInnerDivSize =
413 function (width, height, size, percent) {
414 var innerDiv = this.innerDiv;
415 innerDiv.style.width = width + "px";
416 innerDiv.style.height = height + "px";
417 magnifier.setPosition();
418 magnifier.setSize (width, height);
419 
420 var resolutionInfo = document.getElementById("resolutionInfo");
421 resolutionInfo.innerHTML = percent + "%, " + width + " x " + height + "px";
422 }
423 
424 MainMap.prototype.setZoom =
425 function (newZoom) {
426 if (this.zoom == newZoom) return;
427 var oldZ = this.zoomDim[this.zoom];
428 var newZ = this.zoomDim[newZoom];
429 var innerDiv = this.innerDiv;
430 var imgs = innerDiv.getElementsByTagName("img");
431 while (imgs.length > 0) {
432 innerDiv.removeChild(imgs[0]);
433 }
434 
435 var oldLeft = innerDiv.offsetLeft;
436 var oldTop = innerDiv.offsetTop;
437 var wdth = Math.round(((magres_x * inres_x) / newZ.width) - 2); // 200 * 700px
438 var hght = Math.round(((magres_y * inres_y) / newZ.height) - 2); // 141 * 500px
439 var wdth2 = Math.round(((magres_x * inres_x) / oldZ.width) - 2); // 200 * 700px
440 var hght2 = Math.round(((magres_y * inres_y) / oldZ.height) - 2); // 141 * 500px
441 
442 var newLeft = Math.round(newZ.width * oldLeft / oldZ.width);
443 var newTop = Math.round(newZ.height * oldTop / oldZ.height);
444 
445 if (this.zoom < newZoom) {
446 newLeft = Math.round(newLeft + ((wdth-wdth2)*4));
447 newTop = Math.round(newTop + ((hght-hght2)*4));
448 }
449 if (this.zoom > newZoom) {
450 newLeft = Math.round(newLeft + ((wdth-wdth2)*4));
451 newTop = Math.round(newTop + ((hght-hght2)*4));
452 }
453 
454 innerDiv.style.left = newLeft + "px";
455 innerDiv.style.top = newTop + "px";
456 this.zoom = newZoom; // set the global zoom
457 var nasobek;
458 if(this.zoom==0) { nasobek = eq_mini; }
459 if(this.zoom==1) { nasobek = eq_medi; }
460 if(this.zoom==2) { nasobek = eq_high; }
461 if(this.zoom==3) { nasobek = eq_orig; }
462 this.setInnerDivSize(newZ.width, newZ.height, newZ.size, (parseInt(nasobek*1000)/10));
463 
464 this.checkZoom();
465 this.checkTiles();
466 
467 titulek1 = document.getElementById("mapstats_infopoint");
4685unreal titulek2 = document.getElementById("mapstats_name");
469 titulek3 = document.getElementById("mapstats_ip");
470 titulek4 = document.getElementById("mapstats_status");
471 titulek5 = document.getElementById("mapstats_legend");
472 titulek6 = document.getElementById("mapstats_wave");
473 titulek7 = document.getElementById("mapstats_points");
474 
4751unreal titulek1.innerHTML = "";
476 titulek2.innerHTML = "";
477 titulek3.innerHTML = "";
478 titulek4.innerHTML = "";
479 titulek5.innerHTML = "";
4805unreal titulek6.innerHTML = "";
481 titulek7.innerHTML = "";
4821unreal 
483 canvasInit(nasobek);
484 
485 }
486 
487 MainMap.prototype.doubleClick =
488 function () {
489 if (this.zoom == 3) return;
490 
491 var stara = this.zoom;
492 stara = stara + 1;
493 this.setZoom(stara);
494 
495 }
496 
497 function canvasInit(nasobek) {
498 
499 var canvas_id1 = document.getElementById("paint");
500 canvas_id1.width = parseInt(full_x*nasobek);
501 canvas_id1.height = parseInt(full_y*nasobek);
502 
503 var canvas_id2 = document.getElementById("paint2");
504 canvas_id2.width = parseInt(full_x*nasobek);
505 canvas_id2.height = parseInt(full_y*nasobek);
506 
507 ann = nasobek;
508 var pozdrav = new Array();
509 var pozdrav1 = new Array();
510 var pozdrav2 = new Array();
511 var pozdr = new Array();
512 pozdrav = pomocna.split('\n');
513 pozdrav1 = pomocna1.split('\n');
514 var a_cnt = 0;
5155unreal var p0count = pozdrav.length;
516 var p1count = pozdrav1.length;
5171unreal 
5185unreal for(a=0;a<p0count;a++){
5191unreal if(pozdrav[a]!="") {
520 node[a] = new Array();
521 pozdrav2 = pozdrav[a].split(';');
522 for(b=0;b<pozdrav2.length;b++){
523 node[a][b] = pozdrav2[b];
524 }
525 a_cnt++;
526 }
527 }
5285unreal for(e=0;e<p1count;e++) {
5291unreal if(pozdrav1[e]!="") {
530 node[(e+a_cnt)] = new Array();
531 pozdr = pozdrav1[e].split(';');
532 for(f=0;f<pozdr.length;f++){
533 node[(e+a_cnt)][f] = pozdr[f];
534 }
535 }
536 }
537 
5385unreal nodecount = node.length;
5391unreal var pozdrav3 = new Array();
540 var pozdrav4 = new Array();
541 var size;
542 var clrlnk;
543 m1 = 0;
544 m2 = 0;
545 m3 = 0;
546 m4 = 0;
547 m5 = 0;
548 m6 = 0;
549 m7 = 0;
550 m8 = 0;
551 m9 = 0;
552 m1_a = 0;
553 m2_a = 0;
554 m3_a = 0;
555 m4_a = 0;
556 m5_a = 0;
557 m6_a = 0;
558 m7_a = 0;
559 m8_a = 0;
560 m9_a = 0;
561 cntm = 0;
562 
563 if(pomocna2.length>0) {
564 pozdrav3 = pomocna2.split('\n');
5655unreal var p3count = pozdrav3.length;
566 for(a=0;a<p3count;a++){
5671unreal if(pozdrav3[a]!="") {
568 pozdrav4 = pozdrav3[a].split(';');
5694unreal if(pozdrav4[1].toLowerCase()=="backbone") { size = 4.5; } else { size = 2.7; }
5701unreal if(pozdrav4[2].toLowerCase()=="inp") {
571 if(pozdrav4[3]==1) { clrlnk = wifi_client_a; m1_a = 1; }
572 else if(pozdrav4[3]==2) { clrlnk = wifi_backbone_a; m2_a = 1; }
573 else if(pozdrav4[3]==3) { clrlnk = eth_100_a; m3_a = 1; }
574 else if(pozdrav4[3]==4) { clrlnk = fso_a; m4_a = 1; }
575 else if(pozdrav4[3]==5) { clrlnk = fso_backup_a; m5_a = 1; }
576 else if(pozdrav4[3]==6) { clrlnk = ghz5_a; m6_a = 1; }
577 else if(pozdrav4[3]==7) { clrlnk = ghz10_a; m7_a = 1; }
578 else if(pozdrav4[3]==8) { clrlnk = fiber_a; m8_a = 1; }
579 else { clrlnk = other_a; m9_a = 1; }
580 } else {
581 if(pozdrav4[3]==1) { clrlnk = wifi_client; m1 = 1; }
582 else if(pozdrav4[3]==2) { clrlnk = wifi_backbone; m2 = 1; }
583 else if(pozdrav4[3]==3) { clrlnk = eth_100; m3 = 1; }
584 else if(pozdrav4[3]==4) { clrlnk = fso; m4 = 1; }
585 else if(pozdrav4[3]==5) { clrlnk = fso_backup; m5 = 1; }
586 else if(pozdrav4[3]==6) { clrlnk = ghz5; m6 = 1; }
587 else if(pozdrav4[3]==7) { clrlnk = ghz10; m7 = 1; }
588 else if(pozdrav4[3]==8) { clrlnk = fiber; m8 = 1; }
589 else { clrlnk = other; m9 = 1; }
590 }
591 
592 // Vykreslime si nase linky
593 if(pozdrav4[2].toLowerCase()=="inp") {
594 if(ch_inp) {
595 drawINPLink(pozdrav4[0], size-1, nasobek, clrlnk);
596 }
597 } else {
598 if((ch_backbone) && (size==4.5)) {
599 drawLink(pozdrav4[0], size, nasobek, clrlnk);
600 }
6014unreal if((ch_client) && (size==2.7)) {
6021unreal drawLink(pozdrav4[0], size, nasobek, clrlnk);
603 }
604 }
605 }
606 }
607 }
608 
609 cntm = m1 + m2 + m3 + m4 + m5 + m6 + m7 + m8 + m9 + m1_a + m2_a + m3_a + m4_a + m5_a + m6_a + m7_a + m8_a + m9_a;
610 
611 var pozdrav5 = new Array();
612 var pozdrav6 = new Array();
613 if(ch_infopoint) {
614 if(pomocna3.length>0) {
615 pozdrav5 = pomocna3.split('\n');
616 for(d=0;d<pozdrav5.length;d++) {
617 if(pozdrav5[d]!="") {
618 pozdrav6 = pozdrav5[d].split(';');
619 // Vykreslime si infopointy
620 if(ch_name) {
621 drawInfo(pozdrav6[0],pozdrav6[1],pozdrav6[2],nasobek);
622 }
623 drawInfoPoint(pozdrav6[1],pozdrav6[2],nasobek);
624 }
625 }
626 }
627 }
628 
6295unreal for(e=0;e<p1count;e++) {
6301unreal if(pozdrav1[e]!="") {
631 if(ch_noping) {
632 if(node[(a_cnt+e)][3]==1) {
633 drawClient(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek);
634 if(ch_name) {
635 drawName(node[(a_cnt+e)][0],(node[(a_cnt+e)][1])-1,(node[(a_cnt+e)][2])-1,nasobek)
636 }
637 }
638 if(node[(a_cnt+e)][3]==2) {
639 drawSwitch(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek);
640 }
641 }
642 }
643 }
644 
645 var pozdrav7 = new Array();
646 pozdrav7 = pomocna4.split('\n');
647 var clrpnt;
648 var x_pos;
649 var y_pos;
650 var name_pos;
651 var title_pos;
6525unreal var p7count = pozdrav7.length;
6531unreal 
6545unreal for(c=0;c<p7count;c++){
6551unreal if(pozdrav7[c]!="") {
656 pozdrav8 = pozdrav7[c].split(';');
6575unreal if(pozdrav8[1]==1) { clrpnt = "on"; pozdrav8[2] = pozdrav8[2] + ' ms'; } else { clrpnt = "off"; pozdrav8[2] = "offline"; }
6581unreal if(pozdrav8[0]!=node[c][4]) { x_pos = ip2sour(pozdrav8[0],1); y_pos = ip2sour(pozdrav8[0],2); name_pos = ip2sour(pozdrav8[0],0); title_pos = ip2sour(pozdrav8[0],3); } else { x_pos = node[c][1]; y_pos = node[c][2]; name_pos = node[c][0]; title_pos = node[c][3]; } // check if the result doesnt replaced
659 
660 if(title_pos.toLowerCase()=="ap") {
661 if(ch_ap) {
662 drawAP(x_pos,y_pos,nasobek);
663 drawNode(x_pos,y_pos,nasobek,clrpnt);
664 if(ch_name) {
665 drawName(name_pos,x_pos,y_pos,nasobek);
666 }
667 if((ch_ip) && (ch_status)) {
668 drawStatus(pozdrav8[2],x_pos,y_pos,nasobek);
669 drawIP(pozdrav8[0],x_pos,y_pos,nasobek);
670 } else if((!ch_ip) && (ch_status)) {
671 drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek);
672 } else if((ch_ip) && (!ch_status)) {
673 drawIP(pozdrav8[0],x_pos,y_pos,nasobek);
674 }
675 }
676 } else if(title_pos.toLowerCase()=="router") {
677 if(ch_router) {
678 drawNode(x_pos,y_pos,nasobek,clrpnt);
679 if(ch_name) {
680 drawName(name_pos,x_pos,y_pos,nasobek);
681 }
682 if(ch_status) {
683 drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek);
684 }
685 }
686 } else {
687 if(ch_node) {
688 drawNode(x_pos,y_pos,nasobek,clrpnt);
689 if(ch_name) {
690 drawName(name_pos,x_pos,y_pos,nasobek);
691 }
692 }
693 }
694 }
695 }
696 
697 var legend = document.getElementById('legend');
698 if((ch_legend) && (cntm>0)) {
699 drawLegend();
700 legend.style.display = "block";
701 } else {
702 legend.style.display = "none";
703 }
704 
705 }
706 
707 function drawLink(pos, size, nas, color) {
708 var ctx = document.getElementById('paint').getContext('2d');
709 var points = new Array();
710 var posxy = new Array();
711 var coordinates = new Array();
712 points = pos.split('#');
713 var reg=/(\d+)&(\d+)/;
714 for(i=0;i<points.length;i++){
715 if (reg.test(points[i])) {
716 posxy = points[i].split('&');
717 coordinates[i*2] = parseInt(posxy[0]*nas); // checkni to....
718 coordinates[i*2+1] = parseInt(posxy[1]*nas);
719 } else {
720 coordinates[i*2] = parseInt(node2sour(points[i],1)*nas);
721 coordinates[i*2+1] = parseInt(node2sour(points[i],2)*nas);
722 }
723 }
724 
725 ctx.lineJoin = "round";
726 ctx.strokeStyle = "rgb(20, 20, 20)";
727 ctx.lineWidth = size+1;
728 ctx.beginPath();
729 ctx.moveTo(coordinates[0],coordinates[1]);
730 for(i=2;i<coordinates.length;i+=2){
731 ctx.lineTo(coordinates[i],coordinates[i+1]);
732 }
733 ctx.stroke();
734 
735 ctx.lineJoin = "round";
736 ctx.strokeStyle = "rgb(0, 0, 0)";
737 ctx.lineWidth = size;
738 ctx.beginPath();
739 ctx.moveTo(coordinates[0],coordinates[1]);
740 for(i=2;i<coordinates.length;i+=2){
741 ctx.lineTo(coordinates[i],coordinates[i+1]);
742 }
743 ctx.stroke();
744 
745 ctx.lineJoin = "round";
746 ctx.strokeStyle = color;
747 ctx.lineWidth = size-1;
748 ctx.beginPath();
749 ctx.moveTo(coordinates[0],coordinates[1]);
750 for(i=2;i<coordinates.length;i+=2){
751 ctx.lineTo(coordinates[i],coordinates[i+1]);
752 }
753 ctx.stroke();
754 }
755 
756 function drawINPLink(pos, size, nas, color) {
757 var ctx = document.getElementById('paint').getContext('2d');
758 var points = new Array();
759 var posxy = new Array();
760 var coordinates = new Array();
761 points = pos.split('#');
762 var reg=/(\d+)&(\d+)/;
763 for(i=0;i<points.length;i++){
764 if (reg.test(points[i])) {
765 posxy = points[i].split('&');
766 coordinates[i*2] = parseInt(posxy[0]*nas);
767 coordinates[i*2+1] = parseInt(posxy[1]*nas);
768 } else {
769 coordinates[i*2] = parseInt(node2sour(points[i],1)*nas);
770 coordinates[i*2+1] = parseInt(node2sour(points[i],2)*nas);
771 }
772 }
773 
774 ctx.lineJoin = "round";
775 ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
776 ctx.lineWidth = size+1.5;
777 ctx.beginPath();
778 ctx.moveTo(coordinates[0],coordinates[1]);
779 for(i=2;i<coordinates.length;i+=2){
780 ctx.lineTo(coordinates[i],coordinates[i+1]);
781 }
782 ctx.stroke();
783 
784 ctx.lineJoin = "round";
785 ctx.strokeStyle = color;
786 ctx.lineWidth = size+0.5;
787 ctx.beginPath();
788 ctx.moveTo(coordinates[0],coordinates[1]);
789 for(i=2;i<coordinates.length;i+=2){
790 ctx.lineTo(coordinates[i],coordinates[i+1]);
791 }
792 ctx.stroke();
793 }
794 
795 function drawNode(xo, yo, nas, img) {
7965unreal xo = parseInt((xo*nas)-7);
797 yo = parseInt((yo*nas)-7);
798 if (navigator.appName=="Microsoft Internet Explorer") {
799 if(img=="on") { img = imgon; } else { img = imgoff; }
800 var ctx = document.getElementById('paint2').getContext('2d');
801 ctx.drawImage(img,xo,yo);
802 } else {
803 var text = '<div style="position:absolute;left:' + xo + 'px;top:' + yo + 'px;width: 14px;height: 14px;background-image: url(\'' + img + '.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>';
804 titulek = document.getElementById("mapstats_points");
805 titulek.innerHTML = titulek.innerHTML + text;
806 }
8071unreal }
808 
809 function drawAP(xn, yn, nas) {
8105unreal xn = parseInt((xn*nas)-31);
811 yn = parseInt((yn*nas)-17);
812 if (navigator.appName=="Microsoft Internet Explorer") {
813 var ctx = document.getElementById('paint').getContext('2d');
814 ctx.drawImage(imgap,xn,yn);
815 } else {
816 var text = '<div style="position:absolute;left:' + xn + 'px;top:' + yn + 'px;width: 62px;height: 34px;background-image: url(\'ap.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>';
817 titulek = document.getElementById("mapstats_wave");
818 titulek.innerHTML = titulek.innerHTML + text;
819 }
8201unreal }
821 
822 function drawClient(xc, yc, nas) {
8235unreal xc = parseInt((xc*nas)-7);
824 yc = parseInt((yc*nas)-7);
825 if (navigator.appName=="Microsoft Internet Explorer") {
826 var ctx = document.getElementById('paint').getContext('2d');
827 ctx.drawImage(imgcn,xc,yc);
828 } else {
829 var text = '<div style="position:absolute;left:' + xc + 'px;top:' + yc + 'px;width: 14px;height: 14px;background-image: url(\'client.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>';
830 titulek = document.getElementById("mapstats_wave");
831 titulek.innerHTML = titulek.innerHTML + text;
832 }
8331unreal }
834 
835 function drawSwitch(xs, ys, nas) {
8365unreal xs = parseInt((xs*nas)-6);
837 ys = parseInt((ys*nas)-6);
838 if (navigator.appName=="Microsoft Internet Explorer") {
839 var ctx = document.getElementById('paint').getContext('2d');
840 ctx.drawImage(imgsw,xs,ys);
841 } else {
842 var text = '<div style="position:absolute;left:' + xs + 'px;top:' + ys + 'px;width: 12px;height: 12px;background-image: url(\'switch.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>';
843 titulek = document.getElementById("mapstats_wave");
844 titulek.innerHTML = titulek.innerHTML + text;
845 }
8461unreal }
847 
848 function drawInfoPoint(xl, yl, nas) {
8495unreal xl = parseInt((xl*nas)-7);
850 yl = parseInt((yl*nas)-7);
851 if (navigator.appName=="Microsoft Internet Explorer") {
852 var ctx = document.getElementById('paint').getContext('2d');
853 ctx.drawImage(imginfo,xl,yl);
854 } else {
855 var text = '<div style="position:absolute;left:' + xl + 'px;top:' + yl + 'px;width: 14px;height: 14px;background-image: url(\'info.png\');font-size: 0px;cursor: default;" unselectable = "on"></div>';
856 titulek = document.getElementById("mapstats_wave");
857 titulek.innerHTML = titulek.innerHTML + text;
858 }
8591unreal }
860 
861 function drawLegend() {
862 var epsilon;
863 var cislo = 0;
864 var name = "";
865 var paintlegend = document.getElementById('paintlegend');
866 paintlegend.height = (((cntm-1) * 12)+13);
867 paintlegend.width = "25";
868 var ctx = paintlegend.getContext('2d');
869 ctx.clearRect(0,0,25,((cntm-1) * 12)+13);
8704unreal if(m1==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_client,2.9); name = name + name1 + "<br/>"; cislo++; }
8711unreal if(m2==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_backbone,4.5); name = name + name2 + "<br/>"; cislo++; }
872 if(m3==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,eth_100,4.5); name = name + name3 + "<br/>"; cislo++; }
873 if(m4==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso,4.5); name = name + name4 + "<br/>"; cislo++; }
874 if(m5==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso_backup,4.5); name = name + name5 + "<br/>"; cislo++; }
875 if(m6==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz5,4.5); name = name + name6 + "<br/>"; cislo++; }
876 if(m7==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz10,4.5); name = name + name7 + "<br/>"; cislo++; }
877 if(m8==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fiber,4.5); name = name + name8 + "<br/>"; cislo++; }
878 if(m9==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,other,4.5); name = name + name9 + "<br/>"; cislo++; }
8794unreal if(m1_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_client_a,2.9); name = name + name1 + " " + inp + "<br/>"; cislo++; }
8801unreal if(m2_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_backbone_a,4.5); name = name + name2 + " " + inp + "<br/>"; cislo++; }
881 if(m3_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,eth_100_a,4.5); name = name + name3 + " " + inp + "<br/>"; cislo++; }
882 if(m4_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_a,4.5); name = name + name4 + " " + inp + "<br/>"; cislo++; }
883 if(m5_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_backup_a,4.5); name = name + name5 + " " + inp + "<br/>"; cislo++; }
884 if(m6_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz5_a,4.5); name = name + name6 + " " + inp + "<br/>"; cislo++; }
885 if(m7_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz10_a,4.5); name = name + name7 + " " + inp + "<br/>"; cislo++; }
886 if(m8_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fiber_a,4.5); name = name + name8 + " " + inp + "<br/>"; cislo++; }
887 if(m9_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,other_a,4.5); name = name + name9 + " " + inp + "<br/>"; }
888 drawLegendText(name);
889 }
890 
891 function drawLegendLink(yg,color,size) {
892 var ctx = document.getElementById('paintlegend').getContext('2d');
893 ctx.strokeStyle = "rgb(20, 20, 20)";
894 ctx.lineWidth = size+1;
895 ctx.beginPath();
896 ctx.moveTo(1,yg);
897 ctx.lineTo(24,yg);
898 ctx.stroke();
899 
900 ctx.strokeStyle = "rgb(0, 0, 0)";
901 ctx.lineWidth = size;
902 ctx.beginPath();
903 ctx.moveTo(1,yg);
904 ctx.lineTo(24,yg);
905 ctx.stroke();
906 
907 ctx.strokeStyle = color;
908 ctx.lineWidth = size-1;
909 ctx.beginPath();
910 ctx.moveTo(1,yg);
911 ctx.lineTo(24,yg);
912 ctx.stroke();
913 
914 }
915 
916 function drawLegendINPLink(yg,color,size) {
917 var ctx = document.getElementById('paintlegend').getContext('2d');
9184unreal ctx.strokeStyle = "rgba(255, 255, 255, 0.5)";
919 ctx.lineWidth = size;
920 ctx.beginPath();
921 ctx.moveTo(1,yg);
922 ctx.lineTo(24,yg);
923 ctx.stroke();
924 
9251unreal ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
926 ctx.lineWidth = size;
927 ctx.beginPath();
928 ctx.moveTo(1,yg);
929 ctx.lineTo(24,yg);
930 ctx.stroke();
931 
932 ctx.strokeStyle = color;
933 ctx.lineWidth = size-0.5;
934 ctx.beginPath();
935 ctx.moveTo(1,yg);
936 ctx.lineTo(24,yg);
937 ctx.stroke();
938 }
939 
940 function clearMap(ann) {
941 var ctx = document.getElementById('paint').getContext('2d');
942 ctx.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann));
943 var ctx2 = document.getElementById('paint2').getContext('2d');
944 ctx2.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann));
945 }
946 
947 function node2sour(name, pos) {
948 var ok = 0;
9495unreal for(k=0;k<nodecount;k++){
9501unreal if(node[k][0]==name) {
951 ok = node[k][pos];
952 }
953 if(ok!=0) { return ok; }
954 }
955 return ok;
956 }
957 
958 function ip2sour(ip, pos) {
959 var ok = 0;
9605unreal for(k=0;k<nodecount;k++){
9611unreal if(node[k][4]==ip) {
962 ok = node[k][pos];
963 }
964 if(ok!=0) { return ok; }
965 }
966 return ok;
967 }
968 
969 function nactiSoubory() {
9705unreal var d = new Date();
971 var tm = d.getTime();
972 pomocna = getFile(nodes + "?" + tm);
973 pomocna1 = getFile(noping + "?" + tm);
974 pomocna2 = getFile(links + "?" + tm);
975 pomocna3 = getFile(infopoints + "?" + tm);
976 pomocna4 = getFile(state + "?" + tm);
9771unreal redrawUpdate();
978 }
979 
980 function getFile(url) {
981 AJAX = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false));
982 if (AJAX) {
983 AJAX.open("GET", url, false);
9844unreal AJAX.setRequestHeader("Cache-Control", "no-store");
985 AJAX.setRequestHeader("Cache-Control", "no-cache");
986 AJAX.setRequestHeader("Cache-Control", "must-revalidate");
987 AJAX.setRequestHeader("Pragma", "no-cache");
9881unreal AJAX.send(null);
989 return AJAX.responseText;
990 } else {
991 return false;
992 }
993 }
994 
995 function timerMe() {
996 // auto-downloading source files every 2 minutes
997 setInterval("nactiSoubory()", 2 * 60 * 1000);
998 }
999 
1000 function nastavCheck() {
1001 document.form_map.ch_ap.checked = ch_ap;
1002 document.form_map.ch_router.checked = ch_router;
1003 document.form_map.ch_node.checked = ch_node;
1004 document.form_map.ch_infopoint.checked = ch_infopoint;
1005 document.form_map.ch_noping.checked = ch_noping;
1006 document.form_map.ch_legend.checked = ch_legend;
1007 document.form_map.ch_name.checked = ch_name;
1008 document.form_map.ch_ip.checked = ch_ip;
1009 document.form_map.ch_status.checked = ch_status;
1010 document.form_map.ch_backbone.checked = ch_backbone;
1011 document.form_map.ch_client.checked = ch_client;
1012 document.form_map.ch_inp.checked = ch_inp;
1013 }
1014 
1015 function reDraw() {
1016 if(document.form_map.ch_ap.checked) { ch_ap = true; } else { ch_ap = false; }
1017 if(document.form_map.ch_router.checked) { ch_router = true; } else { ch_router = false; }
1018 if(document.form_map.ch_node.checked) { ch_node = true; } else { ch_node = false; }
1019 if(document.form_map.ch_infopoint.checked) { ch_infopoint = true; } else { ch_infopoint = false; }
1020 if(document.form_map.ch_noping.checked) { ch_noping = true; } else { ch_noping = false; }
1021 if(document.form_map.ch_legend.checked) { ch_legend = true; } else { ch_legend = false; }
1022 if(document.form_map.ch_name.checked) { ch_name = true; } else { ch_name = false; }
1023 if(document.form_map.ch_ip.checked) { ch_ip = true; } else { ch_ip = false; }
1024 if(document.form_map.ch_status.checked) { ch_status = true; } else { ch_status = false; }
1025 if(document.form_map.ch_backbone.checked) { ch_backbone = true; } else { ch_backbone = false; }
1026 if(document.form_map.ch_client.checked) { ch_client = true; } else { ch_client = false; }
1027 if(document.form_map.ch_inp.checked) { ch_inp = true; } else { ch_inp = false; }
1028 titulek1 = document.getElementById("mapstats_infopoint");
10295unreal titulek2 = document.getElementById("mapstats_name");
1030 titulek3 = document.getElementById("mapstats_ip");
1031 titulek4 = document.getElementById("mapstats_status");
1032 titulek5 = document.getElementById("mapstats_legend");
1033 titulek6 = document.getElementById("mapstats_wave");
1034 titulek7 = document.getElementById("mapstats_points");
10351unreal titulek1.innerHTML = "";
1036 titulek2.innerHTML = "";
1037 titulek3.innerHTML = "";
1038 titulek4.innerHTML = "";
1039 titulek5.innerHTML = "";
10405unreal titulek6.innerHTML = "";
1041 titulek7.innerHTML = "";
10421unreal clearMap(ann);
1043 canvasInit(ann);
1044 }
1045 
10465unreal function deleteNames() {
1047 titulek1 = document.getElementById("mapstats_infopoint");
1048 titulek2 = document.getElementById("mapstats_name");
1049 titulek3 = document.getElementById("mapstats_ip");
1050 titulek4 = document.getElementById("mapstats_status");
1051 titulek6 = document.getElementById("mapstats_wave");
1052 titulek7 = document.getElementById("mapstats_points");
1053 titulek1.innerHTML = "";
1054 titulek2.innerHTML = "";
1055 titulek3.innerHTML = "";
1056 titulek4.innerHTML = "";
1057 titulek6.innerHTML = "";
1058 titulek7.innerHTML = "";
1059 }
1060 
10611unreal function drawInfo(txt, xa, ya, nas) {
1062 xa = parseInt((xa*nas)+6);
1063 ya = parseInt((ya*nas)-13);
1064 var text = '<div style="position:absolute;white-space:nowrap;letter-spacing: 1px;left:' + xa + 'px;top:' + ya + 'px;font-family: arial;font-size: 9px;background-color: #000000;color: #ffffff;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>';
1065 
1066 titulek = document.getElementById("mapstats_infopoint");
1067 titulek.innerHTML = titulek.innerHTML + text;
1068 }
1069 
1070 function drawName(txt, xa, ya, nas) {
1071 xa = parseInt((xa*nas)+6);
1072 ya = parseInt((ya*nas)-13);
1073 var text = '<div style="position:absolute;white-space:nowrap;letter-spacing: 1px;left:' + xa + 'px;top:' + ya + 'px;font-family: arial;font-size: 9px;background-color: #000000;color: #ffffff;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>';
1074 
1075 titulek = document.getElementById("mapstats_name");
1076 titulek.innerHTML = titulek.innerHTML + text;
1077 }
1078 
1079 function drawIP(txt, xb, yb, nas) {
1080 xb = parseInt((xb*nas)+6);
1081 yb = parseInt((yb*nas)-1);
1082 var text = '<div style="position:absolute;white-space:nowrap;letter-spacing: 1px;left:' + xb + 'px;top:' + yb + 'px;font-family: arial;font-size: 9px;background-color: #000000;color: #ffffff;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>';
1083 
1084 titulek = document.getElementById("mapstats_ip");
1085 titulek.innerHTML = titulek.innerHTML + text;
1086 }
1087 
1088 function drawStatus(txt, xc, yc, nas) {
1089 xc = parseInt((xc*nas)+6);
1090 yc = parseInt((yc*nas)+11);
1091 var text = '<div style="position:absolute;white-space:nowrap;letter-spacing: 1px;left:' + xc + 'px;top:' + yc + 'px;font-family: arial;font-size: 9px;background-color: #000000;color: #ffffff;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>';
1092 
1093 titulek = document.getElementById("mapstats_status");
1094 titulek.innerHTML = titulek.innerHTML + text;
1095 }
1096 
1097 function drawLegendText(txt) {
1098 var text = '<div style="position:relative;white-space:nowrap;letter-spacing: 1px;font-family: arial;font-size: 9px;color: black;padding-left: 3px;padding-right: 2px;cursor: default;" unselectable = "on">' + txt + '</div>';
1099 
1100 titulek = document.getElementById("mapstats_legend");
1101 titulek.innerHTML = text;
1102 }
1103 
1104 function changeOpacity(opc) {
1105 var opcprc = opc / 100;
1106 var mapstats_update = document.getElementById("mapstats_update");
1107 
1108 if (navigator.appName=="Microsoft Internet Explorer") {
1109 mapstats_update.style.filter = 'alpha(opacity=' + opc + ');';
1110 } else {
1111 mapstats_update.style.setProperty("-moz-opacity",opcprc,null);
1112 mapstats_update.style.setProperty("opacity",opcprc,null);
1113 }
1114 }
1115 
1116 function changeUpdate() {
1117 var promenna = new Date();
1118 var rok = promenna.getFullYear();
1119 var mesic = "" + (promenna.getMonth() + 1);
1120 var den = "" + (promenna.getDate());
1121 var hodin = "" + (promenna.getHours());
1122 var minut = "" + (promenna.getMinutes());
1123 var sekund = "" + (promenna.getSeconds());
1124 if(mesic.length==1) { mesic = "0" + mesic; }
1125 if(den.length==1) { den = "0" + den; }
1126 if(hodin.length==1) { hodin = "0" + hodin; }
1127 if(minut.length==1) { minut = "0" + minut; }
1128 if(sekund.length==1) { sekund = "0" + sekund; }
1129 var mapstats_update = document.getElementById("mapstats_update");
1130 mapstats_update.innerHTML = den + ". " + mesic + ". " + rok + " " + hodin + ":" + minut + ":" + sekund;
1131 }
1132 
1133 function redrawUpdate() {
1134 setTimeout("changeOpacity(90)",100);
1135 setTimeout("changeOpacity(80)",200);
1136 setTimeout("changeOpacity(70)",300);
1137 setTimeout("changeOpacity(60)",400);
1138 setTimeout("changeOpacity(50)",500);
1139 setTimeout("changeOpacity(40)",600);
1140 setTimeout("changeOpacity(30)",700);
1141 setTimeout("changeOpacity(20)",800);
1142 setTimeout("changeOpacity(10)",900);
1143 setTimeout("changeOpacity(0)",1000);
1144 setTimeout("changeUpdate()",1050);
1145 setTimeout("changeOpacity(10)",1100);
1146 setTimeout("changeOpacity(20)",1200);
1147 setTimeout("changeOpacity(30)",1300);
1148 setTimeout("changeOpacity(40)",1400);
1149 setTimeout("changeOpacity(50)",1500);
1150 setTimeout("changeOpacity(60)",1600);
1151 setTimeout("changeOpacity(70)",1700);
1152 setTimeout("changeOpacity(80)",1800);
1153 setTimeout("changeOpacity(90)",1900);
1154 setTimeout("changeOpacity(100)",2000);
1155 }

Powered by WebSVN 2.2.1