function cwScroll() {
	this.delay				= 3500;		//delay between msg scrolls. 3000=3 seconds.
	this.width				= 450;
	this.height				= 100;
	this.bgColor			= '';
	this.background			= '';			//set to '' if you don't wish to use a background image
	this.messages			= new Array();
	var num_msg				= 0;
	var scrollId			= parseInt(Math.random()*1000);
	eval("document.scroll"+scrollId+"=this");
	var i;
	var first_obj;
	var second_obj;
	

	this.addMessage			= function(txt) {
		this.messages[num_msg]=txt;
		num_msg++;
	}

	this.move				= function(whichdiv) {
		var myDiv	= document.getElementById(whichdiv);
		if (parseInt(myDiv.style.top)>0&&parseInt(myDiv.style.top)<=5){
			myDiv.style.top=0+"px";
			setTimeout("document.scroll"+scrollId+".move('"+whichdiv+"')",this.delay);
			setTimeout("document.scroll"+scrollId+".move2('second"+scrollId+"')",this.delay);
			return;
		}
		if (parseInt(myDiv.style.top)>=myDiv.offsetHeight*-1){
			myDiv.style.top=parseInt(myDiv.style.top)-5+"px";
			setTimeout("document.scroll"+scrollId+".move('"+whichdiv+"')",50);
		}
		else{
			myDiv.style.top=this.height+"px"
			myDiv.innerHTML=this.messages[i];
			if (i==this.messages.length-1)
				i=0;
			else
				i++;
		}
	}
	
	this.move2				= function(whichdiv) {
		var myDiv	= document.getElementById(whichdiv);
		if (parseInt(myDiv.style.top)>0&&parseInt(myDiv.style.top)<=5){
			myDiv.style.top=0+"px";
			setTimeout("document.scroll"+scrollId+".move2('"+whichdiv+"')",this.delay);
			setTimeout("document.scroll"+scrollId+".move('first"+scrollId+"')",this.delay);
			return;
		}
		if (parseInt(myDiv.style.top)>=myDiv.offsetHeight*-1){
			myDiv.style.top=parseInt(myDiv.style.top)-5+"px";
			setTimeout("document.scroll"+scrollId+".move2('second"+scrollId+"')",50);
		}
		else{
			myDiv.style.top=this.height+"px"
			myDiv.innerHTML=this.messages[i]
			if (i==this.messages.length-1)
				i=0;
			else
				i++;
		}
	}

	this.run 				= function() {
		document.writeln('<div id="main'+scrollId+'" style="margin:0px; position:relative;width:'+this.width+'px;height:'+this.height+'px;overflow:hidden;background-color:'+this.bgcolor+' ;background-image:url('+this.background+');z-index:0;">')
		document.writeln('<div style="position:absolute;width:'+this.width+'px;height:'+this.height+'px;clip:rect(0 '+this.width+'px '+this.height+'px 0);left:0px;top:0px;">')
		document.writeln('<div id="first'+scrollId+'" style="position:absolute;width:'+this.width+'px;left:0px;top:1px;">')
		document.write(this.messages[0])
		document.writeln('</div>')
		document.writeln('<div id="second'+scrollId+'" style="position:absolute;width:'+this.width+'px;left:0px;top:0px;visibility:hidden;">')
		document.write(this.messages[(this.messages.length==1)? 0 : 1])
		document.writeln('</div>')
		document.writeln('</div>')
		document.writeln('</div>')
		if(this.messages.length>1) {
			if (this.messages.length>2)
				i=2;
			else
				i=0;
			second_obj	= document.getElementById("second"+scrollId);
			this.move2("first"+scrollId);
			second_obj.style.top=this.height+"px";
			second_obj.style.visibility='visible';
		}
	}

}

