/* 	div#scroller->class()
	suspect code by zwischenbilanz */

scroller = function (outdiv, innerdiv, scrollspeed)
{
	this.outdiv_id 		= outdiv || 'main_content';
	this.innerdiv_id 	= innerdiv || 'maincontent';
	this.outdiv_height 	= document.getElementById(this.outdiv_id).offsetHeight;
	this.innerdiv_height= document.getElementById(this.innerdiv_id).offsetHeight;
	this.innerdiv_top 	= parseInt(document.getElementById(this.innerdiv_id).offsetTop);
	this.scrollspeed 	= scrollspeed || 1000;
	this.mustscroll		= false;

	this.init	=	function ()
	{ this.mustscroll =(this.innerdiv_height > this.outdiv_height) ? true : false; }
	
	this.scroll =	function(scrolltype)
	{
		scrolltype = (scrolltype == 'up') ? "scroller.up();" : "scroller.down();";
		document.getElementById(this.innerdiv_id).timer = window.setInterval(scrolltype,20);
	}
	
	this.stop	=	function()
	{
    document.images["pfeilhoch"].src = 'bilder/pfeil_hoch.gif' ;
    document.images["pfeilrunter"].src = 'bilder/pfeil_runter.gif' ;
		window.clearInterval(document.getElementById(this.innerdiv_id).timer);
	}

	this.down		=	function()
	{

     //document.getElementById('pfeilhoch').src='pfeil_hoch_over.gif' ;
     document.images["pfeilrunter"].src = 'bilder/pfeil_runter_over.gif' ;

    if (this.mustscroll == true && this.innerdiv_top > (this.outdiv_height - this.innerdiv_height))
		{
			this.innerdiv_top -= this.scrollspeed;
			document.getElementById(this.innerdiv_id).style.top = this.innerdiv_top+'px';
		}
	
	}

	this.up	=	function()
	{
   // document.getElementById('pfeilhoch').src='pfeil_hoch.gif' ;
    document.images["pfeilhoch"].src = 'bilder/pfeil_hoch_over.gif' ;


		if (this.mustscroll == true && this.innerdiv_top < 0)
		{
			this.innerdiv_top += this.scrollspeed;
			document.getElementById(this.innerdiv_id).style.top = this.innerdiv_top+'px';
		}
	}
	
}

window.onload = function()
{

 if (document.layers)  {
      scroller = new scroller('main_content','maincontent',5);
    }
   else if (document.all)  {
        scroller = new scroller('main_content','maincontent',5);
       }
   else if (document.getElementById)    {
        scroller = new scroller('main_content','maincontent',5);
        }





	//scroller = new scroller('main_content','maincontent',5);
	scroller.init();
}
