$(document).ready(function() {

    // Rollover du logo
    $("img#logo").hover(function(){
        var logo_on = $(this).attr("src").replace(/.png$/gi, "-over.png");
        $(this).attr("src", logo_on);
    },function(){
        var logo_off = $(this).attr("src").replace(/-over.png$/gi, ".png");
        $(this).attr("src", logo_off);
    });

    // Changement des champs au focus
    $('input[type="text"],textarea').focus(function() {  
        $(this).addClass("focus");  
    });  
    $('input[type="text"],textarea').blur(function() {  
        $(this).removeClass("focus");  
    });  

    // Correction du bouton atReply
    $('span.commentAuthor').parent().find("a[href='#'] img").parent().each(function()
    { 
        $(this).addClass("replybutton");
    });

    // Animation de la confirmation du post de commentaires
    window.setTimeout(function() { $("p#pr.message").slideUp("slow"); }, 7000);

    // Citation aléatoire
    jQuery.get("/tools/cite.php", function(data) {
        $("#citation").html(data.replace(/\n/g, '<br/>'))
                      .css("opacity", 0)
                      .css("display", "block")
                      .fadeTo(1000, 0.5);
    });
    //$("#citation").load("/tools/cite.php");

    // Flattr
    var s = document.createElement('script'), t = document.getElementsByTagName('script')[0];
    s.type = 'text/javascript';
    s.async = true;
    s.src = 'http://api.flattr.com/js/0.5.0/load.js?mode=auto';
    t.parentNode.insertBefore(s, t);

});


