﻿function MarqueeUp(controlId,speed){
    var _this = this;
    this.id = controlId;
    this.speed = speed;
    this.scroll = function(){
        if(($(_this.id+'2').offsetHeight - $(_this.id).scrollTop) <= 0){
            $(_this.id).scrollTop -= $(_this.id+'1').offsetHeight;
        }else{
            $(_this.id).scrollTop ++;
        }
    }
    this.init = function(){
        $(_this.id+'2').innerHTML = $(_this.id+'1').innerHTML;
        _this.timer = setInterval(_this.scroll,speed);
        $(_this.id).onmouseover = function(){
            clearInterval(_this.timer);
        }
        $(_this.id).onmouseout = function(){
            _this.timer = setInterval(_this.scroll,speed);
        }
    }
    this.init();
}
function MarqueeLeft(controlId,speed){
    var _this = this;
    this.id = controlId;
    this.speed = speed;
    this.scroll = function(){
        if(($(_this.id+'2').offsetWidth - $(_this.id).scrollLeft) <= 0){
            $(_this.id).scrollLeft -= $(_this.id+'1').offsetWidth;
        }else{
            $(_this.id).scrollLeft ++;
        }
    }
    this.init = function(){
        $(_this.id+'2').innerHTML = $(_this.id+'1').innerHTML;
        _this.timer = setInterval(_this.scroll,speed);
        $(_this.id).onmouseover = function(){
            clearInterval(_this.timer);
        }
        $(_this.id).onmouseout = function(){
            _this.timer = setInterval(_this.scroll,speed);
        }
    }
    this.init();
}
function $(ele){
    return document.getElementById(ele);
}