﻿
function ResizePodleImg()
	{
	//pokud to neni otevřeno js tak nic
	if (! self.opener) return
	
	//objekt fotka
	var fotka = document.getElementById('fotka');
	
	//zjistíme rozměry obrázku a okraje okna
	if(document.all) {
		iw = fotka.width;	
		ih = fotka.height;
		dw = 50;
		dh = 70;
		}
	else {
		iw = fotka.width;	
		ih = fotka.height;
		dw = self.outerWidth - self.innerWidth;
		dh = self.outerHeight - self.innerHeight;
		}
		
	//spočtem nový rozměr okna
	w = iw + dw + 50;
	h = ih + dh + 100;
	
	//pokud by byl větší než obrazovka, zmenšíme ho
	if(w > screen.availWidth) { w = screen.availWidth; };
	if(h > screen.availHeight) { h = screen.availHeight; };
	
	//poloha okna
	l = (screen.availWidth - w)	/ 2;
	t = (screen.availHeight - h) / 2;
	
	//resiznem a posunem okno
	moveTo(l,t);
	resizeTo(w, h);
	self.focus();
	
}