// Freestyler Breaking News Widget

// Custom transition...
Effect.Transitions.slowstop = function(pos) {
  return 1-Math.pow(0.5,20*pos);
}

var fs_banner = Class.create();
fs_banner.prototype = {
	initialize: function(sourceId,outputId) {
	    // Where we are soucing the headlines themselves
		this.sourceId=sourceId;
		// Where we want to output them
		this.outputId=outputId;
		// Headline class...
		this.headlineClass="bs_banner";
		//this.headlinePos=0;
		this.headlinesArray=new Array;
		this.headlinesArray=document.getElementsByClassName(this.headlineClass,this.sourceId);

		this.headlinePos=Math.round(Math.random()*(this.headlinesArray.length - 1));

	},

	animateIn: function() {
		new Effect.Appear(this.outputId);
	},
	animate: function() {
		headline=this.headlinesArray[this.headlinePos].innerHTML;
		// new Effect.Fade(this.outputId,{afterFinish:this.updateOutput.bind(this)});
		this.updateOutput();
  	},
  	updateOutput: function() {
		Element.update(this.outputId,headline);
		//this.animateIn();
	}
};
