/* homepage */

// costanti di pagina home
var max_index=3;
var current_index=0;
var testo="Testo";
var immagine="Immagine";

// array immagini
var Immagini = new Array();
Immagini[0]="images/home/home_0.jpg";
Immagini[1]="images/home/home_1.jpg";
Immagini[2]="images/home/home_2.jpg";

// array testo
var Testi=new Array();
Testi[0]='Mi trovo sulla torre che brilla<br>di tutti i pi&ugrave; grandi amori,<br>tutte le esperienze buone.<br>Da qui posso compiere<br>un volo sorprendente.<br>';
Testi[1]='Ho cambiato la mia mente:<br>sono libera.<br>I demoni se ne sono andati.<br>Il mio angelo &egrave; seduto qui,<br>nel mio luogo...<br>sta cercando di rompere<br>il silenzio delle anime.<br><br>Io mi vergogno perch&egrave;<br>non so dire parole<br>che possano rompere<br>questo silenzio.<br>';
Testi[2]='&Egrave; una notte di desideri,<br>dolorosa.<br>Voglio una deroga.<br>Desidero scoprire di<br>meritare una<br><br>buona destinazione.';


// funzione per impostare opacità immagine
function setOpacity(obj, opacity)
 {
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) 
{
  if (document.getElementById)
   {
    obj = document.getElementById(objId);
    if (opacity <= 100)
     {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 200);
     }//if
   }//if
}//[f]

function initControl(controlId)
 {
  control = document.getElementById(controlId);
  setOpacity(control, 0);
  control.style.visibility = 'visible';
  fadeIn(controlId,0);
}


function homepage()
{
  var index=(current_index % max_index)
  var cur_image=Immagini[index];
  var cur_testo=Testi[index];
  
  // immagine  
  document.getElementById(immagine).src=cur_image;
  initControl(immagine);
      
  // testo
  document.getElementById(testo).style.visibility='hidden';
  document.getElementById(testo).innerHTML=cur_testo;
  initControl(testo);
  
  // reload funziona
  current_index++;
  setTimeout("homepage()",10000);
}//[f]


/* fine homepage */
