/**
 * scrolla
 *
 */
$(document).ready(function () {

	jQuery.easing.def = "easeOutCirc";

	var cont_h = $('#news').height();
	var page_h = $('.singleNews').height();	
	var scro_h = ((cont_h*1) - 15)/2;
	
	var counter = 0;
	var ini_top = 0;
		
	if(page_h > cont_h){
		$('#pagescroller-u').css("display","block");
		$('#pagescroller-d').css("display","block");
	}
	
	
	$('#pagescroller-u').hover(
  		function () {
    		$(this).css("background-position","left bottom");
  		}, 
  		function () {
    		$(this).css("background-position","left top");
  		}
	);
	
	$('#pagescroller-d').hover(
  		function () {
    		$(this).css("background-position","left bottom");
  		}, 
  		function () {
    		$(this).css("background-position","left top");
  		}
	);

	
	$('#pagescroller-d').click(function(){
		
		if(((counter * scro_h*-1)+scro_h+scro_h) > page_h){
			//counter = 0;
		}else{
		
			counter = counter - 1;
		}
		
		var top_m = counter * scro_h;
		
		$('.singleNews').animate({
			marginTop: top_m + "px"	
		}, 1000,'swing', function() {}); 		
		
	});
	
	
	
	
	$('#pagescroller-u').click(function(){
				
		if(counter >= 0){
			counter = 0;
		}else{
			counter = counter + 1;
		}
				
		var top_m = counter * scro_h;
		
		$('.singleNews').animate({
			marginTop: top_m + "px"	
		}, 1000,'swing', function() {});

		
	});
	
});
