marquee.prototype = {
	init : function(){
		this.initdelay = 2000;
		this.speed = 1;
		this.pause = 1;
		this.copyspeed = this.speed;
		this.actualheight = '';
		this.el = getElement("vmarquee");
		if(this.el==null){
			setTimeout(this.init.bind(this),40);
			return;
		}
		o = this;
		Event.observe($("vmarquee"), 'mouseover', function(){o.copyspeed=0;});  
		Event.observe($("vmarquee"), 'mouseout', function(){o.copyspeed=o.speed;});  
		this.el.style.top = 0;
		this.cont = getElement("marqueecontainer");
		this.height = this.cont.offsetHeight;
		this.actualheight = this.el.offsetHeight;
		if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
			this.el.style.height=marqueeheight+"px"
			this.el.style.overflow="scroll";
			return;
		}
		setTimeout(this.load.bind(this),this.initdelay);
	},
	
	load : function(){
		this.interval = setInterval(this.scroll.bind(this),40);
	},
	
	scroll : function(){
		if (parseInt(this.el.style.top)>(this.actualheight*(-1)+1)){
			this.el.style.top = parseInt(this.el.style.top)-this.copyspeed+"px";
		} else {
			this.el.style.top = parseInt(this.height)+1+"px";
		}
	}
}

function marquee(){
	this.init();
}

dom.addLoad("m = new marquee();");
