var scroller_STOPPED = 0;
var scroller_RUNNING = 1;

function scroller_ScrollText(name, width, height){
    this.texts = new Array();
    this.currentText = -1;
    this.name = name;
    this.width = width;
    this.height = height;
    this.mode = scroller_STOPPED;
    this.top = -height;
}

function scroller_addScrollText(scrolltext, divId){
    scrolltext.texts[scrolltext.texts.length] = scroller_getScrollDiv(divId);
}

function scroller_startScroller(scrolltext){
    scrolltext.mode = scroller_RUNNING;
        setTimeout("scroller_runScroller(" + scrolltext.name + ")", 33);
}

function scroller_runScroller(scrolltext){
    if(scrolltext.mode == scroller_RUNNING){
        scroller_processScroller(scrolltext);
    }
}

function scroller_processScroller(scrolltext){
    
    if(scrolltext.texts.length > 0){
        if(scrolltext.currentText == -1){
            scrolltext.currentText = 0;
            scrolltext.top = scrolltext.height;
            scrolltext.texts[scrolltext.currentText].visibility="visible";
        }
    
        if(scrolltext.top < -scrolltext.texts[scrolltext.currentText].height){
            scrolltext.texts[scrolltext.currentText].visibility="hidden";
        
            scrolltext.top = scrolltext.height;
            
            scrolltext.currentText ++;

            if(scrolltext.currentText >= scrolltext.texts.length){
                scrolltext.currentText = 0;
            }
            scrolltext.texts[scrolltext.currentText].visibility="visible";
        }
    
        scrolltext.texts[scrolltext.currentText].top=scrolltext.top;
    
        scrolltext.top -=1;
        if(scrolltext.top < -scrolltext.texts[scrolltext.currentText].height){
            setTimeout("scroller_runScroller(" + scrolltext.name + ")", 2000);
        }else{
            setTimeout("scroller_runScroller(" + scrolltext.name + ")", 33);
        }
    }
    
}

function scroller_getScrollDiv(divId){
    var divTag, browserUsed;
    
    browserUsed = scroller_getBrowser();
    
    if(browserUsed == "ie" || browserUsed == "n6"){
        var temp;
        if(browserUsed == "ie"){
temp = eval("document.all." + divId);
        }else{
temp = document.getElementById(divId);
        }
        if(temp != null){
divTag = temp.style;
        }
    }else if(browserUsed == "n4"){
        divTag = eval("document." + divId);
    }
    return divTag;
}

function scroller_getBrowser(){
    var browserUsed;
    if((navigator.appName + "" + navigator.appVersion).indexOf("Netscape5.0") > -1){
        browserUsed = "n6";
    }else if(navigator.appName=="Netscape"){
        browserUsed = "n4";
    }else{
        browserUsed = "ie";
    }
    return browserUsed;
}

