// zobrazi obrazok url, s nazvom a popisom a rozmerom width a height v samostatnom okne
// prizposobi velkost okna (a obrazku) rozliseniu uzivatela
function ShowImage(url, nazov, popis, width, height) {
	width=parseInt(width);
	height=parseInt(height);
	// prisposob velkost
	maxWidth=screen.width-40;
	maxHeight=screen.height-100;
	if (width > maxWidth || height > maxHeight) {
		if 	(width/maxWidth > height/maxHeight) {	// sirka je viac vacsia ako vyska
			height=parseInt(maxWidth * height/width);
			width=maxWidth;
		} else {	// height > maxHeight			// vyska je viac vacsia ako sirka
			width=parseInt(maxHeight * width/height);
			height=maxHeight;
		}
	}
	
	win=window.open(url, 'preview','width=' + (width+20) + ',height=' + (height+80) + ',resizable=yes,scrollbars=yes');
	win.document.write('<html>\n');
	win.document.write('<head>\n');
	win.document.write('<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">');
	win.document.write('<title>' + nazov + '</title>\n');
	win.document.write('<link href="/skalica.css" rel="stylesheet" type="text/css">\n');
	win.document.write('</head>\n\n');
	
	win.document.write('<body style="background-image:none;">\n');
	win.document.write('<h1>' + nazov + '</h1>\n');
	win.document.write('<div align="center">\n<a href="#" onclick="window.close();">\n');
	win.document.write('<img src="' + url + '" width="' + width + '" height="' + height + '" alt="' + nazov + '" title="Zatvoriť okno">\n');
	win.document.write('</a></div>\n');
	win.document.write('<p class="text">' + popis + '</p>\n');
	win.document.write('</body>\n');
	win.document.write('</html>\n');
	win.document.close();
}
