$(document).ready(function()
{	
	$('#aj_comment_display_opt').change(function()
	{
		if(this.value == 'All Comments')
		{
			$('tbody.junkie').removeClass('disabled');
			$('tbody.nojunkie').removeClass('disabled');
			$('thead.nojunkie span.showcomment').addClass('disabled');
			$('thead.nojunkie span.hidecomment').removeClass('disabled');
			$('thead.junkie span.showcomment').addClass('disabled');
			$('thead.junkie span.hidecomment').removeClass('disabled');
		}
		else if(this.value == 'Junkies Only')
		{
			$('tbody.junkie').removeClass('disabled');
			$('tbody.nojunkie').addClass('disabled');
			$('thead.nojunkie span.showcomment').removeClass('disabled');
			$('thead.nojunkie span.hidecomment').addClass('disabled');
			$('thead.junkie span.showcomment').addClass('disabled');
			$('thead.junkie span.hidecomment').removeClass('disabled');
		}
		else if(this.value == 'Non-Junkies')
		{
			$('tbody.junkie').addClass('disabled');
			$('tbody.nojunkie').removeClass('disabled');
			$('thead.nojunkie span.showcomment').addClass('disabled');
			$('thead.nojunkie span.hidecomment').removeClass('disabled');
			$('thead.junkie span.showcomment').removeClass('disabled');
			$('thead.junkie span.hidecomment').addClass('disabled');
		}
	});
	
	$('span.showcomment').click(function()
	{
		$(this).addClass('disabled');
		$(this).prev("span.hidecomment").removeClass('disabled');
		$(this).parent("th").parent("tr").parent("thead").next("tbody").removeClass('disabled');
	});
	$('span.hidecomment').click(function()
	{
		$(this).addClass('disabled');
		$(this).next("span.showcomment").removeClass('disabled');
		$(this).parent("th").parent("tr").parent("thead").next("tbody").addClass('disabled');
	});
});
