// JavaScript Document
function FEHint( paraObj , __root , __newId )
{
	FEUIBasic.inherits(this,arguments)
	var _super = this.superObj ;
	this.superObj = null ;
	
	this.showHint = _showHint ;
	this.closeHint = _closeHint ;
	this.reConfig = _reConfig ;
	
//_hint方法用来显示信息的DIV	
	var _hintObj ;
//由于该DIV隔一段时间该自动消失,此变量用来捕捉用以实现此效果的setTimeout所返还的ID
	var _hintTimerId ;
	
	var justShow = false ;
/*
###pending work
select等遮盖bug待用iframe方式解决
_showHint方法应增加一个参数,指示在OBJ的左右上下侧的其中之一显示,而非固定
另应声明一个属性,有上述参数设置默认值
pending work###
*/	
	
	main( paraObj , __root , __newId ) ;
	function main( paraObj , __root , __newId )
	{
		_hintObj = null ;
		_hintTimerId = -1 ;
		
		_reConfig( paraObj ) ;
		
		document.attachEvent( "onclick" , bodyClick ) ;
	}
	
	function _showHint( s , obj , t , paraPosObj )
	{
/*
在某个对象附近弹出一个层来提示相关信息,该层将在发生点击动作或一段时间后自动消失
参数s是提示信息的内容,可以为HTML代码
参数obj是一个用来定位的DOM对象,信息将在该对象正上方显示.
参数t为该层的自动消失时间,如果不指定,则默认为3秒后消失
*/
		_closeHint() ;
		if( ( typeof obj ) == "undefined" || obj == null )
		{
			obj = event.srcElement ;
		}
		if( ( typeof t ) == "undefined" || t == null )
		{
			t = 3000 ;
		}
//得到定位对象的绝对坐标
		var posObj = __root.getDOMHandler().getPosition( obj ) ;
	
//开始显示,并实现在若干时间后自动消失
		if( _hintObj == null )
		{
			_hintObj = document.createElement( "DIV" ) ;
			_hintObj.innerHTML = s ;
			_hintObj.style.visibility = "hidden" ;
			_hintObj.style.border = "1px solid gray" ;
			_hintObj.style.padding = "10px" ;
			_hintObj.style.textAlign = "left" ;
			
			document.body.appendChild( _hintObj ) ;

			_hintObj.style.fontSize = 14 ;
			_hintObj.style.position = "absolute" ;
//_hintObj.style.width = _hintObj.offsetWidth + 1 ;
//为什么指定了width就不显示了?
			
			var theScrollObj = __root.getElementByGloablScrollbar() ;
			
			var _hintObjX = posObj.x + parseInt( obj.offsetWidth ) + 5 ;
			var _hintObjY = posObj.y ;
			if( __root.getTopDivExistability() != null )
			{
				_hintObjY = _hintObjY - parseInt( theScrollObj.scrollTop ) ;
				_hintObjX = _hintObjX - parseInt( theScrollObj.scrollLeft ) ;
			}
			if( _hintObjX <= 0 )
			{
				_hintObjX = posObj.x + parseInt( obj.offsetWidth ) ;
			}
			if( typeof paraPosObj != "undefined" )
			{
				_hintObj.style.top = ( _hintObjY + paraPosObj.y ) + "px" ;
				_hintObj.style.left = ( _hintObjX + paraPosObj.x ) + "px" ;
			}
			else
			{
				_hintObj.style.top = _hintObjY + "px" ;
				_hintObj.style.left = _hintObjX + "px" ;
			}
			_hintObj.style.zIndex = 10000000 ;
			_hintObj.style.filter = "alpha(opacity=95)" ;
			_hintObj.style.backgroundColor = "#F8F6F7" ;
			_hintObj.style.color = "#070908" ;
			_hintObj.onblur = function ()
			{
				_hintObj.removeNode( true ) ;
				_hintObj = null ;
			}

			
			
			_hintObj.style.visibility = "visible" ;
			//_hintObj.scrollIntoView( true ) ;
			_hintTimerId = setTimeout( _closeHint , t ) ;
			
			justShow = true ;
			setTimeout( bodyUp , 5 ) ;
		}
	}
	
	function _closeHint()
	{
/*
关闭提示信息
*/
		if( _hintObj != null )
		{
			if( _hintTimerId >= 0 )
			{
				clearTimeout( _hintTimerId )
				_hintTimerId = -1 ;
			}
			_hintObj.removeNode( true ) ;
			_hintObj = null ;
		}
	}
	
	function _reConfig( paraObj )
	{
/*
重置配置参数
*/	
	}
	
	function bodyClick()
	{
		if( justShow )
		{
			return ;	
		}
		setTimeout( _closeHint , 5 ) ;
	}

	function bodyUp()
	{
		justShow = false ;
	}
}
