var sidebarOpen = false;

function openSidebar(id) {
	$(".active-pane").removeClass("active-pane");
	$("#" + id).addClass("active-pane");

	sidebarOpen = true;
	sizer();

	sIFR.replace(bernMedium, { selector: "#" + id + " h1" });

	return false;
}

function closeSidebar() {
	sidebarOpen = false;
	sizer();

	return false;
}

function sizer() {
	var height = $(window).height();
	var width = $(window).width();

	// Set widths.
	$("#pagefooter, #abcplayer").width(width);
	if (sidebarOpen) {
		$("#player").width(width * 0.66);
		$("#sidebar").width(width * 0.33).css("display", "block");
	}
	else {
		$("#player").width(width);
		$("#sidebar").css("display", "none").width(0);
	}

	// Set heights.
	var contentHeight = height - $("#pagefooter").height();
	$("#abcplayer, #player, #sidebar").height(contentHeight);
	$("#panes").height(contentHeight - $("#panes").offset().top - 2);
}

$(function() {
	sizer();
	$(window).resize(sizer);
});

// vim: set noet ts=4 sw=4 cin ai ft=javascript:
