_activeId = '';
var _state = '0';
var _curBlogIndex = 0;
var _curId = _blogIdArray[0];

function ShowHideBlog(id)
{
	$("div.blogsblogpost").removeClass("blogvisible");
	$("div#" + id).addClass("blogvisible");
	
	// remove existing
	$("div#title_" + _activeId).removeClass('blogsidebartitleactive');
	$("div#title_" + _activeId).addClass('blogsidebartitle');
	// add new
	$("div#title_" + id).removeClass('blogsidebartitle');
	$("div#title_" + id).addClass('blogsidebartitleactive');
	
	_activeId = id;
	
	ShowNewsSelector();
}

function ShowNewsSelector()
{
	if(_state=='0'){
		$("div#newsselector2").slideDown("slow");
		$("#newsArrow").attr("src", 'images/up_arrow.png');
		_state = '1';
	} else {
		$("div#newsselector2").slideUp("slow");
		$("#newsArrow").attr("src", 'images/down_arrow.png');
		_state = '0';
	}
}

function SwitchBlog(dir)
{
	// 0 is the most recent blog
	// n is the oldest (I did it backwards on accident)
	
	$("div.blogsblogpost").removeClass("blogvisible"); // remove the visible one
	if(dir=="+") // newer post, so decrement the indexer
	{
		if(_curBlogIndex > 1)
		{
			_curBlogIndex--;
		}
	}
	else // older post so increment the indexer
	{
		if(_blogIdArray.length > (_curBlogIndex + 1))
		{
			_curBlogIndex++;
		}
	}
	_curId = _blogIdArray[_curBlogIndex];
	$("div#" + _curId).addClass("blogvisible"); // make the next one visible
}