function troca_cor_frase(a_link) {
    if (a_link == 'a_dia') {
        document.getElementById('aba_dia').className = "aba-dicas-on";
        document.getElementById('aba_semana').className = "aba-reviews-off"
        document.getElementById('aba_mes').className = "aba-noticias-off";
        loadTop10Data('dia');
    }
    else if (a_link == 'a_semana') {
        document.getElementById('aba_dia').className = "aba-dicas-off";
        document.getElementById('aba_semana').className = "aba-reviews-on";
        document.getElementById('aba_mes').className = "aba-noticias-off";
        loadTop10Data('semana');
    }
    else if (a_link == 'a_mes') {
        document.getElementById('aba_dia').className = "aba-dicas-off";
        document.getElementById('aba_semana').className = "aba-reviews-off";
        document.getElementById('aba_mes').className = "aba-noticias-on";
        loadTop10Data('mes');
    }
}

function loadTop10Data(periodo) {
    if (periodo == 'dia') {
        url = '/html/top5/top10_pcworld_download_day.html';
    }
    else if (periodo == 'semana') {
        url = '/html/top5/top10_pcworld_download_week.html';
    }
    else if  (periodo == 'mes') {
        url = '/html/top5/top10_pcworld_download_month.html';
    }
    document.getElementById('carregando_top10').style.display = 'inline';
    if (window.XMLHttpRequest) {
        xmlhttp_top10 = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        xmlhttp_top10 = new ActiveXObject("Microsoft.XMLHTTP")
    } else {
        alert('Seu browser não suporta os recursos utilizados por este site.');
    }
    if (xmlhttp_top10) {
        url = url + '?rnd=' + Math.random();
        xmlhttp_top10.onreadystatechange = xmlhttpChange_top10;
        xmlhttp_top10.open("GET", url, true);
        xmlhttp_top10.send(null);
    }
}

function xmlhttpChange_top10() {
    if (xmlhttp_top10.readyState==4) {
        if (xmlhttp_top10.status==200) {
            document.getElementById('lista_top10').innerHTML=xmlhttp_top10.responseText;
        } else {
            document.getElementById('lista_top10').innerHTML="Não foi possível carregar os dados do Top 10.";
        }
        document.getElementById('carregando_top10').style.display = 'none';
    }
}