// This script and many more are available free online at
// The JavaScript Source!! http://javascript.internet.com 
// Centralized window modification by Rodrigo Rodrigues - grymor@ibest.com.br

function CaricaFoto(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){
	w=foto1.width;
	h=foto1.height; 
	largh=foto1.width+20;
	altez=foto1.height+40;
 	l = (screen.width-largh)/2;
 	t = (screen.height-altez)/2;
	stringa="width="+largh+",height="+altez+",left="+l+",top="+t;
	finestra=window.open(img,"",stringa);
	finestra.document.open();
	finestra.document.write('<html><head><title>Esquadrimix</title></head>');
	finestra.document.write('<body bgcolor="#000000" onClick="self.close();" onBlur="self.close();">');
	finestra.document.write('<img style="border: 1px solid #018ad5;" src='+img+' width='+w+' height='+h+' border="0" alt="">');
	finestra.document.write('<br>');
	finestra.document.write('<div align="center"><a style="text-decoration: none; color: #ffffff; font-size: 11px; font-family: sans-serif" href="onclick=self.close();">[ Fechar a janela ]</a></div>');
	finestra.document.write('</body></html>');
	finestra.document.close();
	finestra.focus();
  
}
