var marqueeArray = new Array();

function Marquee(obj1,obj2){
	this.HotNewsMarqueeDiv1 = obj1;
	this.HotNewsMarqueeDiv2 = obj2;
	this.marqueesHeight = 14;
	this.stopscroll = false;
	this.preTop = 0;
	this.currentTop = 0;
	this.stoptime = 0;
	
	this.init_srolltext = init_srolltext;
	this.scrollUp = scrollUp;
	this.setTimer = setTimer;
	this.setStopScroll = setStopScroll;
	
	var index = marqueeArray.length;
	marqueeArray[index] = this;	
	
	this.HotNewsMarqueeDiv1.scrollTop = 0;
	with(this.HotNewsMarqueeDiv1){
		style.width = 0;
		style.height = 14;
		style.overflowX = "visible";
		style.overflowY = "hidden";
		noWrap=true;
		onmouseover=new Function("marqueeArray[" + index + "].setStopScroll(true)");
		onmouseout=new Function("marqueeArray[" + index + "].setStopScroll(false)");
	}	
}			
			

function init_srolltext(){
  this.HotNewsMarqueeDiv2.innerHTML = "";
  this.HotNewsMarqueeDiv2.innerHTML += this.HotNewsMarqueeDiv1.innerHTML;
  this.HotNewsMarqueeDiv1.innerHTML = this.HotNewsMarqueeDiv2.innerHTML + this.HotNewsMarqueeDiv2.innerHTML;
  this.setTimer();
}

function setTimer(){
	var index = marqueeArray.length - 1;
	//marqueeArray[index] = this;
	setInterval("marqueeArray[" + index + "].scrollUp()",50);
}

function setStopScroll(flag){
	this.stopscroll = flag; 
}

function scrollUp(){
	if(this.stopscroll) return;
	
	this.currentTop += 1;
	if(this.currentTop == 14){
		this.stoptime   += 1;
		this.currentTop -= 1;
		if(this.stoptime == 50){
			this.currentTop = 0;
			this.stoptime = 0;
		}
	}
	else {
		this.preTop = this.HotNewsMarqueeDiv1.scrollTop;
		this.HotNewsMarqueeDiv1.scrollTop += 1;
		if(this.preTop == this.HotNewsMarqueeDiv1.scrollTop){
			this.HotNewsMarqueeDiv1.scrollTop = this.HotNewsMarqueeDiv2.offsetHeight - this.marqueesHeight;
			this.HotNewsMarqueeDiv1.scrollTop += 1;
		}
	}
}