//////区域设定






function sectionInit(){
	
		var _slideTmp=0
		for (var i=0 ;i<maxncfg;i++){
			var _Unit=Ext.get("basic"+i)
			var _UnitD=Ext.get("basid"+i)
			var _UnitBC=Ext.get("bc"+i)
			if(i<Pvar.ncfg){
				var _UnitSize=countUnitSize(i)
				
				_Unit.setWidth(_UnitSize.Pw,true);
				_Unit.setHeight(_UnitSize.Ph,true);
				_UnitD.setHeight(_UnitSize.Pd,true);
				_UnitBC.setHeight(_UnitSize.Pbc,true);
				_Unit.query("div")[0].innerHTML="宽"+_UnitSize.Sw;
				_Unit.query("div")[1].innerHTML="高"+_UnitSize.Sh;
				_UnitD.query("div")[0].innerHTML="深"+_UnitSize.Sd;
				_UnitD.query("div")[1].innerHTML=_UnitSize.Sbc? "背空"+_UnitSize.Sbc : "" ;
				//_UnitBC.dom.innerHTML="背空"+_UnitSize.Sbc;
				//_Unit.query("div")[2].innerHTML="a"+_UnitSize.Sh;
				//_Unit.dom.innerHTML="宽"+_UnitSize.Sw+"<BR>"+"高"+_UnitSize.Sh
				_Unit.setVisible(true)
				_UnitD.setVisible(true)
				VSection.w.size[i]=_UnitSize.Sw;
				_slideTmp=_slideTmp+_UnitSize.Sw;	
				VSection.w.slide[i]=_slideTmp;
				
				_Unit.on('dblclick', function(){
											  		VSection.controlId=this.id.substring(5)
													Sectionwindow.show()
													
													
													
												})
				
			}else{
				_Unit.setWidth(0,false);
				_Unit.setVisible(false)
				_UnitD.setVisible(false)
				VSection.w.size[i]=0;
				VSection.w.slide[i]=0;
			}
			
		}

		VSection.w.slide.splice(Pvar.ncfg-1,maxncfg-Pvar.ncfg+1);

		var autoW=Ext.query("input[name=autoW]")
			
			for (var i=0; i<autoW.length;i++){
					if(VSection.w.autoTag[i]){
						autoW[i].checked=true
						
					}else{
						autoW[i].checked=false
					}
					
					autoW[i].onclick=function(){
													
												if(this.checked){
													Pvar.sectionSize[this.id.substring(4)].w=0
													var _Psize=Ext.get("Section_Panel").getSize()
													initPsize(_Psize.width-container.Rw,_Psize.height-container.Rh);
													sectionInit()
													setSectionTo2020(this.id.substring(4))
												}else{
													VSection.controlId=this.id.substring(4)
													VSection.w.autoTag[VSection.controlId]=0
													Sectionwindow.show()
													
												}
												
												
														}
				}


			//Ext.get("basic0").setHeight(200,true)
			
			
			

		  
		  




	}
	
	
//设置section的值
function getSectionVar (_i){
	var _h,_d
	
		if(Pvar.sectionSize[_i].h){
				_h = Pvar.sectionSize[_i].h
			}else{
				_h = Pvar.boxSize.h
			}
		if(Pvar.sectionSize[_i].d){
				_d = Pvar.sectionSize[_i].d
			}else{
				_d = Pvar.boxSize.d
			}
		
		return {Wauto:VSection.w.autoTag[_i],cfw2:VSection.w.size[_i],ch3:_h,cfd1:_d,cfd2:Pvar.sectionSize[_i].bc}
	}
	
function setSectionVar ( _i){
		
		var _form=Sectionform.getForm().getValues();
			if(_form.Wauto=="on"){
					Pvar.sectionSize[_i].w=0
					
				}else{
					Pvar.sectionSize[_i].w=	parseInt(_form.cfw2);
				}
		
		Pvar.sectionSize[_i].h=parseInt(_form.ch3);
		Pvar.sectionSize[_i].d=parseInt(_form.cfd1);
		Pvar.sectionSize[_i].bc=parseInt(_form.cfd2);
		
		
		setSectionTo2020(_i)
		
	}




