/*******************************************************************************
On page load.
*******************************************************************************/

$(function()
{	
	if ($('.slideshow').length)
	{		
		$list = $('.slideshow li');
		
		$('.slideshow').html('').css({
			display: 'block',
			margin: '0',
			padding: '0',
			backgroundColor: 'transparent',
			overflow: 'hidden',
			height: '129px',
			width: '600px',
			position: 'relative'
		});
		
		
		$list.each(function()
		{			
			$('.slideshow').append(
				$('<img />')
					.attr('src', $(this).text())
					.css({
						opacity: 0,
						position: 'absolute',
						display: 'block',
						zIndex: $('.slideshow img').length
					})
			);			
		});		
		animate($('.slideshow img'), 0);		
	}
});

function animate($list, index)
{	
	$($list[index]).animate({opacity: 1}, 3000, function()
	{
		$(this).animate({opacity: 0}, 3000);
		animate($list, (++index < $list.length ? index : 0));		
	});
}
