﻿<!--
scrollheight = 30 ;		//卷軸高
lineNum = 1; 
boardheight = scrollheight * lineNum;	//跑馬燈高
//scrollwidth=500;		//跑馬燈寬
scrollTimeOut = 15;		//移動時間
scrollStopTime = 300	//停留時間 值愈小停留愈短

doScroll = true			//是否要跑
scrollCountTime = 0;	//目前時間
offSet = scrollheight;	//偏移量
startSetp = 0;
var RunTime; //控制元件

//啟動
function MsgStart(Obj) {
	var thisSc=document.getElementById(Obj);
	thisSc.style.width = "400px" //scrollwidth + "px";
	thisSc.style.height = boardheight + "px";
	thisSc.style.overflowX = "hidden";
	thisSc.style.overflowY = "hidden";
	thisSc.scrollTop = 0
	RunTime = setInterval("MsgPlay('" + Obj + "')",scrollTimeOut);
}

//持續播放
function MsgPlay(Obj) {
	var thisSc = document.getElementById(Obj);
	if (doScroll == false) return
	offSet ++; 
	if (offSet == scrollheight + 1) {
		scrollCountTime ++ 
		offSet -- 
		if (scrollCountTime == scrollStopTime) {
			offSet = 0
			scrollCountTime = 0
		}
	}else {
		startSetp = thisSc.scrollTop + (scrollheight * lineNum);
		thisSc.scrollTop ++
		if (startSetp == thisSc.scrollTop + (scrollheight * lineNum)) {
			thisSc.scrollTop = scrollheight * (lineNum-1)
			thisSc.scrollTop ++ 
		}
	}
	
}

//停止播放
function MsgStop(Obj) {
	window.clearInterval(RunTime);
}

//繼續播放
function MsgRun(Obj) {
	RunTime = setInterval("MsgPlay('" + Obj + "')",scrollTimeOut);
}
//-->
