// JavaScript Document
var immagini=Array();
var tt=3000; //Tempo permanenza immmagini
var ttrans=1000; //Tempo transizione
var imm='img1';

function slideshowf13(ul, banner){	
	
	var altezzabanner = $(banner).getHeight();
	var larghezzabanner = $(banner).getWidth();
	var divimg1 = document.createElement("div");
		divimg1.setAttribute("id", "divimg1");
		/*divimg1.setAttribute("style", 'height: '+altezzabanner+'px; width: '+larghezzabanner+'px; z-index: 100;	overflow: hidden;');*/
		$(divimg1).setStyle({
						 	height: altezzabanner+'px',
							width: larghezzabanner+'px',
							zindex: 100,
							overflow: 'hidden',
							position: 'absolute'
						 });
	var divimg2 = document.createElement("div");
		$(divimg2).setAttribute("id", "divimg2");
		//divimg2.setAttribute("style", 'height: '+altezzabanner+'px; width: '+larghezzabanner+'px; z-index: 200; position: absolute; top: 0; left: 0;	overflow: hidden;');
		//divimg1.setAttribute("style", 'height: '+altezzabanner+'px; width: '+larghezzabanner+'px; z-index: 100;	overflow: hidden; position : fixed; top: 0px; left: 0px');
		$(divimg2).setStyle({
						 	height: altezzabanner+'px',
							width: larghezzabanner+'px',
							zindex: 200,
							position: 'absolute',
							overflow: 'hidden'
							
						 });
	var immagine1 = document.createElement("img");
		immagine1.setAttribute("id", "img1");
		//immagine1.setAttribute("style", "z-index:100;");
	var immagine2 = document.createElement("img");
		immagine2.setAttribute("id", "img2");
		//immagine2.setAttribute("style", "display: none;");
	//Banner
	divimg1.appendChild(immagine1);
	divimg2.appendChild(immagine2);
	$(banner).appendChild(divimg1);
	$(banner).appendChild(divimg2);
	new Effect.Opacity('divimg2', { from: 0, to: 0, duration: 0.1 })
	cambia_src('img1', 0);
	scorrislide(1);
}

function scorrislide(step){
	setTimeout('cambia_src(\'img2\', '+step+')', tt/2);
	/*setTimeout('$(\'divimg2\').setAttribute("style", "display: block;")', tt);*/
	setTimeout('Effect.Appear(\'divimg2\', { duration: '+ttrans/1000+' })', tt);
	/*setTimeout('new Effect.Opacity(\'divimg2\', { from: 0, to: 1, duration: '+ttrans/1000+' })', tt);*/
	imm=(imm=='img1') ? 'img2' : 'img1';
	step=(step==immagini.length-1) ? 0 : step+1;
	setTimeout('cambia_src(\'img1\', '+step+')', tt+tt/2);
	/*setTimeout('$(\'divimg2\').setAttribute("style", "display: none;")', 2*tt);*/
	setTimeout('Effect.Fade(\'divimg2\', { duration: '+ttrans/1000+' })', 2*tt);
	/*setTimeout('new Effect.Opacity(\'divimg2\', { from: 1, to: 0, duration: '+ttrans/1000+' })', 2*tt);*/
	step=(step==immagini.length-1) ? 0 : step+1;
	setTimeout('scorrislide('+step+')', 2*tt);
	$('divimg1').setStyle({
						 	height: $('fotos').getStyle('height'),
							width: $('fotos').getStyle('width')
						});
	$('divimg2').setStyle({
						 	height: $('fotos').getStyle('height'),
							width: $('fotos').getStyle('width')
						});
	
}
	
	
function cambia_src(imgdest, step){
	$(imgdest).src = immagini[step];
}
