window.log = function(){
  log.history = log.history || [];
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};
(function($) {
    var sidebarToggle = function() {
        var that = this;
        if ($(".sidebar").is(":hidden")) {
            $("#postContainer").animate({ "width": "610px" }, function() {
                $(".sidebar").fadeToggle("fast");
                $(that).text("->");
            });
        } else {
            $(".sidebar").fadeToggle("fast", function() {
                $("#postContainer").animate({ "width": "950px" });
                $(that).text("<-");
            });
        }
    };
    $(function() {
        var pc = $("#postContainer"),
			side = $(".sidebar");
        if (pc.height() < side.height()) {
            pc.css({ "min-height": side.height() });
        }
        $("#sidebarHider").bind("click", sidebarToggle);
        $("pre").bind({
            "mouseenter": function() {
                var w = $(this).find("code").width();
                $(this).css({ position: "relative" }).stop().animate({ width: w || 900 });
            },
            "mouseleave": function() {
                $(this).stop().animate({ width: 500 }, 500, function() {
                    $(this).css({ position: "static" });
                });
            }
        });
    });
    $.fn.fadeToggle = function(speed, easing, callback) { return this.animate({ opacity: 'toggle' }, speed, easing, callback); };
})(window.jQuery)
