jablonka.czprosek.czf

mapstats

Subversion Repositories:
[/] [mapstats.js] - Diff between revs 8 and 9

Show entire file Ignore whitespace

Rev 8 Rev 9
Line 1... Line 1...
// -------------------------------------------------------- // --------------------------------------------------------
// This script made JKLIR as. Unreal][ [http://jklir.net] // This script made by JKLIR as. Unreal][ [http://jklir.net]
// Map engine originally from Emcee Lam [http://sjsutech.com] // Map engine originally from Emcee Lam [http://sjsutech.com]
// Licence: GNU/GPL // Licence: GNU/GPL
// (c) 2008 All rights reserved // (c) 2011 All rights reserved
// -------------------------------------------------------- // --------------------------------------------------------
   
var mainMap; var mainMap;
var magnifier; var magnifier;
if (navigator.appName=="Microsoft Internet Explorer") {  
var imgon = new Image();  
imgon.src = 'on.png';  
var imgoff = new Image();  
imgoff.src = 'off.png';  
var imginfo = new Image();  
imginfo.src = 'info.png';  
var imgap = new Image();  
imgap.src = 'ap.png';  
var imgcn = new Image();  
imgcn.src = 'client.png';  
var imgsw = new Image();  
imgsw.src = 'switch.png';  
}  
   
var node = new Array(); var node = new Array();
var nodecount; var nodecount;
var pozdrav8 = new Array(); var file_nodes = new Array();
var pomocna = new Array(); var file_noping = new Array();
var pomocna1 = new Array(); var file_links = new Array();
var pomocna2 = new Array(); var file_infopoints = new Array();
var pomocna3 = new Array(); var file_state = new Array();
var pomocna4 = new Array(); var ann;
var ann; var m1;
var m1; var m2;
var m2; var m3;
var m3; var m4;
var m4; var m5;
var m5; var m6;
var m6; var m7;
var m7; var m8;
var m8; var m9;
var m9; var m1_a;
var m1_a; var m2_a;
var m2_a; var m3_a;
var m3_a; var m4_a;
var m4_a; var m5_a;
var m5_a; var m6_a;
var m6_a; var m7_a;
var m7_a; var m8_a;
var m8_a; var m9_a;
var m9_a; var cntm;
var cntm; var div_paint;
  var div_points;
  var div_wave;
  var div_infopoint;
  var div_name;
  var div_ip;
  var div_status;
  var numoflinks = 0;
  var maxnumoflinks = 17;
  var is_ie = false;
  if(typeof(G_vmlCanvasManager)!='undefined') { is_ie = true; }
  actual_links = "";
  var drawing_timer;
  var is_adding = true;
   
function minmax_scan() { Array.prototype.max = function() {
if (!document.getElementById('mapstats')) return; var max = this[0];
window.clearInterval(minmax_scanner); var len = this.length;
canvasInit(start_mul); for(var i=1; i<len; i++) if (this[i] > max) max = this[i];
} return max;
  }
  Array.prototype.min = function() {
  var min = this[0];
  var len = this.length;
  for(var i=1; i<len; i++) if (this[i] < min) min = this[i];
  return min;
  }
   
function mapInit(startzoom) { function mapInit (startzoom) {
magnifier = new Magnifier(); magnifier = new Magnifier();
mainMap = new MainMap(startzoom); mainMap = new MainMap(startzoom);
   
var miniMapDiv = document.getElementById("miniMapInner"); var miniMapDiv = document.getElementById("miniMapInner");
miniMapDiv.onmousedown miniMapDiv.onmousedown = function (event) { return magnifier.startMove(event) };
= function (event) { return magnifier.startMove(event) }; miniMapDiv.onmousemove = function (event) { return magnifier.processMove(event) };
miniMapDiv.onmousemove miniMapDiv.onmouseup = function (event) { return magnifier.stopMove(event) };
= function (event) { return magnifier.processMove(event) }; miniMapDiv.ondragstart = function() { return false; } // for IE
miniMapDiv.onmouseup }
= function (event) { return magnifier.stopMove(event) };  
miniMapDiv.ondragstart = function() { return false; } // for IE  
}  
   
function Magnifier () { function Magnifier () {
var this1 = this; var this1 = this;
this.f_dragging = false; this.f_dragging = false;
this.div = document.getElementById("magnifier"); this.div = document.getElementById("magnifier");
this.div.ondragstart = function() { return false; } // for IE this.div.ondragstart = function() { return false; } // for IE
this.div.onmousedown this.div.onmousedown = function (event) { return this1.startMove(event) };
= function (event) { return this1.startMove(event) }; this.div.onmousemove = function (event) { return this1.processMove(event) };
this.div.onmousemove this.div.onmouseup = function (event) { return this1.stopMove(event) };
= function (event) { return this1.processMove(event) }; }
this.div.onmouseup  
= function (event) { return this1.stopMove(event) };  
}  
   
Magnifier.prototype.startMove = Magnifier.prototype.startMove = function (event) {
function (event) { // for IE
// for IE if (!event) event = window.event;
if (!event)  
event = window.event;  
   
var magnifierDiv = document.getElementById("magnifier"); var magnifierDiv = document.getElementById("magnifier");
//var magnifierDiv = this.div; //var magnifierDiv = this.div;
this.dragStartLeft = event.clientX; this.dragStartLeft = event.clientX;
this.dragStartTop = event.clientY; this.dragStartTop = event.clientY;
//magnifierDiv.style.cursor = "move";  
   
this.top = magnifierDiv.offsetTop; this.top = magnifierDiv.offsetTop;
this.left = magnifierDiv.offsetLeft; this.left = magnifierDiv.offsetLeft;
   
this.f_dragging = true; this.f_dragging = true;
return false; return false;
} }
   
/* As you drag the mouse in the mini map, the magnifier responds by /* As you drag the mouse in the mini map, the magnifier responds by
moving. Likewise, the main map will show the current area moving. Likewise, the main map will show the current area
enclosed by the magnifier. */ enclosed by the magnifier. */
Magnifier.prototype.processMove = Magnifier.prototype.processMove = function (event) {
function (event) { var magnifierDiv = this.div;
var magnifierDiv = this.div;  
  if (!event) event = window.event; // for IE
  if (this.f_dragging) {
   
  var minX = 0;
  var maxX = magres_x - magnifierDiv.offsetWidth;
  var minY = 0;
  var maxY = magres_y - magnifierDiv.offsetHeight;
   
  var shiftedLeft = this.left + (event.clientX - this.dragStartLeft);
  if (shiftedLeft < minX) shiftedLeft = minX; // map is not infinite
  if (shiftedLeft > maxX) shiftedLeft = maxX;
  magnifierDiv.style.left = shiftedLeft + "px";
   
if (!event) event = window.event; // for IE var shiftedTop = this.top + (event.clientY - this.dragStartTop);
if (this.f_dragging) { if (shiftedTop < minY) shiftedTop = minY; // map is not infinite
  if (shiftedTop > maxY) shiftedTop = maxY;
var minX = 0; magnifierDiv.style.top = shiftedTop + "px";
var maxX = magres_x - magnifierDiv.offsetWidth;  
var minY = 0; mainMap.setViewPort();
var maxY = magres_y - magnifierDiv.offsetHeight; }
  }
var shiftedLeft = this.left + (event.clientX - this.dragStartLeft);  
if (shiftedLeft < minX) shiftedLeft = minX; // map is not infinite  
if (shiftedLeft > maxX) shiftedLeft = maxX;  
magnifierDiv.style.left = shiftedLeft + "px";  
   
var shiftedTop = this.top + (event.clientY - this.dragStartTop);  
if (shiftedTop < minY) shiftedTop = minY; // map is not infinite  
if (shiftedTop > maxY) shiftedTop = maxY;  
magnifierDiv.style.top = shiftedTop + "px";  
   
mainMap.setViewPort();  
}  
}  
   
Magnifier.prototype.stopMove = Magnifier.prototype.stopMove = function (event) {
function (event) { this.f_dragging = false;
//this.div.style.cursor = ""; is_adding = true;
this.f_dragging = false; checkLinks();
} }
   
Magnifier.prototype.setSize = Magnifier.prototype.setSize = function (innerDivWidth, innerDivHeight) {
function (innerDivWidth, innerDivHeight) { var magnifierWidth = Math.round((magres_x * inres_x) / innerDivWidth) - 2; // 200 * 700px
var magnifierWidth = Math.round((magres_x * inres_x) / innerDivWidth) - 2; // 200 * 700px /* We subtract 2 because the borders are 1 pixel each */
/* We subtract 2 because the borders are 1 pixel each */ var magnifierHeight = Math.round((magres_y * inres_y) / innerDivHeight) - 2; // 141 * 500px
var magnifierHeight = Math.round((magres_y * inres_y) / innerDivHeight) - 2; // 141 * 500px /* We subtract 2 because the borders are 1 pixel each */
/* We subtract 2 because the borders are 1 pixel each */ var magnifierDiv = document.getElementById("magnifier");
var magnifierDiv = document.getElementById("magnifier"); magnifierDiv.style.width = magnifierWidth + "px";
magnifierDiv.style.width = magnifierWidth + "px"; magnifierDiv.style.height = magnifierHeight + "px";
magnifierDiv.style.height = magnifierHeight + "px";  
} document.getElementById("wrapper").style.width = inres_x + document.getElementById("menuset").clientWidth + 18 + "px";
  }
   
Magnifier.prototype.setPosition = Magnifier.prototype.setPosition = function () {
function () { var innerDiv = document.getElementById("innerDiv");
var innerDiv = document.getElementById("innerDiv"); var innerDivWidth = innerDiv.clientWidth;
var innerDivWidth = innerDiv.clientWidth; var innerDivHeight = innerDiv.clientHeight;
var innerDivHeight = innerDiv.clientHeight; var innerDivLeft = innerDiv.offsetLeft;
var innerDivLeft = innerDiv.offsetLeft; var innerDivTop = innerDiv.offsetTop;
var innerDivTop = innerDiv.offsetTop; this.left = Math.round(Math.abs(innerDivLeft) * magres_x / innerDivWidth);
this.left this.top = Math.round(Math.abs(innerDivTop) * magres_y / innerDivHeight);
= Math.round(Math.abs(innerDivLeft) * magres_x / innerDivWidth);  
this.top  
= Math.round(Math.abs(innerDivTop) * magres_y / innerDivHeight);  
   
// alter magnifier // alter magnifier
var magnifierDiv = this.div; var magnifierDiv = this.div;
magnifierDiv.style.left = this.left + "px"; magnifierDiv.style.left = this.left + "px";
magnifierDiv.style.top = this.top + "px"; magnifierDiv.style.top = this.top + "px";
} }
   
function MainMap (zoomfirst) { function MainMap (zoomfirst) {
var this1 = this; var this1 = this;
   
// constants // view port is the visible portion of the main map
// view port is the visible portion of the main map this.viewPortWidth = inres_x; //500
this.viewPortWidth = inres_x; //500 this.viewPortHeight = inres_y; //400
this.viewPortHeight = inres_y; //400  
   
this.tileSize = 256; this.tileSize = 256;
this.f_dragging = false; this.f_dragging = false;
this.innerDiv = document.getElementById("innerDiv"); this.innerDiv = document.getElementById("innerDiv");
this.innerDiv.style.cursor = "url('grab.cur'), default"; this.innerDiv.style.cursor = "url('grab.cur'), default";
   
var outerDiv = document.getElementById("outerDiv"); var outerDiv = document.getElementById("outerDiv");
this.outerDiv = outerDiv; this.outerDiv = outerDiv;
outerDiv.style.width = inres_x + "px"; outerDiv.style.width = inres_x + "px";
outerDiv.style.height = inres_y + "px"; outerDiv.style.height = inres_y + "px";
var underMap = document.getElementById("underMap"); var underMap = document.getElementById("underMap");
underMap.style.width = (inres_x - 4) + "px"; underMap.style.width = (inres_x - 4) + "px";
   
outerDiv.onmousedown outerDiv.onmousedown = function(event) { return this1.startMove(event) };
= function(event) { return this1.startMove(event) }; outerDiv.onmousemove = function(event) { return this1.processMove(event) };
outerDiv.onmousemove outerDiv.onmouseup = function(event) { return this1.stopMove(event) };
= function(event) { return this1.processMove(event) }; outerDiv.ondblclick = function(event) { return this1.doubleClick() };
outerDiv.onmouseup outerDiv.ondragstart = function() { return false; } // for IE
= function(event) { return this1.stopMove(event) };  
outerDiv.ondblclick  
= function(event) { return this1.doubleClick() };  
outerDiv.ondragstart = function() { return false; } // for IE  
   
var zf = 0;  
if(zoomfirst==eq_mini) { zf = 0; } if(zoomfirst==eq_mini) { zf = 0; }
if(zoomfirst==eq_medi) { zf = 1; } else if(zoomfirst==eq_medi) { zf = 1; }
if(zoomfirst==eq_high) { zf = 2; } else if(zoomfirst==eq_high) { zf = 2; }
if(zoomfirst==eq_orig) { zf = 3; } else if(zoomfirst==eq_orig) { zf = 3; }
  else { zf = 0; }
   
this.zoom = zf; this.zoom = zf;
this.zoomDim = [ this.zoomDim = [
{ {
width:parseInt(full_x * eq_mini), width:parseInt(full_x * eq_mini),
height:parseInt(full_y * eq_mini), height:parseInt(full_y * eq_mini),
size:1 size:1,
}, nasobek:eq_mini,
{ numoflinks:17
width:parseInt(full_x * eq_medi), },
height:parseInt(full_y * eq_medi), {
size:2 width:parseInt(full_x * eq_medi),
}, height:parseInt(full_y * eq_medi),
{ size:2,
width:parseInt(full_x * eq_high), nasobek:eq_medi,
height:parseInt(full_y * eq_high), numoflinks:12
size:3 },
}, {
{ width:parseInt(full_x * eq_high),
width:parseInt(full_x * eq_orig), height:parseInt(full_y * eq_high),
height:parseInt(full_y * eq_orig), size:3,
size:4 nasobek:eq_high,
}, numoflinks:10
] },
  {
  width:parseInt(full_x * eq_orig),
  height:parseInt(full_y * eq_orig),
  size:4,
  nasobek:eq_orig,
  numoflinks:7
  },
  ]
   
var zoomElt = this.zoomDim[this.zoom]; var zoomElt = this.zoomDim[this.zoom];
this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(zoomfirst*1000)/10)); this.setInnerDivSize (zoomElt.width, zoomElt.height, zoomElt.size, (parseInt(zoomfirst*1000)/10));
  document.getElementById("zoom"+this.zoom).className = "active";
   
var innerDiv = document.getElementById("innerDiv"); var innerDiv = document.getElementById("innerDiv");
innerDiv.style.left = -(start_left) + "px"; innerDiv.style.left = -(start_left * start_mul) + "px";
innerDiv.style.top = -(start_top) + "px"; innerDiv.style.top = -(start_top * start_mul) + "px";
   
magnifier.setPosition(); magnifier.setPosition();
this.checkTiles(); this.checkTiles();
} }
   
MainMap.prototype.startMove = MainMap.prototype.startMove = function (event) {
function (event) { // for IE
// for IE if (!event) event = window.event;
if (!event) event = window.event;  
   
this.dragStartLeft = event.clientX; this.dragStartLeft = event.clientX;
this.dragStartTop = event.clientY; this.dragStartTop = event.clientY;
var innerDiv = this.innerDiv; var innerDiv = this.innerDiv;
innerDiv.style.cursor = "url('grabbing.cur'), default"; innerDiv.style.cursor = "url('grabbing.cur'), default";
   
this.top = innerDiv.offsetTop;  
this.left = innerDiv.offsetLeft;  
   
this.f_dragging = true;  
return false;  
}  
   
MainMap.prototype.processMove = this.top = innerDiv.offsetTop;
function (event) { this.left = innerDiv.offsetLeft;
var zoomElt = this.zoomDim[this.zoom];  
var maxY = 0;  
var minY = -(zoomElt.height - this.viewPortHeight);  
var maxX = 0;  
var minX = -(zoomElt.width - this.viewPortWidth);  
   
if (!event) event = window.event; // for IE  
var innerDiv = this.innerDiv;  
if (this.f_dragging) {  
var shiftedTop = this.top + (event.clientY - this.dragStartTop);  
if (shiftedTop > maxY) shiftedTop = maxY; // map is not infinite  
if (shiftedTop < minY) shiftedTop = minY;  
innerDiv.style.top = shiftedTop + "px";  
   
var shiftedLeft = this.left + (event.clientX - this.dragStartLeft);  
if (shiftedLeft > maxX) shiftedLeft = maxX; // map is not infinite  
if (shiftedLeft < minX) shiftedLeft = minX;  
innerDiv.style.left = shiftedLeft + "px";  
   
this.checkTiles();  
magnifier.setPosition();  
}  
   
var nasbek; this.f_dragging = true;
var konst = 0; is_adding = true;
if(this.zoom==0) { nasbek = eq_mini; } window.clearInterval(drawing_timer);
if(this.zoom==1) { nasbek = eq_medi; } drawing_timer = window.setInterval(checkLinks, 1100);
if(this.zoom==2) { nasbek = eq_high; } return false;
if(this.zoom==3) { nasbek = eq_orig; } }
if (navigator.appName=="Microsoft Internet Explorer") { konst = -2; }  
var outerDiv = document.getElementById("outerDiv");  
var infoDiv = document.getElementById("infoDiv");  
if (this.f_dragging) {  
infoDiv.innerHTML = parseInt((Math.abs(shiftedLeft) + event.clientX - outerDiv.offsetLeft + konst)/nasbek) + " x " + parseInt((Math.abs(shiftedTop) + event.clientY - outerDiv.offsetTop + konst)/nasbek);  
} else {  
infoDiv.innerHTML = parseInt((Math.abs(parseInt(innerDiv.style.left)) + event.clientX - outerDiv.offsetLeft + konst)/nasbek) + " x " + parseInt((Math.abs(parseInt(innerDiv.style.top)) + event.clientY - outerDiv.offsetTop + konst)/nasbek);  
}  
}  
   
MainMap.prototype.checkZoom = MainMap.prototype.processMove = function (event) {
function () { var zoomElt = this.zoomDim[this.zoom];
var zoomElt = this.zoomDim[this.zoom]; var maxY = 0;
var maxY = 0; var minY = -(zoomElt.height - this.viewPortHeight);
var minY = -(zoomElt.height - this.viewPortHeight); var maxX = 0;
var maxX = 0; var minX = -(zoomElt.width - this.viewPortWidth);
var minX = -(zoomElt.width - this.viewPortWidth);  
var chcky = 0;  
var chckx = 0;  
   
var innerDiv = this.innerDiv; if (!event) event = window.event; // for IE
var shiftedTop = innerDiv.offsetTop; var innerDiv = this.innerDiv;
if (shiftedTop > maxY) { shiftedTop = maxY; chcky = 1; } // map is not infinite if (this.f_dragging) {
if (shiftedTop < minY) { shiftedTop = minY; chcky = 1; } var shiftedTop = this.top + (event.clientY - this.dragStartTop);
if (chcky == 1) innerDiv.style.top = shiftedTop + "px"; if (shiftedTop > maxY) shiftedTop = maxY; // map is not infinite
  if (shiftedTop < minY) shiftedTop = minY;
  innerDiv.style.top = shiftedTop + "px";
   
  var shiftedLeft = this.left + (event.clientX - this.dragStartLeft);
  if (shiftedLeft > maxX) shiftedLeft = maxX; // map is not infinite
  if (shiftedLeft < minX) shiftedLeft = minX;
  innerDiv.style.left = shiftedLeft + "px";
   
var shiftedLeft = innerDiv.offsetLeft; this.checkTiles();
if (shiftedLeft > maxX) { shiftedLeft = maxX; chckx = 1; }// map is not infinite magnifier.setPosition();
if (shiftedLeft < minX) { shiftedLeft = minX; chckx = 1; } }
if (chckx == 1) innerDiv.style.left = shiftedLeft + "px";  
   
magnifier.setPosition(); var konst = 0;
} var nasobek = this.zoomDim[this.zoom].nasobek;
  if (is_ie) { konst = -2; }
  var outerDiv = this.outerDiv;
  var infoDiv = document.getElementById("infoDiv");
  if(this.f_dragging) {
  infoDiv.innerHTML = parseInt((Math.abs(shiftedLeft) + event.clientX - outerDiv.offsetLeft + konst)/nasobek) + " x " + parseInt((Math.abs(shiftedTop) + event.clientY - outerDiv.offsetTop + konst)/nasobek);
  } else {
  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);
  }
  }
   
MainMap.prototype.checkTiles = MainMap.prototype.checkZoom = function () {
function () { window.clearInterval(drawing_timer);
var innerDiv = this.innerDiv; var zoomElt = this.zoomDim[this.zoom];
var tileSize = this.tileSize; var maxY = 0;
var visibleTiles = this.getVisibleTiles(); var minY = -(zoomElt.height - this.viewPortHeight);
var visibleTilesMap = {}; var maxX = 0;
var i; var minX = -(zoomElt.width - this.viewPortWidth);
  var chcky = 0;
  var chckx = 0;
   
var size = this.zoomDim[this.zoom].size; var innerDiv = this.innerDiv;
for (i=0;i<visibleTiles.length; i++) { var shiftedTop = innerDiv.offsetTop;
var tile = visibleTiles[i]; if (shiftedTop > maxY) { shiftedTop = maxY; chcky = 1; } // map is not infinite
var xy = "x" + tile.x + "y" + tile.y; if (shiftedTop < minY) { shiftedTop = minY; chcky = 1; }
var tileName if (chcky == 1) innerDiv.style.top = shiftedTop + "px";
= xy + "z" + this.zoom;  
visibleTilesMap[tileName] = true;  
var img = document.getElementById (tileName);  
if (!img) {  
img = document.createElement("img");  
img.src  
= "size" + size + "/" + xy + ".jpg";  
img.style.position = "absolute";  
img.style.left = (tile.x * tileSize) + "px";  
img.style.top = (tile.y * tileSize) + "px";  
img.setAttribute("id", tileName);  
img.setAttribute("galleryimg", "no");  
innerDiv.appendChild(img);  
}  
}  
   
var imgs = innerDiv.getElementsByTagName("img"); var shiftedLeft = innerDiv.offsetLeft;
for (i = 0; i < imgs.length; i++) { if (shiftedLeft > maxX) { shiftedLeft = maxX; chckx = 1; }// map is not infinite
var id = imgs[i].getAttribute("id"); if (shiftedLeft < minX) { shiftedLeft = minX; chckx = 1; }
if (!visibleTilesMap[id]) { if (chckx == 1) innerDiv.style.left = shiftedLeft + "px";
innerDiv.removeChild(imgs[i]);  
i--;  
}  
}  
}  
   
MainMap.prototype.getVisibleTiles = magnifier.setPosition();
function () { document.getElementById("zoom0").className = "";
var innerDiv = this.innerDiv; document.getElementById("zoom1").className = "";
var mapX = innerDiv.offsetLeft; document.getElementById("zoom2").className = "";
var mapY = innerDiv.offsetTop; document.getElementById("zoom3").className = "";
var tileSize = this.tileSize; document.getElementById("zoom"+this.zoom).className = "active";
  }
   
  MainMap.prototype.checkTiles = function () {
  var innerDiv = this.innerDiv;
  var tileSize = this.tileSize;
  var visibleTiles = this.getVisibleTiles();
  var visibleTilesMap = {};
  var i;
   
var startX = Math.abs(Math.floor(mapX / tileSize)) - 1; var size = this.zoomDim[this.zoom].size;
if (startX < 0) startX = 0; for(i=0;i<visibleTiles.length; i++) {
var startY = Math.abs(Math.floor(mapY / tileSize)) - 1; var tile = visibleTiles[i];
if (startY < 0) startY = 0; var xy = "x" + tile.x + "y" + tile.y;
var tilesX = Math.ceil(this.viewPortWidth / tileSize) + 1; var tileName = xy + "z" + this.zoom;
var tilesY = Math.ceil(this.viewPortHeight / tileSize) + 1; visibleTilesMap[tileName] = true;
  var img = document.getElementById(tileName);
var visibleTiles = []; if (!img) {
var counter = 0; img = document.createElement("img");
for (x = startX; x < (tilesX + startX); x++) { img.src = "size" + size + "/" + xy + ".jpg";
for (y = startY; y < (tilesY + startY); y++) { img.style.position = "absolute";
var tile = {}; img.style.left = (tile.x * tileSize) + "px";
tile.x = x; img.style.top = (tile.y * tileSize) + "px";
tile.y = y; img.setAttribute("id", tileName);
visibleTiles[counter++] = tile; innerDiv.appendChild(img);
} }
} }
return visibleTiles;  
}  
   
MainMap.prototype.stopMove = var imgs = innerDiv.getElementsByTagName("img");
function (event) { for(i=0; i<imgs.length; i++) {
this.innerDiv.style.cursor = "url('grab.cur'), default"; var id = imgs[i].getAttribute("id");
this.f_dragging = false; if (!visibleTilesMap[id]) {
} innerDiv.removeChild(imgs[i]);
  i--;
  }
  }
  }
   
// movement in the magnifier moves main map's view port MainMap.prototype.getVisibleTiles = function () {
MainMap.prototype.setViewPort = var innerDiv = this.innerDiv;
function () { var mapX = innerDiv.offsetLeft;
var magDiv = document.getElementById("magnifier"); var mapY = innerDiv.offsetTop;
var innerDiv = this.innerDiv; var tileSize = this.tileSize;
var magLeft = magDiv.offsetLeft;  
var magTop = magDiv.offsetTop;  
var innerDivWidth = innerDiv.clientWidth;  
var innerDivHeight = innerDiv.clientHeight;  
   
/* set innerDivLeft */  
var innerDivLeftMin = inres_x - innerDivWidth; //500  
var innerDivLeft  
= Math.round((-magLeft) * innerDivWidth / magres_x);  
if (innerDivLeft < innerDivLeftMin) innerDivLeft = innerDivLeftMin;  
innerDiv.style.left = innerDivLeft + "px";  
   
/* set innerDivTop */ var startX = Math.abs(Math.floor(mapX / tileSize)) - 1;
var innerDivTopMin = inres_y - innerDivHeight; //400 if (startX < 0) startX = 0;
var innerDivTop var startY = Math.abs(Math.floor(mapY / tileSize)) - 1;
= Math.round((-magTop) * innerDivHeight / magres_y); if (startY < 0) startY = 0;
if (innerDivTop < innerDivTopMin) innerDivTop = innerDivTopMin; var tilesX = Math.ceil(this.viewPortWidth / tileSize) + 1;
innerDiv.style.top = innerDivTop + "px"; var tilesY = Math.ceil(this.viewPortHeight / tileSize) + 1;
   
this.checkTiles(); var visibleTiles = [];
} var counter = 0;
  for (x = startX; x < (tilesX + startX); x++) {
  for (y = startY; y < (tilesY + startY); y++) {
  var tile = {};
  tile.x = x;
  tile.y = y;
  visibleTiles[counter++] = tile;
  }
  }
  return visibleTiles;
  }
   
MainMap.prototype.setInnerDivSize = MainMap.prototype.stopMove = function (event) {
function (width, height, size, percent) { window.clearInterval(drawing_timer);
var innerDiv = this.innerDiv; checkLinks();
innerDiv.style.width = width + "px"; is_adding = false;
innerDiv.style.height = height + "px"; checkLinks();
magnifier.setPosition(); this.innerDiv.style.cursor = "url('grab.cur'), default";
magnifier.setSize (width, height); this.f_dragging = false;
  }
   
var resolutionInfo = document.getElementById("resolutionInfo"); // movement in the magnifier moves main map's view port
resolutionInfo.innerHTML = percent + "%, " + width + " x " + height + "px"; MainMap.prototype.setViewPort = function () {
} var magDiv = document.getElementById("magnifier");
  var innerDiv = this.innerDiv;
  var magLeft = magDiv.offsetLeft;
  var magTop = magDiv.offsetTop;
  var innerDivWidth = innerDiv.clientWidth;
  var innerDivHeight = innerDiv.clientHeight;
   
MainMap.prototype.setZoom = /* set innerDivLeft */
function (newZoom) { var innerDivLeftMin = inres_x - innerDivWidth; //500
if (this.zoom == newZoom) return; var innerDivLeft = Math.round((-magLeft) * innerDivWidth / magres_x);
var oldZ = this.zoomDim[this.zoom]; if (innerDivLeft < innerDivLeftMin) innerDivLeft = innerDivLeftMin;
var newZ = this.zoomDim[newZoom]; innerDiv.style.left = innerDivLeft + "px";
var innerDiv = this.innerDiv;  
var imgs = innerDiv.getElementsByTagName("img");  
while (imgs.length > 0) {  
innerDiv.removeChild(imgs[0]);  
}  
   
var oldLeft = innerDiv.offsetLeft; /* set innerDivTop */
var oldTop = innerDiv.offsetTop; var innerDivTopMin = inres_y - innerDivHeight; //400
var wdth = Math.round(((magres_x * inres_x) / newZ.width) - 2); // 200 * 700px var innerDivTop = Math.round((-magTop) * innerDivHeight / magres_y);
var hght = Math.round(((magres_y * inres_y) / newZ.height) - 2); // 141 * 500px if (innerDivTop < innerDivTopMin) innerDivTop = innerDivTopMin;
var wdth2 = Math.round(((magres_x * inres_x) / oldZ.width) - 2); // 200 * 700px innerDiv.style.top = innerDivTop + "px";
var hght2 = Math.round(((magres_y * inres_y) / oldZ.height) - 2); // 141 * 500px  
   
var newLeft = Math.round(newZ.width * oldLeft / oldZ.width); this.checkTiles();
var newTop = Math.round(newZ.height * oldTop / oldZ.height); }
   
if (this.zoom < newZoom) { MainMap.prototype.setInnerDivSize = function (width, height, size, percent) {
newLeft = Math.round(newLeft + ((wdth-wdth2)*4)); var innerDiv = this.innerDiv;
newTop = Math.round(newTop + ((hght-hght2)*4)); innerDiv.style.width = width + "px";
} innerDiv.style.height = height + "px";
if (this.zoom > newZoom) { magnifier.setPosition();
newLeft = Math.round(newLeft + ((wdth-wdth2)*4)); magnifier.setSize(width, height);
newTop = Math.round(newTop + ((hght-hght2)*4));  
}  
   
innerDiv.style.left = newLeft + "px"; var resolutionInfo = document.getElementById("resolutionInfo");
innerDiv.style.top = newTop + "px"; resolutionInfo.innerHTML = percent + "%, " + width + " x " + height + "px";
this.zoom = newZoom; // set the global zoom }
var nasobek;  
if(this.zoom==0) { nasobek = eq_mini; }  
if(this.zoom==1) { nasobek = eq_medi; }  
if(this.zoom==2) { nasobek = eq_high; }  
if(this.zoom==3) { nasobek = eq_orig; }  
this.setInnerDivSize(newZ.width, newZ.height, newZ.size, (nasobek*1000)/10);  
   
this.checkZoom(); MainMap.prototype.setZoom = function (newZoom) {
this.checkTiles(); is_adding = true;
  if (this.zoom == newZoom) return;
  window.clearInterval(drawing_timer);
  actual_links = "";
  numoflinks = 0;
  var oldZ = this.zoomDim[this.zoom];
  var newZ = this.zoomDim[newZoom];
  var innerDiv = this.innerDiv;
  var imgs = innerDiv.getElementsByTagName("img");
  while (imgs.length > 0) {
  innerDiv.removeChild(imgs[0]);
  }
   
titulek1 = document.getElementById("mapstats_infopoint"); var oldLeft = innerDiv.offsetLeft;
titulek2 = document.getElementById("mapstats_name"); var oldTop = innerDiv.offsetTop;
titulek3 = document.getElementById("mapstats_ip"); var wdth = Math.round(((magres_x * inres_x) / newZ.width) - 2); // 200 * 700px
titulek4 = document.getElementById("mapstats_status"); var hght = Math.round(((magres_y * inres_y) / newZ.height) - 2); // 141 * 500px
titulek5 = document.getElementById("mapstats_legend"); var wdth2 = Math.round(((magres_x * inres_x) / oldZ.width) - 2); // 200 * 700px
titulek6 = document.getElementById("mapstats_wave"); var hght2 = Math.round(((magres_y * inres_y) / oldZ.height) - 2); // 141 * 500px
titulek7 = document.getElementById("mapstats_points");  
   
titulek1.innerHTML = ""; innerDiv.style.left = Math.round(Math.round(newZ.width * oldLeft / oldZ.width) + ((wdth-wdth2)*4)) + "px";
titulek2.innerHTML = ""; innerDiv.style.top = Math.round(Math.round(newZ.height * oldTop / oldZ.height) + ((hght-hght2)*4)) + "px";
titulek3.innerHTML = ""; this.zoom = newZoom; // set the global zoom
titulek4.innerHTML = ""; this.setInnerDivSize(newZ.width, newZ.height, newZ.size, (newZ.nasobek*1000)/10);
titulek5.innerHTML = ""; maxnumoflinks = newZ.numoflinks;
titulek6.innerHTML = "";  
titulek7.innerHTML = "";  
   
canvasInit(nasobek); this.checkZoom();
  this.checkTiles();
   
} deleteNames();
  canvasInit(newZ.nasobek);
   
MainMap.prototype.doubleClick = }
function () {  
if (this.zoom == 3) return;  
   
var stara = this.zoom; MainMap.prototype.doubleClick = function () {
stara = stara + 1; if (this.zoom == 3) return;
this.setZoom(stara); this.setZoom(this.zoom + 1);
  }
   
  MainMap.prototype.addNewLinks = function (minx, maxx, miny, maxy, linkname) {
  var innerDiv = this.innerDiv;
  var frameLeft = -innerDiv.offsetLeft;
  var frameTop = -innerDiv.offsetTop;
  var frameRight = frameLeft + inres_x;
  var frameBottom = frameTop + inres_y;
  var regexp = new RegExp(linkname + ' ', 'gi');
  if(!regexp.test(actual_links)) {
  return (minx <= frameRight && frameLeft <= maxx && miny <= frameBottom && frameTop <= maxy);
} }
  }
   
function canvasInit(nasobek) { MainMap.prototype.removeOldLinks = function (minx, maxx, miny, maxy, linkname) {
  var innerDiv = this.innerDiv;
  var frameLeft = -innerDiv.offsetLeft;
  var frameTop = -innerDiv.offsetTop;
  var frameRight = frameLeft + inres_x;
  var frameBottom = frameTop + inres_y;
  var regexp = new RegExp(linkname + ' ', 'gi');
  if(regexp.test(actual_links) && numoflinks>=maxnumoflinks) {
  if(!(minx <= frameRight && frameLeft <= maxx && miny <= frameBottom && frameTop <= maxy)) {
  actual_links = actual_links.replace(regexp, "");
  var linkDOM = document.getElementById(linkname);
  if(is_ie) {
  linkDOM.parentNode.parentNode.removeChild(linkDOM.parentNode);
  } else {
  linkDOM.parentNode.removeChild(linkDOM);
  }
  numoflinks--;
  return;
  }
  }
  }
   
var canvas_id1 = document.getElementById("paint");  
canvas_id1.width = parseInt(full_x*nasobek);  
canvas_id1.height = parseInt(full_y*nasobek);  
   
if (navigator.appName=="Microsoft Internet Explorer") { function canvasInit(nasobek) {
var canvas_id2 = document.getElementById("paint2"); is_adding = true;
canvas_id2.width = parseInt(full_x*nasobek); actual_links = "";
canvas_id2.height = parseInt(full_y*nasobek); numoflinks = 0;
}  
  div_paint = document.getElementById("paint");
  div_points = document.getElementById("mapstats_points");
  div_wave = document.getElementById("mapstats_wave");
  div_infopoint = document.getElementById("mapstats_infopoint");
  div_name = document.getElementById("mapstats_name");
  div_ip = document.getElementById("mapstats_ip");
  div_status = document.getElementById("mapstats_status");
   
  div_paint.style.width = parseInt(full_x*nasobek) + "px";
  div_paint.style.height = parseInt(full_y*nasobek) + "px";
   
  var mapstats_over = document.getElementById("mapstats_over");
  mapstats_over.style.width = parseInt(full_x*nasobek) + "px";
  mapstats_over.style.height = parseInt(full_y*nasobek) + "px";
   
ann = nasobek; ann = nasobek;
var pozdrav = new Array(); var pozdrav2 = new Array();
var pozdrav1 = new Array(); var pozdr = new Array();
var pozdrav2 = new Array(); var pozdrav = file_nodes.split('\n');
var pozdr = new Array(); var pozdrav1 = file_noping.split('\n');
pozdrav = pomocna.split('\n'); var a_cnt = 0;
pozdrav1 = pomocna1.split('\n'); var p0count = pozdrav.length;
var a_cnt = 0; var p1count = pozdrav1.length;
var p0count = pozdrav.length;  
var p1count = pozdrav1.length;  
   
for(a=0;a<p0count;a++){ for(a=0;a<p0count;a++){
if(pozdrav[a]!="") { if(pozdrav[a]!=false) {
node[a] = new Array(); node[a] = new Array();
pozdrav2 = pozdrav[a].split(';'); pozdrav2 = pozdrav[a].split(';');
for(b=0;b<pozdrav2.length;b++){ for(b=0;b<pozdrav2.length;b++){
node[a][b] = pozdrav2[b]; node[a][b] = pozdrav2[b];
} }
a_cnt++; a_cnt++;
} }
} }
for(e=0;e<p1count;e++) { for(e=0;e<p1count;e++) {
if(pozdrav1[e]!="") { if(pozdrav1[e]!=false) {
node[(e+a_cnt)] = new Array(); node[(e+a_cnt)] = new Array();
pozdr = pozdrav1[e].split(';'); pozdr = pozdrav1[e].split(';');
for(f=0;f<pozdr.length;f++){ for(f=0;f<pozdr.length;f++){
node[(e+a_cnt)][f] = pozdr[f]; node[(e+a_cnt)][f] = pozdr[f];
} }
} }
} }
   
nodecount = node.length; nodecount = node.length;
var pozdrav3 = new Array(); var pozdrav3 = new Array();
var pozdrav4 = new Array(); var pozdrav4 = new Array();
var size; var size;
var clrlnk; var clrlnk;
m1 = 0; m1 = 0; m1_a = 0;
m2 = 0; m2 = 0; m2_a = 0;
m3 = 0; m3 = 0; m3_a = 0;
m4 = 0; m4 = 0; m4_a = 0;
m5 = 0; m5 = 0; m5_a = 0;
m6 = 0; m6 = 0; m6_a = 0;
m7 = 0; m7 = 0; m7_a = 0;
m8 = 0; m8 = 0; m8_a = 0;
m9 = 0; m9 = 0; m9_a = 0;
m1_a = 0; cntm = 0;
m2_a = 0;  
m3_a = 0; checkLinks();
m4_a = 0;  
m5_a = 0;  
m6_a = 0;  
m7_a = 0;  
m8_a = 0;  
m9_a = 0;  
cntm = 0;  
   
if(pomocna2.length>0) { 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;
pozdrav3 = pomocna2.split('\n');  
var p3count = pozdrav3.length;  
for(a=0;a<p3count;a++){  
if(pozdrav3[a]!="") {  
pozdrav4 = pozdrav3[a].split(';');  
if(pozdrav4[1].toLowerCase()=="backbone") { size = 4.5; } else { size = 2.7; }  
if(pozdrav4[2].toLowerCase()=="inp") {  
if(pozdrav4[3]==1) { clrlnk = wifi_client_a; m1_a = 1; }  
else if(pozdrav4[3]==2) { clrlnk = wifi_backbone_a; m2_a = 1; }  
else if(pozdrav4[3]==3) { clrlnk = eth_100_a; m3_a = 1; }  
else if(pozdrav4[3]==4) { clrlnk = fso_a; m4_a = 1; }  
else if(pozdrav4[3]==5) { clrlnk = fso_backup_a; m5_a = 1; }  
else if(pozdrav4[3]==6) { clrlnk = ghz5_a; m6_a = 1; }  
else if(pozdrav4[3]==7) { clrlnk = ghz10_a; m7_a = 1; }  
else if(pozdrav4[3]==8) { clrlnk = fiber_a; m8_a = 1; }  
else { clrlnk = other_a; m9_a = 1; }  
} else {  
if(pozdrav4[3]==1) { clrlnk = wifi_client; m1 = 1; }  
else if(pozdrav4[3]==2) { clrlnk = wifi_backbone; m2 = 1; }  
else if(pozdrav4[3]==3) { clrlnk = eth_100; m3 = 1; }  
else if(pozdrav4[3]==4) { clrlnk = fso; m4 = 1; }  
else if(pozdrav4[3]==5) { clrlnk = fso_backup; m5 = 1; }  
else if(pozdrav4[3]==6) { clrlnk = ghz5; m6 = 1; }  
else if(pozdrav4[3]==7) { clrlnk = ghz10; m7 = 1; }  
else if(pozdrav4[3]==8) { clrlnk = fiber; m8 = 1; }  
else { clrlnk = other; m9 = 1; }  
}  
   
// Vykreslime si nase linky var pozdrav5 = new Array();
if(pozdrav4[2].toLowerCase()=="inp") { var pozdrav6 = new Array();
if(ch_inp) { if(ch_infopoint) {
drawINPLink(pozdrav4[0], size-1, nasobek, clrlnk); if(file_infopoints.length>0) {
} pozdrav5 = file_infopoints.split('\n');
} else { for(d=0;d<pozdrav5.length;d++) {
if((ch_backbone) && (size==4.5)) { if(pozdrav5[d]!=false) {
drawLink(pozdrav4[0], size, nasobek, clrlnk); pozdrav6 = pozdrav5[d].split(';');
} // Vykreslime si infopointy
if((ch_client) && (size==2.7)) { if(ch_name) {
drawLink(pozdrav4[0], size, nasobek, clrlnk); drawInfo(pozdrav6[0],pozdrav6[1],pozdrav6[2],nasobek);
}  
}  
}  
} }
} drawInfoPoint(pozdrav6[1],pozdrav6[2],nasobek);
  }
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; }
  }
  }
   
var pozdrav5 = new Array(); for(e=0;e<p1count;e++) {
var pozdrav6 = new Array(); if(pozdrav1[e]!="") {
if(ch_infopoint) { if(ch_noping) {
if(pomocna3.length>0) { if(node[(a_cnt+e)][3]==1) {
pozdrav5 = pomocna3.split('\n'); drawClient(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek);
for(d=0;d<pozdrav5.length;d++) { if(ch_name) {
if(pozdrav5[d]!="") { drawName(node[(a_cnt+e)][0],(node[(a_cnt+e)][1])-1,(node[(a_cnt+e)][2])-1,nasobek)
pozdrav6 = pozdrav5[d].split(';');  
// Vykreslime si infopointy  
if(ch_name) {  
drawInfo(pozdrav6[0],pozdrav6[1],pozdrav6[2],nasobek);  
}  
drawInfoPoint(pozdrav6[1],pozdrav6[2],nasobek);  
}  
}  
}  
} }
  }
  if(node[(a_cnt+e)][3]==2) {
  drawSwitch(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek);
  }
  }
  }
  }
   
for(e=0;e<p1count;e++) { var pozdrav7 = file_state.split('\n');
if(pozdrav1[e]!="") { var pozdrav8 = new Array();
if(ch_noping) { var clrpnt;
if(node[(a_cnt+e)][3]==1) { var x_pos;
drawClient(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek); var y_pos;
if(ch_name) { var name_pos;
drawName(node[(a_cnt+e)][0],(node[(a_cnt+e)][1])-1,(node[(a_cnt+e)][2])-1,nasobek) var title_pos;
} var p7count = pozdrav7.length;
}  
if(node[(a_cnt+e)][3]==2) {  
drawSwitch(node[(a_cnt+e)][1],node[(a_cnt+e)][2],nasobek);  
}  
}  
}  
}  
   
var pozdrav7 = new Array(); for(c=0;c<p7count;c++){
pozdrav7 = pomocna4.split('\n'); if(pozdrav7[c]!=false) {
var clrpnt; pozdrav8 = pozdrav7[c].split(';');
var x_pos; if(pozdrav8[1]==1) { clrpnt = "on"; pozdrav8[2] = pozdrav8[2] + ' ms'; } else { clrpnt = "off"; pozdrav8[2] = "offline"; }
var y_pos; 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
var name_pos;  
var title_pos;  
var p7count = pozdrav7.length;  
   
for(c=0;c<p7count;c++){ if(title_pos.toLowerCase()=="ap") {
if(pozdrav7[c]!="") { if(ch_ap) {
pozdrav8 = pozdrav7[c].split(';'); drawAP(x_pos,y_pos,nasobek);
if(pozdrav8[1]==1) { clrpnt = "on"; pozdrav8[2] = pozdrav8[2] + ' ms'; } else { clrpnt = "off"; pozdrav8[2] = "offline"; } drawNode(x_pos,y_pos,nasobek,clrpnt);
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 if(ch_name) {
  drawName(name_pos,x_pos,y_pos,nasobek);
if(title_pos.toLowerCase()=="ap") { }
if(ch_ap) { if((ch_ip) && (ch_status)) {
drawAP(x_pos,y_pos,nasobek); drawStatus(pozdrav8[2],x_pos,y_pos,nasobek);
drawNode(x_pos,y_pos,nasobek,clrpnt); drawIP(pozdrav8[0],x_pos,y_pos,nasobek);
if(ch_name) { } else if((!ch_ip) && (ch_status)) {
drawName(name_pos,x_pos,y_pos,nasobek); drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek);
} } else if((ch_ip) && (!ch_status)) {
if((ch_ip) && (ch_status)) { drawIP(pozdrav8[0],x_pos,y_pos,nasobek);
drawStatus(pozdrav8[2],x_pos,y_pos,nasobek); }
drawIP(pozdrav8[0],x_pos,y_pos,nasobek); }
} else if((!ch_ip) && (ch_status)) { } else if(title_pos.toLowerCase()=="router") {
drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek); if(ch_router) {
} else if((ch_ip) && (!ch_status)) { drawNode(x_pos,y_pos,nasobek,clrpnt);
drawIP(pozdrav8[0],x_pos,y_pos,nasobek); if(ch_name) {
} drawName(name_pos,x_pos,y_pos,nasobek);
}  
} else if(title_pos.toLowerCase()=="router") {  
if(ch_router) {  
drawNode(x_pos,y_pos,nasobek,clrpnt);  
if(ch_name) {  
drawName(name_pos,x_pos,y_pos,nasobek);  
}  
if(ch_status) {  
drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek);  
}  
}  
} else {  
if(ch_node) {  
drawNode(x_pos,y_pos,nasobek,clrpnt);  
if(ch_name) {  
drawName(name_pos,x_pos,y_pos,nasobek);  
}  
}  
}  
}  
} }
  if(ch_status) {
var legend = document.getElementById('legend'); drawStatus(pozdrav8[2],x_pos,y_pos-parseInt(12/nasobek),nasobek);
if((ch_legend) && (cntm>0)) { }
drawLegend(); }
legend.style.display = "block"; } else {
} else { if(ch_node) {
legend.style.display = "none"; drawNode(x_pos,y_pos,nasobek,clrpnt);
  if(ch_name) {
  drawName(name_pos,x_pos,y_pos,nasobek);
} }
  }
  }
  }
  }
   
  var legend = document.getElementById('legend');
  if((ch_legend) && (cntm>0)) {
  drawLegend();
  legend.style.display = "block";
  } else {
  legend.style.display = "none";
} }
  }
   
function drawLink(pos, size, nas, color) { function drawLink(pos, size, nas, color) {
var ctx = document.getElementById('paint').getContext('2d'); var linkname = "canvas" + pos.replace(/(#|&|_|\.|\:)/gi, "");
var points = new Array(); var points = new Array();
var posxy = new Array(); var posxy = new Array();
var coordinates = new Array(); var coordinates = new Array();
points = pos.split('#'); var cor_x = new Array();
var reg=/(\d+)&(\d+)/; var cor_y = new Array();
for(i=0;i<points.length;i++){ points = pos.split('#');
if (reg.test(points[i])) { var reg=/(\d+)&(\d+)/;
posxy = points[i].split('&'); for(i=0;i<points.length;i++){
coordinates[i*2] = parseInt(posxy[0]*nas); // checkni to.... if (reg.test(points[i])) {
coordinates[i*2+1] = parseInt(posxy[1]*nas); posxy = points[i].split('&');
} else { coordinates[i*2] = parseInt(posxy[0]*nas);
coordinates[i*2] = parseInt(node2sour(points[i],1)*nas); coordinates[i*2+1] = parseInt(posxy[1]*nas);
coordinates[i*2+1] = parseInt(node2sour(points[i],2)*nas); cor_x.push(coordinates[i*2]);
} cor_y.push(coordinates[i*2+1]);
} } else {
  coordinates[i*2] = parseInt(node2sour(points[i],1)*nas);
  coordinates[i*2+1] = parseInt(node2sour(points[i],2)*nas);
  cor_x.push(coordinates[i*2]);
  cor_y.push(coordinates[i*2+1]);
  }
  }
   
  var maxX = cor_x.max();
  var minX = cor_x.min();
  var maxY = cor_y.max();
  var minY = cor_y.min();
  if(is_adding) {
  if(!mainMap.addNewLinks(minX, maxX, minY, maxY, linkname)) return;
  } else {
  if(!mainMap.removeOldLinks(minX, maxX, minY, maxY, linkname)) return;
  }
  numoflinks++;
  actual_links = actual_links + linkname + " ";
  var canvas = document.createElement("canvas");
  canvas.width = maxX - minX + 10;
  canvas.height = maxY - minY + 10;
  canvas.id = linkname;
   
  if(is_ie) {
  // for IE's VML absolute positioning
  var div = document.createElement("div");
  div.style.width = maxX - minX + 10 + "px";
  div.style.height = maxY - minY + 10 + "px";
  div.style.position = "absolute";
  div.style.left = (minX - 5) + "px";
  div.style.top = (minY - 5) + "px";
  div.appendChild(canvas);
  div_paint.appendChild(div);
  G_vmlCanvasManager.initElement(canvas);
  } else {
  canvas.setAttribute("style", "position:absolute;left:" + (minX - 5) + "px;top:" + (minY - 5) + "px;");
  div_paint.appendChild(canvas);
  }
  var ctx = document.getElementById(linkname).getContext('2d');
   
  minX -= 5;
  minY -= 5;
   
ctx.lineJoin = "round"; ctx.lineJoin = "round";
ctx.strokeStyle = "rgb(20, 20, 20)"; ctx.strokeStyle = "rgb(20, 20, 20)";
ctx.lineWidth = size+1; ctx.lineWidth = size+1;
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(coordinates[0],coordinates[1]); ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);
for(i=2;i<coordinates.length;i+=2){ for(i=2;i<coordinates.length;i+=2){
ctx.lineTo(coordinates[i],coordinates[i+1]); ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);
}  
ctx.stroke();  
   
ctx.lineJoin = "round";  
ctx.strokeStyle = "rgb(0, 0, 0)";  
ctx.lineWidth = size;  
ctx.beginPath();  
ctx.moveTo(coordinates[0],coordinates[1]);  
for(i=2;i<coordinates.length;i+=2){  
ctx.lineTo(coordinates[i],coordinates[i+1]);  
}  
ctx.stroke();  
   
ctx.lineJoin = "round";  
ctx.strokeStyle = color;  
ctx.lineWidth = size-1;  
ctx.beginPath();  
ctx.moveTo(coordinates[0],coordinates[1]);  
for(i=2;i<coordinates.length;i+=2){  
ctx.lineTo(coordinates[i],coordinates[i+1]);  
}  
ctx.stroke();  
} }
  ctx.stroke();
   
function drawINPLink(pos, size, nas, color) { ctx.lineJoin = "round";
var ctx = document.getElementById('paint').getContext('2d'); ctx.strokeStyle = "rgb(0, 0, 0)";
var points = new Array(); ctx.lineWidth = size+1;
var posxy = new Array(); ctx.beginPath();
var coordinates = new Array(); ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);
points = pos.split('#'); for(i=2;i<coordinates.length;i+=2){
var reg=/(\d+)&(\d+)/; ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);
for(i=0;i<points.length;i++){  
if (reg.test(points[i])) {  
posxy = points[i].split('&');  
coordinates[i*2] = parseInt(posxy[0]*nas);  
coordinates[i*2+1] = parseInt(posxy[1]*nas);  
} else {  
coordinates[i*2] = parseInt(node2sour(points[i],1)*nas);  
coordinates[i*2+1] = parseInt(node2sour(points[i],2)*nas);  
}  
}  
   
ctx.lineJoin = "round";  
ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";  
ctx.lineWidth = size+1.5;  
ctx.beginPath();  
ctx.moveTo(coordinates[0],coordinates[1]);  
for(i=2;i<coordinates.length;i+=2){  
ctx.lineTo(coordinates[i],coordinates[i+1]);  
}  
ctx.stroke();  
   
ctx.lineJoin = "round";  
ctx.strokeStyle = color;  
ctx.lineWidth = size+0.5;  
ctx.beginPath();  
ctx.moveTo(coordinates[0],coordinates[1]);  
for(i=2;i<coordinates.length;i+=2){  
ctx.lineTo(coordinates[i],coordinates[i+1]);  
}  
ctx.stroke();  
} }
  ctx.stroke();
   
function drawNode(xo, yo, nas, img) { ctx.lineJoin = "round";
xo = parseInt((xo*nas)-7); ctx.strokeStyle = color;
yo = parseInt((yo*nas)-7); ctx.lineWidth = size-1;
if (navigator.appName=="Microsoft Internet Explorer") { ctx.beginPath();
if(img=="on") { img = imgon; } else { img = imgoff; } ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);
var ctx = document.getElementById('paint2').getContext('2d'); for(i=2;i<coordinates.length;i+=2){
ctx.drawImage(img,xo,yo); ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);
} else {  
var text = '<div class="grab" style="position:absolute;left:' + xo + 'px;top:' + yo + 'px;width: 14px;height: 14px;background-image: url(\'' + img + '.png\');font-size: 0px;" unselectable = "on"></div>';  
titulek = document.getElementById("mapstats_points");  
titulek.innerHTML = titulek.innerHTML + text;  
}  
} }
  ctx.stroke();
  }
   
function drawAP(xn, yn, nas) { function drawINPLink(pos, size, nas, color) {
xn = parseInt((xn*nas)-31); var linkname = "canvas" + pos.replace(/(#|&|_|\.|\:)/gi, "");
yn = parseInt((yn*nas)-17); var points = new Array();
if (navigator.appName=="Microsoft Internet Explorer") { var posxy = new Array();
var ctx = document.getElementById('paint').getContext('2d'); var coordinates = new Array();
ctx.drawImage(imgap,xn,yn); var cor_x = new Array();
} else { var cor_y = new Array();
var text = '<div class="grab" style="position:absolute;left:' + xn + 'px;top:' + yn + 'px;width: 62px;height: 34px;background-image: url(\'ap.png\');font-size: 0px;" unselectable = "on"></div>'; points = pos.split('#');
titulek = document.getElementById("mapstats_wave"); var reg=/(\d+)&(\d+)/;
titulek.innerHTML = titulek.innerHTML + text; for(i=0;i<points.length;i++){
} if (reg.test(points[i])) {
  posxy = points[i].split('&');
  coordinates[i*2] = parseInt(posxy[0]*nas);
  coordinates[i*2+1] = parseInt(posxy[1]*nas);
  cor_x.push(coordinates[i*2]);
  cor_y.push(coordinates[i*2+1]);
  } else {
  coordinates[i*2] = parseInt(node2sour(points[i],1)*nas);
  coordinates[i*2+1] = parseInt(node2sour(points[i],2)*nas);
  cor_x.push(coordinates[i*2]);
  cor_y.push(coordinates[i*2+1]);
  }
} }
   
function drawClient(xc, yc, nas) { var maxX = cor_x.max();
xc = parseInt((xc*nas)-7); var minX = cor_x.min();
yc = parseInt((yc*nas)-7); var maxY = cor_y.max();
if (navigator.appName=="Microsoft Internet Explorer") { var minY = cor_y.min();
var ctx = document.getElementById('paint').getContext('2d'); if(is_adding) {
ctx.drawImage(imgcn,xc,yc); if(!mainMap.addNewLinks(minX, maxX, minY, maxY, linkname)) return;
} else { } else {
var text = '<div class="grab" style="position:absolute;left:' + xc + 'px;top:' + yc + 'px;width: 14px;height: 14px;background-image: url(\'client.png\');font-size: 0px;" unselectable = "on"></div>'; if(!mainMap.removeOldLinks(minX, maxX, minY, maxY, linkname)) return;
titulek = document.getElementById("mapstats_wave"); }
titulek.innerHTML = titulek.innerHTML + text; numoflinks++;
} actual_links = actual_links + linkname + " ";
  var canvas = document.createElement("canvas");
  canvas.width = maxX - minX + 10;
  canvas.height = maxY - minY + 10;
  canvas.id = linkname;
   
  if(is_ie) {
  // for IE's VML absolute positioning
  var div = document.createElement("div");
  div.style.width = maxX - minX + 10 + "px";
  div.style.height = maxY - minY + 10 + "px";
  div.style.position = "absolute";
  div.style.left = (minX - 5) + "px";
  div.style.top = (minY - 5) + "px";
  div.appendChild(canvas);
  div_paint.appendChild(div);
  G_vmlCanvasManager.initElement(canvas);
  } else {
  canvas.setAttribute("style", "position:absolute;left:" + (minX - 5) + "px;top:" + (minY - 5) + "px;");
  div_paint.appendChild(canvas);
} }
  var ctx = document.getElementById(linkname).getContext('2d');
   
  minX -= 5;
  minY -= 5;
   
function drawSwitch(xs, ys, nas) { ctx.lineJoin = "round";
xs = parseInt((xs*nas)-6); ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
ys = parseInt((ys*nas)-6); ctx.lineWidth = size+1.5;
if (navigator.appName=="Microsoft Internet Explorer") { ctx.beginPath();
var ctx = document.getElementById('paint').getContext('2d'); ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);
ctx.drawImage(imgsw,xs,ys); for(i=2;i<coordinates.length;i+=2){
} else { ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);
var text = '<div class="grab" style="position:absolute;left:' + xs + 'px;top:' + ys + 'px;width: 12px;height: 12px;background-image: url(\'switch.png\');font-size: 0px;" unselectable = "on"></div>';  
titulek = document.getElementById("mapstats_wave");  
titulek.innerHTML = titulek.innerHTML + text;  
}  
} }
  ctx.stroke();
   
function drawInfoPoint(xl, yl, nas) { ctx.lineJoin = "round";
xl = parseInt((xl*nas)-7); ctx.strokeStyle = color;
yl = parseInt((yl*nas)-7); ctx.lineWidth = size+0.5;
if (navigator.appName=="Microsoft Internet Explorer") { ctx.beginPath();
var ctx = document.getElementById('paint').getContext('2d'); ctx.moveTo(coordinates[0]-minX,coordinates[1]-minY);
ctx.drawImage(imginfo,xl,yl); for(i=2;i<coordinates.length;i+=2){
} else { ctx.lineTo(coordinates[i]-minX,coordinates[i+1]-minY);
var text = '<div class="grab" style="position:absolute;left:' + xl + 'px;top:' + yl + 'px;width: 14px;height: 14px;background-image: url(\'info.png\');font-size: 0px;" unselectable = "on"></div>';  
titulek = document.getElementById("mapstats_wave");  
titulek.innerHTML = titulek.innerHTML + text;  
}  
} }
  ctx.stroke();
  }
   
function drawLegend() { function checkLinks() {
var epsilon; if(file_links.length>0) {
var cislo = 0; pozdrav3 = file_links.split('\n');
var name = ""; var p3count = pozdrav3.length;
var paintlegend = document.getElementById('paintlegend'); for(a=0;a<p3count;a++){
paintlegend.height = (((cntm-1) * 12)+13); if(pozdrav3[a]!=false) {
paintlegend.width = "25"; pozdrav4 = pozdrav3[a].split(';');
var ctx = paintlegend.getContext('2d'); if(pozdrav4[1].toLowerCase()=="backbone") { size = 4.1; } else { size = 2.7; }
ctx.clearRect(0,0,25,((cntm-1) * 12)+13); if(pozdrav4[2].toLowerCase()!="inp") {
if(m1==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_client,2.9); name = name + name1 + "<br/>"; cislo++; } if(pozdrav4[3]==1) { clrlnk = wifi_client; m1 = 1; }
if(m2==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_backbone,4.5); name = name + name2 + "<br/>"; cislo++; } else if(pozdrav4[3]==2) { clrlnk = wifi_backbone; m2 = 1; }
if(m3==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,eth_100,4.5); name = name + name3 + "<br/>"; cislo++; } else if(pozdrav4[3]==3) { clrlnk = eth_100; m3 = 1; }
if(m4==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso,4.5); name = name + name4 + "<br/>"; cislo++; } else if(pozdrav4[3]==4) { clrlnk = fso; m4 = 1; }
if(m5==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso_backup,4.5); name = name + name5 + "<br/>"; cislo++; } else if(pozdrav4[3]==5) { clrlnk = fso_backup; m5 = 1; }
if(m6==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz5,4.5); name = name + name6 + "<br/>"; cislo++; } else if(pozdrav4[3]==6) { clrlnk = ghz5; m6 = 1; }
if(m7==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz10,4.5); name = name + name7 + "<br/>"; cislo++; } else if(pozdrav4[3]==7) { clrlnk = ghz10; m7 = 1; }
if(m8==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fiber,4.5); name = name + name8 + "<br/>"; cislo++; } else if(pozdrav4[3]==8) { clrlnk = fiber; m8 = 1; }
if(m9==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,other,4.5); name = name + name9 + "<br/>"; cislo++; } else { clrlnk = other; m9 = 1; }
if(m1_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_client_a,2.9); name = name + name1 + " " + inp + "<br/>"; cislo++; } } else {
if(m2_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_backbone_a,4.5); name = name + name2 + " " + inp + "<br/>"; cislo++; } if(pozdrav4[3]==1) { clrlnk = wifi_client_a; m1_a = 1; }
if(m3_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,eth_100_a,4.5); name = name + name3 + " " + inp + "<br/>"; cislo++; } else if(pozdrav4[3]==2) { clrlnk = wifi_backbone_a; m2_a = 1; }
if(m4_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_a,4.5); name = name + name4 + " " + inp + "<br/>"; cislo++; } else if(pozdrav4[3]==3) { clrlnk = eth_100_a; m3_a = 1; }
if(m5_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_backup_a,4.5); name = name + name5 + " " + inp + "<br/>"; cislo++; } else if(pozdrav4[3]==4) { clrlnk = fso_a; m4_a = 1; }
if(m6_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz5_a,4.5); name = name + name6 + " " + inp + "<br/>"; cislo++; } else if(pozdrav4[3]==5) { clrlnk = fso_backup_a; m5_a = 1; }
if(m7_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz10_a,4.5); name = name + name7 + " " + inp + "<br/>"; cislo++; } else if(pozdrav4[3]==6) { clrlnk = ghz5_a; m6_a = 1; }
if(m8_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fiber_a,4.5); name = name + name8 + " " + inp + "<br/>"; cislo++; } else if(pozdrav4[3]==7) { clrlnk = ghz10_a; m7_a = 1; }
if(m9_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,other_a,4.5); name = name + name9 + " " + inp + "<br/>"; } else if(pozdrav4[3]==8) { clrlnk = fiber_a; m8_a = 1; }
drawLegendText(name); else { clrlnk = other_a; m9_a = 1; }
  }
   
  if(pozdrav4[2].toLowerCase()!="inp") {
  if((ch_backbone && size==4.1) || (ch_client && size==2.7)) {
  drawLink(pozdrav4[0], size, ann, clrlnk);
  }
  } else {
  if(ch_inp) {
  drawINPLink(pozdrav4[0], size-1, ann, clrlnk);
  }
  }
  }
  }
} }
  }
   
function drawLegendLink(yg,color,size) { function drawNode(xo, yo, nas, img) {
var ctx = document.getElementById('paintlegend').getContext('2d'); xo = parseInt((xo*nas)-7);
ctx.strokeStyle = "rgb(20, 20, 20)"; yo = parseInt((yo*nas)-7);
ctx.lineWidth = size+1; var text = '<div class="node" style="position:absolute;left:' + xo + 'px;top:' + yo + 'px;background:url(\'' + img + '.png\');" unselectable = "on"></div>';
ctx.beginPath(); div_points.innerHTML += text;
ctx.moveTo(1,yg); }
ctx.lineTo(24,yg);  
ctx.stroke();  
   
ctx.strokeStyle = "rgb(0, 0, 0)"; function drawAP(xn, yn, nas) {
ctx.lineWidth = size; xn = parseInt((xn*nas)-31);
ctx.beginPath(); yn = parseInt((yn*nas)-17);
ctx.moveTo(1,yg); var text = '<div class="ap" style="position:absolute;left:' + xn + 'px;top:' + yn + 'px;" unselectable = "on"></div>';
ctx.lineTo(24,yg); div_wave.innerHTML += text;
ctx.stroke(); }
   
ctx.strokeStyle = color; function drawClient(xc, yc, nas) {
ctx.lineWidth = size-1; xc = parseInt((xc*nas)-7);
ctx.beginPath(); yc = parseInt((yc*nas)-7);
ctx.moveTo(1,yg); var text = '<div class="client" style="position:absolute;left:' + xc + 'px;top:' + yc + 'px;" unselectable = "on"></div>';
ctx.lineTo(24,yg); div_wave.innerHTML += text;
ctx.stroke(); }
   
} function drawSwitch(xs, ys, nas) {
  xs = parseInt((xs*nas)-6);
  ys = parseInt((ys*nas)-6);
  var text = '<div class="switch" style="position:absolute;left:' + xs + 'px;top:' + ys + 'px;" unselectable = "on"></div>';
  div_wave.innerHTML += text;
  }
   
function drawLegendINPLink(yg,color,size) { function drawInfoPoint(xl, yl, nas) {
var ctx = document.getElementById('paintlegend').getContext('2d'); xl = parseInt((xl*nas)-7);
ctx.strokeStyle = "rgba(255, 255, 255, 0.5)"; yl = parseInt((yl*nas)-7);
ctx.lineWidth = size; var text = '<div class="infopoint" style="position:absolute;left:' + xl + 'px;top:' + yl + 'px;" unselectable = "on"></div>';
ctx.beginPath(); div_wave.innerHTML += text;
ctx.moveTo(1,yg); }
ctx.lineTo(24,yg);  
ctx.stroke();  
   
ctx.strokeStyle = "rgba(0, 0, 0, 0.1)"; function drawInfo(txt, xa, ya, nas) {
ctx.lineWidth = size; xa = parseInt((xa*nas)+6);
ctx.beginPath(); ya = parseInt((ya*nas)-13);
ctx.moveTo(1,yg); var text = '<div class="stitek" style="position:absolute;left:' + xa + 'px;top:' + ya + 'px;" unselectable = "on">' + txt + '</div>';
ctx.lineTo(24,yg); div_infopoint.innerHTML += text;
ctx.stroke(); }
   
ctx.strokeStyle = color; function drawName(txt, xa, ya, nas) {
ctx.lineWidth = size-0.5; xa = parseInt((xa*nas)+6);
ctx.beginPath(); ya = parseInt((ya*nas)-13);
ctx.moveTo(1,yg); var text = '<div class="stitek" style="position:absolute;left:' + xa + 'px;top:' + ya + 'px;" unselectable = "on">' + txt + '</div>';
ctx.lineTo(24,yg); div_name.innerHTML += text;
ctx.stroke(); }
}  
   
function clearMap(ann) { function drawIP(txt, xb, yb, nas) {
var ctx = document.getElementById('paint').getContext('2d'); xb = parseInt((xb*nas)+6);
ctx.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); yb = parseInt((yb*nas)-1);
if (navigator.appName=="Microsoft Internet Explorer") { var text = '<div class="stitek" style="position:absolute;left:' + xb + 'px;top:' + yb + 'px;" unselectable = "on">' + txt + '</div>';
var ctx2 = document.getElementById('paint2').getContext('2d'); div_ip.innerHTML += text;
ctx2.clearRect(0,0,parseInt(full_x * ann),parseInt(full_y * ann)); }
}  
}  
   
function node2sour(name, pos) { function drawStatus(txt, xc, yc, nas) {
var ok = 0; xc = parseInt((xc*nas)+6);
for(k=0;k<nodecount;k++){ yc = parseInt((yc*nas)+11);
if(node[k][0]==name) { var text = '<div class="stitek" style="position:absolute;left:' + xc + 'px;top:' + yc + 'px;" unselectable = "on">' + txt + '</div>';
ok = node[k][pos]; div_status.innerHTML += text;
} }
if(ok!=0) { return ok; }  
}  
return ok;  
}  
   
function ip2sour(ip, pos) { function drawLegendText(txt) {
var ok = 0; document.getElementById("mapstats_legend").innerHTML = '<div class="legend" unselectable = "on">' + txt + '</div>';
for(k=0;k<nodecount;k++){ }
if(node[k][4]==ip) {  
ok = node[k][pos];  
}  
if(ok!=0) { return ok; }  
}  
return ok;  
}  
   
function nactiSoubory() { function drawLegend() {
var d = new Date(); var epsilon;
var tm = d.getTime(); var cislo = 0;
pomocna = getFile(nodes + "?" + tm); var name = "";
pomocna1 = getFile(noping + "?" + tm); var paintlegend = document.getElementById('paintlegend');
pomocna2 = getFile(links + "?" + tm); paintlegend.height = (((cntm-1) * 12)+13);
pomocna3 = getFile(infopoints + "?" + tm); paintlegend.width = "25";
pomocna4 = getFile(state + "?" + tm); var ctx = paintlegend.getContext('2d');
redrawUpdate(); ctx.clearRect(0,0,25,((cntm-1) * 12)+13);
} if(m1==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_client,2.7); name = name + name1 + "<br/>"; cislo++; }
  if(m2==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,wifi_backbone,4.1); name = name + name2 + "<br/>"; cislo++; }
  if(m3==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,eth_100,4.1); name = name + name3 + "<br/>"; cislo++; }
  if(m4==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso,4.1); name = name + name4 + "<br/>"; cislo++; }
  if(m5==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fso_backup,4.1); name = name + name5 + "<br/>"; cislo++; }
  if(m6==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz5,4.1); name = name + name6 + "<br/>"; cislo++; }
  if(m7==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,ghz10,4.1); name = name + name7 + "<br/>"; cislo++; }
  if(m8==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,fiber,4.1); name = name + name8 + "<br/>"; cislo++; }
  if(m9==1) { epsilon = ((cislo*12)+5); drawLegendLink(epsilon,other,4.1); name = name + name9 + "<br/>"; cislo++; }
  if(m1_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_client_a,2.7); name = name + name1 + " " + inp + "<br/>"; cislo++; }
  if(m2_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,wifi_backbone_a,4.1); name = name + name2 + " " + inp + "<br/>"; cislo++; }
  if(m3_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,eth_100_a,4.1); name = name + name3 + " " + inp + "<br/>"; cislo++; }
  if(m4_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_a,4.1); name = name + name4 + " " + inp + "<br/>"; cislo++; }
  if(m5_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fso_backup_a,4.1); name = name + name5 + " " + inp + "<br/>"; cislo++; }
  if(m6_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz5_a,4.1); name = name + name6 + " " + inp + "<br/>"; cislo++; }
  if(m7_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,ghz10_a,4.1); name = name + name7 + " " + inp + "<br/>"; cislo++; }
  if(m8_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,fiber_a,4.1); name = name + name8 + " " + inp + "<br/>"; cislo++; }
  if(m9_a==1) { epsilon = ((cislo*12)+5); drawLegendINPLink(epsilon,other_a,4.1); name = name + name9 + " " + inp + "<br/>"; }
  drawLegendText(name);
  }
   
function getFile(url) { function drawLegendLink(yg,color,size) {
AJAX = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false)); var ctx = document.getElementById('paintlegend').getContext('2d');
if (AJAX) { ctx.strokeStyle = "rgb(20, 20, 20)";
AJAX.open("GET", url, false); ctx.lineWidth = size+1;
AJAX.setRequestHeader("Cache-Control", "no-store"); ctx.beginPath();
AJAX.setRequestHeader("Cache-Control", "no-cache"); ctx.moveTo(1,yg);
AJAX.setRequestHeader("Cache-Control", "must-revalidate"); ctx.lineTo(24,yg);
AJAX.setRequestHeader("Pragma", "no-cache"); ctx.stroke();
AJAX.send(null);  
return AJAX.responseText;  
} else {  
return false;  
}  
}  
   
function timerMe() { ctx.strokeStyle = "rgb(0, 0, 0)";
// auto-downloading source files every 2 minutes ctx.lineWidth = size;
setInterval("nactiSoubory()", 2 * 60 * 1000); ctx.beginPath();
} ctx.moveTo(1,yg);
  ctx.lineTo(24,yg);
  ctx.stroke();
   
function nastavCheck() { ctx.strokeStyle = color;
document.form_map.ch_ap.checked = ch_ap; ctx.lineWidth = size-1;
document.form_map.ch_router.checked = ch_router; ctx.beginPath();
document.form_map.ch_node.checked = ch_node; ctx.moveTo(1,yg);
document.form_map.ch_infopoint.checked = ch_infopoint; ctx.lineTo(24,yg);
document.form_map.ch_noping.checked = ch_noping; ctx.stroke();
document.form_map.ch_legend.checked = ch_legend; }
document.form_map.ch_name.checked = ch_name;  
document.form_map.ch_ip.checked = ch_ip;  
document.form_map.ch_status.checked = ch_status;  
document.form_map.ch_backbone.checked = ch_backbone;  
document.form_map.ch_client.checked = ch_client;  
document.form_map.ch_inp.checked = ch_inp;  
}  
   
function reDraw() { function drawLegendINPLink(yg,color,size) {
if(document.form_map.ch_ap.checked) { ch_ap = true; } else { ch_ap = false; } var ctx = document.getElementById('paintlegend').getContext('2d');
if(document.form_map.ch_router.checked) { ch_router = true; } else { ch_router = false; } ctx.strokeStyle = "rgba(255, 255, 255, 0.5)";
if(document.form_map.ch_node.checked) { ch_node = true; } else { ch_node = false; } ctx.lineWidth = size;
if(document.form_map.ch_infopoint.checked) { ch_infopoint = true; } else { ch_infopoint = false; } ctx.beginPath();
if(document.form_map.ch_noping.checked) { ch_noping = true; } else { ch_noping = false; } ctx.moveTo(1,yg);
if(document.form_map.ch_legend.checked) { ch_legend = true; } else { ch_legend = false; } ctx.lineTo(24,yg);
if(document.form_map.ch_name.checked) { ch_name = true; } else { ch_name = false; } ctx.stroke();
if(document.form_map.ch_ip.checked) { ch_ip = true; } else { ch_ip = false; }  
if(document.form_map.ch_status.checked) { ch_status = true; } else { ch_status = false; }  
if(document.form_map.ch_backbone.checked) { ch_backbone = true; } else { ch_backbone = false; }  
if(document.form_map.ch_client.checked) { ch_client = true; } else { ch_client = false; }  
if(document.form_map.ch_inp.checked) { ch_inp = true; } else { ch_inp = false; }  
titulek1 = document.getElementById("mapstats_infopoint");  
titulek2 = document.getElementById("mapstats_name");  
titulek3 = document.getElementById("mapstats_ip");  
titulek4 = document.getElementById("mapstats_status");  
titulek5 = document.getElementById("mapstats_legend");  
titulek6 = document.getElementById("mapstats_wave");  
titulek7 = document.getElementById("mapstats_points");  
titulek1.innerHTML = "";  
titulek2.innerHTML = "";  
titulek3.innerHTML = "";  
titulek4.innerHTML = "";  
titulek5.innerHTML = "";  
titulek6.innerHTML = "";  
titulek7.innerHTML = "";  
clearMap(ann);  
canvasInit(ann);  
}  
   
function deleteNames() { ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
titulek1 = document.getElementById("mapstats_infopoint"); ctx.lineWidth = size;
titulek2 = document.getElementById("mapstats_name"); ctx.beginPath();
titulek3 = document.getElementById("mapstats_ip"); ctx.moveTo(1,yg);
titulek4 = document.getElementById("mapstats_status"); ctx.lineTo(24,yg);
titulek6 = document.getElementById("mapstats_wave"); ctx.stroke();
titulek7 = document.getElementById("mapstats_points");  
titulek1.innerHTML = "";  
titulek2.innerHTML = "";  
titulek3.innerHTML = "";  
titulek4.innerHTML = "";  
titulek6.innerHTML = "";  
titulek7.innerHTML = "";  
}  
   
function drawInfo(txt, xa, ya, nas) { ctx.strokeStyle = color;
xa = parseInt((xa*nas)+6); ctx.lineWidth = size-0.5;
ya = parseInt((ya*nas)-13); ctx.beginPath();
var text = '<div class="grab" 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;" unselectable = "on">' + txt + '</div>'; ctx.moveTo(1,yg);
  ctx.lineTo(24,yg);
  ctx.stroke();
  }
   
titulek = document.getElementById("mapstats_infopoint"); function clearMap() {
titulek.innerHTML = titulek.innerHTML + text; div_paint.innerHTML = "";
} }
   
function drawName(txt, xa, ya, nas) {  
xa = parseInt((xa*nas)+6);  
ya = parseInt((ya*nas)-13);  
var text = '<div class="grab" 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;" unselectable = "on">' + txt + '</div>';  
   
titulek = document.getElementById("mapstats_name"); function node2sour(name, pos) {
titulek.innerHTML = titulek.innerHTML + text; var ok = 0;
  for(k=0;k<nodecount;k++){
  if(node[k][0]==name) {
  ok = node[k][pos];
  }
  if(ok!=0) { return ok; }
} }
  return ok;
  }
   
function drawIP(txt, xb, yb, nas) { function ip2sour(ip, pos) {
xb = parseInt((xb*nas)+6); var ok = 0;
yb = parseInt((yb*nas)-1); for(k=0;k<nodecount;k++){
var text = '<div class="grab" 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;" unselectable = "on">' + txt + '</div>'; if(node[k][4]==ip) {
  ok = node[k][pos];
titulek = document.getElementById("mapstats_ip"); }
titulek.innerHTML = titulek.innerHTML + text; if(ok!=0) { return ok; }
} }
  return ok;
  }
   
function drawStatus(txt, xc, yc, nas) { function loadFiles() {
xc = parseInt((xc*nas)+6); var d = new Date();
yc = parseInt((yc*nas)+11); var tm = d.getTime();
var text = '<div class="grab" 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;" unselectable = "on">' + txt + '</div>'; file_nodes = getFile(nodes + "?" + tm);
  file_noping = getFile(noping + "?" + tm);
  file_links = getFile(links + "?" + tm);
  file_infopoints = getFile(infopoints + "?" + tm);
  file_state = getFile(state + "?" + tm);
  redrawUpdate();
  }
   
titulek = document.getElementById("mapstats_status"); function getFile(url) {
titulek.innerHTML = titulek.innerHTML + text; AJAX = (window.XMLHttpRequest ? new XMLHttpRequest() : (window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : false));
} if (AJAX) {
  AJAX.open("GET", url, false);
  AJAX.setRequestHeader("Cache-Control", "no-store");
  AJAX.setRequestHeader("Cache-Control", "no-cache");
  AJAX.setRequestHeader("Cache-Control", "must-revalidate");
  AJAX.setRequestHeader("Pragma", "no-cache");
  AJAX.send(null);
  return AJAX.responseText;
  } else {
  return false;
  }
  }
   
function drawLegendText(txt) { function setAutoLoader() {
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>'; // auto-downloading source files every 2 minutes
  setInterval("loadFiles()", 2 * 60 * 1000);
  }
   
titulek = document.getElementById("mapstats_legend"); function setCheckboxes() {
titulek.innerHTML = text; document.form_map.ch_ap.checked = ch_ap;
} document.form_map.ch_router.checked = ch_router;
  document.form_map.ch_node.checked = ch_node;
  document.form_map.ch_infopoint.checked = ch_infopoint;
  document.form_map.ch_noping.checked = ch_noping;
  document.form_map.ch_legend.checked = ch_legend;
  document.form_map.ch_name.checked = ch_name;
  document.form_map.ch_ip.checked = ch_ip;
  document.form_map.ch_status.checked = ch_status;
  document.form_map.ch_backbone.checked = ch_backbone;
  document.form_map.ch_client.checked = ch_client;
  document.form_map.ch_inp.checked = ch_inp;
  }
   
  function deleteNames() {
  div_paint.innerHTML = "";
  div_points.innerHTML = "";
  div_wave.innerHTML = "";
  div_infopoint.innerHTML = "";
  div_name.innerHTML = "";
  div_ip.innerHTML = "";
  div_status.innerHTML = "";
  document.getElementById("mapstats_legend").innerHTML = "";
  }
   
function changeOpacity(opc) { function reDraw() {
var opcprc = opc / 100; if(document.form_map.ch_ap.checked) { ch_ap = true; } else { ch_ap = false; }
var mapstats_update = document.getElementById("mapstats_update"); if(document.form_map.ch_router.checked) { ch_router = true; } else { ch_router = false; }
  if(document.form_map.ch_node.checked) { ch_node = true; } else { ch_node = false; }
  if(document.form_map.ch_infopoint.checked) { ch_infopoint = true; } else { ch_infopoint = false; }
  if(document.form_map.ch_noping.checked) { ch_noping = true; } else { ch_noping = false; }
  if(document.form_map.ch_legend.checked) { ch_legend = true; } else { ch_legend = false; }
  if(document.form_map.ch_name.checked) { ch_name = true; } else { ch_name = false; }
  if(document.form_map.ch_ip.checked) { ch_ip = true; } else { ch_ip = false; }
  if(document.form_map.ch_status.checked) { ch_status = true; } else { ch_status = false; }
  if(document.form_map.ch_backbone.checked) { ch_backbone = true; } else { ch_backbone = false; }
  if(document.form_map.ch_client.checked) { ch_client = true; } else { ch_client = false; }
  if(document.form_map.ch_inp.checked) { ch_inp = true; } else { ch_inp = false; }
  deleteNames();
  clearMap();
  canvasInit(ann);
  }
   
if (navigator.appName=="Microsoft Internet Explorer") { function changeOpacity(opc) {
mapstats_update.style.filter = 'alpha(opacity=' + opc + ');'; var opcprc = opc / 100;
} else { var mapstats_update = document.getElementById("mapstats_update");
mapstats_update.style.setProperty("-moz-opacity",opcprc,null);  
mapstats_update.style.setProperty("opacity",opcprc,null);  
}  
}  
   
function changeUpdate() { if (is_ie) {
var promenna = new Date(); mapstats_update.style.filter = 'alpha(opacity=' + opc + ');';
var rok = promenna.getFullYear(); } else {
var mesic = "" + (promenna.getMonth() + 1); mapstats_update.style.setProperty("-moz-opacity",opcprc,null);
var den = "" + (promenna.getDate()); mapstats_update.style.setProperty("opacity",opcprc,null);
var hodin = "" + (promenna.getHours());  
var minut = "" + (promenna.getMinutes());  
var sekund = "" + (promenna.getSeconds());  
if(mesic.length==1) { mesic = "0" + mesic; }  
if(den.length==1) { den = "0" + den; }  
if(hodin.length==1) { hodin = "0" + hodin; }  
if(minut.length==1) { minut = "0" + minut; }  
if(sekund.length==1) { sekund = "0" + sekund; }  
var mapstats_update = document.getElementById("mapstats_update");  
mapstats_update.innerHTML = den + ". " + mesic + ". " + rok + " " + hodin + ":" + minut + ":" + sekund;  
} }
  }
   
function redrawUpdate() { function changeUpdate() {
setTimeout("changeOpacity(90)",100); var promenna = new Date();
setTimeout("changeOpacity(80)",200); var rok = promenna.getFullYear();
setTimeout("changeOpacity(70)",300); var mesic = "" + (promenna.getMonth() + 1);
setTimeout("changeOpacity(60)",400); var den = "" + (promenna.getDate());
setTimeout("changeOpacity(50)",500); var hodin = "" + (promenna.getHours());
setTimeout("changeOpacity(40)",600); var minut = "" + (promenna.getMinutes());
setTimeout("changeOpacity(30)",700); var sekund = "" + (promenna.getSeconds());
setTimeout("changeOpacity(20)",800); if(mesic.length==1) { mesic = "0" + mesic; }
setTimeout("changeOpacity(10)",900); if(den.length==1) { den = "0" + den; }
setTimeout("changeOpacity(0)",1000); if(hodin.length==1) { hodin = "0" + hodin; }
setTimeout("changeUpdate()",1050); if(minut.length==1) { minut = "0" + minut; }
setTimeout("changeOpacity(10)",1100); if(sekund.length==1) { sekund = "0" + sekund; }
setTimeout("changeOpacity(20)",1200); document.getElementById("mapstats_update").innerHTML = den + ". " + mesic + ". " + rok + " " + hodin + ":" + minut + ":" + sekund;
setTimeout("changeOpacity(30)",1300); }
setTimeout("changeOpacity(40)",1400);  
setTimeout("changeOpacity(50)",1500); function redrawUpdate() {
setTimeout("changeOpacity(60)",1600); setTimeout("changeOpacity(90)",100);
setTimeout("changeOpacity(70)",1700); setTimeout("changeOpacity(80)",200);
setTimeout("changeOpacity(80)",1800); setTimeout("changeOpacity(70)",300);
setTimeout("changeOpacity(90)",1900); setTimeout("changeOpacity(60)",400);
setTimeout("changeOpacity(100)",2000); setTimeout("changeOpacity(50)",500);
} setTimeout("changeOpacity(40)",600);
  setTimeout("changeOpacity(30)",700);
  setTimeout("changeOpacity(20)",800);
  setTimeout("changeOpacity(10)",900);
  setTimeout("changeOpacity(0)",1000);
  setTimeout("changeUpdate()",1050);
  setTimeout("changeOpacity(10)",1100);
  setTimeout("changeOpacity(20)",1200);
  setTimeout("changeOpacity(30)",1300);
  setTimeout("changeOpacity(40)",1400);
  setTimeout("changeOpacity(50)",1500);
  setTimeout("changeOpacity(60)",1600);
  setTimeout("changeOpacity(70)",1700);
  setTimeout("changeOpacity(80)",1800);
  setTimeout("changeOpacity(90)",1900);
  setTimeout("changeOpacity(100)",2000);
  }

Powered by WebSVN 2.2.1