$(document).ready(function(){

  $('#content').infinitescroll({
    debug           : false,
    nextSelector    : "div.navigation a:first",
    loadingImg      : "http://blog.titussimoens.be/wp-content/plugins/infinite-scroll/ajax-loader.gif",
    loadingText     : "<em>Hang on, loading the next post…</em>",
    donetext        : "<em>That's it folks, I'm out of posts.</em>",
    navSelector     : "div.navigation",
    contentSelector : "#content",
    itemSelector    : "#content  .post"
    },function(){ 
hovers(); 
    });
  
  hovers();
  $("#biography_wrapper").hide();
  $("#about_me, .footer .close a").attr("href","javascript:;");
  $("#about_me, .footer .close a").click(function(){
    if(!$("#about_me").hasClass("opened")){
      $("body").prepend($("#biography_wrapper"));
      $("#biography_wrapper").slideDown('slow',function(){
        $("#about_me").addClass("opened");
      });
    }else{
      $("#biography_wrapper").slideUp('slow',function(){
        $("#about_me").removeClass("opened");
      });
    }
    
  });
  
  if($("#comments .comment").length>0){
    var c_height = 0;
    $("#comments .comment").each(function(){
      if($(this).height()>c_height){
        c_height = $(this).height();
      }
    });
    $("#comments .comment").css("height",c_height+"px");
  }
});

function hovers(){
  $(".footer li, #about_me, .social_icons li").each(function(){
    if(!$(this).hasClass("hover-enabled")){
      $(this).css("opacity",0.6);
      $(this).hover(
        function(){
          if(!$(this).hasClass("hovered")){
            $(this).addClass("hovered");
            $(this).fadeTo('fast',1);
          }
        },
        function(){
          $(this).fadeTo('fast',0.6,function(){
            $(this).removeClass("hovered");
          });
        }
      );
      $(this).addClass("hover-enabled");
    }
  });
  
}