function restoreBlockState(blockId) {
	if ($.cookie('blockState-'+blockId) > 0) {
		$("#"+blockId).show();
	}
	else {
		$("#"+blockId).hide();
	}
}

// toggles a block, and saves the actual state in cookie, if second parameter is true
// the saved state should be restored on load with restoreBlockState(blockId);
function toggleBlock(blockId, saveCookie) {
	if( $("#"+blockId+":visible").length ) {
		$("#"+blockId).hide(200);
		if (saveCookie) {
			$.cookie('blockState-'+blockId, 0, { path: "/" });
		}
	}
	else {
		$("#"+blockId).show(200);
		if (saveCookie) {
			$.cookie('blockState-'+blockId, 1, { path: "/" });
		}
	}
}

$(document).ready( function() {
	// open links with class 'new-window' in new window
	$("a.new-window").live( 'click', function() {
		window.open($(this).attr('href'));
		return false;
	} );
} );

