function exibeEvento(param,orientacao,pag)
{

    xmlFunc = new Array();
    xmlFunc['requestFile'] = 'eventos_exibe.php';
    xmlFunc['method'] = 'GET';
    //xmlFunc['execute'] = true;

    xmlFunc['onLoading'] = function ()
    {
    }

    xmlFunc['onError'] = whenError;
    xmlFunc['onFail'] = whenFail;

    xmlFunc['vars'] = {
        'cod' : Array(param, false)
        , 'orientacao' : Array(orientacao, false)
        , 'pag' : Array(pag, false)
    };

    xmlFunc['onCompletion'] = function ()
    {

        var listImgEvento = document . getElementById('listImgEvento');
        var paginacaoEventos = document . getElementById('paginacaoEventos');
        var abaEventoEsq = document . getElementById('abaEventoEsq');
        var abaEventoDir = document . getElementById('abaEventoDir');
        var listRodapeEvento = document . getElementById('listRodapeEvento');

		listImgEvento . innerHTML = "";
		paginacaoEventos . innerHTML = "";
		listRodapeEvento . innerHTML = "";

		if (XMLHttpClass . responseStatus[XMLHttpClass . qtdRequests]) {
            var string = XMLHttpClass . response[XMLHttpClass . qtdRequests];
        } else {
            var string = '<p>URLString Sent: ' + XMLHttpClass . URLString[XMLHttpClass . qtdRequests] + '</p>';
        }

		var arrayRes = string.split('*');

		if (typeof(arrayRes[0]) != "undefined") {
			listImgEvento . innerHTML = arrayRes[0];
		}
		else {
			listImgEvento . innerHTML = "Nenhum registro encontrado.";
		}
		
		if (typeof(arrayRes[1]) != "undefined") {
			listRodapeEvento . innerHTML = arrayRes[1] + arrayRes[2];
		}
		
		if (typeof(arrayRes[3]) != "undefined") {
			paginacaoEventos . innerHTML = arrayRes[3];
		}

		abaEventoEsq.onclick = function() { exibeEvento(param,'H',1); trocaTopo(this); };
		abaEventoDir.onclick = function() { exibeEvento(param,'V',1); trocaTopo(this); };
		
		//trocaTopo(abaEventoEsq);
		$(document).ready(function() {
			$(function() {
				$('a.lightbox').lightBox({fixedNavigation:true});
			});
		});

    }

    XMLHttpClass . requestHTTP(xmlFunc);
}

function trocaTopo(param) {

	if (typeof(param) != "undefined") {
		var divCont  = document.getElementById("topoAbasEvento")
		var elementos = divCont.getElementsByTagName("a")
		
		var numElementos = elementos.length
		
		for (var i=0; i<numElementos; i++) {
			elementos[i].className = 'inativo'
		}
		
		param.className = 'ativo'
	}
	else {
        var abaEventoEsq = document . getElementById('abaEventoEsq');
        var abaEventoDir = document . getElementById('abaEventoDir');
		
		abaEventoEsq.className = 'ativo'
		abaEventoDir.className = 'inativo'
		
	}

}

function trocaLinkLateral(param) {

	if (typeof(param) != "undefined") {
		var divCont  = document.getElementById("eventos")
		var elementos = divCont.getElementsByTagName("a")
		
		var numElementos = elementos.length
		
		for (var i=0; i<numElementos; i++) {
			elementos[i].className = ''
		}
		
		param.className = 'ativo'
	}

}
