﻿function confronto(foto_m, foto_v, foto_c, jogo, local, data_hora) {
    this.foto_m = foto_m;
    this.foto_v = foto_v;
    this.foto_c = foto_c;
    this.jogo = jogo;
    this.local = local;
    this.data_hora = data_hora;
}

function mudarParaTab(id, prefix) {

    var alltabs = ["profissional", "sub20", "sub18", "sub15", "basquete", "futsal", "handebol", 
        "sub16", "hoquei", "futebolfeminino", "timeb", "sub14", "sub17", "sub13"];
    var pjs = [pj_profissional, pj_sub20, pj_sub18, pj_sub15, pj_basquete, pj_futsal, pj_handebol,
        pj_sub16, pj_hoquei, pj_futebolfeminino, pj_timeb, pj_sub14, pj_sub17, pj_sub13];
    var ujs = [uj_profissional, uj_sub20, uj_sub18, uj_sub15, uj_basquete, uj_futsal, uj_handebol,
        uj_sub16, uj_hoquei, uj_futebolfeminino, uj_timeb, uj_sub14, uj_sub17, uj_sub13];
    
    // Variável jid contém o índice do jogo no array pjs e ujs
    jid = -1;
    for (i = 0; i < alltabs.length; i++) {
        if (alltabs[i] == id) {
            jid = i;
            break;
        }
    }

    // Lendo o próximo e o último jogo
    var pj = pjs[jid];
    var uj = ujs[jid];

    // Coloca status das imagens selecionas para ON
    var tab = document.getElementById("tab_" + id);
    tab.style.backgroundImage = "url(/2009/Imagens/Confrontos/conf_" + id + "_on.png)";
    tab.style.cursor = "auto";
    
    // Atualiza conteúdo do próximo jogo e do último jogo
    document.getElementById(prefix + "uj_foto_mandante").style.backgroundImage = "url(" + uj.foto_m + ")";
    document.getElementById(prefix + "uj_foto_visitante").style.backgroundImage = "url(" + uj.foto_v + ")";
    document.getElementById(prefix + "uj_foto_campeonato").style.backgroundImage = "url(" + uj.foto_c + ")";
    document.getElementById(prefix + "uj_jogo").innerText = uj.jogo;
    document.getElementById(prefix + "uj_jogo").innerHTML = uj.jogo;
    document.getElementById(prefix + "uj_local").innerText = uj.local;
    document.getElementById(prefix + "uj_local").innerHTML = uj.local;
    document.getElementById(prefix + "uj_data_hora").innerText = uj.data_hora;
    document.getElementById(prefix + "uj_data_hora").innerHTML = uj.data_hora;
    document.getElementById(prefix + "pj_foto_mandante").style.backgroundImage = "url(" + pj.foto_m + ")";
    document.getElementById(prefix + "pj_foto_visitante").style.backgroundImage = "url(" + pj.foto_v + ")";
    document.getElementById(prefix + "pj_foto_campeonato").style.backgroundImage = "url(" + pj.foto_c + ")";
    document.getElementById(prefix + "pj_jogo").innerText = pj.jogo;
    document.getElementById(prefix + "pj_jogo").innerHTML = pj.jogo;
    document.getElementById(prefix + "pj_local").innerText = pj.local;
    document.getElementById(prefix + "pj_local").innerHTML = pj.local;
    document.getElementById(prefix + "pj_data_hora").innerText = pj.data_hora;
    document.getElementById(prefix + "pj_data_hora").innerHTML = pj.data_hora;
    
    // Coloca o status das imagens não=selecionadas para OFF
    for (i = 0; i < alltabs.length; i++) {
        if (alltabs[i] != id) {
            var outra_tab = document.getElementById("tab_" + alltabs[i]);
            if (outra_tab != null) {
                outra_tab.style.backgroundImage = "url(/2009/Imagens/Confrontos/conf_" + alltabs[i] + "_off.png)";
                outra_tab.style.cursor = "pointer";
            }
        }        
    }

}

function tabClick(id) {
    mudarParaTab(id, "");
}

function aspnet_tabClick(id) {
    mudarParaTab(id, "ctl00_template_conteudo_fec_confrontos_");
}
