/*
Pro použití postačí vložit tento soubor takto:
<script language="javascript" type="text/javascript" src="foto.js"></script>

A k obrázku stačí přidat onClick:
<img onClick="img(this)" src="xxxxx_th.ttt" .... >
(může se přidat styl ruka, aby bylo jasné, že je aktivní)

funkce img() odstraní z názvu souboru "_th" a zobrazí ho v pop-up okně

*/
function img(image) 
{
	var a, src, t;
	a = image.attributes;
	src = a.getNamedItem("src").value;
	t = src.lastIndexOf("_th");
	src2 = src.substring(0,t) + src.substring(t+3);
	imgWin(src2);
}

function imgWin(pFileName, pTitle, pClose) 
{
  photoWin = window.open( "", "img_win", "width="+420+",height="+360+",screenX=20,screenY=40,left=20,top=40, status=no");
  photoWin.document.write('<html><head>');
//  photoWin.document.write('<title>Fotografie</title>');
  photoWin.document.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');
  photoWin.document.write('<meta http-equiv="pragma" content="no-cache" >');
  photoWin.document.write('<meta http-equiv="cache-control" content="no-cache, must-revalidate">');
  photoWin.document.write('<script language="JavaScript" type="text/javascript">');
  photoWin.document.write( "function resize_win(){ var ImgObj=document.getElementById(\'win_img\');  OrigW=ImgObj.width; OrigH=ImgObj.height; resizeTo(OrigW+28,OrigH+90);}");
  photoWin.document.write('</script>');

  photoWin.document.write('<style>');
  photoWin.document.write('body{background-color:#FFFFFF;}');
  photoWin.document.write('</style>');
  
  photoWin.document.write('</head>');
  photoWin.document.write('<body onload="resize_win()">');
  photoWin.document.write('<a href="javascript:self.close()" alt="zavřít">');
  photoWin.document.write('<img id="win_img" name="win_img" src="' + pFileName + '"  border="0" alt="' + pClose + '" />');
  photoWin.document.write('</a>');
  photoWin.document.write('</body></html>');
  photoWin.document.close();
  photoWin.focus();
}
