//==============================================================================//
// Configure here                                                               //
//==============================================================================//

var pause 		= -700;		// Pause. The lower, the longer.
var interval 	= 5;		// The timer interval. Note: a very low interval 
				// (like:don't use 1 or 2) may decrease system performance. 

//==============================================================================//
// End configuring variables                                                    //
//==============================================================================//
var steps 		= 1;		// Amount of steps to scroll each interval.
var sync 		= -350; 	// counter to trigger the scroll and the pause.

function init_scrolling()
{
  var div = document.getElementById("scrollPage");

  x = div.childNodes[0].cloneNode(true); // Duplicate page1.
  div.appendChild(x);			 // Attach the duplicate to the bottom of the scrollPage div.
  scroll();				 // Start to scroll.
}

function scroll()
{
  var div = document.getElementById("scrollPage");

  if (sync > -1)
  {
    div.scrollTop += steps;
  }
  sync += steps;

  if (sync >= div.clientHeight)
  {
    sync = pause / steps;
  }

  var current_scroll = (div.scrollHeight - div.scrollTop) - div.clientHeight;

  if (current_scroll <= 0)
  {
    div.scrollTop = 0;
  }
  setTimeout("scroll()", interval);
}