$(function(){
    setIndexes();
    setTimeout(
        'animate(0,' + $('#partneri p').length + ')'
        ,2000
    );
});

function setIndexes(){
    count = $('#partneri p').length;
    $('#partneri p').each(function(){
        $(this).css("z-index",count--);
    });
}

function animate(index,count){
    if(index + 1 == count){
        $('#partneri p:eq(0)').css("z-index",0).show();
        $('#partneri p:eq(' + (index) + ')').hide(1000,function(){
            $('#partneri p:eq(0)').css("z-index",count);
            setTimeout(
                'animate(0,' + count + ')'
                ,2000
            );
        });
    } else {
        $('#partneri p:eq(' + (index + 1) + ')').show();
        $('#partneri p:eq(' + (index) + ')').hide(1000,function(){
            setTimeout(
                'animate(' + (index + 1) + ',' + count + ')'
                ,2000
            );
        });
    }
}
