$(document).ready(function() {	

	//Show Banner
	$("#destaque .desc").show(); //Show Banner
	$("#destaque .block").animate({ opacity: 0.75 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$("#destaque-desc ul li:first").addClass('active'); 
	$("#destaque-desc ul li").click(function(){ 
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('a.imagem').attr("href"); //Get Main Image URL
		var link = $(this).find('a.link').attr("href");
		var imgDesc = $(this).find('.block').html(); 	//Get HTML of block
		var imgDescHeight = $("#destaque").find('.block').height();	//Calculate height of block	
		
		if ($(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser		
			$("#destaque img").animate({ opacity: 0}, 500 );
			$("#destaque .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 500 , function() {
				$("#destaque .block").html(imgDesc).animate({ opacity: 0.75,	marginBottom: "0" }, 500 );
				$("#destaque a").attr('href',link);
				$("#destaque img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 500 );
			});
		}
		
		$("#destaque-desc ul li").removeClass('active'); //Remove class of 'active' on all lists
		$(this).addClass('active');  //add class of 'active' on this list only
		return false;
		
	}) .hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});
	
	var a = 1;
    setInterval(function() { 
        $('#destaque-desc ul li:eq('+a+')').click();
        a++;
        if (a == 5)
        	a = 0;
    }, 5000); 
});//Close Function