var BlogScroller = {
timer   : 4, // second
display : 1000,  // how many items displayed
interval: null,
animation: 1000, //milisecond

init: function() {
	if (!BlogScroller.interval) {
		$("#blog_scroller .wrapper").mouseover(function(){
			BlogScroller.stopScroll();
		}).mouseout(function(){
			BlogScroller.startScroll();
		})
		BlogScroller.RatingUpdate();
		BlogScroller.startScroll();
	}
},

RatingUpdate: function(){
		$(".wrapper .headline:first").addClass("next");
		var h = $(".wrapper .next").height();
		$(".wrapper .next").animate( { marginTop: -h}, BlogScroller.animation, function() {
		$(".wrapper .next").css("marginTop", 0);
		$(".wrapper .next").appendTo("#blog_scroller .wrapper");
		$(".wrapper .next").removeClass("next");
	});
},

startScroll: function() {
	if (!this.interval) {
		this.interval = setInterval("BlogScroller.RatingUpdate()", this.timer * 1000);
	}
},

stopScroll: function() {
	if (this.interval) {
			clearInterval(this.interval);
			this.interval = false;
		}
	}
};
$(BlogScroller.init);