
var speed = .26;
var timer=0;
var letterSpeed = 200;
var img = new Image();
var nW='';
var path='';
function resizeInit(){
	clearTimeout(timer); //stop letters
	with(nW)if(closed||!E)return;
		else {
			l.innerHTML="Obrazek pobrany";
			focus();
		}
	timer=setTimeout(function() {
		nW.l.style.display='none';
		nW.b.style.backgroundImage="url('"+img.src+"')";
		timer = setInterval(resize,15);
	},700);
}
function resize(tH,tW,rs) {
	with(nW)if(closed||!E)return;
	with(img) {
		rs=width/height*speed;
		tH=height-(nW.innerHeight||nW.E.clientHeight||nW.b.clientHeight);
		tW=width-(nW.innerWidth||nW.E.clientWidth||nW.b.clientWidth);
	}
	if(!(tH=Math.abs(tH)>5?tH*rs:0)&&!(tW=Math.abs(tW)>5?tW*rs:0))timer=clearInterval(timer);
	nW.moveBy(-tW/2,-tH/2);
	nW.resizeBy(tW,tH);
}
img.onload = resizeInit
img.onerror = function(){
	nW.l.innerHTML="Nastapil blad przy pobieraniu obrazka";
	timer=clearTimeout(timer); //stop letters
}

function sprawdzCase(i,z){
	with(nW)if(closed||!E)return;
	with(nW.inf)nW.l.innerHTML=substring(0,i)+eval("z.to"+(/[a-z]/.test(z=charAt(i))?'Upper':'Lower')+'Case()')+substring(++i);
	timer = setTimeout('sprawdzCase('+(i>=nW.inf.length?0:i)+')',letterSpeed)
}
function windowOpen(l,n,w,h,ie){return window.open(l,n,'scrollbars=yes,height='+h+',width='+w+((ie=document.all)?',left=':',screenX=')+((screen.availWidth/2)-(w/2))+(ie?',top=':',screenY=')+((screen.availHeight/2)-(h/2))+',toolbar=no, menubar=no,location=no,scrollbars=no,personalbar=no,status=no,resizable=no');}
function showBiggerImg(o,w,h,d,E,b){
	d=document;E=d.documentElement;b=document.body;if(!E)return!0;
	timer=clearTimeout(timer);
	if(!window.opera&&nW) nW.close();
	with( (nW= windowOpen('','obrazek',w,h)).document ) {
		open();
		write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'+
			'<h'+'tml xmlns="http://www.w3.org/1999/xhtml">'+
			'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">'+
			'<title>Powiekszony obrazek</title>\n\n'+
			'<style type="text/css">body{margin:0;background:#FFFFFF no-repeat 2px 2px;}\n#loading{text-align:center;color:#113369;background:#FFFFFF;font:bold 14px Verdana;width:100%;}</style>'+
			'</head><b'+'ody><br />'+
			'<div id="loading">Trwa pobieranie obrazka prosze czekac</div>'+
			'</bo'+'dy></ht'+'ml>');
		close();
	}
	nW.d=nW.document;nW.E=nW.d.documentElement;nW.b=nW.d.body;
	nW.l=nW.d.getElementById('loading');
	nW.inf=nW.l.innerHTML;
	img.src=path+o;
	if(img.complete)setTimeout(resizeInit,500);
	sprawdzCase(0);
	return!1;
}
