﻿var count=0;
var x=0;
var timeOutVal=3*1000;
var original_timeOutVal=timeOutVal;

document.write('<div id="ticker"></div>');

function setTicker() {
	if (!msgs[count]) return;
	
	if (x == msgs[count].length) {
		document.getElementById("ticker").innerHTML='<span>Artikel terbaru: <span><a href="' + msg_url[count] + '">' +  msgs[count] + '</a>';
	} else {
		var tmp=msgs[count].substring(0,x);
		document.getElementById("ticker").innerHTML='<span>Artikel terbaru: <span><a href="' + msg_url[count] + '">' +  tmp + '</a>';
	}

	if(x==msgs[count].length) {
		setTimeout("setTicker()", timeOutVal);
		count++;
		x=0;
	} else {
		x++;
		setTimeout("setTicker()", 5);
	}
	if (count >= msgs.length) {
		count = 0;
	}
}

function setDelay() {
	timeOutVal = 10000000000000;
	count--;
}

function reset() {
	timeOutVal = original_timeOutVal;
	setTicker();
}

setTicker();