//	alert(document.getElementById("vsechno").offsetWidth+", "+document.getElementById("vsechno").clientWidth+", "+document.body.offsetWidth+", "+document.body.clientWidth);
//	alert(document.getElementById("vsechno").offsetHeight+", "+document.getElementById("vsechno").clientHeight+", "+document.body.offsetHeight+", "+document.body.clientHeight);

function resizeWindow(extra,maxh) {
	// extra: bit 0 - centrovat
	//        bit 1 - scrollbar
	// window.onkeypress=closeEsc;
	var vse=document.getElementById("vsechno");
	var foot=document.getElementById("footer");
	var Width, Height, inW, inH;
	inW = vse.offsetWidth+20;
	if (window.outerWidth) {
		Width = (window.outerWidth > window.innerWidth) ? window.outerWidth-window.innerWidth : 12;
		Width += inW;
		inH = vse.offsetHeight+foot.offsetHeight+10;
		Height = (window.outerHeight > window.innerHeight) ? window.outerHeight-window.innerHeight : 5+31+20;
		Height += inH;
//	 alert('All: '+Height+', vse: '+vse.offsetHeight+', top: '+foot.offsetTop+', foot: '+foot.offsetHeight+','+window.outerHeight+','+window.innerHeight);
	} else {
		Width = inW+12;
		inH = foot.offsetTop+foot.offsetHeight+10;
		Height = inH+5+31;
//	 alert('All: '+Height+', vse: '+vse.offsetHeight+', top: '+foot.offsetTop+', foot: '+foot.offsetHeight);
	}
	if ((extra >> 1) % 2) {
		Width+=18;
//		if (/Opera/.test(navigator.userAgent)) Width+=2;		
	}
	var max = window.screen.availHeight;
	if (maxh) {
		max = window.screen.availHeight >> 1;
		if (max < 500) max = 500;
		if (max > window.screen.availHeight) max = window.screen.availHeight;
	}
	if (Height > max-20) {inH += max-20-Height; Height=max-20;}
	// if (Height > window.screen.availHeight) { Height=window.screen.availHeight; Width+=16; }
	if (Width > window.screen.availWidth-20) {inW += window.screen.availWidth-20-Width; Width=window.screen.availWidth-20;}
//	if (extra % 2) centerWindow(Width, Height);
	window.resizeTo(Width, Height);
	if (!window.outerWidth) {
		inWr = document.documentElement.offsetWidth-4;
		inHr = document.documentElement.offsetHeight-4;
		if (inHr < inH || inWr < inW) {
			if (inHr < inH) inH -= inHr;
			else inH = 0;
			if (inWr < inW) inW -= inWr;
			else inW = 0;
			window.resizeBy(inW, inH);
		}
	}
//	if ((extra >> 1) % 2 == 0) window.scrollbars.visible=false;
}

function centerWindow(Width, Height) {
	window.moveTo((window.screen.availWidth-Width)>>1, (window.screen.availHeight-Height)>>1);
}

function mailVelikosti(ktery) {	// volano z predatdal
	var pdf = (ktery > 30);
	var size, txt2;
	if (pdf) size = pdfsize[ktery % 10 - 1];
	else     size = fotosize[ktery % 10 - 1];
	var ctrl = document.getElementById("velikost");
  var txt1 = (EnglisH) ? "Size of" : "Velikost";
	if (pdf) txt2 = (EnglisH) ? "document:" : "dokumentu:";
	else     txt2 = (EnglisH) ? "photos:" : "fotografií:";
	if (size) {
		ctrl.innerHTML = txt1+"<br />"+txt2+"<br /><strong>"+size+" KB</strong>";
		ctrl.style.visibility = "visible";
	} else {
		ctrl.innerHTML = txt2;
		ctrl.style.visibility = "hidden";
	}
}


