function xmlhttpLoadBusinessCenter(url){
if (window.XMLHttpRequest) {
	xmlhttp_business = new XMLHttpRequest();
} else if (window.ActiveXObject) {
	xmlhttp_business = new ActiveXObject("Microsoft.XMLHTTP")
}
if (xmlhttp_business ) {
        url = url + '/?rnd=' + Math.random();
	xmlhttp_business.onreadystatechange = xmlhttpChange_businessCenter;
	xmlhttp_business.open("GET", url, true);
	xmlhttp_business.send(null);
}
}
function xmlhttpChange_businessCenter() {
    if (xmlhttp_business.readyState==4) {
        if (xmlhttp_business.status==200) {
            document.getElementById('businesscenter').innerHTML=xmlhttp_business.responseText;
            rotacionaDivs(0,'');
        } else {
            document.getElementById('businesscenter').innerHTML="Não foi possível carregar os dados do Business Center.";
        }
    }
}

var ROTATE = '';
var PAUSE = false;
var INDEX = 0;
var LISTACZ = listaCZ;
var LENCZ = LISTACZ.length;

function AlternaDiv(antDivId, divId){
    // oculta div anterior e mostra div atual
    var antDiv = document.getElementById(antDivId);
    var div = document.getElementById(divId);
    antDiv.style.display = "none";
    div.style.display = "block";
}
 
function rotacionaDivs(i,tipo){
    // rotaciona os divs
    INDEX = i;
    if (tipo == 'prev'){
        if(INDEX < LENCZ-1){antIndice = INDEX+1;}
        else{antIndice = 0;}
    }
    else{
        if (INDEX == 0){antIndice = LENCZ-1;}
        else{antIndice = INDEX-1;}
    }
    AlternaDiv(LISTACZ[antIndice], LISTACZ[INDEX])
    if (INDEX < LENCZ-1){proxIndice = INDEX+1;}
    else{proxIndice = 0;}
    ROTATE = window.setTimeout('rotacionaDivs('+proxIndice+')',5000);
}

function pauseDivs(){
    if (PAUSE){
        PAUSE = false;
        if (INDEX < LENCZ-1){i = INDEX+1;}
        else{i = 0;}
        rotacionaDivs(i,'');
    }
    else{
        PAUSE = true;
        clearInterval(ROTATE);
    }
}
function previousDiv(){
    if (PAUSE){
        if (INDEX == 0){antIndice = LENCZ-1;}
        else{antIndice = INDEX-1;}
        AlternaDiv(LISTACZ[INDEX], LISTACZ[antIndice])
        INDEX = antIndice;
    }
    else{
        clearInterval(ROTATE);
        if (INDEX == 0){i = LENCZ-1;}
        else{i = INDEX-1;}
        rotacionaDivs(i,'prev');
    }
}
function nextDiv(){
    if (PAUSE){
        if (INDEX < LENCZ-1){proxIndice = INDEX+1;}
        else{proxIndice = 0;}
        AlternaDiv(LISTACZ[INDEX], LISTACZ[proxIndice])
        INDEX = proxIndice;
        
    }
    else{
        clearInterval(ROTATE);
        if (INDEX < LENCZ-1){i = INDEX+1;}
        else{i = 0;}
        rotacionaDivs(i,'');
    }
}