function abbrInit() {
	if (!document.getElementsByTagName) return;
    if (arguments.callee.done) return;
    arguments.callee.done = true;
	var el = getElementsByClassName('abbr');
	var t;
	if (el.length == 0) return
	for (var i = 0; i < el.length; i++) {
		t = el[i].innerHTML.split(' ');
		for (var j = 0; j < t.length; j++) t[j] = '<span style="margin-left: 1px;">' + t[j] + '</span>';
		el[i].innerHTML = t.join(' ');
		t = el[i].getElementsByTagName('SPAN');
		for (j = 0; j < t.length; j++) {
			t[j].setAttribute('abbr-title', el[i].getAttribute('title'));
			t[j].onclick = abbrShowTT;
		}
		el[i].setAttribute('title', '');
	}
	document.onclick = new Function('if (abbrCur) { abbrHideTT(); }');
}

if (document.addEventListener) document.addEventListener("DOMContentLoaded", abbrInit, null);
var abbrOldhandler = window.onload
window.onload = (typeof abbrOldhandler == "function") ? function() { abbrOldhandler(); abbrInit(); } : abbrInit

function abbrShowTT(e) {
	var e = e || window.event;
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();

	abbrCur = true;
	
	var x = getRelLeft(this) - 260 + this.offsetWidth,
		y = getRelTop(this) + this.offsetHeight + 3

	$('bcontent-abbr').innerHTML = this.getAttribute('abbr-title')

	var h = (document.documentElement && document.documentElement.scrollTop) ? document.documentElement.scrollTop : document.body.scrollTop
	h += getBodyHeight()
	if (y + $('balloon-abbr').offsetHeight + 70 > h) y = y - $('balloon-abbr').offsetHeight - 25;
	
	$('balloon-abbr').style.left = x + 'px';
	$('balloon-abbr').style.top = y + 'px';
	$('balloon-abbr').style.visibility = 'visible';
	$('shadow').style.width = 360 + 'px'
	$('shadow').style.height = $('balloon-abbr').offsetHeight + 40 + 'px'
	$('shmiddle').style.height = $('balloon-abbr').offsetHeight - 20 + 'px'
	$('shadow').style.left = x - 18 + 'px';
	$('shadow').style.top = y - 18 + 'px';
	$('shadow').style.visibility = 'visible';
	
}

function abbrHideTT() {
	abbrCur = false;
	$('shadow').style.visibility = 'hidden';
	$('shadow').style.cursor = ''; 
	$('balloon-abbr').style.visibility = 'hidden';
}

var abbrTM, abbrCur = false;

