//Это объект "блок-контейнер". Объявление класса одинаково для всех
function TBlockContainer(name){
	this.name=name;
	this.Hname='H'+name;
	this.own=document.getElementById(this.Hname);
	this.tileContainer=document.getElementById(this.Hname+'_Title');
	this.container=document.getElementById(this.Hname+'_Container');
	this.buttonOC=document.getElementById(this.Hname+'_ButtonOC');
	this.width=100;
	
	this.tabList = new Array();
	
	this.bufferAJAX='';
	
	this.CloseOpen=function(){
		if(this.container.style.display=='block'){
			this.container.style.display='none';
			this.buttonOC.innerHTML='<b>+</b>';
		}else{
			this.container.style.display='block';
			this.buttonOC.innerHTML='<b>-</b>';
		}
	}
	
	this.TabClick=function(tabTitle){
		//проверить наличие места для кнопок
		var tabcont = document.getElementById(this.Hname+'_Tab_Button');
		if(tabcont!=null){
			//выставить флаги
			var s='';
			for(var id in this.tabList){
				if(id!='toJSONString'){
					s+="<div style='background:#";
					if(id==tabTitle){
						this.tabList[id]=true;
						s+="ffdd33;float:left' ";
						document.getElementById(this.Hname+'_Tab_'+id).style.display='block';
					}else{
						this.tabList[id]=false;
						s+="cccccc;float:left' onclick='"+this.name+".TabClick(\""+id+"\");'";
						document.getElementById(this.Hname+'_Tab_'+id).style.display='none';
					}
					s+=">&nbsp;"+id+"&nbsp;</div>";
					//переключить видимость
				}
			}
			//перерисовать закладки
			tabcont.innerHTML=s;
		}
	}
	
	this.SetTitle=function(title){
		this.tileContainer.innerHTML=title;
	}
}
