var baseUrl = 'http://pcworld.uol.com.br';
function loadMacroMais(sec){
    if (sec == 'dicas'){url = baseUrl + '/dicas/box_itens_recentes/';
                        urltop = '/html/top5/top5_pcworld_dicas_day.html';}
    if (sec == 'noticias'){url= baseUrl + '/noticias/box_itens_recentes/';
                           urltop = '/html/top5/top5_pcworld_noticias_day.html';}
    if (sec == 'games'){url= baseUrl + '/games/box_itens_recentes/';
                        urltop = '/html/top5/top5_pcworld_games_day.html';}
    if (sec == 'apple'){url= baseUrl + '/mac/box_itens_recentes/';
                        urltop = '/html/top5/top5_pcworld_apple_day.html';}
    if (sec == 'reviews'){url= baseUrl + '/reviews/box_itens_recentes/';
                          urltop = '/html/top5/top5_pcworld_review_day.html';}

    if (window.XMLHttpRequest) {
        xmlhttp_macromais = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        xmlhttp_macromais = new ActiveXObject("Microsoft.XMLHTTP")
    } else {
        alert('Seu browser não suporta os recursos utilizados por este site.');
    }
    if (window.XMLHttpRequest) {
        xmlhttp_macrotop = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        xmlhttp_macrotop = new ActiveXObject("Microsoft.XMLHTTP")
    } else {
        alert('Seu browser não suporta os recursos utilizados por este site.');
    }
    if (xmlhttp_macromais) {
        url = url + '?rnd=' + Math.random();
        xmlhttp_macromais.onreadystatechange = xmlhttpChange_recentes;
        xmlhttp_macromais.open("GET", url, true);
        xmlhttp_macromais.send(null);}
    if (xmlhttp_macrotop) {
        urltop = urltop + '?rnd=' + Math.random();
        xmlhttp_macrotop.onreadystatechange = xmlhttpChange_top5;
        xmlhttp_macrotop.open("GET", urltop, true);
        xmlhttp_macrotop.send(null);}
}
function xmlhttpChange_top5() {
    if (xmlhttp_macrotop.readyState==4) {
        if (xmlhttp_macrotop.status==200) {
            document.getElementById('lista_top5').innerHTML=xmlhttp_macrotop.responseText;
        } else {
            document.getElementById('lista_top5').innerHTML="Não foi possível carregar os dados do Top 5.";
        }
    }
}
function xmlhttpChange_recentes() {
    if (xmlhttp_macromais.readyState==4) {
        if (xmlhttp_macromais.status==200) {
            document.getElementById('lista_recentes').innerHTML=xmlhttp_macromais.responseText;
        } else {
            document.getElementById('lista_recentes').innerHTML="Não foi possível carregar os itens recentes.";
        }
    }
}