var gOScrollInterval = null;
var gIScrollInterval = 10;
var gIScrollCurrent = 0;
var gSScrollDirection = "next";
var gIScrollMax;

function scroll_start()	{
  	if (gIScrollMax)	{
		gOScrollInterval = window.setInterval("scrollInterval()", gIScrollInterval * 1000);
	}
}

function scroll_stop()	{
	window.clearInterval(gOScrollInterval);
}

function scrollInterval()	{
  	if (!bIsComplete) return;
  	
	var sDirection;
  	
	if (gSScrollDirection == "next")	{
		if (gIScrollCurrent >= gIScrollMax)	{
			gSScrollDirection = "previous";
		}
	}
	else	{	// "previous"
		if (gIScrollCurrent <= 0)	{
			gSScrollDirection = "next";
		}
	}
	scrollFeature(gSScrollDirection);
}

// start scrolling automatically
addEvent(window, 'load', scroll_start);
