// JavaScript Document

function foto(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
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){
  largh=foto1.width+20;
  altez=foto1.height+20;
  x = screen.width/2 - foto1.width/2
  y = screen.height/2 - foto1.height/2;
  stringa="width="+largh+",height="+altez +",left="+x+", top="+y;
  finestra=window.open(img,"",stringa);
  
}

