//<![CDATA[

var mtickerEl = new Array();//전역변수
var mtickerElsum = 1; //initmTicker함수전체호출수-추가할때마다수정요함 - 전역변수로 수정함.

function initmTicker(mtickerContainer, mtickerContent, delay) {
	mtickerEl[mtickerEl.length] = mtickerContainer;
	var speed = 20; //스크롤속도-작을수록빠름
	//var mtickerElsum = 1; //initmTicker함수전체호출수-추가할때마다수정요함
	mtickerContainer.delay = delay/(speed/mtickerElsum); //mtickerEl.length를mtickerElsum로수정
	mtickerContainer.moveOffset = mtickerContainer.offsetHeight;//Safari만다른값.가끔될때도있음.
	mtickerContainer.count = 0;
	mtickerContainer.mtickerOver = false;
	mtickerContainer.cont = mtickerContent;
	mtickerContainer.cont.currentHeight = 0;
//	mtickerContainer.cont.innerHTML += mtickerContainer.cont.innerHTML;//컨텐츠복제해서2번렌더링..스크롤시만필요
	mtickerContainer.move = setInterval("movemTicker()", speed);
	for (var i=0; i<mtickerEl.length; i++) {
		mtickerEl[i].onmouseover = function() { this.mtickerOver=true; }
		mtickerEl[i].onmouseout = function() { this.mtickerOver=false; }
	}
}
function movemTicker() {//
	for (var i=0; i<mtickerEl.length; i++) {
		if (mtickerEl[i].cont.currentHeight % mtickerEl[i].moveOffset == 0 && mtickerEl[i].count < mtickerEl[i].delay) {
			if(!mtickerEl[i].mtickerOver) mtickerEl[i].count++;//mtickerOver가 false 일때 카운트증가시킨다
		} else {
			mtickerEl[i].count = 0;
			//mtickerEl[i].cont.currentHeight--;//한줄씩위로스크롤
			mtickerEl[i].cont.currentHeight -= mtickerEl[i].moveOffset;//스크롤안하고한줄씩로테이션
			if (mtickerEl[i].cont.currentHeight % (mtickerEl[i].cont.offsetHeight) == 0) {
				mtickerEl[i].cont.currentHeight = 0;
			}
			mtickerEl[i].cont.style.top = mtickerEl[i].cont.currentHeight + "px";
		}
//	var test = document.getElementById("test");//test
//	test.innerHTML =  mtickerEl[i].moveOffset +"  currentHeight="+mtickerEl[i].cont.currentHeight;//test
	}
}
function prevmTicker(as_mtickerElnum) {//이전한줄보기
	var mtickerElnum = as_mtickerElnum-1;	
	mtickerEl[mtickerElnum].count = 0;
	mtickerEl[mtickerElnum].cont.currentHeight+= mtickerEl[mtickerElnum].moveOffset;
	if (-mtickerEl[mtickerElnum].cont.currentHeight < 0) {
		mtickerEl[mtickerElnum].cont.currentHeight = mtickerEl[mtickerElnum].moveOffset-mtickerEl[mtickerElnum].cont.offsetHeight;
	}
	mtickerEl[mtickerElnum].cont.style.top = mtickerEl[mtickerElnum].cont.currentHeight + "px";
}
function nextmTicker(as_mtickerElnum) {//다음한줄보기
	var mtickerElnum = as_mtickerElnum-1;
	mtickerEl[mtickerElnum].count = 0;
	mtickerEl[mtickerElnum].cont.currentHeight-= mtickerEl[mtickerElnum].moveOffset;
	if (-mtickerEl[mtickerElnum].cont.currentHeight >= mtickerEl[mtickerElnum].cont.offsetHeight) {
		mtickerEl[mtickerElnum].cont.currentHeight = 0;
	}
	mtickerEl[mtickerElnum].cont.style.top = mtickerEl[mtickerElnum].cont.currentHeight + "px";
}

//]]>
