jQuery.fn.scrollBlock = function(settings) {
	settings = jQuery.extend({
		blockHeight: 500,
		blockVisibleHeight: 200,
		scrollSpeed: "normal",
		scrollStep: 150
	}, settings);
	return this.each(function(i){
		$(".news_items",this).css("height",settings.blockVisibleHeight+"px");
		$(".news_items", this).css("overflow","hidden");
		$(".news_items", this).css("position","relative");
		$(".container", this).css("left","0px");
		$(".container", this).css("top","0px");
		$(".container", this).css("position","relative");

		$(".next a",this).click(function() {
			if (animating == false) {
				thisParent = $(this).parent().parent().parent();

				// On vérifie si l'on est pas en bas
				if ((settings.blockHeight + parseInt($(".container",thisParent).css("top")) - settings.blockVisibleHeight) == 0)
					return false;

				animating = true;
				// On calcul la position du scroll
				animate = parseInt($(".container",thisParent).css("top")) - settings.scrollStep;
				if (-animate > settings.blockHeight - settings.blockVisibleHeight)
					animate = -(settings.blockHeight - settings.blockVisibleHeight);

				//animate = -(blockHeight + parseInt(jQuery(".container",thisParent).css("top")) - 220);
				jQuery(".container",thisParent).animate({top: animate}, "slow", function() {
					jQuery(this).css("top",animate);
					animating = false;
				});
			}
			return false;
		});

		$(".prev a",this).click(function() {
			if (animating == false) {
				thisParent = $(this).parent().parent().parent();
				
				// On vérifie si l'on est pas en haut
				if (parseInt($(".container",thisParent).css("top")) == 0)
					return false;

				animating = true;
				// On calcul la position du scroll
				animate = parseInt($(".container",thisParent).css("top")) + settings.scrollStep;
				if (animate > 0)
					animate = 0;

				jQuery(".container",thisParent).animate({top: animate}, "slow", function() {
					jQuery(this).css("top",animate);
					animating = false;
				});
			}
			return false;
		});
	});
};