var mySlideShow;

window.addEvent('domready',function(){
    
    // instance with a few options
    mySlideShow = new SlideShow('banners_destaque',{
        delay:20000,
        duration:2000,
        transition: 'fadeThroughBackground',
        autoplay: true
    });
    
    var slideLabels = $$('#indice_banner li');
    slideLabels.each(function(element, index){
        element.addEvents({
            click: function(){
                // index of list items match index of slides
                mySlideShow.show(index, {transition: 'fadeThroughBackground', duration: 2000});
            },
            mouseenter: function(){
                element.tween('background-color', '#efe5d1');
            },
            mouseleave: function(){
                if (!element.hasClass('current')){ 
                    element.tween('background-color', '#923b21');
                }
            }
        });
    });

    mySlideShow.addEvent('show', function(slideData){
        // args of the show event are the previous/next slides and their index
        // again, slideLabels index matches slide index so this is cake
        slideLabels[slideData.previous.index].tween('background-color', '#923b21').removeClass('current');
        slideLabels[slideData.next.index].tween('background-color', '#efe5d1').addClass('current');
    });
    

    
    
    FotoShow = new SlideShow ('thumbs_inicial',{
        transition: 'fadeThroughBackground',
        autoplay: false
    });
    
    $$('.showNext').addEvent('click',function(){
        FotoShow.showNext();
    });
    
    $$('.showPrevious').addEvent('click',function(){
        FotoShow.showPrevious();
    });
    
        //Efeito slideshow dos banners de parceiros
    ParceirosShow = new SlideShow ('thumbs_parceiros',{
        transition: 'fadeThroughBackground',
        autoplay: true
    });
    
});
