// PPP - 2005
// (c) artegence www.artegence.com

function popup(url, width, heigth)
{
  zoom('popup', url, width, heigth);
}

function zoom(title, url, width, height)
{
  
  this.w = screen.width;
  this.h = screen.height;
  
  if(this.w > width + 150)
  {
    this.width2 = width;
  }
  else
  {
    this.width2 = this.w - 150;
  }
  
  if(this.h > height + 150)
  {
    this.height2 = height;
  }
  else
  {
    this.height2 = this.h - 150;
  }
  
  this.scrleft = (this.w - this.width2) / 2;
  this.scrtop = (this.h - this.height2) / 2;
  
  
  
  //resizable=no,menubar=no,scrollbars=yes,status=no,width=540,height=400,left=' + scrleft + ',top=' + scrtop)
  
  if(title == 'popup') {
    var urlStrony = url;
  }
  else {
    var urlStrony = false;
  }
  
  win = window.open(urlStrony, '', 'resizable=no,menubar=no,scrollbars=auto,status=no,width='+ this.width2 +',height='+ this.height2 +',left=' + this.scrleft + ',top=' + this.scrtop);
  status = urlStrony;
  
  if(!urlStrony) {
    this.html = '<html>'+
    '<head>'+
    '<title>'+title+'</title>'+
    '</head>'+
    '<body margintop="0" marginleft="0" marginheight="0" marginwidth="0" style="margin: 0px" scroll="auto">'+
    '<a href="javascript:window.close()"><img width="'+width+'" height="'+height+'" src="'+url+'" border="0" alt="Kliknij aby zamkn±æ" /></a>'+
    '</body>'+
    '</html>';
    win.document.write(this.html);
    win.document.close();
  }
  
}

function dostosuj(t, w, h)
{
  if (t.width>w)
  { 
    t.width = w;
  }
  if(t.height>h)
  {
    t.height = h;
  }
}


function okno(url, name, width, height, scroll, resize,location) {
var str = "width="+width+",height="+height+""
if(scroll)
str += ",scrollbars=1";
else
str += ",scrollbars=0";

if(resize)
str += ",resizable=1";
else
str += ",resizable=0";

if(location)
str += ",location=1,toolbar=1,directories=1,status=1,menuBar=1";
else
str += ",location=0,toolbar=0,directories=0,status=0,menuBar=0";

if (window.screen){
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;
    var xc = (aw - width) / 2;
var yc = (ah - height) / 2;
xc = xc >= 0 ? xc : 0;
yc = yc >= 0 ? yc : 0;
    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }

newWindow = openWin( url, name,  str); 
if(newWindow.opener==null) newWindow.opener=self;
newWindow.focus();
}

function openWin( windowURL, windowName, windowFeatures ) { 
return window.open( windowURL, windowName, windowFeatures ) ; 
} 

function openerGo(url){
    var location = url;
    if(window.opener && !window.opener.closed){
      window.opener.location.href = location;
      self.close();
    } else {

      okno(location,'',800,600,1,1,1);
    }
}
