function trace(value)
{
	return;
	try
	{
		console.info(value);
	}
	catch (err)
	{
		// Ignore it
	}
}

window.Projects_Pager_Active = false;

window.Projects_Previous = function()
{
	if (window.Projects_Pager_Active)
	{
		return;
	}

	var current = $('#List div.List:visible');
	var prev = $(current).prev('div.List:first');
	if (prev.length == 0)
	{
		return false;
	}
	
	current.hide();
	current.removeClass('current');
	prev.show();
	prev.addClass('current');
	window.Update_Pager(prev);
	/*window.Projects_Pager_Active = true;
	current.fadeOut(500, function()
		{
			prev.fadeIn(250, function()
				{
					window.Projects_Pager_Active = false;
				}
			);
			window.Update_Pager(prev);
		}
	);*/
}

window.Projects_Next = function()
{
	if (window.Projects_Pager_Active)
	{
		return;
	}

	var current = $('#List div.List:visible');
	var next = $(current).next('div.List:first');
	if (next.length == 0)
	{
		return false;
	}
	
	current.hide();
	current.removeClass('current');
	next.show();
	next.addClass('current');
	window.Update_Pager(next);
	/*window.Projects_Pager_Active = true;
	current.fadeOut(500, function()
		{
			next.fadeIn(250, function()
				{
					window.Projects_Pager_Active = false;
				}
			);
			window.Update_Pager(next);
		}
	);*/
}

window.Update_Pager = function(active)
{
	if ($(active).prev('div.List:first').length > 0)
	{
		$('#Pager_Up:not(:visible)').show();
		$('#Pager_Up_Disabled:visible').hide();
	}
	else
	{
		$('#Pager_Up_Disabled:not(:visible)').show();
		$('#Pager_Up:visible').hide();
	}

	if ($(active).next('div.List:first').length > 0)
	{
		$('#Pager_Down:not(:visible)').show();
		$('#Pager_Down_Disabled:visible').hide();
	}
	else
	{
		$('#Pager_Down_Disabled:not(:visible)').show();
		$('#Pager_Down:visible').hide();
	}
}

window.Featured_Show = function(img)
{
	var big = $('#Featured_Big img').get(0);
	big.src = img.src;
}

window.Featured_Pager_Active = false;

window.Featured_Previous = function(button)
{
	var holder = $(button).parent().parent();
	var current = $('div.Group:visible', holder);
	var prev = $(current).prev('div.Group:first');
	if (prev.length == 0)
	{
		trace('Previous not found');
		return false;
	}

	current.hide();
	current.removeClass('current');
	prev.show();
	prev.addClass('current');
	window.Featured_Update_Pager(prev);
}

window.Featured_Next = function(button)
{
	var holder = $(button).parent().parent();
	var current = $('div.Group:visible', holder);
	var next = $(current).next('div.Group:first');
	if (next.length == 0)
	{
		trace('Next not found');
		return false;
	}

	current.hide();
	current.removeClass('current');
	next.show();
	next.addClass('current');
	window.Featured_Update_Pager(next);
}

window.Featured_Update_Pager = function(active)
{
	var pager = $(active).parent().find('div.Pager');
	var prev = $(active).prev('div.Group');
	if (prev.length > 0)
	{
		$('img.Left.Enabled:not(:visible)', pager).show();
		$('img.Left.Disabled:visible', pager).hide();
	}
	else
	{
		$('img.Left.Disabled:not(:visible)', pager).show();
		$('img.Left.Enabled:visible', pager).hide();
	}

	var next = $(active).next('div.Group');
	if (next.length > 0)
	{
		$('img.Right.Enabled:not(:visible)', pager).show();
		$('img.Right.Disabled:visible', pager).hide();
	}
	else
	{
		$('img.Right.Disabled:not(:visible)', pager).show();
		$('img.Right.Enabled:visible', pager).hide();
	}
}
