//<![CDATA[


var _main                = {

    init      : function() {

        this.before();

    },

    before    : function() {
        libraries.jQswfObject.init  = true;
        libraries.jQjcarousel.init  = true;
        libraries.jQueryQuery.init  = true;
        libraries.comVT.init        = true;

        _loader.core();
    },

    after     : function() {

        swf.init();
        carousel.init();
        newsArticles.init();
        curiosities.init();
        removelink.init();
        comVideoTutotial.init();
    }
};


var swf                  = {

    init      : function() {

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

    },

    check     : function() {

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

    },

    core      : function() {

        this.amb();
        this.banner();
        //this.floater();

    },

    amb       : function() {

        $('.swf-home').flash({
            swf         : def.project.pathSwf + 'home/navegadorbanners.swf',
            wmode		:'transparent',
            width		: $('div.banner-flash').width(),
            height		: $('div.banner-flash').height(),
            flashvars   : {
                name1   : 'jQuery',
                name2   : 'SWFObject',
                name3   : 'Plugin'
            }
        });

    },

    banner    : function() {

        $('div.banner').flash({
            swf         : def.project.pathSwf + 'home/clarocurtas-vencedores-home.swf',
			wmode		:'transparent',
            width		: $('div.banner').width(),
            height		: $('div.banner').height()
        });

    },

    floater      : function() {

        $('div.floater-home div.container-flash').flash({
            swf         : def.project.pathSwf + 'home/adesivo_seminario.swf',
			wmode		:'transparent',
            width		: $('div.container-flash').width(),
            height		: $('div.container-flash').height()
        });
        
    }
};


var carousel             = {

    init      : function() {

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

    },

    check     : function() {

        return ( _exists('#curio-carousel') && typeof jQuery.jcarousel == 'function' ) ? true : false;

    },

    core      : function() {

        $('#curio-carousel').jcarousel({
            initCallback    : carousel.callback,
            easing          : 'BounceEaseOut',
            animation       : 1000,
            scroll          : 1,
            buttonNextHTML  : null,
            buttonPrevHTML  : null,
            auto            : 3,
            wrap            : 'both'
        });

    },

    callback    : function(carousel) {

        $('li.prev-curiosities a').bind('click', function() {
            carousel.prev();
            return false;
        });

        $('li.next-curiosities a').bind('click', function() {
            carousel.next();
            return false;
        });
    }
};


var newsArticles         = {

    init      : function() {

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

    },

    check     : function() {

        return (_exists('ul.tabNav') ) ? true : false;

    },

    core      : function() {

        $('ul.tabNav li.article a').eq(0).click(function(){

            $('ul.tabNav li.news a').removeClass('selected');
            $('ul.tabNav li.article a').eq(0).addClass('selected');

            $('ul.tabNav li.news ul').hide();
            $('ul.tabNav li.article ul').fadeIn();

            return false;

        });

        $('ul.tabNav li.news a').eq(0).click(function(){

            $('ul.tabNav li.article a').removeClass('selected');
            $('ul.tabNav li.news a').eq(0).addClass('selected');

            $('ul.tabNav li.article ul').hide();
            $('ul.tabNav li.news ul').fadeIn();

            return false;

        });

    }
};


var curiosities          = {

    init      : function() {

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

    },

    check     : function() {

        return ( _exists('.slide-curiosities') && typeof jQuery.fn.cycle == 'function' ) ? true : false;

    },

    core      : function() {

        $('.slide-curiosities').cycle({
            fx      : 'scrollHorz',
            timeout : 5000,
            delay   : -1000,
            next    : '.next-curiosities',
            prev    : '.prev-curiosities'
        });

    }

};


var removelink           = {

    init      : function() {

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

    },

    check     : function() {

        return ( _exists('a.nav-1')) ? true : false;

    },

    core      : function() {

        $('a.nav-1').removeAttr('href');

    }
};


_main.init();


//]]>
