// scrollovani vysledku

var delay = 45;
var delay2 = 3000;
var count = -1;
var text_index = 0;
var my_timeout;

function init_hotnews(){
  if(messages.length != null || messages.length != 0) {
		my_timeout = setTimeout("scroll_hotnews();", delay);
	}
}

function scroll_hotnews(){
  count = (count + 1) % (text.length + 1);
  var html = text.substr(0, count);
  if(elem = document.getElementById('scrollingtext')) {
   elem.innerHTML = html;
  }

  if(count == text.length) {
  	my_timeout = setTimeout("scroll_hotnews();", delay2);
    text_index = (text_index + 1) % messages.length;
    text = messages[text_index];
    count = 0;
  } 
  else {
  	my_timeout = setTimeout("scroll_hotnews();", delay);
  }
}



