﻿//<!--
// Speed 0-10, px to move
var scrollSpeed = 1;
var currentSpeed = scrollSpeed;
var initialDelay = 2000;  // 2 seconds
var scrollDiv = null;
var direction = -1;

function InitializeScroller() {
    scrollDiv = document.all ? document.all.scrollPanel : document.getElementById("scrollPanel");
    scrollDiv.style.top = "0px";
    initHeight = parseInt(scrollDiv.style.height);
    scrollDiv.onmouseover = function() { currentSpeed = 0 };
    scrollDiv.onmouseout = function() { currentSpeed = scrollSpeed };
    setTimeout("GetDataHeight()", initialDelay);
}

function GetDataHeight() {
    theLength = scrollDiv.offsetHeight;
    if (theLength == 0) {
        setTimeout("GetDataHeight()", 40);
    } else {
    ScrollDiv();
    }
}

function ScrollDiv() {
    scrollDiv.style.top = parseInt(scrollDiv.style.top) + (currentSpeed * direction) + "px";
    if (parseInt(scrollDiv.style.top) < (theLength - parseInt(scrollDiv.parentNode.clientHeight)) * -1) {
        direction = 1;
        setTimeout("ScrollDiv()", initialDelay);
    } else if (parseInt(scrollDiv.style.top) >= 0) {
        direction = -1;
        setTimeout("ScrollDiv()", initialDelay);
    } else {
        setTimeout("ScrollDiv()", 40);
    }
}
//-->
