    var cat_top5 = 'noticias';
function troca_cor_frase(a_link) {
    if (a_link == 'a_day') {
        document.getElementById('a_day').className = "gdsmover";
        document.getElementById('a_week').className = "gdsmlink"
        document.getElementById('a_month').className = "gdsmlink";
    }
    else if (a_link == 'a_week') {
        document.getElementById('a_week').className = "gdsmover";
        document.getElementById('a_day').className = "gdsmlink";
        document.getElementById('a_month').className = "gdsmlink";
    }
    else if (a_link == 'a_month') {
        document.getElementById('a_month').className = "gdsmover";
        document.getElementById('a_day').className = "gdsmlink";
        document.getElementById('a_week').className = "gdsmlink";
    }
    if (a_link == 'a_downs') {
        cat_top5 = 'downloads';
        document.getElementById('a_downs').className = "titdownover";
        document.getElementById('a_dicas').className = "titdicas";
        document.getElementById('a_reviews').className = "titrev";
        loadTop5Data('dia');
        troca_cor_frase('a_day');
    }
    else if (a_link == 'a_dicas') {
        cat_top5 = 'dicas';
        document.getElementById('a_downs').className = "titdown";
        document.getElementById('a_dicas').className = "titdicasover";
        document.getElementById('a_reviews').className = "titrev";
        loadTop5Data('dia');
        troca_cor_frase('a_day');
    }
    else if (a_link == 'a_reviews') {
        cat_top5 = 'reviews';
        document.getElementById('a_downs').className = "titdown";
        document.getElementById('a_dicas').className = "titdicas";
        document.getElementById('a_reviews').className = "titrevover";
        loadTop5Data('dia');
        troca_cor_frase('a_day');
    }

}

function loadTop5Data(periodo) {
    if (periodo == 'dia') {
        if (cat_top5 == 'dicas') {
            url = '/html/top5/top5_pcworld_dicas_day.html';
        }
        else if (cat_top5 == 'noticias') {
            url = '/html/top5/top5_pcworld_review_day.html';
        }
        else if (cat_top5 == 'downloads') {
            url = '/html/top5/top5_pcworld_download_day.html';
        }
        else if (cat_top5 == 'reportagens') {
            url= '/html/top5/top5_pcworld_dicas_day.html';
        }
        else if (cat_top5 == 'reviews') {
            url= '/html/top5/top5_pcworld_review_day.html';
        }
        else{
            url = '/html/top5/top5_pcworld_download_day.html';
        }
    }
    else if (periodo == 'semana') {
        if (cat_top5 == 'dicas') {
            url = '/html/top5/top5_pcworld_dicas_week.html';
        }
        else if (cat_top5 == 'noticias') {
            url = '/html/top5/top5_pcworld_review_week.html';
        }
        else if (cat_top5 == 'downloads') {
            url = '/html/top5/top5_pcworld_download_week.html';
        }
        else if (cat_top5 == 'reportagens') {
            url= '/html/top5/top5_pcworld_dicas_week.html';
        }
        else if (cat_top5 == 'reviews') {
            url= '/html/top5/top5_pcworld_review_week.html';
        }
        else{
            url = '/html/top5/top5_pcworld_download_week.html';
        }
    }
    else if  (periodo == 'mes') {
        if (cat_top5 == 'dicas') {
            url = '/html/top5/top5_pcworld_dicas_month.html';
        }
        else if (cat_top5 == 'noticias') {
            url = '/html/top5/top5_pcworld_review_month.html';
        }
        else if (cat_top5 == 'downloads') {
            url = '/html/top5/top5_pcworld_download_month.html';
        }
        else if (cat_top5 == 'reportagens') {
            url= '/html/top5/top5_pcworld_dicas_month.html';
        }
        else if (cat_top5 == 'reviews') {
            url= '/html/top5/top5_pcworld_review_month.html';
        }
        else{
            url = '/html/top5/top5_pcworld_download_month.html';
        }
    }
    document.getElementById('carregando_top5').style.display = 'inline';
    if (window.XMLHttpRequest) {
        xmlhttp_top5 = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        xmlhttp_top5 = new ActiveXObject("Microsoft.XMLHTTP")
    } else {
        alert('Seu browser não suporta os recursos utilizados por este site.');
    }
    if (xmlhttp_top5) {
        url = url + '?rnd=' + Math.random();
        xmlhttp_top5.onreadystatechange = xmlhttpChange_top5;
        xmlhttp_top5.open("GET", url, true);
        xmlhttp_top5.send(null);
    }
}

function xmlhttpChange_top5() {
    if (xmlhttp_top5.readyState==4) {
        if (xmlhttp_top5.status==200) {
            document.getElementById('lista_top5').innerHTML=xmlhttp_top5.responseText;
        } else {
            document.getElementById('lista_top5').innerHTML="Não foi possível carregar os dados do Top 5.";
        }
        document.getElementById('carregando_top5').style.display = 'none';
    }
}