function openwnd(link_win)
{
  w=screen.width - 40;
	h=screen.height - 40;
	window.open(link_win,"_blank","toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,left=5,top=5,width="+w+",height="+h);
}

function OpenWndSize(link_win,w,h)
{
	window.open( link_win,"_blank","toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,left=5,top=5,width="+w+",height="+h );
}

// FUNZIONI PER VIDEO GALLERY

// CAMBIA FOTO
function CambiaFoto(foto, w, h, td, n, lft_arrow, rgt_arrow )
{
 vedi_attendere(); // stampa la scritta attendere fino a quando si carica la foto
 
 // assegno i valori alla foto grande
 document.getElementById('fotogrande').src= foto ;
 document.getElementById('fotogrande').width = w ;
 document.getElementById('fotogrande').height = h ;
 
 // trovo la cella della thumb corrispondente alla foto grande
 for( i=1; i<=n; i++ )
 {
 	idcella= 'td' + i;
	cella = document.getElementById( idcella );
 	cella.style.background = '';
 }
 // coloro la cella della thumb corrispondente alla foto grande
 cella = document.getElementById(td);
 cella.style.background = 'yellow';
 
 // freccia dx: nascondo se è l'ultima foto
 frecciadx = document.getElementById( "nextfoto" ); // trovo la freccia dx
 if( rgt_arrow==0 ) frecciadx.style.display = 'none'; // nacondo la freccia dx
 else  frecciadx.style.display = ''; // vedo la freccia dx
 // freccia sx: nascondo se è la prima foto
 frecciasx = document.getElementById( "prevfoto" ); // trovo la freccia dx
 if( lft_arrow==0 ) frecciasx.style.display = 'none'; // nacondo la freccia sx
 else  frecciasx.style.display = ''; // vedo la freccia sx
 
}

// trova il nome del file della foto attuale
function actfoto()
{
 fotoattuale = document.getElementById('fotogrande'); // foto visibile
 srcfoto = fotoattuale.src; // url foto visibile
 indiceslash = 1 + srcfoto.lastIndexOf("/"); // indice dell'ultima occorenza dello / nel'url
 return srcfoto.substring(indiceslash); // file foto attuale
}

// nasconde la scritta "Attendere caricamento foto in corso ... " e mostra la foto
function nascondi_attendere()
{
 att = document.getElementById( 'attendere' );
 foto = document.getElementById('fotogrande');
 att.style.display = 'none';
 foto.style.display = '';
}
// mostra la scritta "Attendere caricamento foto in corso ... " e nasconde la foto
function vedi_attendere()
{
 att = document.getElementById( 'attendere' );
 foto = document.getElementById( 'fotogrande' );
 att.style.display = '';
 foto.style.display = 'none';
}

// FINE FUNZIONI PER VIDEO GALLERY