var akce_fontSpace = 10; //pt
var akce = null;

function akce_getDelay(text)
{
 return Math.min(20000, Math.max(4000, Math.round(20000 * Math.sin(Math.PI * text.length / 300))));
}

function akce_next(nyni, posuv)
{ 
 var obj = document.getElementById("seznam");
 posuv++;

 if (posuv == akce_fontSpace)
 {
  obj.innerHTML = akce[nyni];
  obj.style.bottom = "-1px";
  nyni++;
  if (nyni >= akce.length)
   nyni = 0;
  obj.innerHTML += "<br />" + akce[nyni];
  setTimeout("akce_next(" + nyni + ", 0)", akce_getDelay(akce[nyni]));
 }
 else
 {
  obj.style.bottom = posuv + "pt";
  setTimeout("akce_next(" + nyni + "," + posuv + ")", 40);
 }
}

function akce_init(akceList)
{
 var obj = document.getElementById("seznam");
 if (obj && akceList.length)
 {
  obj.style.bottom = "-1px";
  obj.innerHTML = akceList[0];
  if (akceList.length > 1)
  {
   akce = akceList;
   obj.innerHTML += "<br />" + akce[1];
   setTimeout("akce_next(1, 0)", akce_getDelay(akce[1]));
  }
 }
}
