﻿ScrollItems = 0;
ScrollerHeight = 105;
TotalHeight = 0;
MaxHeight = 0;
ScrollOffset = 20;
ScrollSpeed = 1;
ScrollDelay = 50;
ScrollerStarted = false;
	
if (!document.getElementById) document.getElementById = document.all;

function InitScroller() {
    for (var i = 0; i < ScrollItems; i++) {
	    elm = document.getElementById ("ScrollItem" + i);
	    elm.style.top = (TotalHeight + ScrollOffset) + "px";
	    TotalHeight += elm.offsetHeight;
    }
		
    if (TotalHeight - MaxHeight < ScrollerHeight) TotalHeight += ScrollerHeight;
    StartScroller();
}
	
function ScrollUp () {
    for (var i = 0; i < ScrollItems; i++) {
	    elm = document.getElementById ("ScrollItem" + i);
	    y = parseInt (elm.style.top) - ScrollSpeed;
	    if (y < (ScrollOffset - elm.offsetHeight)) y += TotalHeight;
	    elm.style.top = y + "px";
    }
}
	
function StopScroller() {
    if (ScrollerStarted) {
	    clearInterval (ScrollTimer);
	    ScrollerStarted = false;
    }
}

function StartScroller() {
    if (!ScrollerStarted && ScrollItems > 0) {
	    ScrollTimer = window.setInterval ("ScrollUp()", ScrollDelay);
	    ScrollerStarted = true;
    }
}

