function winPop2(img, x, y)
{
  foto1= new Image();
  foto1.src=(img);
  check(img);
}


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 + 7; //- mozi
  h = foto1.height + 7;
  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>Budinex</title><style>html,body{height:100%}body{margin:0px;padding:0;border:0;background-color:#849097;}.table{height:100%;width:100%} .ramka{border: solid 1px; border-color: #778288;  padding: 0px; margin:0px;}</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);
}

function otworz(url,name,w, h)
{
var l = screen.width / 2 - 640 / 2;
var t = screen.height / 2 - 480 / 2;
var Win = window.open(url,name,"toolbar=no,menubar=no, location=no, personalbar=no, status=no, resizable=yes, scrollbars=yes, copyhistory=no, width=640, height=480, left=" + l + ", top=" + t);
Win.resizeTo(w + 10, h + 30);
Win.moveTo(l, t);
}


