(function() {
  var change_image, change_tweet, index, tweet_offset;
  tweet_offset = null;
  change_tweet = function() {
    var $first;
    $first = $('#twitter li:first-child');
    return $first.animate({
      opacity: 0,
      "margin-top": '-=' + tweet_offset
    }, 2000, function() {
      var $last;
      $last = $first.clone();
      $first.remove();
      $last.css({
        "margin-top": "0px",
        "opacity": 1
      });
      $('#twitter ul').append($last);
      return true;
    });
  };
  index = 0;
  change_image = function() {
    var $first, $next;
    index++;
    $first = $("#slider li.active");
    $next = $first.next();
    if (index === $("#slider li").length) {
      $next = $("#slider li:first-child");
      index = 0;
    }
    $first.hide(1000).removeClass("active");
    return $next.show(1000).addClass("active");
  };
  window.need('jquery-css-transform.js');
  window.need('rotate3Di.js');
  window.need('jquery.nivo.slider.pack.js');
  $(function() {
    var rotate_time;
    $("#twitter a,#socialmedia a").click(function(e) {
      return $(this).attr('target', '_blank');
    });
    tweet_offset = $("#twitter li").height() + parseInt($("#twitter li").css('padding-top'));
    setInterval(change_tweet, 5000);
    rotate_time = 350;
    $('#dots ul li').hover(function() {
      var $this;
      $this = $(this);
      return $this.find('div').stop().rotate3Di(180, rotate_time, {
        sideChange: function() {
          $(this).parent().find('.front').hide();
          return $(this).parent().find('.back').show();
        }
      });
    }, function() {
      var $this;
      $this = $(this);
      return $this.find('div').stop().rotate3Di(0, rotate_time, {
        sideChange: function() {
          $(this).parent().find('.front').show();
          return $(this).parent().find('.back').hide();
        }
      });
    });
    return $('#slider').nivoSlider({
      effect: 'random',
      pauseOnHover: true,
      pauseTime: 5000
    });
  });
}).call(this);

