function Foto(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+44;
  altez=foto1.height+24;
  extras="";
  if (altez>550)
  {
	  altez=550;extras=", scrollbars=yes";
  }
  stringa="width="+largh+",height="+altez+extras;
  finestra=window.open(img,"",stringa);
with(finestra.document) {
open();
write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title>Podgl±d obrazka</title><meta http-equiv="content-type" content="text/html; charset=utf-8"><link rel="stylesheet" href="pliki/styl.css" type="text/css"><style>body{margin:2px;}</style></head><body style="margin:10px;"  onselectstart="return false" ondragstart="return false" oncontextmenu="return false"><table width="100%" height="100%" ><tr><td align="center" height="100%"><img src="'+img+'"   onclick="window.close();"/></td></tr></table></body></html>');
close();
}
}
 		function CheckEMail(mail)
		{
		   if (Trim(mail) == '')
			  return false;

		   if (mail.indexOf('@') == -1)
			  return false;

		   if (mail.indexOf('.') == -1)
			  return false;

		   if (mail.length < 4)
			  return false;

		   if (mail.indexOf('@') != mail.lastIndexOf('@'))
			  return false;

		   return true;
		}
		function Trim(lancuch)
		{
		   if (lancuch=='')
			  return lancuch;
		   while (lancuch.charAt(0) == " ")
			  lancuch = lancuch.substring(1,lancuch.length);
		   while (lancuch.charAt(lancuch.length-1) == " ")
			  lancuch = lancuch.substring(0,lancuch.length-2);
		   return lancuch;
		}
   function openWindow(dest, param) {
    Win = window.open(dest,'NoweOkno',param); Win.focus();
   }

