/*
可重复应用的切换块类
启动函数： setAction(eLits,cList,cClass,nClass)

eList		控制器列表
cList		受控列表
cClass		当前控制器样式
nClass		控制器普通样式
*/
function swapBlock()
{
	this.currentList=new Array();
	this.groupId=0;
}
swapBlock.prototype={	
	getObj:function(str){
		if(typeof(str)=="string")
		{
			return document.getElementById(str);
		}
		else{
			return str;
		}
	},
	setAction:function(eList,cList,cClass,nClass)
	{
		if(!eList)
		{ 
			/* 初始化控制器参数缺失 */
			return 
		}
		
		var _this=this;				
		_this.currentList[_this.groupId]=0;		
		for(var i=0; i<eList.length; i++)
		{
			_this.getObj(eList[i]).orderNum=i;	
			_this.getObj(eList[i]).groupId=_this.groupId;
			
			if(cList && _this.getObj(cList[i])){								
				_this.getObj(cList[i]).style.display="none";
			}			
			_this.getObj(eList[i]).onmouseover=function(){
				if(this.orderNum!=_this.currentList[this.groupId])
				{	
					if(cClass)
					{
						_this.getObj(eList[_this.currentList[this.groupId]]).className=nClass;					
						this.className=cClass;
					}
				
									
											
					if(_this.getObj(cList[this.orderNum]))
					{	
						_this.getObj(cList[this.orderNum]).style.display="block";							
					}
					if( cList && cList[_this.currentList[this.groupId]] && _this.getObj(cList[_this.currentList[this.groupId]]))
					{							
						_this.getObj(cList[_this.currentList[this.groupId]]).style.display="none";								
					}						
					
					_this.currentList[this.groupId]=this.orderNum;
				}
			}
		}
		if(cClass)
		{
			_this.getObj(eList[0]).className=cClass;
		}
		if(cList && _this.getObj(cList[0]))
		{			
			_this.getObj(cList[0]).style.display="block";	
		}
		_this.groupId++;
		
	}
	
}



