function PrevFoto(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+70;  
  OpenNewWindow(img,largh,altez)
  return false;
}
}
function OpenNewWindow(cPicture,width,hight)
  {
  NewWindow=window.open("","NewOne","width="+width+",height="+hight,"scrollbars=no","resizable=no");
  NewWindow.document.write ("<HTML><HEAD><TITLE>");
  NewWindow.document.write ("</TITLE></HEAD>");
  NewWindow.document.write ("<BODY BGCOLOR='white'>");
  NewWindow.document.write ("<p><img src=");
  NewWindow.document.write (cPicture);
  NewWindow.document.write ("></p>");
    NewWindow.document.write ("<center><FORM><INPUT TYPE='button' VALUE='Chiudi' onClick='self.close()'>");
  NewWindow.document.write ("</FORM></CENTER></BODY></HTML>");
  NewWindow.document.write ("</BODY></HTML>");
  NewWindow.document.close();
  return false;
}

