/**
 * TikiCMS
 * Copyright (C) 2009-2010, Tiki Web Inteligente Ltda.
 * @requires jQuery 1.4.2 or latter
 *
 * $Id: application_controller_home.js 36 2010-07-13 21:54:05Z caio $
 */
Application.Controller.Home = (function($) {

    function index() {
        // Efeito hover coleção
        $('.home_colecao_list a').hover(function(){
            $(this).find('img').stop(false,false).animate({top: '0'}, 500, 'easeOutQuint');            
            $(this).find('.tit').stop(false,false).animate({height: '50px'}, 500, 'easeOutQuint');
        },function(){
            $(this).find('img').stop(false,false).animate({top: '-20px'}, 500, 'easeOutQuint');            
            $(this).find('.tit').stop(false,false).animate({height: '45px'}, 500, 'easeOutQuint');
        });
        
        //
        $('.home_portal_list a').hover(function(){
            $(this).find('img').stop(false,false).animate({
                top: '0',
                opacity: '0.25'
            }, 500, 'easeOutQuint');
            $(this).find('.saiba_mais').stop(false,false).animate({right: '0'}, 500, 'easeOutQuint');
            $(this).find('.tit').stop(false,false).animate({height: '45px'}, 500, 'easeOutQuint');
        },function(){
            $(this).find('img').stop(false,false).animate({
                top: '-20px',
                opacity: '1'
            }, 500, 'easeOutQuint');
            $(this).find('.saiba_mais').stop(false,false).animate({right: '-83px'}, 500, 'easeOutQuint');
            $(this).find('.tit').stop(false,false).animate({height: '40px'}, 500, 'easeOutQuint');
        });
        
        
        // Carrega os tweets
        $("#twitter").getTwitter({
            userName: "lialinecalcados",
            numTweets: 10,
            preloaderId: "twitter_preloader",
            loaderText: "Carregando tweets...",
            slideIn: false,
            showHeading: false,
            showProfileLink: false,
            onLoad: function() {
                setInterval(troca_tweet, 5000);
            }
        });
        
        // Função que troca o tweet exibido
        function troca_tweet(){
            $('#twitter_update_list li:first').fadeTo(300, 0, function(){
                $(this).slideUp(300);
            });
            
            setTimeout(function(){
                $('#twitter_update_list li:first').detach().attr('style','').appendTo('#twitter_update_list');
            }, 700);
        };
    }

    return { 'index': index };
})(jQuery);

