<!--
// 2007-7-27
function Marquee(){

	//定义一些常用而且要经常用到的变量
	this.contaner="contaner1";
	this.contanerWidth=530;
	this.contanerHeight=96;
	this.style="";
	this.content=new Array();
	this.contentId=0;
	this.marqueeInterval=new Array(); 
	this.marqueeHeight=0;
	this.delay=5000;
//	this.instance="instance1";
//	this.id="ID_"+(""+Math.random()).substr(10);
	this.id=arguments[0];
	eval(this.id+"=this;");

	//接下来的是定义一些要使用到的函数
	this.initMarquee=function() {
		var str=this.content[0];
		document.write('<div id="'+this.contaner+'" style="overflow:hidden;width:'+this.contanerWidth+'px;height:'+this.contanerHeight+'px;'+this.style+'" onmouseover="'+this.id+'.mouseover()" onmouseout="'+this.id+'.mouseout()"><div>'+str+'</div></div>');
		if(this.content.length<=1){this.content[1]=this.content[0]}
		this.contaner=document.getElementById(this.contaner);
		this.contentId++;
		this.marqueeInterval[0]=setInterval(this.id+".startMarquee()",this.delay);
	}

	this.mouseover=function () {
		if(this.marqueeInterval[0]){
			clearInterval(this.marqueeInterval[0]);
		}
	}

	this.mouseout=function () {
		this.marqueeInterval[0]=setInterval(this.id+".startMarquee()",this.delay);
	}

	this.startMarquee=function () {
		var str=this.content[this.contentId];
		this.contentId++;
		if(this.contentId>=this.content.length) this.contentId=0;
		if(this.contaner.childNodes.length==1) {
			var nextLine=document.createElement('div');
			nextLine.innerHTML=str;
			this.contaner.appendChild(nextLine);
		} else {
			this.contaner.childNodes[0].innerHTML=str;
			this.contaner.appendChild(this.contaner.childNodes[0]);
			this.contaner.scrollTop=0;
		}
		clearInterval(this.marqueeInterval[1]);
		this.marqueeInterval[1]=setInterval(this.id+".scrollMarquee()",10);
	}

	this.scrollMarquee=function () {
		this.contaner.scrollTop++;
		if(this.contaner.scrollTop%this.marqueeHeight==(this.marqueeHeight-0)){
			clearInterval(this.marqueeInterval[1]);
		}
	}

}
//-->

