// JavaScript Document
<!--
// Nuovo oggetto che implementa l'animazione
function insegna(name,tag) {
  this.name = name;
  this.ID = document.getElementById(name);
  this.text = this.ID.innerHTML;
  this.ID.innerHTML = "<" + tag + ">&nbsp</" + tag + ">";
  this.count = 0;

  this.endR=255; 
  this.endG=255; 
  this.endB=255;
  this.r=204; 
  this.g=0; 
  this.b=0;
  this.speed = 3;
  this.fade = fade;
  
  this.scrivi = scrivi;
  setTimeout(this.name+".scrivi()", 2000);    
}

function scrivi() {
  if (this.count == 0)  {
     this.r=204; 
     this.g=0; 
     this.b=0;
     this.ID.style.color = "#"+convert[this.r]+convert[this.g]+convert[this.b];     
     this.ID.innerHTML = this.text.charAt(this.count);
  }
  else 
     this.ID.innerHTML = this.ID.innerHTML + this.text.charAt(this.count);
  this.count=this.count+1;
  if (this.count == this.text.length) {
     this.fade();
     this.count = 0;
  }
  else 
     setTimeout(this.name+".scrivi()", 150);    
}

function fade() {
  this.ID.style.color = "#"+convert[this.r]+convert[this.g]+convert[this.b];
  var col = this.r+this.speed;
  this.r = (col > this.endR) ? this.endR : col;
  col = this.g+this.speed;
  this.g = (col > this.endG) ? this.endG : col;
  col = this.b+this.speed;
  this.b = (col > this.endB) ? this.endB : col;
  if (this.r == this.endR && this.g == this.endG && this.b == this.endB) {
       this.ID.style.color = "#"+convert[this.r]+convert[this.g]+convert[this.b];
       setTimeout(this.name+".scrivi()",0);
  } else
       setTimeout(this.name+".fade()",0);   
}   

// Convertitore esadecimale
var convert = new Array(); 
var hexbase = new Array("0", "1", "2", "3", "4", "5", "6", "7", 
"8", "9", "A", "B", "C", "D", "E", "F");   
for (x=0, value=0; x<16; x++) { 
  for (y=0; y<16; y++) { 
    convert[value] = hexbase[x] + hexbase[y]; 
    value++; 
  } 
}

-->