// JavaScript para tv //
var index = 1;
var menu_time = 5000;
var anterior = 4;
var timer = setTimeout('trocaMsg()', menu_time);
function trocaMsg(){
    index = index % 5 + 1;
    channel(index);
    tempo();
}

function tempo(){
    clearTimeout(timer);
    timer = setTimeout("trocaMsg()", menu_time);
}

function channel(id){
    index = id;
    $K("tvn"+id).style.background = "#166d91";
    $K("tvn"+id).style.color = "#FFF";
    $K("tvn"+anterior).style.backgroundImage = "";
    $K("tvn"+anterior).style.color = "#166d91";

    $K('tvshow').innerHTML = document.getElementById('tv'+id).innerHTML;
    anterior = id;
}

function tvch(id, out){
    if (out == 1) {
        clearTimeout(timer);
        channel(id);
    }
    else {
        tempo();
    }
}