﻿/* News feed animations */
// feedTickerInterval comes from the host page

$(document).ready(function(){    
	var maxHeight = 0;
	var current = $("#newsfeed div:first");
	do
	{
		if(current.height() > maxHeight)
			maxHeight = current.height();
		current = current.next();
	}
	while(current.length>0)
	
    $("#newsfeed").css("height",maxHeight);
    //alert(maxHeight);
    
	$("#newsfeed > div").hide();
	//$("#newsfeed > div:first").slideDown(700);
	$("#newsfeed > div:first").fadeIn(700);
	//$("#newsfeed>div.first").animate({opacity: 0},700);
	setTimeout(newsfeedtick, feedTickerInterval);
});

newsfeedtick = function()
{
	var active = $("#newsfeed > div:visible");
	//active.slideUp(700);
	//active.fadeOut(500);
	active.animate({opacity: "hide",height:"0px"},700);
	
	var sibling = active.next();
	if(sibling.length)
		sibling.fadeIn(700);//sibling.slideDown(700);
	else
		$("#newsfeed > div:first").fadeIn(700);
		//$("#newsfeed > div:first").slideDown(700);
			
	setTimeout(newsfeedtick, feedTickerInterval);
}