
var marqueeArray = new Array();

function Marquee(obj1,obj2){

	this.icefable1 = obj1;
	this.icefable2 = obj2;
	this.marqueesHeight = 40;
	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.icefable1.scrollTop = 0;
	with(this.icefable1){
		style.width = 0;
		style.height = this.marqueesHeight;
		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.icefable2.innerHTML = "";
  this.icefable2.innerHTML += this.icefable1.innerHTML;
  this.icefable1.innerHTML = this.icefable2.innerHTML + this.icefable2.innerHTML;
  this.setTimer();
}

function setTimer(){
	var index = marqueeArray.length - 1;
	//marqueeArray[index] = this;
	setInterval("marqueeArray[" + index + "].scrollUp()",70);
}


function setStopScroll(flag){
	this.stopscroll = flag; 
}


function scrollUp(){
	if(this.stopscroll) return;
	
	this.currentTop += 1;
	if(this.currentTop == 20){
		this.stoptime   += 1;
		this.currentTop -= 1;
		if(this.stoptime == 50){
			this.currentTop = 0;
			this.stoptime = 0;
		}
	}
	else {
		this.preTop = this.icefable1.scrollTop;
		this.icefable1.scrollTop += 1;
		if(this.preTop == this.icefable1.scrollTop){
			this.icefable1.scrollTop = this.icefable2.offsetHeight - this.marqueesHeight;
			this.icefable1.scrollTop += 1;
		}
	}
}	  


