BUF = '';

var id1;
var id2;

a = b = file = "";
c = new Array();
home = mail = revinf = st_val = re = re_sw = no = 0;

function denkoh(mode) {
	re = 0;
	if (no > max) no = 0;
	if (no < 0) no = max;
	a = str[no].split(",");
	for (i=0; i<10; i++) c[i] = a[i];
	msg =  c[0];
	no++;

	if (a[1]) {
		document.denkoh_f.inf.style.background = a[1];
		document.denkoh_f.name.style.background = a[1];
	}
	else {
		document.denkoh_f.inf.style.background = def_background;
		document.denkoh_f.name.style.background = def_background;
	}

	if (a[2]) {
		document.denkoh_f.inf.style.color = a[2];
		document.denkoh_f.name.style.color = a[2];
	}
	else {
		document.denkoh_f.inf.style.color = def_color;
		document.denkoh_f.name.style.color = def_color;
	}
	tl = 0;
	telop();
}

function telop(){
	tl += 1;
	document.denkoh_f.inf.value=msg.substring(0,tl);
	if(tl <= msg.length && tl > 0) id1 = setTimeout("telop()",100);
	else id1 = setTimeout("del()",4000);
}

function del(){
	end = msg.length;
	msg=msg.substring(1,end);
	document.denkoh_f.inf.value = msg;
	if(end > 0) id2 = setTimeout("del()",100);
	else if (re == 0 && re_sw) { re_sw = 0; id2 = setTimeout("re_print()",1500); }
	else if(re) id2 = setTimeout("denkoh(1)",1500);
	else id2 = setTimeout("denkoh()",1500);
}

function re_print() {
	if (a[10] && ! re) {
		if (id1) clearTimeout(id1);
		if (id2) clearTimeout(id2);
		denkoh(1);
	}
	else if (re) {
		if (id1) clearTimeout(id1);
		if (id2) clearTimeout(id2);
		re = 0;
		denkoh();
	}
}

