//<![CDATA[


var _main                    = {

    init          : function() {

        this.before();

    },

    before        : function() {
        libraries.jQswfObject.init    = true;
        libraries.jQscrollTo.init      = true;

        _loader.core();
    },

    after         : function() {

        vencedores.init();
    }
};


var vencedores               = {

    init          : function() {

        if (this.check())  this.core();

    },

    check         : function() {

        return (_exists('.photo-list') &&
            typeof jQuery.fn.flash == 'function' ) ? true : false;

    },

    foobar                   : {

        url  : '',
        name : ''

    },

    core          : function() {

        $('a.original').click(function(){

            $('.video-player, .closed').remove();
            $('li.video-show').removeClass('video-show')

            vencedores.foobar.url  = $(this).attr('href');
            vencedores.foobar.name = $(this).attr('href').replace(/.*\/(?!.*\/)(.*)\.(.*)/,"$1");
            var html  = '<div class="video-player"><p><span class="destaque">Carregando. Por favor aguarde...</span><img src="/_img/global/ajax-loader-video.gif" class="icon" /></p></div>';
            var close = '<a href="#" title="Fechar vídeo" class="closed">fechar</a>'

            $(this).closest('li').addClass('video-show');
            $(this).closest('li').prepend(html);
            $(this).closest('div.description').append(close);
            $.scrollTo( '.video-show', 1000, {easing:'BounceEaseOut'} );

            vencedores.video();

            return false;
        });

        $('a.closed').live('click', function(){
            $.scrollTo( '.video-show', 1000, {easing:'BounceEaseOut'} );
            $('.video-player, .closed').remove();
            $('li.video-show').removeClass('video-show');
            return false;
        });

        $('a.top').click(function(){
            $.scrollTo( 'h1', 1000, {easing:'BounceEaseOut'} );
            return false;
        });

    },

    video         : function() {

        setTimeout(function(){

            $('.video-player').flash({
                swf                 : def.project.pathSwf + 'global/video-player.swf',
                width		        : $('div.video-player').width(),
                height		        : $('div.video-player').height(),
                allowscriptaccess   : 'always',
                allowfullscreen     : 'true',
                wmode		        : 'transparent',
                params              : {
                    allowfullscreen     : 'true',
                    allowscriptaccess   : 'always'
                },
                flashvars           : {
                    file            : def.project.pathFlv + vencedores.foobar.url,
                    logo            : def.project.pathImg + 'global/logo.png',
                    skin            : def.project.pathSwf + 'global/skin-claro-curtas.swf',
                    image           : def.project.pathImg + 'videos/vencedores/thumb/' + vencedores.foobar.name + '.jpg',
                    controlbar      : 'over'
                }
            });

        },1000);

    }
};


_main.init();


//]]>
