/**
ļ: 197:88/Library/js/m/tabs.js, 1 tab indent, CR LF, GB2312
ģ: ǩ[Module.tabs]
: 9:49 2007-2-27
÷: 
oneTabs.init("ӱǩid");
*/
var Module=Module||{};

Module.tabsArray=[];
Module.tabs=function(){
	var ome=this;
};
Module.tabs.prototype={
	tab_handle:function(ev){
		ev=ev||window.event;
		try{
			this.getElementsByTagName('a')[0].blur();
			var tid=this.getAttribute('tid');
			var curI=this.getAttribute('i');
			if(isNaN(parseInt(tid))){return false;}
			var theA=Module.tabsArray[tid];
			for(var i=0, tab, tc, iM=theA['tlen']; i<iM; i++){
				tab=theA['tabs'][i];
				tc=theA['tcs'][i];
				if(i==curI){
					Dom.addClass('cur', theA['tabs'][curI]);
					Dom.removeClass('hide', theA['tcs'][curI]);
				}else{
					Dom.removeClass('cur', tab);
					Dom.addClass('hide', tc);
				}
			}
		}catch(er){}
		return false;
	},
	init:function(tabs_id, opt){
		var ome=this, isIE=Base.isIE();
		if(opt){/*load option*/
			/*do something*/
		}
		var curTabId=Module.tabsArray.length;
		var theA=Module.tabsArray[curTabId]={'tid':curTabId, "tabs_id":tabs_id};
		var Tab=document.getElementById(tabs_id);
		if(!Tab){return;}
		var tabs=Tab.getElementsByTagName('li');
		if(!tabs || !tabs.length){return;}
		if(isIE){
			Tab.style.height=tabs[0].offsetHeight+'px';
			Tab.style.overflow='hidden';
		}
		theA['tabs']=[];
		theA['tcs']=[];
		theA['tlen']=0;
		for(var i=0, tab; (tab=tabs[i]); i++){
			/*normal tab*/
			theA['tabs'][i]=tab;
			tab.setAttribute('i', i);
			tab.setAttribute('tid', curTabId);
			var tc;
			if(tc=document.getElementById(tabs_id+'_c'+(i+1))){
				theA['tcs'][i]=tc;
				theA['tlen']=i+1;
				if(!Dom.hasClass('cur', tab)){
					Dom.addClass('hide', tc);
				}
				tab.onclick=ome.tab_handle;
			}else{
				for(var j=0; j<i; j++){
					tab2=tabs[j];
					tab2.onclick=null;
					if(0 && isIE){
						tab2.onmouseover=tab2.onmouseout=null;
					}
				}
				theA=null;
				return;
			}
			if(0 && isIE){
				tab.onmouseover=function(){Dom.addClass('hover', this)};
				tab.onmouseout=function(){Dom.removeClass('hover', this)};
			}
		}
	}
};
var oneTabs=new Module.tabs();