$(function(){
    
    if($("#tweets").size() > 0) {
        function rotateTweets() {
            $("#tweets li:first").fadeOut(500, function() {
               $("#tweets").append($(this)); 
               $("#tweets li:first").width($("#tweets").width()).fadeIn(500);
            });
        }

        var tweetRotationInterval = setInterval(function(){ rotateTweets(); }, 7500 );
        $("#tweets li:first").width($("#tweets").width()).fadeIn(500);
        
        twttr.anywhere(function (T) {
            T("#tweets").hovercards();
        });
        
        $("#tweets")
            .mouseenter(function() { clearInterval(tweetRotationInterval); })
            .mouseleave(function() { clearInterval(tweetRotationInterval); tweetRotationInterval = setInterval(function(){ rotateTweets(); }, 7500 ); });
    }
    
});
