
scrollVertical.prototype.scrollArea=null;
scrollVertical.prototype.scrollMsg=null;
scrollVertical.prototype.unitHeight=0;
scrollVertical.prototype.msgHeight=0;
scrollVertical.prototype.copyMsg=null;
scrollVertical.prototype.scrollValue=0;
scrollVertical.prototype.scrollHeight=0;
scrollVertical.prototype.isStop=true;
scrollVertical.prototype.isPause=false;
scrollVertical.prototype.scrollTimer=null;
scrollVertical.prototype.speed=2000;
scrollVertical.prototype.isMoz=function ()
{
	return navigator.userAgent.toLowerCase().indexOf('gecko')>0;
	
};
scrollVertical.prototype.play=function (o)
{
	var s_msg=o.scrollMsg;
	var c_msg=o.copyMsg;
	var s_area=o.scrollArea;
	var msg_h=o.msgHeight;
	var anim=function ()
	{
		if(o.scrollTimer)clearTimeout(o.scrollTimer);
		if(o.isPause)
		{
			o.scrollTimer=setTimeout(anim,10);
			return ;
			
		}
		if(msg_h-o.scrollValue<=0)
		{
			o.scrollValue=0;
			
		}else 
		{
			o.scrollValue+=1;
			o.scrollHeight+=1;
			
		}
		if(o.isMoz)
		{
			s_area.scrollTop=o.scrollValue;
			
		}else 
		{
			s_msg.style.top=-1*o.scrollValue+"px";
			c_msg.style.top=(msg_h-o.scrollValue)+"px";
			
		}
		if(o.scrollHeight%s_area.offsetHeight==0)
		{
			o.scrollTimer=setTimeout(anim,o.speed);
			
		}else 
		{
			o.scrollTimer=setTimeout(anim,10);
			
		}
	};
	anim();
	
};
function scrollVertical(disp,msg,tg,th)
{
	if(typeof(disp)=='string')
	{
		this.scrollArea=document.getElementById(disp);
		
	}else 
	{
		this.scrollArea=disp;
		
	}
	if(typeof(msg)=='string')
	{
		this.scrollMsg=document.getElementById(msg);
		
	}else 
	{
		this.scrollMsg=msg;
		
	}
	var s_msg=this.scrollMsg;
	var s_area=this.scrollArea;
	if(!tg)var tg='li';
	//alert(s_msg.innerHTML);
	this.unitHeight=parseInt(th);
	//this.unitHeight=s_msg.getElementsByTagName(tg)[0].offsetHeight+parseInt(th);
	//this.unitHeight=this.unitHeight==parseInt(th)?this.unitHeight+46:this.unitHeight;
	//alert(this.unitHeight);
	this.msgHeight=this.unitHeight*s_msg.getElementsByTagName(tg).length;
	//alert(s_msg.getElementsByTagName(tg).length);

	s_msg.style.position="absolute";
	s_msg.style.top=0;
	s_msg.style.left=0;
	s_msg.style.width='100%';
	//s_msg.style.height=this.msgHeight+"px";
	var copydiv=document.createElement('div');
	copydiv.id=s_area.id+"_copymsgid";
	copydiv.innerHTML=s_msg.innerHTML;
	copydiv.style.height=this.msgHeight+"px";
	s_area.appendChild(copydiv);
	//alert(s_area.innerHTML);
	copydiv.style.position="absolute";
	copydiv.style.top=this.msgHeight+"px";
	copydiv.style.left=0;
    copydiv.style.width='100%';
	this.copyMsg=copydiv;
	this.play(this);
	
}
