// JavaScript Documentvar leftposition=10; // 브라우저 왼쪽과 스크롤 텍스트와의 거리
var topposition=0; // 브라우저 위쪽과 스크롤 텍스트와의 거리
var tickerwidth=208; // 테이블 가로크기
var tickerheight=10; // 테이블 세로크기
var tickerpadding=0; // 테이블과 글자사이 공간
var borderwidth=0; // 테이블 테두리 두께
var fnt="Verdana"; // 글자체
var fntsize=9; // 글자크기
var fntsizelastletter=10;
var fntcolor="000000"; // 글자색
var fntcolorlastletter="red";
var fntweight=4;
var backgroundcolor=""; // 배경색
var standstill=2000; // 완성된 글자가 보여지는 시간 (2000 = 2초)
var speed=40; // 작히는 속도 - 작을수록 빠르다
var i_substring=0;
var i_presubstring=0;
var i_message=0;
var messagecontent="";
var messagebackground="";
var messagepresubstring="";
var messageaftersubstring="";
fntweight=fntweight*100;

function initiateticker() {
	getmessagebackground()
	if (document.all) {	
		//document.all.ticker.style.posLeft=leftposition
		//document.all.ticker.style.posTop=topposition
		//document.all.tickerbg.style.posLeft=leftposition
		//document.all.tickerbg.style.posTop=topposition
		tickerbg.innerHTML=messagebackground;
		showticker();
	}
	if (document.layers) {
		document.tickerbg.document.write(messagebackground);
		document.tickerbg.document.close();
		//document.ticker.left=leftposition
		//document.ticker.top=topposition
		//document.tickerbg.left=leftposition
		//document.tickerbg.top=topposition
		showticker();
	}
}

function getmessagebackground() {
		messagebackground="<table border="+borderwidth+" width="+tickerwidth+" height="+tickerheight+"><tr><td valign=top bgcolor='"+backgroundcolor+"'>"
		messagebackground+="</td></tr></table>"
}

function getmessagecontent() {
		messagepresubstring=message[i_message].substring(0,i_presubstring)
		messageaftersubstring=message[i_message].substring(i_presubstring,i_substring)
		messagecontent="<table border=0 cellpadding="+tickerpadding+" width="+tickerwidth+" height="+tickerheight+"><tr><td valign=top>"
		messagecontent+="<span style='position:relative; font-family:"+fnt+";color:"+fntcolor+";font-size:"+fntsize+"pt;font-weight:"+fntweight+"'>"	
		messagecontent+="<a href='"+messagelink[i_message]+"' target='"+linktarget[i_message]+"'>"
		messagecontent+="<font color='"+fntcolor+"'>"
		messagecontent+=messagepresubstring
		messagecontent+="</font>"
		messagecontent+="</a>"
		messagecontent+="</span>"
		messagecontent+="<span style='position:relative; font-family:"+fnt+";color:"+fntcolor+";font-size:"+fntsizelastletter+"pt;font-weight:900'>"	
		messagecontent+="<a href='"+messagelink[i_message]+"' target='"+linktarget[i_message]+"'>"
		messagecontent+="<font color='"+fntcolor+"'>"
		messagecontent+=messageaftersubstring
		messagecontent+="</font>"
		messagecontent+="</a>"
		messagecontent+="</span>"
		messagecontent+="</td></tr></table>"
}

function showticker() {
	if (i_substring<=message[i_message].length-1) {
			i_substring++;
			i_presubstring=i_substring-1;
			if (i_presubstring<0) {i_presubstring00}
			getmessagecontent();
		if (document.all) {
			ticker.innerHTML=messagecontent;
			var timer=setTimeout("showticker()", speed);
		}
		if (document.layers) {
			document.ticker.document.write(messagecontent);
			document.ticker.document.close();
			var timer=setTimeout("showticker()", speed);
		}
	}
	else {
		clearTimeout(timer);
		var timer=setTimeout("changemessage()", standstill);
	}
}


function changemessage() {
	i_substring=0;
	i_presubstring=0;
	i_message++;
	if (i_message>message.length-1) {
		i_message=0;
	}
	showticker();
}


/*
var message=new Array();
var messagelink=new Array();
var linktarget=new Array();

message[0]="메시지1";
messagelink[0]="#";
linktarget[0]="_blank";


document.write('<DIV ID="tickerbg" style="position:absolute"></DIV>');
document.write('<DIV ID="ticker" style="position:absolute"></DIV>');
document.write('<DIV id="deletethisblock" style="position:absolute;top:10px;left:180px;"></DIV>');
*/
