﻿jQuery(document).ready(function($) {
	$('.featuredcontent_postwrapper:first').fadeIn(500);

	$('.featuredcontent_arrow_right').click(function() {clearInterval(myInterval);MoveRight();});
	
	$('.featuredcontent_arrow_left').click(function() {clearInterval(myInterval);MoveLeft();});
	
	
	function MoveRight()  {
		$('.featuredcontent_postwrapper:visible').fadeOut(500, function(){
			if ($(this).next('.featuredcontent_postwrapper').text()!='')
			{
				$(this).next('.featuredcontent_postwrapper').fadeIn(500);
			}
			else
			{
				$('.featuredcontent_postwrapper:first').fadeIn(500);
			}
		});
	}
	
	function MoveLeft() {

		$('.featuredcontent_postwrapper:visible').fadeOut(500, function(){
			if ($(this).prev('.featuredcontent_postwrapper').text()!='')
			{
				$(this).prev('.featuredcontent_postwrapper').fadeIn(500);
			}
			else
			{
				$('.featuredcontent_postwrapper:last').fadeIn(500);
			}
		});
	}
	
	var myInterval = setInterval ( MoveRight, 5000 );

});

