pgatual = 'pagina1';

function loadContentsGalerias(url) {
    //var enc_url = encodeURIComponent(url);
    if (window.XMLHttpRequest) {
        xmlhttp_galerias_contents = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        try {
            xmlhttp_galerias_contents = new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch (e) {
            try {
                    xmlhttp_galerias_contents = new ActiveXObject('Microsoft.XMLHTTP');
            }
            catch (e) {
                document.getElementById('divgaleriasblocos').innerHTML="Não foi possível carregar os dados das paginações.";
            }
        }
    } else {
        alert('Seu browser não suporta os recursos utilizados por este site.');
    }
    if (xmlhttp_galerias_contents) {
        url = url + '/?rnd=' + Math.random();
        xmlhttp_galerias_contents.onreadystatechange = xmlhttpChange_galerias_contents;
        xmlhttp_galerias_contents.open("GET", url, true);
        xmlhttp_galerias_contents.send(null);
    }
}

function xmlhttpChange_galerias_contents() {
    if (xmlhttp_galerias_contents.readyState==4) {
        if (xmlhttp_galerias_contents.status==200) {
            html = xmlhttp_galerias_contents.responseText
            document.getElementById('contents-mais-slideshows').innerHTML=html;
            troca_pagina(pgatual);
        }
        else {
            document.getElementById('contents-mais-slideshows').innerHTML="Não foi possível carregar os dados das paginações.";
        }
    }
}

function loadPaginacaoGalerias(url) {
    //var enc_url = encodeURIComponent(url);
    if (window.XMLHttpRequest) {
        xmlhttp_galerias_blocos = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        try {
            xmlhttp_galerias_blocos = new ActiveXObject('Msxml2.XMLHTTP');
        }
        catch (e) {
            try {
                    xmlhttp_galerias_blocos = new ActiveXObject('Microsoft.XMLHTTP');
            }
            catch (e) {
                document.getElementById('divgaleriasblocos').innerHTML="Não foi possível carregar os dados das paginações.";
            }
        }
    } else {
        alert('Seu browser não suporta os recursos utilizados por este site.');
    }
    if (xmlhttp_galerias_blocos) {
        url = url + '/?rnd=' + Math.random();
        xmlhttp_galerias_blocos.onreadystatechange = xmlhttpChange_galerias_blocos;
        xmlhttp_galerias_blocos.open("GET", url, true);
        xmlhttp_galerias_blocos.send(null);
    }
}

function xmlhttpChange_galerias_blocos() {
    if (xmlhttp_galerias_blocos.readyState==4) {
        if (xmlhttp_galerias_blocos.status==200) {
            html = xmlhttp_galerias_blocos.responseText
            document.getElementById('paginacao').innerHTML=html;

        }
        else {
            document.getElementById('paginacao').innerHTML="Não foi possível carregar os dados das paginações.";
        }
    }
}

function troca_pagina(pgclick){
    var isIE = (navigator.appName=='Microsoft Internet Explorer');
    if (isIE){ var dummy = 'block';}
    else{var dummy = 'table';}

    document.getElementById(pgatual).style.display = 'none';
    document.getElementById(pgclick).style.display = dummy;
    pgatual = pgclick;
}