﻿
function VerticalScroller(varName, elemID, height, speed, html) {
    this.varName = varName;
    this.elemID = elemID;
    this.sheight = height;    
    this.sspeed = speed;
    this.resumesspeed = this.sspeed;
    this.htmlContent = html;
}

VerticalScroller.prototype.start = function() {        
    if (document.all) 
        this.iemarquee(this.elemID);
	else if (document.getElementById)
		this.ns6marquee(document.getElementById(this.elemID));
}

VerticalScroller.prototype.iemarquee = function(whichdiv) {
    this.iediv=eval(whichdiv);
	//this.sheight += 50;
	this.iediv.style.pixelTop=this.sheight;
	if (this.htmlContent)
	    this.iediv.innerHTML = this.htmlContent;
	    
	this.sizeup=this.iediv.offsetHeight;
	this.ieslide();
}

VerticalScroller.prototype.ieslide = function() {
    if (this.iediv.style.pixelTop>=this.sizeup*(-1)){
		this.iediv.style.pixelTop-=this.sspeed;
		window.setTimeout(this.varName+".ieslide();", 100);
	}
	else{
		this.iediv.style.pixelTop=this.sheight;
		eval(this.varName+".ieslide();");		
	}
}

VerticalScroller.prototype.ns6marquee = function(whichdiv) {
    this.ns6div=eval(whichdiv);
	//this.sheight += 50;
	this.ns6div.style.top=this.sheight + "px";
	if (this.htmlContent)	    
	    this.ns6div.innerHTML=this.htmlContent;
	this.sizeup=this.ns6div.offsetHeight;
	this.ns6slide();
}

VerticalScroller.prototype.ns6slide = function() {
    if (parseInt(this.ns6div.style.top)>=this.sizeup*(-1)){
		var theTop = parseInt(this.ns6div.style.top)-this.sspeed;
		this.ns6div.style.top = theTop + "px";
		window.setTimeout(this.varName+".ns6slide();", 100);
	}
	else {
		this.ns6div.style.top = this.sheight + "px";
		eval(this.varName+".ns6slide();");		
	}
}