var idt = 0;
function koniec() {
  var id = document.getElementById('duze');
  id.style.display = 'none';
}

function ukryj() {
  clearTimeout(idt);
  idt = setTimeout(koniec, 300)
}

function duza(img, plik, pw, ph) {
  clearTimeout(idt);
  var oleft = otop = 0;
  sz = parseInt(img.style.width);
  wy = parseInt(img.style.height);
  do {
    oleft += img.offsetLeft;
    otop += img.offsetTop;
  } while (img = img.offsetParent);
  var x = oleft + sz/2;
  var y = otop  + wy/2;
  var id = document.getElementById('duze');
  id.style.width = pw+'px';
  id.style.height = ph+'px';
  id.style.left = x-(parseInt(id.style.width)/2)+'px';
  id.style.top = y-(parseInt(id.style.height)/2)-420+'px';
  if (parseInt(id.style.left)<0) id.style.left = '0px';
  if (parseInt(id.style.top)<0) id.style.top = '0px';
  id.innerHTML = "<img src='"+plik+"' style='width:"+pw+"px; height:"+ph+"px;' />";
  id.style.display = 'block';
}
