$(document).ready(function() {
	$("#mid_section .tweets ul li").first().next().addClass("alt"); 
	$("#right .tweets ul li").first().next().addClass("alt"); 
	
	$("#video_data .table_wrap").hide();
	$("#video_data p a").click(function(e) {
		e.preventDefault();
		$("#video_data .table_wrap").slideToggle('slow');
	});
	
	// activate homepage slider
  	rotatePics(1);
});


// homepage image fader
function rotatePics(currentPhoto) {
  var numberOfPhotos = $('#slider ul li').length;
  currentPhoto = currentPhoto % numberOfPhotos;
	
  $('#slider ul li').eq(currentPhoto).fadeOut(function() {
		// re-order the z-index
    $('#slider ul li').each(function(i) {
      $(this).css(
        'zIndex', ((numberOfPhotos - i) + currentPhoto) % numberOfPhotos
      );
    });
    $(this).show();
    setTimeout(function() {rotatePics(++currentPhoto);}, 4000);
  });
}
