$(document).ready(function()
{	
	$(".list_switcher_header").click(function()
	{
		if ($(this).hasClass("list_switcher_header_selected"))
		{
			return;
		}
		
		var data_id = $(this)
			.siblings(".list_switcher_header")
				.removeClass("list_switcher_header_selected")
				.end()
			.addClass("list_switcher_header_selected")
			.attr("id")
				.split("list_switcher_header_")[1];
		
		$("#list_switcher_data_"+data_id)
			.siblings(".list_switcher_data_selected")
				.fadeOut(list_switcher_fade_time, function()
						{
							$("#list_switcher_data_"+data_id).fadeIn(list_switcher_fade_time);
						})
				.removeClass("list_switcher_data_selected")
				.end()
			.addClass("list_switcher_data_selected");
	});
	
	/*
	 now the responsibility of the view to init, since they may contain images that haven't been loaded and
	 potentially has lots of stuff...
	*/
	//setTimeout(init_all_lists, 50); now the responsibility of the view to init, since these may contain paginatdd
});

var list_switcher_fade_time = 250;

function list_switcher_init_all_lists()
{
	$(".list_switcher_container").each(function(i, e)
	{
		list_switcher_init_list($(this).attr('id').split("list_switcher_")[1]);
	});
}

function list_switcher_init_list(uid)
{
	$("#list_switcher_"+uid)
		.find(".list_switcher_header:first")
			.click()
			.end()
		.find(".list_switcher_data:first")
			.fadeIn(list_switcher_fade_time);
}
