// JavaScript para tv //
var index = 1; 
var menu_time = 6000; 
var anterior = 6; 
var timer = setTimeout('trocaMsg()',menu_time); 

function trocaMsg() { 
// Numero de quadros 7//
index = index%7 +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-papeis //
var index_p = 1; 
var menu_time_p = 2800; 
var anterior_p = 6; 
var timer_p = setTimeout('trocaMsg_p()',menu_time_p); 

function trocaMsg_p() { 
  index_p = index_p%6 +1; 
  channel_p(index_p); 
  tempo_p(); 
}          
function tempo_p() { 
  clearTimeout(timer_p);	
  timer_p = setTimeout("trocaMsg_p()",menu_time_p);
}  
function channel_p(idx) { 
  index_p = idx; 
  document.getElementById("tvp" + anterior_p).className= "transp"; 
  document.getElementById("tvp" + idx).className = "opac"; 
  document.getElementById('paptv').innerHTML=document.getElementById('ptv' + idx).innerHTML;	
  anterior_p = idx;
}
function tvch_p(idx, out) {
	if (out == 1) { 
	  clearTimeout(timer_p);
	  channel_p(idx);
	} else { 
	  tempo_p();
	}
}
//channel_p(1);

//Função p/ n Aparecer erro de JS no navegador do Tiozinho
function semerro(){
  return true;
}
window.onerror=semerro;