
function init_html() {
	init_pop('aspop','astatement');
	init_pop('abpop','aabout');
	var aTr,aTd;
	aTr = document.getElementById('ithumb');
	while (aTr) {
		if (aTr.nodeName == "#text") aTr = aTr.nextSibling;
		if (aTr.nodeName == "TR") break;
		aTr = aTr.firstChild;
	}
	if (!aTr) return;
	while (aTr) {
		if (aTr.nodeName == "TR") {
			aTd = aTr.firstChild;
			while (aTd) {
				if (aTd.nodeName == "TD") init_thumb(aTd);
				aTd = aTd.nextSibling;
			}
		}
		aTr = aTr.nextSibling;
	}
	document.onmouseover = hide_pop;
}

function init_pop(aPhrase,toPop) {
	var aSpan = document.getElementById(aPhrase);
	var aDiv = document.getElementById(toPop);
	aSpan.popDiv = aDiv;
	aSpan.onmouseover = show_text;
	aSpan.onmouseout = ignore_text;
	aDiv.popDiv = aDiv;
 	aDiv.onmouseover = keep_pop;
}

var popShowing = null;
var popWaiting = null;

function show_text(ev) {
	if (!ev) {ev = window.event}
	ev.cancelBubble = true;
	hide_pop(ev);
	popWaiting = this.popDiv;
	delayTimer = setTimeout(pop_text,200);
	return false;
}

function ignore_text(ev) {
	if (!delayTimer) return false;
	clearTimeout(delayTimer);
	popWaiting = null;
	return false;
}

function pop_text() {
	popShowing = popWaiting;
	popShowing.style.visibility="visible";
}

function keep_pop(ev) {
	if (!ev) {ev = window.event}
	ev.cancelBubble = true;
	return false;
}

function hide_pop(ev) {
	if (!ev) {ev = window.event}
	ev.cancelBubble = true;
	if (!popShowing) return false;
	popShowing.style.visibility="hidden";
	popShowing = null;
	return false;
}

var errCount = 3;

function init_thumb(aTd) {
	var anImg = aTd.firstChild;
	if (anImg.nodeName == "#text") anImg = anImg.nextSibling;
	anImg.onmouseover = show_image;
	anImg.onmouseout = ignore_show;
}

var delayTimer = null;
var newSrc = '';
var newTitle = '';

function show_image(ev) {
	if (newSrc == this.src) return;
	if (delayTimer) clearTimeout(delayTimer);
	newSrc = this.src;
	newTitle = this.alt;
	delayTimer = setTimeout(change_image,200);
}

function ignore_show(ev) {
	if (!delayTimer) return false;
	clearTimeout(delayTimer);
	newSrc = '';
	return false;
}

function change_image() {
	var anImg = document.getElementById('ifull');
	var aTitle = document.getElementById('ititle');
	anImg.src = newSrc;
	aTitle.firstChild.nodeValue = newTitle;
	delayTimer = null;
}

