jQuery(document).ready(
    function($){

        var config = {						//metodo da biblioteca jquery.cycle.all.js
            cleartype:     !$.support.opacity,  //true if clearType corrections should be applied (for IE)
            cleartypeNoBg: true, 				//set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
            fx:    'fade',				//efeito
            sync:   0, 							//de onde surge o próximo elemento
            delay: -2000,						//tempo após inicio do 'scrollDown' quando elemento está saindo da página para que o próximo elemento faça o 'scrollDown', entrando na página
            containerResize: 1,
            timeout:  10000						//intervalo entre efeitos


        }
        //paginacao
        config.pager = '#main-destaque-pagination';
        // callback fn that creates a thumbnail to use as pager anchor
        config.pagerAnchorBuilder = function(idx, slide) {
            return '<a href="#" class="button button-'+(idx+1)+'">&nbsp;</a>';
        }
            
           
        $('#main-destaque').cycle(config);
       
    }
    )


$(document).observe('dom:loaded',function(){    
    new Carousel('carousel-video-content',
        $$('#carousel-video-content .slide'),
        $$('#carousel-video a.carousel-control'),
        {
            duration:0.4,
            frequency:5
        }
        );
    $$('#carousel-video-content .slide a').each(function(link){
        $(link).observe('click',function(evt){

            var youtube = new Rbm.Youtube();
            
            youtube.showPlayer(link.down('span').innerHTML,'box-display-video');
            var a = $('box-titulo-video').down('a');
            a.update(link.title)
            .href=link.href;
            a.title = link.title;
                                 
                                 
            

            $$('#carousel-video-content .slide').each(function(obj){
                $(obj).removeClassName('selected');
            });
            $(link).up('.slide').addClassName('selected');
        });

                

    });
        

});
/*Biography carousel*/

$(document).observe('dom:loaded',function(){

    ////////////////////////////////////////
    new Carousel( 'carousel-biography-content',
        $$('#carousel-biography .slide'),
        $$('#carousel-biography a.carousel-control'),
        {
            duration:0.4,
            frequency:5
        }
        );
    try{
        var slideWrapper = $('carousel-biography-content').down('.slide-wrapper');
        var first =  $(slideWrapper).down().getDimensions().width ;
        var width = $(slideWrapper).childElements().length * first;
        slideWrapper.setStyle({
            'width':width+'px'
            });
    }catch(e){
        alert(e);
    }
});


  
