$(document).ready(function(){

    $(".containerDisco, .descricaoEspetaculo").hide();
    
	$('.expandir').click(function(){
	   var click = $(this);
	   $('.expandir').each(function(){
	       if($(this) != click)
           {
            $(this).removeClass('ativo');
           }
	   });
	   $(this).toggleClass('ativo');
	   $('.expandir:not(.ativo)').next().slideUp("slow");
       $(this).next().slideToggle("slow");
	});
    
    $(".inativo").attr('href','javascript:void(0);');
    
    var numPag = 1;
    
    $('a.prox').click(function(){
        numPag++; 
        carregarImagens();       
    });
    
    $('a.ant').click(function(){
        if(numPag > 1)
        {
            numPag--; 
            carregarImagens();    
        }    
    });
     
    function carregarImagens()
    {
        $.ajax({
           type: "POST",
           url: "carregarImagens.php",
           data: "p=" + (numPag-1),
           success: function(msg){
             if(msg != "")
             {
                $('ul.listaFotos').html(msg);
                $(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'light_rounded'});
             } 
             else
             {
                numPag--;
             }
           }
         });
    }
	
});