as_memory00 = null;
as_memory01 = null;
as_memory02 = null;
as_memory03 = null;

function insertArticleData(from_li_a)
	{
	var data = $("#"+from_li_a.attr("rel"));
	$("#article_spot .header").html($(".header",data).html());
	$("#article_spot .content").html($(".content",data).html());
	
	var parent_li = from_li_a.parents("li:first");
	var prev_li_a = $("a",parent_li.prev());
	var next_li_a = $("a",parent_li.next());
	var prev_btn = $("#article_spot .article_nav .prev");
	var next_btn = $("#article_spot .article_nav .next");
	as_memory02 = prev_li_a;
	as_memory03 = next_li_a;
	
	prev_btn.unbind("click");
	next_btn.unbind("click");
	if (prev_li_a.text())
		{
		prev_btn.html(prev_li_a.text()+" [Prev]");
		prev_btn.removeClass("hidden");
		prev_btn.bind("click",function()
			{
			loadArticle(as_memory02);
			return false;
			});
		}
	else
		{
		prev_btn.addClass("hidden");
		prev_btn.bind("click",function(){return false;});
		}
	if (next_li_a.text())
		{
		next_btn.html(next_li_a.text()+" [Next]");
		next_btn.removeClass("hidden");
		next_btn.bind("click",function()
			{
			loadArticle(as_memory03);
			return false;
			});
		}
	else
		{
		next_btn.addClass("hidden");
		next_btn.bind("click",function(){return false;});
		}
	}

function loadArticle(from_li_a)
	{
	if (!as_memory00)
		{
		as_memory00 = true;
		var t = from_li_a;
		var article_spot = $("#article_spot");

		/* find and set theme */
		var parent_class = t.parents("ul:first").attr("class");
		var possible_themes = ["green","maroon","bronze"];
		for (var i=0;i<possible_themes.length;i++) article_spot.removeClass("article_spot-"+possible_themes[i]);
		for (var i=0;i<possible_themes.length;i++)
			{
			if (parent_class.indexOf(possible_themes[i]))
				{
				article_spot.addClass("article_spot-"+possible_themes[i]);
				break;
				}
			}

		/* find and insert article data */
		var hide_these = $(".as_cutthis");
		as_memory01 = t;
		if (article_spot.css("display") != "none")
			{
			article_spot.hide(800,function()
				{
				insertArticleData(as_memory01);
				$("#article_spot").show(600,function()
					{
					as_memory00 = false;
					});
				});
			}
		else
			{
			$(".as_cutthis").hide(800,function()
				{
				insertArticleData(as_memory01);
				$("#article_spot").show(600,function()
					{
					as_memory00 = false;
					});
				});
			}
		}
	}

function closeArticleSpot()
	{
	if (!as_memory00 && $("#article_spot").css("display") != "none")
		{
		as_memory00 = true;
		$("#article_spot").hide(800,function()
			{
			$(".as_cutthis").show(600,function()
				{
				as_memory00 = false;
				});
			});
		}
	}

function setUpDrHarrisList()
	{
	var show_initially = 4;
	if ($("#drharris_list li").length > show_initially)
		{
		$("#drharris_list li:eq("+show_initially+")").before('<li class="show_all"><a href="#">More About Dr. Harris</a></li>');
		
		$("#drharris_list .show_all").bind("click",function()
			{
			$(this).remove();
			//$("#drharris_list li").css("display","block");
			$("#drharris_list li").fadeIn(900);
			return false;
			});
		$("#drharris_list li:gt("+show_initially+")").css("display","none");
		}
	}