//from classic
var previewPref = '';
function showLatest() {}	

// called if user preference is for collapsed:
function preview() { 
	$('table td.last div').animate({ width: 110 }, 'fast');
    $("ul.recent").animate({height: 'show'}, 'fast');
	$("#collapser").html("Collapse All");
	$("a.lastpost").remove();
	$(".collapsed").removeClass("collapsed");
	window.previewPref = 'false';
	
}
//alert (window.previewPref);
function hideRecent() { 
	$('table td.last div').animate({ width: 240 }, 'fast');
	$("ul.recent").animate({height: 'hide'}, 'fast'); //
	$("#collapser").html("Expand All");
	$("ul.recent").find("a:eq(0)").each(function(i){
		$(this).parent().parent().parent().parent().addClass("collapsed");
	});
 	$("span.topicMeta").each(function(i){
		$(this).click(function() {
			thisParent = $(this).parent().parent();
			if (thisParent.attr("class").indexOf("collapsed") != -1) {
				thisParent.children("ul.recent").animate({height: 'show'}, 'fast');
				thisParent.toggleClass("collapsed");
			}	
		});
   	});
	var previewPref = 'true';
}

//when document ready:
$(function() {
	if (previewPref == '') { // because preview preference kicked in
	   $("#collapser").toggle(function(e) {
        e.preventDefault();
        hideRecent();      
	}, function() {
		preview();
	});
} else { 
	$("#collapser").toggle(function(e) {
        e.preventDefault();
        preview();      
	}, function() {
		hideRecent();
	});
	}
});