// JavaScript para tv //
var index = 1;
var menu_time = 6000; 
var anterior = 6;
var timer = setTimeout('trocaMsg()',menu_time); 
function trocaMsg() {
	index = index%6 +1;
	channel(index);
	tempo();
}          
function tempo() {
	clearTimeout(timer);
	timer = setTimeout("trocaMsg()",menu_time);
}  
function channel(id) {
	index = id;
	document.getElementById("tvn" + anterior).className= "transp";
	document.getElementById("tvn" + id).className = "opac";
	document.getElementById('tvshow').innerHTML=document.getElementById('tv' + id).innerHTML;
	anterior = id;
}
function tvch(id, out) {
	if (out == 1){
		clearTimeout(timer);
		channel(id);
	}
	else {
		tempo();
	}
}
//channel(1);

// JavaScript para tv 2//
var ind = 1;
var mt = 6000; 
var ant = 6;
var tmr = setTimeout('mudaMsg()',mt); 
function mudaMsg() {
	ind = ind%6 +1;
	canal(ind);
	temporal();
}          
function temporal() {
	clearTimeout(tmr);
	tmr = setTimeout("mudaMsg()",mt);
}  
function canal(id) {
	ind = id;
	document.getElementById("kdn" + ant).className= "transp";
	document.getElementById("kdn" + id).className = "opac";
	document.getElementById('kdshow').innerHTML=document.getElementById('kd' + id).innerHTML;
	ant = id;
}
function kdch(id, out) {
	if (out == 1){
		clearTimeout(tmr);
		canal(id);
	}
	else {
		temporal();
	}
}

// JavaScript para noticias//
var indice = 1;
var menu = 6000; 
var prev = 6;
var tiago = setTimeout('muda()',menu); 
function muda() {
	indice = indice%6 +1;
	noticia(indice);
	temp();
}          
function temp() {
	clearTimeout(tiago);
	tiago = setTimeout("muda()",menu);
}  
function noticia(id) {
	indice = id;
	document.getElementById("not" + prev).className= "transp";
	document.getElementById("not" + id).className = "opac";
	document.getElementById('show').innerHTML=document.getElementById('nt' + id).innerHTML;
	prev = id;
}
function carol(id, out) {
	if (out == 1){
		clearTimeout(tiago);
		noticia(id);
	}
	else {
		temp();
	}
}
