<!--

/*variabile per controllare se è già stata aperta una finestra di pop*/
var popUpWin=0;

/*Funzione per aprire fineste di POP GENERICHE: 
chiude pop già aperte e centra la finestra.*/
function MM_openBrWindow(win_URL,win_Name,win_Width,win_Height,scorrimento) {
if(popUpWin)
  {
	if(!popUpWin.closed) popUpWin.close();
	}
win_Left = Math.floor((screen.width - win_Width)/2); 
win_Top = Math.floor((screen.height - win_Height)/2);
features="width="+win_Width+",height="+win_Height+",top="+win_Top+",left="+win_Left+",scrollbars="+scorrimento;
popUpWin=window.open(win_URL,win_Name,features);
popUpWin.focus();
}

/*Funzione per aprire IMMAGINI in finestre di pop: 
chiude pop già aperte, calcola le dimensioni dell'immagine (se è superiore alla larghezzo dello schermo attiva le barre di scorrimento) e centra la finestra.*/
function PrevFoto(img, desc) {
if(popUpWin)
  {
	if(!popUpWin.closed) popUpWin.close();
	}
  foto1= new Image();
  foto1.src=(unescape(img));
  Controlla(img, desc);
}
function Controlla(img, desc){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img, desc);
  }
  else{
    funzione="Controlla('"+img+"', '"+desc+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img, desc){
  largh=foto1.width;
  altez=foto1.height;
  barre="no";
  
  if (largh>screen.width) {
  barre="yes";
  largh=screen.width-10;
  altez=altez+16;
  winl=0;
  }
  else {
  winl = Math.floor((screen.width - largh)/2); 
  }
  
  if (altez>screen.height) {
	barre="yes";
	altez=screen.height-60;
	if (winl!=0) {
	largh=largh+16;}
	wint=0;
	}
	else {
	wint = Math.floor((screen.height - altez)/2);
	}  
	
	stringa="width="+largh+",height="+altez+",top="+wint+",left="+winl+",scrollbars="+barre;
	popUpWin=window.open("view-foto.asp?file="+img+"&titolo="+desc+"","pop",stringa);
	
	popUpWin.focus();
	}
//-->
