var a_testa=new Array();var maxImg=0;var curImg;var next=0;var num="";var animazione;function setSlideShow(){a_testa=document.getElementById('divTesta').getElementsByTagName('IMG');curImg=a_testa[0];maxImg=a_testa.length;animazione=setInterval(slideShow,5000);}
function slideShow(){num=curImg.id.split('_')[1];next=0;if(num==(maxImg-1)){next=0;}else{next=parseInt(num,10)+1;}
document.getElementById('imgTesta_'+next).style.display='block';clearInterval(animazione);fading(curImg.id);}
function fading(id){var img=document.getElementById(id);var opacity=1;var opacityIE=100;img.dissolvenza=window.setInterval(function(){img.style.opacity=opacity-(1/10);img.style.filter='alpha(opacity='+opacityIE-10+')';opacity=opacity-(1/10);if(opacity<=0){window.clearInterval(img.dissolvenza);endSlideShow();}}
,60)}
function endSlideShow(){document.getElementById('imgTesta_'+next).style.zIndex=20;document.getElementById('imgTesta_'+num).style.zIndex=18;document.getElementById('imgTesta_'+num).style.display='none';document.getElementById('imgTesta_'+num).style.opacity=1;document.getElementById('imgTesta_'+num).style.filter='alpha(opacity=100)';changeDesc();curImg=document.getElementById('imgTesta_'+next);animazione=setInterval(slideShow,5000);}
function changeDesc(){document.getElementById('divImgT_'+num).style.backgroundImage='';document.getElementById('divImgT_'+next).style.backgroundImage="url('images/back_open_h.jpg')";document.getElementById('divText_'+num).style.display='none';document.getElementById('divText_'+next).style.display='block';}
