var topNewsDelay;
var curTopNews = 0;
var cntTopNews = 0;
var topNewsPlay = 1;

function init_home(cnt){
	if(cnt != 0){
	  cntTopNews = cnt-1;
	  curTypeNews = cntTopNews;
	  topNewsDelay = setTimeout('nextTopNews()', 10000);
	  mvTopNews("r");
	}
}

function nextTopNews(){
	mvTopNews("r");
}

function toggleMvTopNews(){
	if(topNewsPlay == 1){
		document.getElementById("topNewsPause").src = "/images/arrowR.gif";
		topNewsPlay = 0;
		clearTimeout(topNewsDelay);
	}else{
		document.getElementById("topNewsPause").src = "/images/pause.gif";
		topNewsPlay = 1;
		mvTopNews("r");
	}
}

function mvTopNews(dir){
	clearTimeout(topNewsDelay);
	if(dir == "r"){
	  if(curTopNews >= cntTopNews){
	  	curTopNews = 0;  
	  }else{
		curTopNews++;  
	  }
	}else{
	  if(curTopNews <= 0){
	    curTopNews = cntTopNews;
	  }else{
		curTopNews--;  
	  }
	}
	var strHtml = document.getElementById("headlineBot" + curTopNews).innerHTML;
	document.getElementById("headlineNewzDiv").innerHTML = strHtml;
	topNewsDelay = setTimeout('nextTopNews()', 10000);
}