$(function() {
	$("#main").css("width","auto");

$(".wide").hide();
			$("#load").show();
			$("#right").animate({marginRight: "0px"}, 1500, function() { $("#right #nav .img").css("background-position","-29px 0px"); });
			$("#main").animate({paddingRight: "312px"}, 1500, Column);
			$("#next").animate({right: "+=196px"}, 1500);
			$("#main").css("width","auto");

});
Column = function() {
	var len = $(".wide div").length;
	for (i = 0; i < len; i++) {
		var txt = $(".wide div:eq("+ i +")").html();
		$(".wide").append(txt);
	}
	$(".wide div").remove();
	$(".wide br").remove();
	$("#load").hide();
	$(".wide").show();
	wi = $("#main").width();
	he = 350;
	$('.wide').columnize({width : wi, height : he});
	$(".wide div:eq(0)").attr("id","active");
}

$("#nav").toggle(
		function() {
			$(".wide").hide();
			$("#load").show();
			$("#right").animate({marginRight: "-195px"}, 1500, function() { $("#right #nav .img").css("background-position","0px 0px"); } );
			$("#main").animate({paddingRight: "117px"}, 1500, Column);
			$("#next").animate({right: "-=196px"}, 1500);
			$("#main").css("width","auto");
			
			
		}, 	function() {

$(".wide").hide();
			$("#load").show();
			$("#right").animate({marginRight: "0px"}, 1500, function() { $("#right #nav .img").css("background-position","-29px 0px"); });
			$("#main").animate({paddingRight: "312px"}, 1500, Column);
			$("#next").animate({right: "+=196px"}, 1500);
			$("#main").css("width","auto");

			
			
	}
	);
