$(document).ready(function(){
    $(".paginator").hide();
    $('#articlesPublished').find('a[class^="home_actu_line"]').each(function(){
       if($(this).html().length > 45){
           //alert($(this).html().substring(0,45));
           var shortLabel = $(this).html().substring(0,45);
           if(shortLabel.charAt(shortLabel.length-1) != ' '){
               for(var i=shortLabel.length;i>=0;--i){
                   if(shortLabel.charAt(i) == ''){
                       shortLabel = shortLabel.substring(0,i-1)+"...";
                       break;
                   }
               }
           }
           shortLabel = shortLabel+"...";
           $(this).html(shortLabel);
       }
    });
});

function fbs_click() {
    var u=location.href;
    var t=document.title;
    window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;
}

function loadArticleJs(){
    showAll($(".active_show_hide"));
}

function showAll(object){
    object.animate({width:'670px'},2000);
    object.find(".home_actu_line").animate({width:'650px'},2000,function(){
        $(this).children(".home_actu_chapo").css({width: '570px'});
        $(this).children(".home_actu_content").show();
        $(this).children(".small").hide();
        $(this).children(".full").show();
        $(".paginator").show();
    });
}

function hideAll(object){
    $(".paginator").hide();
    object.animate({width:'300px'},2000);
    object.find(".home_actu_line").animate({width:'280px'},2000,function(){
        $(this).children(".home_actu_chapo").css({width: '210px'});
        $(this).children(".home_actu_content").hide();
        $(this).children(".full").hide();
        $(this).children(".small").show();
    });
}
