// JavaScript Document
 var news_exists = false;
   
   
   var steuerung;
   var y_pos_news=0;
   var y_steps_news=145;
   var y_pos_scroller=0;
 
 
 function autoscroll_down(){
	   	$('n_down').fireEvent('alt',$('n_down'),0);
		
   }

window.addEvent('domready', function() {
   
  
   
   
 
     
   function scroll_up(pos,steps){
	   pos = pos-steps;	
	   if (pos<0){pos=0;}
	   return pos;
   }
   
   function scroll_down(pos,steps,divheightscroll,divheight){
	   tmp = pos+divheight;
	   if (tmp<divheightscroll){
	   		pos = pos+steps;
	   }
	   return pos;
   }
   
  
   
    
   
   
   
   
   
   try{
	  var myFx_news = new Fx.Scroll('box_news_sc_content');
      
	  
	  
	 

	  news_exists = true;
   }
   catch(err){
	   news_exists = false;
   };
   
   
   if (news_exists == true){
	    $('n_up').addEvent('click', function() {
		   clearInterval(steuerung);
		   y_pos_news=scroll_up(y_pos_news,y_steps_news);
		   myFx_news.start(0,y_pos_news);
		});
		 
	   $('n_down').addEvent('click', function() {
		  clearInterval(steuerung);
		    size=$('box_news_sc_content').getScrollSize();
			y_pos_scroller=size.y;
		   size2=$('box_news_sc_content').getSize();
		   
		   
		  if((y_pos_news+y_steps_news)>=y_pos_scroller){
			  	//myFx_news.start(0,0);
				y_pos_news=scroll_up(0,y_pos_scroller);
		   		myFx_news.start(0,0);
		  }
		  else
		  {
			  	y_pos_news=scroll_down(y_pos_news,y_steps_news,size.y,size2.y);		  
		   		myFx_news.start(0,y_pos_news);
		  }
		   
		});
	   
	   $('n_down').addEvent('alt', function() {
		    size=$('box_news_sc_content').getScrollSize();
			y_pos_scroller=size.y;
		   size2=$('box_news_sc_content').getSize();
		   
		   
		  if((y_pos_news+y_steps_news)>=y_pos_scroller){
			  	//myFx_news.start(0,0);
				y_pos_news=scroll_up(0,y_pos_scroller);
		   		myFx_news.start(0,0);
		  }
		  else
		  {
			  	y_pos_news=scroll_down(y_pos_news,y_steps_news,size.y,size2.y);		  
		   		myFx_news.start(0,y_pos_news);
		  }
		   
		});
	   
	 
	  steuerung = setInterval('autoscroll_down()', 4000);
   }
   
   
  

	   

   
   


  



});

