jQuery(function($){	
	$('#thumb_fotos a').lightBox(); // seleciona todos os links que contenham o atributo rel="lightbox"		
	//executa slide show de imagens na pagina outono inverno 2009
	$('#galeria_outono_inverno a').lightBox();
	
	//chama slideShow();
	slideShow();
	
	$('#thumb_fotos img').hover(function(){
		$(this).fadeTo('fast', 0.3);
	}, 
	function(){
		$(this).fadeTo('fast', 1);
	});
	
}); //fim do main

function slideShow() { 
	 	  
     //Esconde todas as âncoras usando a propriedade display:none
     $('#galeria_outono_inverno a').css("display","none");  
       
     //Pega a primeria imagem e a apresenta na tela(para isso seta a propriedade display:block)  
     $('#galeria_outono_inverno a:first').css("display", "block" );  
     $('#thumb_fotos img.foto1').fadeTo('slow', 0.3);  
            
     //Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds  
     setInterval('gallery()',10000);  
}  
   
 function gallery() {  
 	   //imagem atual
	  var current, thumb_imagem, foto_original;
	  
	 //if no IMGs have the show class, grab the first image  
     current = ($('#galeria_outono_inverno a.show')?  $('#galeria_outono_inverno a.show') : $('#galeria_outono_inverno a:first'));  
	 
	 //destaca thumb da imagem atual.
	 thumb_destaque = current.attr('href').replace('images/colecao_outono_inverno/', '');
	 thumb_destaque = thumb_destaque.substr(-9);
     thumb_destaque = thumb_destaque.substr(0, 5); //devolve algo como foto1
	 
	 $('#thumb_fotos img.' +thumb_destaque).fadeTo('slow', 1);	 	 

	 //Get next image, if it reached the end of the slideshow, rotate it back to the first image  
     var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#galeria_outono_inverno a:first') :current.next()) : $('#galeria_outono_inverno a:first'));     

	 //destaca thumb da imagem atual.
	 thumb_destaque = next.attr('href').replace('images/colecao_outono_inverno/', '');
	 thumb_destaque = thumb_destaque.substr(-9);
	 thumb_destaque = thumb_destaque.substr(0, 5);
	 $('#thumb_fotos img.' +thumb_destaque).fadeTo('slow', 0.5);
     
     //Set the fade in effect for the next image, show class has higher z-index  
	 next.css({
			  display: 'block',
			  opacity: 0.0			  
			  })
	 .addClass('show')
	 .animate({opacity: 1.0}, 1000);
   
     //Hide the current image  
     current.animate({opacity: 0.0}, 1000)
	 .css({display: 'none'})
     .removeClass('show'); 
	 
	 
	 
       
 } 