var delay = 95;
var delay2 = 8000;
var count = -1;
var text_index = 0;
var href = '';
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(html.charAt(count-1)=='<'){
					  var i=count;
						  while(html.charAt(count-1)!='>'){
								          count = (count + 1) % (text.length + 1);
													          html = text.substr(0, count);

							}

				}
				  if(elem = document.getElementById('hotnews')) {
						    if (href != '') {
									      if (count == text.length) {
													        elem.innerHTML = "<a href='"+href+"'>"+html+"&nbsp;&ndash;&nbsp;<span class='vice'>v�ce</span></a>";
																	      }
												      else {
																        elem.innerHTML = "<a href='"+href+"'>"+html+"</a>";
																				      }
															    }
								    else {elem.innerHTML = html;}
										  }

					  if(count == text.length) {
							    my_timeout = setTimeout("scroll_hotnews();", delay2);
									    text_index = (text_index + 1) % messages.length;
											    text = messages[text_index];
													    if (hrefs[text_index] != null) {href = hrefs[text_index];} else {href = '';}
															    count = 0;
																	  }
						  else {
								    my_timeout = setTimeout("scroll_hotnews();", delay);
										  }
}


