﻿function animar() {	
	$('#fotos img').eq(0).animate({opacity: 0}, 0 , function() {
	$(this).appendTo('#fotos').animate({opacity: 1}, 1000);
	})
}	

$(document).ready(function() {
	$('<p class="legenda" />').appendTo('#fotos');
	$('.legenda').css({
	position: 'absolute',
	opacity: 0.9,
	visibility: 'hidden',
	width: '380px',
	left: 0,
	top: 302,
	color: '#333',
	zIndex: 1000,	
	fontSize: '14px',
	padding: '5px 10px',
	borderBottom: '1px dotted #fff',
	background: '#fff',
	margin:0
	});

	
	$('#fotos img').each(function() {
		$(this).css({
		position: 'absolute'
		})
	})
		rodar = setInterval(animar, 3000);
		
	$('#fotos img').hover(		
		function() {
		clearInterval(rodar);
		$('.legenda').text( $(this).attr('alt') )
		.css('visibility', 'visible');
		}, function() {
		$('.legenda').css('visibility', 'hidden');
		rodar = setInterval(animar,3000);
		});
});

