// JavaScript Document
function FEUIBasic( __DOMObj , __root , __newId )
{
/*
###pending work
可能出现A控件触发B控件,可能出现的情况是:
1 如果A是原本可能自动消失的控件,如浮动面板,则B不结束,A不应自动结束
2 在程序员指定的情况下,如果A结束了,应自动将B也结束
pending work###
*/
	this.getObjById = _getObjById ;
	this.getObjListById = _getObjListById ;
	this.getRoot = _getRoot ;
	this.getMainObj = _getMainObj ;
	this.getParentObj = _getParentObj ;
	this.show = _show ;
	this.showOnly = _showOnly;
	this.hide = _hide ;
	this.restore = _restore ;
	this.setParentObjId = _setParentObjId ;
	this.getObjUsingState = _getObjUsingState ;
	this.getUIId = _getUIId ;
	this.getUIObjKey = _getUIObjKey ;
	this.AjaxSend = _AjaxSend ;
	this.AjaxTransaction = _AjaxTransaction ;
	this.dataBindTransaction = _dataBindTransaction ;
	this.reInit = _reInit ;
	this.closeSelf = _closeSelf ;
	this.end = _end ;

/*容器基类的相关方法*/
	this.appendContent = _appendContent ;
	this.apartContent = _apartContent ;
	this.getContentInfo = _getContentInfo ;
	this.getContentObj = _getContentObj ;
	this.getContentObjList = _getContentObjList ;
	this.minimize = _minimize ;
	this.maximize = _maximize ;
	this.revert = _revert ;
	this.addCTNArea = _addCTNArea ;
	this.removeCTNArea = _removeCTNArea ;
	this.showCTN = _showCTN ;
	this.hiddenCTN = _hiddenCTN ;

/*内容基类的相关方法*/
	this.appendToContent = _appendToContent ;
	this.apartFromContainer = _apartFromContainer ;	
	this.getAutoEndForApart = _getAutoEndForApart ;
	this.getAutoEndForEnd = _getAutoEndForEnd ;
	
	
	
	this.Ctn = null ;
	this.usingState = false ;
	
	var _this = this ;
	
	var _mainObj = null ;
	var _root = null ;
	var _UIObjKey = "" ;
	var _UIId = "" ;
	var _parentObj = null ;
	var _displayFlag = true ;
	var _CtnObjPool ;
	var _CtnContentPool ;
	var _defaultCtnKey ;
	var _CtnKeyPix ;
	var _onlyDefaultCtnFlag ;
//作为内容的对象
	var _contentObj ;
//拖动栏	
	var _titleBarObj ;
//关闭按钮	
	var _closeButton ;
//最小化按钮	
	var _minimizeButton ;
//最大化按钮	
	var _maximizeButton ;
//还原按钮	
	var _revertButton ;
//标记是否已经开始	
	var _beginMoveFlag ;
//初始化按住titleBar即进行拖动的功能	
	var _dragStart ;
//刚才的X坐标和Y坐标	
	var _justX , _justY ;
//当前容器是否有内容	
	var _hasContent ;
	
//有的时候,容器想显示的内容,只是一段简单的字符串_contentStr
	var _contentStr ;
//一个容器,当调用applyContent方法为其填充了内容的时候,如果_autoUsingState变量为真,则把对象的正在使用状态置为真
	var _autoUsingState ;
//一个容器,当调用apartContent方法分离内容的时候,如果_autoHidden 变量为真,则对象自动隐藏
	var _autoHidden ;
//一个容器,当调用apartContent方法分离内容的时候,如果_autoReinit 变量为真,则自动调用reinit方法
	var _autoReinit ;
//一个容器,当调用apartContent方法分离内容的时候,如果_autoEndForApart 变量为真,则销毁自己
	var _autoEndForApart ;
//一个内容,当调用其容器end方法时,如果_autoEndForEnd 变量为真,则也销毁自己(内容)
	var _autoEndForEnd ;

/*当执行show方法时将触发此事件*/
	this.onShow = function (){}
/*当执行hide方法时将触发此事件*/
	this.onHide = function (){}


/*容器类的相关事件*/
/*当执行maximize方法时触发此事件*/
	this.onMaximize = function (){}
/*当执行applyContent方法时触发此事件*/
	this.onApplyContent = function (){}
/*当执行apartContent方法时触发此事件*/
	this.onApartContent = function (){}

/*内容类的相关事件*/
/*当被容器类设为内容时触发*/	
	this.onAppendToContent = function (){}
/*当与容器类分离时触发*/
	this.onApartFromContainer = function (){}

	main( __DOMObj , __root , __newId ) ;
	function main( __DOMObj ,__root ,__newId )
	{
		_root = __root ;
		if( typeof _root != "object" || _root == null )
		{
			_root = null ;
			return ;	
		}
				
		_mainObj = _root.getOtherHandler().getVar( __DOMObj , null ) ;
		_UIObjKey = _root.getOtherHandler().getVar( __newId , "" ) ;
		_UIId = _root.getOtherHandler().getObjAttribute( __DOMObj , "UIClassName" , "" ) ;
		var parentObjId = _root.getOtherHandler().getObjAttribute( __DOMObj , "parentObjId" , null ) ;
		if( parentObjId != null )
		{
			_parentObj = document.getElementById( parentObjId ) ;
		}
		_displayFlag = true ;
		if( _mainObj != null && _mainObj.style.display =="none" )
		{
			_displayFlag = false ;
		}
		
		//_CtnObj = _this.getObjById( "content" ) ;
		_defaultCtnKey = "default";
		_CtnKeyPix = "$" ;
		_CtnObjPool = _root.getOtherHandler().getDictionary() ;
		_CtnContentPool = _root.getOtherHandler().getDictionary() ;
		var ctnList = _getObjListById( "content" ) ;
		var defaultObjFlag = false ;
		var otherCtnObjFlag = false ;
		for( var i = 0 ; i < ctnList.length ; i++ )
		{
/*
将所有的显示区域对象加入到池中.
采用第一个未指明ctnKey的对象作为默认对象
第二个及第二个以上未指明ctnKey的对象,不会被加入到池中
如果指明的ctnKey发生重复,将采用第一个加入到池中,其它的不会被加入
*/
			var currentObj = ctnList[ i ] ;
			var newContentObj = getCTNContentObj() ;
			if( currentObj.getAttribute( "ctnKey" ) != null )
			{
				var currentKey = currentObj.getAttribute( "ctnKey" ) ;
				if( !_CtnObjPool.Exists( _CtnKeyPix+ currentKey ) )
				{
					_CtnObjPool.Add( _CtnKeyPix+ currentKey , currentObj ) ;
					_CtnContentPool.Add( _CtnKeyPix+ currentKey , newContentObj ) ;
					otherCtnObjFlag = true ;
				}
			}
			else
			{
				if( !defaultObjFlag )
				{
					defaultObjFlag = true ;
					_CtnObjPool.Add( _defaultCtnKey , currentObj ) ;
					_CtnContentPool.Add( _defaultCtnKey , newContentObj ) ;
				}
			}
		}
		if( defaultObjFlag && !otherCtnObjFlag )
		{
			_onlyDefaultCtnFlag = true ;
		}
		
		_titleBarObj = _this.getObjById( "titleBar" ) ;
		_closeButton = _this.getObjById( "closeButton" ) ;
		if( _closeButton != null )
		{
			_closeButton.onclick = function ()
			{
				_this.closeSelf() ;	
			}
		}
		_minimizeButton = _this.getObjById( "minimizeButton" ) ;
		if( _minimizeButton != null )
		{
			_minimizeButton.onclick = function ()
			{
				_this.minimize() ;	
			}
		}
		_maximizeButton = _this.getObjById( "maximizeButton" ) ;
		if( _maximizeButton != null )
		{
			_maximizeButton.onclick = function ()
			{
				_this.maximize() ;	
			}
		}
		_revertButton = _this.getObjById( "_revertButton" ) ;
		if( _revertButton != null )
		{
			_revertButton.onclick = function ()
			{
				_this.revert() ;	
			}
		}
		_autoUsingState = _root.getOtherHandler().parseBool(_root.getOtherHandler().getObjAttribute( __DOMObj , "autoUsingState" , "false" )) ;
		_autoHidden = _root.getOtherHandler().parseBool(_root.getOtherHandler().getObjAttribute( __DOMObj , "autoHidden" , "false" )) ;
		_autoReinit = _root.getOtherHandler().parseBool(_root.getOtherHandler().getObjAttribute( __DOMObj , "autoReinit" , "false" )) ;
		_autoEndForApart = _root.getOtherHandler().getObjAttribute( __DOMObj , "autoEndForApart" , "auto" ).toLowerCase() ;
		if( _autoEndForApart != "auto" && _autoEndForApart != "true" )
		{
			_autoEndForApart = "false" ;
		}
		_autoEndForEnd = _root.getOtherHandler().getObjAttribute( __DOMObj , "_autoEndForEnd" , "auto" ).toLowerCase() ;
		if( _autoEndForEnd != "auto" && _autoEndForEnd != "true" )
		{
			_autoEndForEnd = "false" ;
		}
		if( _titleBarObj != null )
		{
//初始化拖动所需要的程序
			initMainDown() ;
			with( __DOMObj.style )
			{
/*
###cross-browser
这里还应加上针对IE7和FF的写法,即直接使用position为fixed
cross-browser###
*/
				if( _autoHidden )
				{
					visibility = "hidden" ;
				}
				position = "absolute" ;
				zIndex = 1000 ;
				border1 = "#000000 solid 1px" ;//test
			}
			with( _titleBarObj.style )
			{
/*
###advice
待扩展
advice###
*/
			}
		}
		_beginMoveFlag = false ;
		_dragStart = false ;
		_hasContent = false ;
		_justX = 0 ;
		_justY = 0 ;
		_contentObj = null ;
		_contentStr = null ;
		
	}
	
	function _getObjById( _id )
	{
/*
根据Id,得到内部的DOM对象
参数_id:DOM对象的Id
*/
		if( _mainObj == null )
		{
			return null ;	
		}
		return _mainObj.all.item( _id , 0 ) ;
	}
	
	function _getObjListById( _id )
	{
/*
根据Id,得到内部的DOM对象的列表
参数_id:DOM对象的Id
*/
		if( _mainObj == null || _mainObj.all.item( _id , 0 ) == null )
		{
			return new Array() ; 
		}
		if( _mainObj.all.item( _id , 1 ) == null )
		{
			var list = new Array() ;
			list[ list.length ] = _mainObj.all.item( _id , 0 ) ;
			return list ;
		}
		return _mainObj.all.item( _id )
	}
	
	function _getRoot()
	{
/*
得到框架的引用
*/	
		return _root ;
	}
	
	function _getMainObj()
	{
/*
得到框架的引用
*/	
		return _mainObj ;
	}

	function _getContentInfo( key )
	{
		var key = _root.getOtherHandler().getVar( _key , null ) ;
		if( key == null )
		{
			key = _defaultCtnKey ;
		}
		else
		{
			key = _CtnKeyPix + key ;
		}
		var _CtnCentenObj = null ;
		if( _CtnContentPool.Exists( key ) )
		{
			_CtnCentenObj = _CtnContentPool.Item( key ) ;
		}
		if(  _CtnCentenObj == null )
		{
			return null ;	
		}
		if( !_CtnCentenObj.contentFlag || contentObj != null )
		{
			return null ;	
		}
//var newContentObj = { contentFlag:false , contentStr:null , contentObj:null , paraObj:null }
		var newContentObj = { key:key , contentObj:_CtnCentenObj , domObj:null , paraObj:null }
		if( ( typeof _CtnCentenObj.contentObj.getMainObj ) != "function" )
		{
			newContentObj.domObj = _CtnCentenObj.contentObj ;
		}
		else
		{
			newContentObj.domObj = _CtnCentenObj.getMainObj() ;
		}
	}
	
	function _getParentObj()
	{
		return _parentObj ;
	}


	function _show( __x , __y , _fixFlag )
	{
/*
显示主对象
*/
		var fixFlag = _root.getOtherHandler().getVar( _fixFlag , true ) ;
		if( ( typeof _mainObj.parentNode.tagName ) == "undefined" )
		{
//如果没在body树下
			if( fixFlag )
			{
				document.body.appendChild( _mainObj ) ;
			}
			else
			{
				_root.getElementByGloablScrollbar().appendChild( _mainObj ) ;
			}
		}
		
		var mainObj = _this.getMainObj() ;
		if( mainObj == null )
		{
			return ;	
		}
		
		var defaultVisibility = mainObj.style.visibility ;
		var defaultDisplay = mainObj.style.display ;

		//为了取位置和大小,设置visibility和display值
		mainObj.style.display = "" ;
		//mainObj.style.display = "inherit" ;
		mainObj.style.visibility = "hidden" ;
		
		
		//确定显示位置,如果是允许被拖动的对象,则要显示在屏幕的正中央
		//if( _titleBarObj != null )
		{
			//计算位置
			var _x , _y ;
			
			_x = parseInt( ( parseInt( window.screen.availWidth ) - parseInt( mainObj.offsetWidth ) ) / 2 ) ;
			if( _x < 0 )
			{
				_x = 0 ;	
			}
			var _height = parseInt( window.screen.availHeight ) ;
			if( window.screen.height == 768 )
			{/*奇怪,为什么要作这个调整,否则对不齐*/
				_height = 600 ;
			}
			_y = parseInt( ( _height - parseInt( mainObj.offsetHeight ) ) / 2 ) ;
			if( _y < 0 )
			{
				_y = 0 ;	
			}
			
			_x = _root.getOtherHandler().getVar( __x , _x ) ;
			_y = _root.getOtherHandler().getVar( __y , _y ) ;
//设置位置
			with( mainObj.style )
			{
				top = _y ;
				left = _x ;
			}
		}
		
//取位置和大小结束,恢复visibility和display的值
		mainObj.style.display = defaultDisplay ;
		mainObj.style.visibility = defaultVisibility ;
		
//显示,使容器可见
		_showOnly();
	}
	
	function _showOnly()
	{
//显示,使容器可见
		var mainObj = _this.getMainObj() ;
		mainObj.style.display = "" ;
		_displayFlag = true ;		
	}
	
	function _hide()
	{
/*
隐藏主对象
*/	
		var mainObj = _this.getMainObj() ;
		if( mainObj == null )
		{
			return ;	
		}
		mainObj.style.display = "none" ;
		_displayFlag = false ;
	}
	
	function _restore()
	{
/*
如果指明了原父对象,则还原其位置
*/
		if( _parentObj == null || _mainObj == null )
		{
			return ;
		}
		_parentObj.appendChild( _mainObj ) ;
	}
	
	function _setParentObjId( _obj )
	{
/*
指明了原父对象,即位置对像,以便特定情况下进行还原
参数_obj:指明的对象,也可以是Id的字符串		
*/
		if( ( typeof _obj ) == "object" )
		{
			_parentObj = _obj
		}
		else if( ( typeof _obj ) == "string" )
		{
			_parentObj = document.getElementById( _obj ) ;
		}
	}
	
	function _getObjUsingState()
	{
/*
指明对象是否正在使用中.
这一点对onlyOne类型的控件非常重要.
*/
		return _this.usingState ;
	}
	
	function _getUIId()
	{
/*
得到对象的元件在元件池中的Id
*/	
		return _UIId ;
	}
	
	function _getUIObjKey()
	{
/*
得到对象在实例池中的key
*/	
		return _UIObjKey ;
	}
	
	function _AjaxSend( _sendStr , _baseUrlKey , _url , _para , _flag )
	{
/*
Ajax申请数据。
由于Ajax申请是由框架自动执行,因此需要实现此方法,供子类调用.
*/
		if( _root != null )
		{
			_root.UIObjAjaxSend( _this , _sendStr , _baseUrlKey , _url , _para , _flag ) ;
		}
	}
	
	function _AjaxTransaction( _xmlData , _requestState , _para , _key )
	{
/*
暴露出一个接口,供调用.
由于Ajax申请是由框架自动执行,当申请结束后,系统自动调用此方法
###addvice
//待将来添加相应的代码
addvice###
*/
		_this.dataBindTransaction( _xmlData , _requestState , _para , _key ) ;
	}

	function _dataBindTransaction( _xmlData , _requestState , _para , _key )
	{
		
	}

	function _reInit()
	{
/*
暴露出一个接口,供调用.
当UI控件执行特定操作的时候,可能需要重置一些值,系统会自动调用此方法
*/
	}
	
	function _closeSelf( _flag )
	{
/*
关闭容器.如果容器是悬浮的窗口,则这个方法通常是有用的
*/
		if( _getRoot() != null )
		{
			_getRoot().removeUIObj( _getUIObjKey() , null , _flag ) ;	
		}
	}
	
	
	function _end( _flag )
	{
/*
暴露出一个接口,供调用
*/
		var endFlag = _root.getOtherHandler().getVar( _flag , null ) ;

		var list = _CtnObjPool.Keys() ;
		for( var i = 0 ; i < list.length ; i++ )
		{
			var key = list[ i ]
			var _CtnObj = _CtnObjPool.Item( key ) ;
			var _CtnCentenObj = _CtnContentPool.Item( key ) ;
	//			var newContentObj = { contentFlag:false , contentStr:null , contentObj:null , paraObj:null }
		
			if( _CtnCentenObj.contentFlag )
			{
				if( _CtnCentenObj.contentObj != null && ( typeof _CtnCentenObj.contentObj.apartContent ) == "function" )
				{
//如果是UI控件的话
					var selfEnd = false ;//默认值
					if( ( typeof _CtnCentenObj.contentObj.closeSelf ) == "function"  )
					{
//正常情况下,UI控件都会有这个方法,这么写只是保险起见
						if( ( typeof _CtnCentenObj.contentObj.getAutoEndForEnd ) == "function" && _CtnCentenObj.contentObj.getAutoEndForEnd() != "auto" )
						{
//先判断自定义属性
							selfEnd = root.getOtherHandler().parseBool( _CtnCentenObj.contentObj.getAutoEndForEnd() ) ;
						}
						else if( endFlag != null )
						{
//再判断参数
							selfEnd = endFlag ;
						}
						else
						{
							selfEnd = false ;//默认值
						}
						if( ( typeof _CtnCentenObj.contentObj.getAutoEndForApart ) == "function" && _CtnCentenObj.contentObj.getAutoEndForApart() == "true" )
						{
//如果设置了分离即自动结束,则不用调用自动销毁方法,因为已经在分离的时候被调用过了
							selfEnd = false ;
						}
					}
					_apartContent( key ) ;
					if( selfEnd )
					{
						_CtnCentenObj.contentObj.closeSelf( _flag ) ;
					}
				}
				else
				{
					_apartContent( key ) ;
				}
			}
		}


		_this = null ;
		if( _mainObj != null )
		{
			_mainObj.parentNode.removeChild( _mainObj ) ;
			_mainObj = null ;
		}
		_root = null ;
		_UIObjKey = null ;
		_UIId = null ;
		_parentObj = null ;
	}
	
	function _appendContent( _obj , paraObj , _key , _overwrite )
	{
/*
设置内容.
当显示过程结束,或您想更换显示内容的时候,必须手工调用apartContent方法分离容器与内容
置内容并不等同于显示,如果您想显示内容,还需要调用show方法
另外,也可以指定一个固定的字符串作为显示信息
参数_obj:作为内容的UI控件,或用于显示的字符串
*/
//如果未定义显示区域,则返回
// contentFlag:false , contentStr:null , contentObj:null , paraObj:null 
		var key = _root.getOtherHandler().getVar( _key , null ) ;
		var overwrite = _root.getOtherHandler().getVar( _overwrite , false ) ;
		if( key == null )
		{
			key = _defaultCtnKey ;
		}
		else
		{
			key = _CtnKeyPix + key ;
		}
		var _CtnObj = null ;
		var _CtnCentenObj = null ;
		if( _CtnObjPool.Exists( key ) && _CtnContentPool.Exists( key ) )
		{
			_CtnObj = _CtnObjPool.Item( key ) ;
			_CtnCentenObj = _CtnContentPool.Item( key ) ;
		}
		if( _CtnObj == null || _CtnCentenObj == null )
		{
			return ;	
		}
		
		if( _CtnCentenObj.contentFlag && !overwrite )
		{
			return ;	
		}
		_apartContent( key ) ;
		
		var _successFlag = false ;
/*如果传入的是简单的字符串,直接设置其innerHTML*/
		if( ( typeof _obj ) == "string" )
		{
			_CtnObj.innerHTML = _obj ;
//设置_contentObj引用该内容元件实例
//指明本容器当前已有内容
			_successFlag = true ;
			_CtnCentenObj.contentStr = _obj ;
			_CtnCentenObj.contentObj = null ;
		}
//如果是内容类型的元件实例
		else if( ( typeof _obj ) == "object" )
		{
			if( ( typeof _obj.appendToContent ) == "function" )
			{
/*调用内容元件的BeSetContent,使其完成那一部分的整合准备工作
并返回可作为实际内容的DOM对象(theTemp)*/
				var theTemp = _obj.appendToContent( _this ) ;
//将可作为实际内容的DOM对象移至本元件的内容区域
				if( theTemp != null && ( typeof theTemp ) == "object" )
				{
					_CtnObj.appendChild( theTemp ) ;
	//设置_contentObj引用该内容元件实例
	//指明本容器当前已有内容
					_successFlag = true ;
					_CtnCentenObj.contentStr = null ;
					_CtnCentenObj.contentObj = _obj ;
				}
			}
			else
			{
				if( _obj != null && ( typeof _obj ) == "object" )
				{
					_CtnObj.appendChild( _obj ) ;
	//设置_contentObj引用该内容元件实例
	//指明本容器当前已有内容
					_successFlag = true ;
					_CtnCentenObj.contentStr = null ;
					_CtnCentenObj.contentObj = _obj ;
				}
			}
		}
		
		if( _successFlag )
		{
			_CtnCentenObj.contentFlag = true ;
			_CtnCentenObj.paraObj = paraObj ;
		}
		
		if( _successFlag && _autoUsingState && _onlyDefaultCtnFlag )
		{
			_this.usingState = true ;
		}
	}
	
	function _apartContent( _key )
	{
/*
分离容器与内
容如果内容是个内容类,则调用其内容本身的方法执行内容方面的后续工作;
如果是个字符串,则将简单地执行清空
*/
		var key = _root.getOtherHandler().getVar( _key , null ) ;
		if( key == null )
		{
			key = _defaultCtnKey ;
		}
		else
		{
			key = _CtnKeyPix + key ;
		}
		var _CtnObj = null ;
		var _CtnCentenObj = null ;
		if( _CtnObjPool.Exists( key ) && _CtnContentPool.Exists( key ) )
		{
			_CtnObj = _CtnObjPool.Item( key ) ;
			_CtnCentenObj = _CtnContentPool.Item( key ) ;
		}
		if( _CtnObj == null || _CtnCentenObj == null || !_CtnCentenObj.contentFlag )
		{
			return ;	
		}
		
		if( _CtnCentenObj.contentStr != null )
		{
			_CtnObj.innerHTML = "" ;
		}
		else if( ( typeof _CtnCentenObj.contentObj ) == "object" )
		{
			if( ( typeof _CtnCentenObj.contentObj.apartFromContainer ) == "function" )
			{
				_CtnCentenObj.contentObj.apartFromContainer() ;
			}
			else
			{
				_CtnCentenObj.contentObj.parentNode.removeChild( _CtnCentenObj.contentObj ) ;
			}
			_CtnObj.innerHTML = "" ;
		}
		else
		{
			return ;	
		}
		
		_CtnCentenObj.contentFlag = false ;
		_CtnCentenObj.paraObj = null ;
		_CtnCentenObj.contentStr = null ;
		_CtnCentenObj.contentObj = null ;
		
		if( _onlyDefaultCtnFlag && _autoHidden )
		{
			_this.hide() ;
		}
		if( _onlyDefaultCtnFlag && !_hasContent && _autoUsingState )
		{
			_this.usingState = false ;
		}
		if( !_CtnCentenObj.contentFlag && _autoReinit && _onlyDefaultCtnFlag )
		{
			_this.reInit() ;
		}
		if( !_hasContent && _autoEndForApart == "true" && _onlyDefaultCtnFlag )
		{
			_this.end() ;
		}
	}
		
	
	function _getContentObj(_key)
	{
/*
得到内容对象
*/
		var key = _root.getOtherHandler().getVar( _key , null ) ;
		if( key == null )
		{
			key = _defaultCtnKey ;
		}
		else
		{
			key = _CtnKeyPix + key ;
		}
		if( _CtnContentPool.Exists( key ) )
		{
			var cObj = _CtnContentPool.Item( key ) ;
			if( !cObj.contentFlag )
			{
				return null ;	
			}
			if( cObj.contentStr != null )
			{
				return cObj.contentStr ;
			}
			return cObj.contentObj ;
		}
//{ contentFlag:false , contentStr:null , contentObj:null , paraObj:null } ;
		return null ;
	}
	
	function _getContentObjList()
	{
/*
得到内容对象的列表
*/
		
	}
	
	function _minimize()
	{
/*
最小化
*/
		if( _CtnObj != null )
		{
//隐藏内容区域
			_CtnObj.style.display = "none" ;
//隐藏最小化按钮
			_minimizeButton.style.display = "none" ;
//显示还原按钮
			_revertButton.style.display = "" ;
		}
	}
	
	function _maximize()
	{
/*
最大化
###pending work
//暂未实现
pending work###
*/
	}
	
	function _revert()
	{
/*
还原
*/
		if( _CtnObj != null )
		{
//显示内容区域
			_CtnObj.style.display = "" ;
//显示最小化按钮
			_minimizeButton.style.display = "" ;
//隐藏还原按钮
			_revertButton.style.display = "none" ;
		}
	}

	function _addCTNArea( _key , _obj , _display )
	{
		var key = _root.getOtherHandler().getVar( _key , "" ) ;
		var obj = _root.getOtherHandler().getVar( _obj , null ) ;
		var display = _root.getOtherHandler().getVar( _display , null ) ;

		if( key.trim() == "" || obj == null )
		{
			return false ;	
		}
		
		if( _CtnObjPool.Exists( _CtnKeyPix+ key ) )
		{
			return false ;
		}
		var newContentObj = getCTNContentObj() ;
		_CtnObjPool.Add( _CtnKeyPix+ key , obj ) ;
		_CtnContentPool.Add( _CtnKeyPix+ key , newContentObj ) ;
		
		if( display != null )
		{
			if( display )
			{
				obj.style.display = "" ;
			}
			else
			{
				obj.style.display = "none" ;
			}
		}
		return true ;
	}
	
	function _removeCTNArea( _key , _remove )
	{
		var key = _root.getOtherHandler().getVar( _key , "" ) ;
		var remove = _root.getOtherHandler().getVar( _remove , false ) ;
		if( key.trim() == "" )
		{
			return false;	
		}
		if( !_CtnObjPool.Exists( _CtnKeyPix+ key ) )
		{
			return false ;
		}
		
		_apartContent( key ) ;
		if( remove )
		{
			var obj = _CtnObjPool.Item( _CtnKeyPix+ key ) ;
			obj.parentNode.removeChild( obj ) ;
			obj = null ;
		}
		
		_CtnObjPool.Remove( _CtnKeyPix+ key ) ;
		_CtnContentPool.Remove( _CtnKeyPix+ key ) ;
		
	}
	
	function _showCTN( _key )
	{
		return __showCTN( _key , true ) ;
	}
	
	function _hiddenCTN( _key )
	{
		return __showCTN( _key , false ) ;
	}

	function __showCTN( _key , _type )
	{
		var type = _root.getOtherHandler().getVar( _type , true ) ;
		var key = _root.getOtherHandler().getVar( _key , null ) ;
		if( key == null )
		{
			key = _defaultCtnKey ;
		}
		else
		{
			key = _CtnKeyPix + key ;
		}
		if( !_CtnObjPool.Exists( key ) )
		{
			return false ;
		}
		var obj = _CtnObjPool.Item( key ) ;
		if( type )
		{
			obj.style.display = "" ;
		}
		else
		{
			obj.style.display = "none" ;
		}
		return true ;
	}

	function initMainDown()
	{
//如果容器可以被拖动,此函数初始化拖动
		if( _titleBarObj != null )
		{
			_titleBarObj.onmousedown = _down ;
			document.body.attachEvent( "onmouseup" , _up )
			document.body.attachEvent( "onmousemove" , _move )
		}
	}

	function _down()
	{
//鼠标在拖动栏上按下
		_beginMoveFlag = true ;
	}
	
	function _up()
	{
//鼠标松开
		_beginMoveFlag = false ;
		_dragStart = false ;
		document.body.onselectstart = new Function( "return true" )
	}
	
	function _move()
	{
//如果鼠标在拖动栏上按住不动,并开始移动,则执行移动的相关操作
		if( _beginMoveFlag )
		{
//拖动期间,禁止拖动
			if( !_dragStart )
			{
				document.body.onselectstart = new Function( "return false" )
				_dragStart = true ;
			}
			
//计算差值
			var difX , difY ;
			difX = event.x - _justX ;
			difY = event.y - _justY ;
		
			var mainObj = _this.getMainObj() ;
			if( mainObj != null )
			{
//重设容器的位置
				mainObj.style.top = parseInt( mainObj.style.top ) + difY ;
				mainObj.style.left = parseInt( mainObj.style.left ) + difX ;
			}
		}
		
		_justX = event.x ;
		_justY = event.y ;		
	}	
	
	function _appendToContent( _theCtn )
	{
/*
将本类作为内容放置并显示于容器类中.本方法供容器类调用
*/
//将本类的容器类属性指向传入的容器类
		_this.Ctn = _theCtn ;
		var mainObj = _this.getMainObj() ;
		
//将本类的"使用中"标记置为真.对于onlyOne类型的元件,这个标记将发挥作用,防止重复使用.
		if( _autoUsingState )
		{
			_this.usingState = true ;
		}


//触发onAppendToContent事件
		_this.onAppendToContent() ;
//返回本类的实体给容器类,以供其完成调入该容器的工作
		return mainObj ;
	}
	
	function _apartFromContainer()
	{
/*
将本类与容器类分离.本方法供容器调用
*/
//将本类的容器类属性指向空,以避免内存溢出
		_this.Ctn = null ;
		var mainObj = _this.getMainObj() ;
		var parentObj = _this.getParentObj() ;
		
		if( _autoUsingState )
		{
			_this.usingState = false ;
		}
		if( _autoReinit )
		{
//重置实体中相关元素的默认值
			_this.reInit() ;
		}
//得到root类的引用,可能需要调用root类的一些方法完成相关工作		
		var root = _this.getRoot() ;
		if( mainObj != null && ( typeof mainObj ) == "object" )
		{
//如果有原父对象.可移回DOM树中原下
			if( parentObj != null )
			{
				parentObj.appendChild( _this.moraObj ) ;
			}
//反之,直接删除该实体
			else
			{
				mainObj.parentNode.removeChild( mainObj );
			}
		}
		var tempThis = _this ;
//如果要求自动销毁
		if( _autoEndForApart == "true" )
		{
//调用end方法即可完成上述工作
			_this.closeSelf() ;
		}
//调用onApartFromContainer事件		
		tempThis.onApartFromContainer() ;
		tempThis = null ;
	}
	
	function _getAutoEndForApart()
	{
		return _autoEndForApart
	}
	
	function _getAutoEndForEnd()
	{
		return _autoEndForEnd ;
	}
	
	function getCTNContentObj()
	{
		return { contentFlag:false , contentStr:null , contentObj:null , paraObj:null } ;
	}
}