﻿function MarqueeObject(container, scrolled) {
    var framesPerSec = 30;
    var scrollAmountInit = 1;
    var scrollAmount = scrollAmountInit;
    var freq = (1 / framesPerSec) * 1000;

    var heightOffset = container.clientHeight;
    var scrolledHeight = scrolled.clientHeight;

    this.ScrollTick = function () {
        var topNum = scrolled.style.top.replace("px", "") * 1;
        scrolled.style.top = (topNum - scrollAmount) + "px";
        //zero scroller
        if (Math.abs(topNum) <= (scrolledHeight)) return;
        scrolled.style.top = heightOffset + "px";
    }

    this.InitScroll = function () {

        scrolled.style.top = heightOffset - 150 + "px";
        scrolled.style.visibility = "visible";
    }

    container.onmouseover = function () {
        //do stop
        scrollAmount = 0;
    }

    container.onmouseout = function () {
        //do continue
        scrollAmount = scrollAmountInit;
    }

    this.InitScroll();

    //clearInterval(myInt);
    var myInt = setInterval(this.ScrollTick, freq);
}


