$(document).ready(function(){
	
	/* Oscar Arzola */
	$('.B_homeCrumb').next().remove();
	$('.B_last_arrow').prev().remove();
	
	var isAlone = $('.B_last_arrow').prev().attr('class');
	
	if( isAlone == 'B_firstCrumb' ) {
		$('.B_firstCrumb').next().removeClass('B_last_arrow').addClass('B_last_arrow_bl');
		$('.B_last_arrow_bl div').remove();
	}
	
	$('#MinisteriosPublicos ul li a').click(function(e){
        
		$('#spinner').show();
		$('#showMps').hide('slow');
		e.preventDefault();
		var id = $(this).attr('id').split('_');
		var params = {};
		params['idDoc'] = id[1];
        
		$.ajax({
            url: 'index.php?id=362',
            dataType: 'text',
            data: params,
            success: function(response){
                $('#showMps').show('slow');
                $('#spinner').hide();
                $('#showMps').empty().append(response);
                $(".iframe").colorbox({width:"50%", height:"70%", iframe:true});
            }
		});
        
	});
    
	$('#List ul li a').click(function(e){
        
        e.preventDefault();
        var id = $(this).attr('id').split('_');
        var params = {};
        params['idDoc'] = id[1];
        
        $.ajax({
            url: 'index.php?id=362',
            dataType: 'text',
            data: params,
            success: function(response){
                $(".iframe").colorbox({width:"50%", height:"70%", iframe:true});
            }
        });
        
	});
	
	$(".pdfview").colorbox({width:"670px", height:"550px", iframe:true});
	
	$('.thumbx a').click(function(e){
        
		$('#responseGals').empty();
		e.preventDefault();
		var id = $(this).attr('id').split('_');
		var params = {};
		params['idDoc'] = id[1];
        
		$.ajax({
            url: 'index.php?id=512',
            dataType: 'text',
            data: params,
            success: function(response){
                $('#responseGals').html(response);
                $("a[rel='lightbox[maxigallery]']").colorbox();
                $(".thumbs li:first-child a").click();
            }
		});
        
	});
    
	$(".youtube").colorbox({iframe:true, width:650, height:550});
    
	var cuantasGalerias = $('.galeria-concurso ul li').length;
	var nuevoAnchoUlGaleria = cuantasGalerias*162;
	
	$('.galeria-concurso ul').css('width',nuevoAnchoUlGaleria);
    
	$('.galeria-concurso').serialScroll({
        items:'li',
        prev:'#contenido a.prev',
        next:'#contenido a.next',
        start:0, //as we are centering it, start at the 2nd
        duration:500,
        force:true,
        stop:true,
        lock:false,
        cycle:false, //don't pull back once you reach the end
        jump: true //click on the images to scroll to them
	});
    
	$("#denuncia").click(function(e){
	    e.preventDefault();
	    $(this).next().click();
	});
	
});