function display_products()
{
	var count_products	=	$('#mac-games-thumbnails li a.active').parent().next().length;
	var next_link		=	count_products > 0 ? $('#mac-games-thumbnails li a.active').parent().next().find('a').attr('rel') : $('#mac-games-thumbnails li:first').find('a').attr('rel');
	var	next			=	count_products > 0 ? $('#mac-games-thumbnails li a.active').parent().next() : $('#mac-games-thumbnails li:first');

	$('mac-games-thumbnails li a').removeClass('active');
	$('#mac-games img').attr({src: next_link}).hide().fadeIn(1500);
	next.find('a').addClass('active').click();
}

$(document).ready(function()
{
	$('#mac-games-thumbnails li a:first').addClass('active');
	$('#mac-games-thumbnails li a').hover(function()
	{
		var new_alt		=	$(this).find('strong').html();
		var price		=	$(this).find('em').html();

		$('#mac-games-description strong').html(new_alt);
		$('#mac-games-description em').html(price);
		//	Animate the Teaser
		$('#mac-games-description').stop(true, true).fadeIn();
	}, function()
	{
		$('#mac-games-description').fadeOut();
	}).click(function()
	{
		var new_alt		=	$(this).find('strong').html();
		var new_src		=	$(this).attr('rel');
		var new_link	=	$(this).attr('href');
		var price		=	$(this).find('em').html();

		$('#mac-games-thumbnails li a').removeClass('active');
		$(this).addClass('active');
		
		$('#mac-games li a').attr({href: new_link, title: new_alt});
		$('#mac-games li a em').html(new_alt+' - buy now from GameTree Online');
		$('#mac-games img').attr({src: new_src, alt: new_alt, title: new_alt});
		$('#mac-games-description strong').html(new_alt);
		$('#mac-games-description em').html(price);
		
		return false;
	});
	
	//	Run our display_products() function every 7.5 seconds
	setInterval('display_products()', 7500);

	//	maybe move this into the .hover() state to get rid of the flickering
	$('#mac-games a').hover(function()
	{
		$('#mac-games-description strong, #mac-games-description em').hide();
		$('#mac-games-description strong').show().html($('#mac-games-thumbnails .active').find('strong').html());
		$('#mac-games-description em').show().html($('#mac-games-thumbnails .active').find('em').html());
		$('#mac-games-description').stop(true, true).fadeIn();
	}, function()
	{
		$('#mac-games-description').fadeOut();
	});
		
	//	tabber
	var tabs = $('.tabber-content');
	tabs.hide().filter(':first').fadeIn();
	
	$('#tabs a:not(.redirect)').click(function()
	{
		tabs.hide();
		tabs.filter(this.hash).fadeIn(750);

		$('#tabs a').removeClass('selected');
		$(this).addClass('selected');
		return false;
	}).filter(':first').click();
	
	$('img').not('.thumbnail').lazyload();
	
	Shadowbox.init();
});
