/**
 *	Allows the slideshow to be fluid width, while containing the featured item
 *	The slideshow uses the jquery.centredScroller plugin to scroll the active item
 *
 *	@author 	Thomas J Bradley <hey@thomasjbradley.ca>
 *	@dependencies	jquery, jquery.centredScroller
 */
var FeatureSlideshow =
{
	api: null,
	context: null,

	/**
	 *	Sets up the centredScroller instance and the next/prev event buttons
	 *
	 *	@return	void
	 */
	init: function()
	{
		FeatureSlideshow.context = $j('#slideshow');
		FeatureSlideshow.api = FeatureSlideshow.context.centredScroller({'autoAdvance':7000});

		FeatureSlideshow.api.onAutoAdvanceBefore(function()
		{
			FeatureSlideshow.hideInfo();
		});

		FeatureSlideshow.api.onAutoAdvanceAfter(function()
		{
			FeatureSlideshow.showInfo();
		});

		$j('.next', FeatureSlideshow.context).bind('click.liberal', function()
		{
			FeatureSlideshow.hideInfo();

			FeatureSlideshow.api.next(function()
			{
				FeatureSlideshow.showInfo();
			});

			return false;
		});

		$j('.prev', FeatureSlideshow.context).bind('click.liberal', function()
		{
			FeatureSlideshow.hideInfo()

			FeatureSlideshow.api.prev(function()
			{
				FeatureSlideshow.showInfo();
			});

			return false;
		});

		FeatureSlideshow.context.delegate('.slide', 'mouseenter.liberal', function()
		{
			FeatureSlideshow.api.stopAutoAdvance();
		});

		FeatureSlideshow.context.delegate('.slide', 'mouseleave.liberal', function()
		{
			FeatureSlideshow.api.startAutoAdvance();
		});
	},

	/**
	 *	Hides the info box and buttons
	 *
	 *	@return	void
	 */
	hideInfo: function()
	{
		$j('.current .info', FeatureSlideshow.context).hide();
		/*$j('.slide', FeatureSlideshow.context).removeClass('current'); Sboisvert*/
	},

	/**
	 *	Shows the info box and buttons
	 *
	 *	@return	void
	 */
	showInfo: function()
	{
		$j('.current .info', FeatureSlideshow.context).hide();
		$j('.current .info', FeatureSlideshow.context).fadeIn(800);
	}
};





/**
 *	Set up all page features if they are available on the page
 */
$j(document).ready(function()
{
	$j('body').addClass('js');

	if($j('.tab-group').length > 0)
	{
		Tabs.init();
	}

	
	



	if($j('#slideshow').length > 0)
	{
		FeatureSlideshow.init();
	}

	

	
});





