/**
 * Login form handling
 */
$(function() {
 // Login form should not be displayed by default.
 $("#sidebar-loginform > form").hide();

 // Let h2 element act like a like.
 $("#sidebar-loginform > h2 > span").hover(
  function() {
   $(this).css({backgroundColor: "#CCCCCC", color: "#CC0000", cursor: "pointer"});
  },
  function() {
   $(this).css({backgroundColor: "#990000", color: "#CCCCCC", cursor: "auto"});
  }
 );
 $("#sidebar-loginform > h2").toggle(
  function() {
   $("#sidebar-loginform > form").slideDown(250);
  },
  function() {
   $("#sidebar-loginform > form").slideUp(250);
  }
 );
});

/**
 * Background toggling for better reading of blog entries.
 */
$(function() {
 $("#contents").find("div.blogentry p,h2,li").hover(
  function() {
   $(this).css("backgroundColor", "#660000");
  },
  function() {
   $(this).css("backgroundColor", "#990000");
  }
 );
});

/**
 * Cool news links in overview.
 */
$(function() {
 $("div.blog-select").each(
  function() {
   $(this).data("link", $(this).find("a").attr("href"));
   $(this).find("a").each(
    function() {
     $(this).replaceWith($(this).contents());
    }
   );
  }
 );
 $("div.blog-select").hover(
  function() {
   $(this).css({backgroundColor: "#660000", border: "1px solid #CCCCCC", cursor: "pointer"});
  },
  function() {
   $(this).css({backgroundColor: "#990000", border: "1px solid #660000", cursor: "auto"});
  }
 );
 $("div.blog-select").click(
  function() {
   window.location.href = $(this).data("link");
  }
 );
});

/**
 * Archive bar.
 */

//TODO

