// <![CDATA[

var x=0;
var y=0;
var divtot=0;
	
function wi(){
	
	corrente = 0;
	vuoto = 0; 
	
	while ( vuoto < 10 ) {
		
		if ( document.getElementById('img_gal_' + corrente) ) {
			divtot = divtot + 1;
			corrente = corrente + 1;
			vuoto = 0;
		} else {
			vuoto = vuoto + 1;
			corrente = corrente + 1;
		}
		
	}
	
	divtot = divtot - 1;
	
	var whichImage = 0;
	if (divtot > 0)
		$('img_gal_' + whichImage).appear({duration: 1.0});
		
	x = whichImage;
	y = 0;
	
	if (divtot > 0)
		play_1 = setInterval('Play_1()',4000); //QUI SETTARE IL TEMPO PER L'INTERVALLO

}

function Play_1() {
	
	y = x+1;
		
	if (x > divtot) {
		x = 0;
		y = x+1;
	}
	if (y > divtot) {
		y = 0;
	} else {
		x = x;
		y = x+1;
	}
	$('img_gal_'+x).fade({duration: 1.0});
	$('img_gal_'+y).appear({duration: 1.0});
	x++;
}
	
// ]]>
