var divtot; var fx = new Array();

function load_home(){
	divtot=document.getElementById('bg').getElementsByTagName('img').length-1;
	corrente = 0;
	vuoto = 0; 
	
	var whichImage = 0;
	//for (var i=0; i<=divtot; i++)
		//fx[i] = $('image-1_' + i).effects({duration: 1000, transition: Fx.Transitions.Quart.easeInOut});
		
	if (divtot > 0) {
		/*fd = $('image-1_' + whichImage).effects({duration: 1000, transition: Fx.Transitions.Quart.easeOut, 'display': 'none'});
		$('image-1_' + whichImage).style.display = "";
		fd.start({ 
		}).chain(function() {
		this.start.delay(1000, this, {'opacity' : 1});
		});*/
		
		//$('image-1_' + whichImage).style.display = "";
		$('image-1_' + whichImage).fx = $('image-1_' + whichImage).effect('opacity', {duration: 2000}).start(1);
		
	}
	
	x = whichImage;
	y = 0;
	
	if (divtot > 0)
		play_1 = setInterval('load_play()',8000); //QUI SETTARE IL TEMPO PER L'INTERVALLO

}


function load_play() {
	y = x+1;
		
	if (x > divtot) {
		x = 0;
		y = x+1;
	}
	if (y > divtot) {
		y = 0;
	} 
	
	/*fx = $('image-1_' + x).effects({duration: 1000, transition: Fx.Transitions.Quart.easeOut});
	fy = $('image-1_' + y).effects({duration: 1000, transition: Fx.Transitions.Quart.easeIn});
	
	fx.start({ 
	}).chain(function() {
	this.start.delay(1000, this, {'opacity' : 0});	
	});
	$('image-1_'+x).style.display = 'none';
	$('image-1_'+y).style.display = '';
	fy.start({ 
	}).chain(function() {
	this.start.delay(1000, this, {'opacity' : 1});
	});*/

	//$('image-1_'+x).style.display="none";
	//$('image-1_'+y).style.display="";	
	//if($('image-1_' + x).fx){$('image-1_' + x).fx.stop();}
    //if($('image-1_' + y).fx){$('image-1_' + y).fx.stop();}

	$('image-1_' + x).fx = $('image-1_' + x).effect('opacity', {duration: 3000}).start(0);
	//alert ("opacity : 0");
	//$('image-1_'+x).style.display="none";
	//$('image-1_'+y).style.display="";	
	$('image-1_' + y).fx = $('image-1_' + y).effect('opacity', {duration: 3000}).start(1);
	x++;
}

