function adjustLayout() {
	cCol=xGetElementById('lContent');
	rCol=xGetElementById('lRightCol');

 	rColW = 0;
	rColH = 0;
 	if(rCol!=undefined) { 
		rColW = 160;
		rColH = xHeight(rCol);
 	} else { cCol.style.marginRight= 0+'px'; }

	adjustHeight()
}

function adjustHeight() {
	h=xClientHeight();
	mCol=xGetElementById('lMain');
	lCol=xGetElementById('lLeftCol');
	tCol=xGetElementById('lTopMenu');

	tCol.style.width= xWidth(cCol)+rColW+'px';		
	if(xIE){	adjustWidthIE(); }
	if(!xIE){ adjustWidthFF(); }

	lColTop=xHeight(lCol)+15;
	cColTop=xHeight(cCol);
	lColH= lColTop- 80;
	m=Math.max(lColH, cColTop, rColH);
	if(m<h-87){ m=h-87; }
	lCol.style.height= m+'px';
	cCol.style.height= m+'px';
	cCol.style.minHeight= m+'px';
	xGetElementById('lLoboBot').style.top= xHeight(cCol)+xHeight(xGetElementById('lFooter'))+xHeight(tCol)-61+'px';
 	if(rCol!=undefined) { 
 		rCol.style.height= m-4+'px';
 		rCol.style.top= xHeight(tCol)+'px';
 	}
 	
 	/*
 	if(xIE){
	cCol.style.height= 1000+'px'; 	
 	
 	}
 	*/
	
}

function adjustWidthIE(){
	if(isEven(xWidth(cCol,true))){ pix = 1; } else { pix = 0; }
 	if(rCol!=undefined) { rCol.style.right= -1+pix+'px'; }
	 
	xGetElementById('lFooter').style.width= xWidth(cCol)+rColW-8+'px';
}

function adjustWidthFF(){

	TabC=xGetElementById('TabCon');
 	if( xWidth(cCol)<xWidth(TabC)+rColW-40 ){
		tCol.style.width= xWidth(TabC)+rColW+24+'px';
 		cCol.style.minWidth= xWidth(TabC)+'px';
 		xGetElementById('lMain').style.minWidth= xWidth(cCol)+rColW+210+'px';
 		xGetElementById('lMainBackg').style.minWidth= xWidth(cCol)+rColW+250+'px';
 	}



}

function isEven(x){return~x&1}

function xSizeToParent(id,direction) {
	/*
	direction= 'h' (height)) lub 'w' (width)
	*/
	d=xGetElementById(id);
	dParent=xParent(d);
	
	if(!direction || direction=='h') {
		h=xHeight(dParent);
		//USUWANIE JEDNEGO PIKSELA PRZY NIEPARZYSTYCH WYMIARACH
		if(xIE) {
			if(h%2) { h-=1; xHeight(dParent,h);	}
		}
		//MARGIN
		h-=xGetComputedStyle(d,'margin-top',true);
		h-=xGetComputedStyle(d,'margin-bottom',true);
		//PADDING PARENTA
		h-=xGetComputedStyle(dParent,'padding-top',true);
		h-=xGetComputedStyle(dParent,'padding-bottom',true);
		xHeight(d,h);
	}
	if(!direction || direction=='w') {
		w=xWidth(dParent);
		//USUWANIE JEDNEGO PIKSELA PRZY NIEPARZYSTYCH WYMIARACH
		if(xIE) {
			if(w%2) { w-=1; xWidth(dParent,w); }
		}
		//MARGIN
		w-=xGetComputedStyle(d,'margin-left',true);
		w-=xGetComputedStyle(d,'margin-right',true);
		//PADDING PARENTA
		w-=xGetComputedStyle(dParent,'padding-left',true);
		w-=xGetComputedStyle(dParent,'padding-right',true);
		xWidth(d,w);
	}
}

function boxShadow(idPre,idPost) {
	box=xGetElementById(idPre+idPost);
	Parent=xParent(box);
	shLT=xGetElementsByClassName(idPre+'LT',box);
	shRT=xGetElementsByClassName(idPre+'RT',box);
	shLB=xGetElementsByClassName(idPre+'LB',box);
	shRB=xGetElementsByClassName(idPre+'RB',box);
	shL=xGetElementsByClassName(idPre+'L',box);
	shR=xGetElementsByClassName(idPre+'R',box);
	shT=xGetElementsByClassName(idPre+'T',box);
	shB=xGetElementsByClassName(idPre+'B',box);
	//WIDTH & HEIGHT
	ParentW=xWidth(Parent);
	ParentH=xHeight(Parent);
	//USUWANIE JEDNEGO PIKSELA PRZY NIEPARZYSTYCH WYMIARACH
	if(xIE) {
		if(ParentW%2) { ParentW-=1; xWidth(Parent,ParentW); }
		if(ParentH%2) { ParentH-=1; xHeight(Parent,ParentH); }
	}
	//USTAWIANIE WYMIAROW TAKICH SAMYCH JAK PARENT
	xWidth(box,ParentW);
	xHeight(box,ParentH);
	
	//TOP
	shLTW=xWidth(shLT[0]);
	shRTW=xWidth(shRT[0]);
	xWidth(shT[0],ParentW-shLTW-shRTW);
	xLeft(shT[0],shLTW);
	//BOTTOM
	shLBW=xWidth(shLB[0]);
	shRBW=xWidth(shRB[0]);
	xWidth(shB[0],ParentW-shLBW-shRBW);
	xLeft(shB[0],shLBW);
	//LEFT
	shLTH=xHeight(shLT[0]);
	shLBH=xHeight(shLB[0]);
	xHeight(shL[0],ParentH-shLTH-shLBH);
	xTop(shL[0],shLTH);
	//RIGHT
	shRTH=xHeight(shRT[0]);
	shRBH=xHeight(shRB[0]);
	xHeight(shR[0],ParentH-shRTH-shRBH);
	xTop(shR[0],shRTH);
	//SHOW
	xShow(box);
}