function stampa_testo(){
  testo=testo+frase.charAt(i);
  document.getElementById("intro_msg").innerHTML=testo;
  if (i<frase.length-1){
    i++;
    setTimeout(stampa_testo,80);
  }else{
    document.getElementById("enter").innerHTML="<a href='home.php' title='enter'>[entra]</a>";
    return;
  }
}

function animazione(){
  x=x+1;
  if (x==xmax){
    return;
  }
  if (y0>ymax){
    y=ymax;
  }else{
    y=(a*Math.pow(x-x0,2))+y0;
    if (x==xf){
      rimbalzi=rimbalzi+1;
      y0=rimbalzi*100;
      x0=Math.round(xf+Math.sqrt((ymax-y0)/a));
      xf=Math.round(x0+Math.sqrt((ymax-y0)/a));
    }
  }
  document.getElementById("pallone").style.left=Math.round(x)+"px";
  document.getElementById("pallone").style.top=Math.round(y)+"px"; 
  setTimeout(animazione,20);
}

function srotola_foto(){
  
  if (hfoto==hfotomax){
    return;
  }else{
    hfoto=hfoto+1;
  }
  document.getElementById("foto").style.height=Math.round(hfoto)+"px";
  setTimeout(srotola_foto,50);
}



function init(){
  w=window.innerWidth; 
  h=window.innerHeight;
  
  i=0;
  testo="";
  frase=" ...ogni anno un manipolo sgangherato di sagome affronta suo malgrado il duro cammino di un campionato di calcio... quale forza misteriosa li spinge nell'impresa? ... ";

  frameRate=25;
  rimbalzi=0;
  xmax=360;   
  ymax=350;
  x0=0; 
  y0=-125; 
  x=x0;
  y=y0;
  a=0.05; 
  xf=Math.round(x0+Math.sqrt((ymax-y0)/a));
  
  hfoto=0;hfotomax=208;

  stampa_testo();
  animazione();
  srotola_foto();
  
}


