
//========================================================================================================================================
// DESC:  PrepScroll Function
// INFO:  Prepares Layer For Use
// USAGE: Pass Layer Name, Width, Top Style Setting and How Much of Layer To Display
// MISC:  None
//========================================================================================================================================

function PrepScroll( layername, width, top, windowSize ) {

	// Create Instance Of Object

		theLayer = new GetObject( layername );

	// The Width and Top Location of The Layer

	   theLayer.clipWidth = width +20;
	   theLayer.topper    = top;

	// Set How Much Of Layer To Display

	   theLayer.clipTop    = 0;
	   theLayer.clipBottom = windowSize;

   // Create ScrollTime Member

      theLayer.ScrollTime;

	if ( document.getElementById || document.all ) {

		theLayer.layerHeight = theLayer.obj.offsetHeight;
		theLayer.style.clip  = 'rect( ' + theLayer.clipTop + ' ' + theLayer.clipWidth + ' ' + theLayer.clipBottom + ' 0 )';

	}

	// Initilize Scroll Area To Top of Page

		theLayer.style.top = theLayer.topper;

}

//========================================================================================================================================

//========================================================================================================================================
// DESC:  PerformScroll Function
// INFO:  Scrolls The Layer
// USAGE: Pass Amount As Argument
// MISC:  None
//========================================================================================================================================

function PerformScroll( direction ) {

   // Set Scroll Speed Depending On Direction

      amount = ( direction == 'u' ) ? -2 : 2;

   // If End Of The Layer Has Been Found, Return To Caller

      if ( theLayer.clipTop + amount < 0 || theLayer.clipBottom + amount > theLayer.layerHeight )
         return;

   // Increase Layer Properties

      theLayer.clipTop    += amount;
      theLayer.clipBottom += amount;
      theLayer.topper     -= amount;

	if ( document.getElementById || document.all ) {

		theLayer.style.clip = 'rect( ' + theLayer.clipTop + ' ' + theLayer.clipWidth + ' ' + theLayer.clipBottom + ' 0 )';
		theLayer.style.top  = theLayer.topper;

	}

   // Create Dummy Copy of direction To Pass To Recursive Call In setTimeout

      dir = direction;

   // Set Timer To Re-Call Function Again To Continue Scroll

	   theLayer.scrollTime = setTimeout( 'PerformScroll( dir )', 20 );

}

//========================================================================================================================================

//========================================================================================================================================
// DESC:  StopScroll Function
// INFO:  Stops The Layer From Scrolling
// USAGE: None
// MISC:  None
//========================================================================================================================================

function StopScroll() {

	if ( theLayer.scrollTime )
		clearTimeout( theLayer.scrollTime );

}

//========================================================================================================================================