/**
 * Ticker
 */
var TickerRotation={
	init:function(){
		this.meldung=$('#ticker div');
		this.prev=-1;
		this.cur=-1;
		this.playing=true;
		this.play();
	},
	play:function(){
		var _this=this;
		if(!this.playing) return false;
		this.step(1);
		this.tm=setTimeout(function(){_this.play()},10000);
	},
	step:function(num){
		this.prev=this.cur;
		this.cur+=num;
		if(this.cur>=this.meldung.length) this.cur=0;
		if(this.cur<0) this.cur=this.meldung.length-1;
		if(this.prev>0) $(this.meldung[this.prev]).fadeOut('slow');
		$(this.meldung[this.cur]).fadeIn('slow');
		return false;
	}
}


// init when document is ready
$(document).ready(function(e){
	TickerRotation.init();
});
