/*********************************************************************************************************************************/
/* DOCUMENT READY CALLS **********************************************************************************************************/
/*********************************************************************************************************************************/
$(document).ready(function(){

	/* SLIDESHOW start ***************************************************************/
	var slideshow = setInterval( "slideSwitch()", 5000 );
	/* SLIDESHOW end *****************************************************************/

}); //close document.ready


/*********************************************************************************************************************************/
/* DOCUMENT READY FUNCTIONS ******************************************************************************************************/
/*********************************************************************************************************************************/

/* SLIDESHOW function start *********************************************************/
function slideSwitch(direction) {
	var $active = $('#slideshow span.active');

	if ( $active.length == 0 ) $active = $('#slideshow span:first');	
	
	if(direction == 'Next' || direction == null){ var $next = $active.next('span').length ? $active.next() : $('#slideshow span:first'); }
	else if(direction == 'Previous') { var $next = $active.prev('span').length ? $active.prev() : $('#slideshow span:last'); }	

	$active.addClass('last-active');
	
	$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 500, function() {
			 $active.removeClass('active last-active');
	});
	
}
/* SLIDESHOW function end ***********************************************************/
