/* 
<div id="demo" style="overflow:hidden; height:94px; padding-left:10px;">
   <div id="demo1">
	{显示内容}
   </div>
   <div id="demo2"></div>
</div>
*/
var upMarqueeObject = function(key){
    var _key;
    _key = key;
	this.speed = 30;
	this.pobj = null;
	this.cobj1 = null;
	this.cobj2 = null;
	this.varInterval = 0;
	this.marquee = function(){
	    if(this.pobj.scrollTop >= this.cobj1.offsetHeight)
		{
			this.pobj.scrollTop = 0;
	    }
		else{
			this.pobj.scrollTop++
		}
	}
	this.play = function(){
		this.varInterval = setInterval("upMarquee.keys['"+_key+"'].marquee();",this.speed);
	}
	this.stop = function(){
		clearInterval(this.varInterval);
	}
	this.init = function(){
//	    if(this.cobj1.clientHeight<this.pobj.clientHeight){
//	        this.cobj1.style.height = this.cobj2.style.height = this.pobj.clientHeight+"px";
//	    }
	    this.cobj2.innerHTML = this.cobj1.innerHTML;
	    this.play();
	}
}

var upMarquee = {
	keys:[],
	add:function(key,pobjId,cobj1Id,cobj2Id){
		var obj = new upMarqueeObject(key);
		obj.pobj = document.getElementById(pobjId);
		obj.cobj1 = document.getElementById(cobj1Id);
		obj.cobj2 = document.getElementById(cobj2Id);
		obj.pobj.onmouseover = function(){
			upMarquee.keys[key].stop();
		}
		obj.pobj.onmouseout = function(){
			upMarquee.keys[key].play();
		}
		upMarquee.keys[key]=obj;
		upMarquee.keys[key].init();
	}
}
