$(document).ready(function() {
  
  // ------ Homepage Stage Slideshow
  $('#stage').append('<div id="stagearrow"></div>');
  
	$('#stageslideshow').cycle({
    width: '945',
    height: '399',
    fx: 'fade',
    timeout: 7000,
    speed: '500',
    pager:  '#stagenav',
    pagerAnchorBuilder: function(idx, slide) {
      return '#stagenav li:eq(' + idx + ') a';
    },
    before: function(){
      var idx = $('#stageslideshow>div').index($(this));
      $('#stagearrow').animate({top: $('#stagenav li:eq(' + idx + ')').position().top + 5}, 500);
    }
  });

  $('#stageslideshow div').css('visibility', 'visible');

  // Twitter Feed Slideshow
  $("#twitter ul").cycle({
    cleartype: 1
  });
  
  /*
  $("li a[href='http://www.twofuturesproject.org']").after('<a href="#video" id="launch2futvideo" rel="#overlay" class="button-launch" style="margin-left: 20px;">Watch the Video We Made</a>');
  $('body').append('<div class="simple_overlay" id="overlay" style="width: 785px; height: 336px;"><div class="contentWrap"></div></div>');
  
  $('#launch2futvideo[rel]').overlay({
    onLoad: function() {
      $('#homepage-slideshow').cycle('pause');
    },
    onClose: function() {
      setTimeout(function(){$('#homepage-slideshow').cycle('resume');}, 1000);
    },
    onBeforeLoad: function() {
      var wrap = this.getContent().find(".contentWrap");
      wrap.css({width: '100%', height: '100%'});
      wrap.flashembed({
       src: 'flash/2futplayer.swf',
       bgcolor: '#535353'
      });
    } 
  });
  */
  
});
