jQuery(function(){
    var i = 1;
    jQuery('.fs-entry .fs-title').each(function(){
        jQuery(this).hide();
        jQuery(this).after('<div class="fs-number">' + i + '</div>');
        i++;
    });
    jQuery('#obra-1').show();
    jQuery('.obra-concluida-content').each(function(){
        if(jQuery(this).find('.gallery')[0]){
            jQuery(this).find('.obra-gallery').append(jQuery(this).find('.gallery'));
            jQuery(this).find('.lk-mais-fotos').show();
        }
    });

    jQuery('.projeto-txt').find('img').eq(0).appendTo(jQuery('.projeto-img'));
    jQuery('.projeto-txt').find('img').eq(0).remove();
    jQuery('.projeto-txt').find('br').eq(0).remove();
    
});

function obra(n){
    jQuery('.obras-andamento-wrapper ul li').removeClass('obra-ativa')
    jQuery('.obras-andamento-wrapper ul li').eq(n - 1).addClass('obra-ativa');
    jQuery('.obras-andamento-post-wrapper').hide();
    jQuery('#obra-' + n).show();
}

function obrasMais(obj){
    jQuery('.obra-content').slideUp();
    jQuery('.obra-concluida-img').animate( {width: '450px', height: '125px'} );
    jQuery('.obra-concluida-txt').animate( {width: '209px', height: '105px'} );
    jQuery('.obra-resumo').slideDown();
    jQuery(obj).parent().parent().prev().animate( {width: '150px'} );
    jQuery(obj).parent().parent().animate( {width: '508px'} );
    jQuery(obj).parent().slideUp(500, function(){
       jQuery(obj).parent().parent().css('height', 'auto');
       jQuery(obj).parent().parent().parent().css('height', 'auto');
       jQuery(obj).parent().next().find('.gallery').appendTo(jQuery(obj).parent().parent().find('.obra-gallery'));
       jQuery(obj).parent().next().slideDown(500);
    });
}

//function obrasMaisFotos(obj){
//    jQuery(obj).hide();
//    jQuery('.obra-content, .gallery').slideUp();
//    jQuery('.obra-concluida-img').animate( {width: '450px', height: '125px'} );
//    jQuery('.obra-concluida-txt').animate( {width: '209px'} );
//    jQuery('.obra-resumo').slideDown();
//    jQuery(obj).parent().parent().prev().animate( {width: '150px'} );
//    jQuery(obj).parent().parent().animate( {width: '508px'} );
//    jQuery(obj).parent().parent().parent().css('height', 'auto');
//    jQuery(obj).parent().parent().css('height', 'auto');
//    jQuery(obj).parent().prev().find('.gallery').appendTo(jQuery(obj).parent().next());
//    jQuery(obj).parent().next().slideDown();
//    jQuery('.gallery-icon').lightbox();
//}

function fecharObra(obj){
    jQuery(obj).parent().slideUp(500, function(){
        jQuery('.obra-content').slideUp();
        jQuery('.obra-concluida-txt').animate( {width: '209px', height: '105px'}, function(){
            jQuery('.obra-concluida-img').animate( {width: '450px', height: '125px'} );
        });
        jQuery('.obra-resumo').slideDown();
    });
}
