$(document).ready(function(){
		$('body').addClass('hasJS');
		
		var $items=$('#news_inner .news_article').length;
		var $item_height=51;
		var $height=($items-2)*parseInt('-'+($item_height));
		
		
		$('#up_button').each(function(){
			var $this = $(this);
			var $hd = $('p', $this);
			var $bt = $('<img style="cursor:pointer;" src="../images/up.png" onmouseover="this.src=\'../images/up_on.png\'" onmouseout="this.src=\'../images/up.png\'" alt="Scroll Up" />');
			
			if ($items > 3){
				$bt.click(function(){
					var $pos = parseInt($('#news_inner').css('top'));
					var $new_pos = $pos+51+'px';
					if (parseInt($new_pos) > 0){$new_pos='0px';}
					if ($pos != $new_pos){$('#news_inner').animate({'top':$new_pos},500);};
				});
			}
			$bt.prependTo($hd);
		});
		
		$('#down_button').each(function(){
			var $this = $(this);
			var $hd = $('p', $this);
			var $bt = $('<img style="cursor:pointer;" src="../images/down.png" onmouseover="this.src=\'../images/down_on.png\'" onmouseout="this.src=\'../images/down.png\'" alt="Scroll Down" />');
			
			if ($items > 3){
				$bt.click(function(){
					var $pos = parseInt($('#news_inner').css('top'));
					var $new_pos = $pos-51+'px';
					if (parseInt($new_pos) != ($height)){$('#news_inner').animate({'top':$new_pos},500);}
				});
			}
			$bt.prependTo($hd);
		});
		
		
		var $items1=$('#events_inner .events_article').length;
		var $item_height1=51;
		var $height1=($items1-2)*parseInt('-'+($item_height1));
		
		
		$('#up_button1').each(function(){
			var $this1 = $(this);
			var $hd1 = $('p', $this1);
			var $bt1 = $('<img style="cursor:pointer;" src="../images/up.png" onmouseover="this.src=\'../images/up_on.png\'" onmouseout="this.src=\'../images/up.png\'" alt="Scroll Up" />');
			
			if ($items1 > 3){
				$bt1.click(function(){
					var $pos1 = parseInt($('#events_inner').css('top'));
					var $new_pos1 = $pos1+51+'px';
					if (parseInt($new_pos1) > 0){$new_pos1='0px';}
					if ($pos1 != $new_pos1){$('#events_inner').animate({'top':$new_pos1},500);};
				});
			}
			$bt1.prependTo($hd1);
		});
		
		$('#down_button1').each(function(){
			var $this1 = $(this);
			var $hd1 = $('p', $this1);
			var $bt1 = $('<img style="cursor:pointer;" src="../images/down.png" onmouseover="this.src=\'../images/down_on.png\'" onmouseout="this.src=\'../images/down.png\'" alt="Scroll Down" />');
			
			if ($items1 > 3){
				$bt1.click(function(){
					var $pos1 = parseInt($('#events_inner').css('top'));
					var $new_pos1 = $pos1-51+'px';
					if (parseInt($new_pos1) != ($height1)){$('#events_inner').animate({'top':$new_pos1},500);}
				});
			}
			$bt1.prependTo($hd1);
		});
	});