// 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);
    }
}


ie = document.all ? true : false;

function writeFromTo(source, target){
  if(document.getElementById && !document.all && document.getElementById(source)){
   var src = document.getElementById(source);
   var tar = document.getElementById(target);
   var content = src.innerHTML;
   if(tar){
     tar.innerHTML = content;
   }
  }
  if(document.all && document.all[source]){
   var src = document.all[source];
   var tar = document.all[target];
   var content = src.innerHTML;
   if(tar){
     tar.innerHTML = content;
   }
  }
}

function pokaz(ile) {
	f = document.forms['formularz'];
	
	for(x = 2; x <= 4; x++) {
		if(x <= ile) {
			writeFromTo('sourceczlonekzespolu' + x, 'czlonekzespolu' + x);
		}
		else {
			// ukryj
			writeFromTo('clear', 'czlonekzespolu' + x);
		}
	}
}
function zoom_swf(nazwa,url,dlugosc,wysokosc) {

	var parametry='menubar=no,location=no,resizable=yes,scrollbars=no,status=no,width='+dlugosc+',height='+wysokosc;
	var w;
	w=window.open('','iden',parametry);
	w.document.title=nazwa;
	var zawartosc='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+dlugosc+'" height="'+wysokosc+'" id="glowna_belka312" align="middle">';
	zawartosc+='<param name="allowScriptAccess" value="sameDomain" />';
	zawartosc+='<param name="movie" value="'+url+'" />';
	zawartosc+='<param name="quality" value="high" />';
	zawartosc+='<param name="bgcolor" value="#ffffff" />';
	zawartosc+='<embed src="'+url+'" quality="high" bgcolor="#ffffff" width="'+dlugosc+'" height="'+wysokosc+'" name="glowna_belka312" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	zawartosc+='</object>';
	w.document.getElementsByTagName('body')[0].style.margin=0;
	w.document.getElementsByTagName('body')[0].style.padding=0;
	//w.document.getElementsByTagName('body')[0].innerHTML=zawartosc;
	w.document.write(zawartosc);

	return false;
}
