function winPop(img){
  foto1= new Image();
  foto1.src=(img);
  check(img);
}
function check(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    func="check('"+img+"')";
    interval=setTimeout(func,20);
  }
}
function viewFoto(img)
{
  w = foto1.width +0; //- mozi
  h = foto1.height + 0;
  var l = screen.width / 2 - w / 2;
  var t = screen.height / 2 - h / 2;

  string="width="+w+",height="+h+",left="+l+",top="+t;
  //result=window.open(img,"",string);


  string="width="+w+",height="+h;+",toolbar=no,menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=no, copyhistory=no, left=" + l + ", top=" + t;
  handle=window.open(img,"",string);
  handle.document.write("<html><head><title></title><style>html,body{margin:0px;padding:0;border:0;</style></head>");
  handle.document.write('<body><table cellpadding=0 cellspacing=0 border=0 class="table"><tr><td align=center><a href="javascript:self.close();" title="zamknij okno"><img src='+img+' class="ramka"></a></td></tr></table></body></html>');
  handle.moveTo(l, t);
}
