/*
	创建：2009-06-18
	作者：Aoeiuv.Com
	说明：显示Title属性
	注意：此js必须放到页面的最后面，否则需要的事件可能会被其他js挂起
*/
var ghOldOnMouseOver = document.onmouseover;
var ghOldOnMouseUp = document.onmouseup;
var dyHint = null;

function _chn(s)
{
	var c,n,i,k;
	c = '';
	n = s.length;
	for (i=0;i<n;i++)
	{
		if (s.charCodeAt(i) == 10) {
			c += '<br>';
		}
		else
			c += s.charAt(i);
	}
	return c;
}

// 取代系统的提示信息
function ToShowTitle(tt){
	if ((tt == null) || (tt == '')) return;
	dyHint = document.createElement('DIV');
	dyHint.style.cssText = 'left:0;top:0;visibility:hidden; position:absolute;z-index:99999;background-color: #F4F7FB; border: 1px #000000 solid; font-size: 12px; padding:4px; overflow-x:hidden;overflow-y:hidden; text-align:left; line-height:18px;';
	dyHint._Type = 0;
	dyHint._tWait = 200;
	dyHint._tStep = 50;
	dyHint._tStop = 7000
	dyHint._tOver = 100;
	dyHint._CurH = 0;
	dyHint._StepOpen = 8;
	dyHint._StepClose = 8;
	dyHint._ScrollOpen = false;
	dyHint._ScrollClose = true;
	dyHint._TimeOut = 0;
	dyHint._From = null;
	document.body.insertBefore(dyHint,document.body.firstChild);

	var	ttt = tt.replace(/[\r\n]/g,'<br>');
	//t = _chn(t);

	with (dyHint)
	{
		innerHTML = ttt;
		_Title = tt;
		_From = event.srcElement;
		_From.title = '';
		var l = event.clientX+document.body.scrollLeft+12;
		var t = event.clientY+document.body.scrollTop+15;
		var l1 = document.body.clientWidth + document.body.scrollLeft - 10;
		var t1 = document.body.clientHeight + document.body.scrollTop - 10;
		if (l + scrollWidth > l1) l = l1 - scrollWidth;
		if (t + scrollHeight > t1) t = t1 - scrollHeight;
		_CurH = 0;
		_Type = 1;
		with (style){
			height = 0;
			pixelLeft = l;
			pixelTop = t;
		}
		_TimeOut =	window.setTimeout('ShowTitleTimer()',_tWait);
	}
}

function GetTitle(){
	var t = event.srcElement;
	if ((t == null) || (t == '')) return true;
	ToShowTitle(t.title);
	if (ghOldOnMouseOver != null) 
		return ghOldOnMouseOver;
	else
		return true;
}

function ShowTitleTimer(){
	with (dyHint){
		var n = scrollHeight;
		switch (_Type){
			case 1:
				style.visibility = 'visible';
				_Type = 2;
			case 2:
				if ((_CurH += _StepOpen) > n) _CurH = n;
				if (_ScrollOpen) scrollTop = n - _CurH;
				if ((style.height = _CurH) == n) 
				{
					_Type = 3;
					_TimeOut = window.setTimeout('ShowTitleTimer()',_tStop);
				}else
					_TimeOut = window.setTimeout('ShowTitleTimer()',_tStep);
				break;
			case 3:
				if ((_CurH -= _StepClose) < 0) _CurH = 0;
				if (_ScrollClose) scrollTop = n - _CurH;
				if ((style.height = _CurH) == 0)
					StopTitle();
				else
					_TimeOut = window.setTimeout('ShowTitleTimer()',_tOver);
				break;
		}
	}
}

function StopTitle(){
	if (null == dyHint) return;
	with (dyHint)
	{
		clearTimeout(_TimeOut);
		_TimeOut = 0;
		_Type = 0;
		style.visibility = 'hidden';
		if (_From == null) return;
		_From.title = _Title;
		_From = null
	}
	dyHint.removeNode(true);
	dyHint = null;
	if (ghOldOnMouseUp != null) 
		return ghOldOnMouseUp;
	else
		return true;
}

function ShowTitleStar(){
	document.onmouseover = GetTitle;
	document.onmouseout = StopTitle;
}
ShowTitleStar();