function TabControl(tab_bar,active_tab,key_store){
	this.switchTab=function(tab_id,tab_head){
		this.active_tab.className=this.active_tab.className.replace(/\s+[\w]+/,'');
		this.active_tab=document.getElementById(tab_id);
		this.active_tab.className += ' ' + this.active_tab.className + '_active';
		this.active_head.className = this.active_head.className.replace(/\s+[\w]+/,'');
		this.active_head = tab_head;
		this.active_head.className += ' ' + this.active_head.className + '_active';
//		if(this.key_store) putvalue(this.key_store,tab_id);
	}
	this.setActive = function(active_tab){
		this.active_tab = active_tab;
		this.active_head = active_tab.firstChild;
		this.active_tab.className += ' ' + this.active_tab.className + '_active';
		this.active_head.className += ' ' + this.active_head.className + '_active';
	}
	this.addTab = function(tab_page){
		this.bar.appendChild(tab_page.firstChild);
	}
	this.bar = tab_bar;
	if(arguments.length == 3) this.key_store=key_store;
	else this.key_store=null;
	this.setActive(active_tab);
}
