function adjustLayout() {
	mCol=xGetElementById('lMain');
	lCol=xGetElementById('lLeftCol');
	cCol=xGetElementById('lContent');
	rCol=xGetElementById('lRightCol');
	
	colH = 0; colWidth = 0;
	if(lCol!=undefined){ colH = xHeight(lCol)-10;
		cCol.style.marginLeft= xWidth(lCol)+10+20+'px'; 
		colWidth = colWidth + xWidth(lCol)+30;		
		} else { cCol.style.marginLeft= 20+'px'; }
	
	if(rCol!=undefined){ if(colH<xHeight(rCol)){colH = xHeight(rCol)-10;}
		cCol.style.marginRight= xWidth(rCol)+20+'px'; 
		colWidth = colWidth + xWidth(rCol)+30;
		} else{ cCol.style.marginRight= 10+'px'; }
		
	if(!xIE && xWidth(xGetElementById('conTab'))> xWidth(cCol)){
		mCol.style.minWidth = xWidth(xGetElementById('conTab'))+colWidth+'px'; }

	adjustWidth()
}

function adjustWidth(){
	mCol=xGetElementById('lMain');
	cCol=xGetElementById('lContent');
	tCol=xGetElementById('lTop');
	
	w=xClientWidth();
	if(xIE && w>950){ xGetElementById('lMain').style.width= w-50+'px'; 
		tCol.style.width = xWidth(mCol);
		xGetElementById('lFooter').style.width= xWidth(mCol);
	} else { xGetElementById('lMain').style.width= 950+'px';	}
		
		
	h=xClientHeight();
	cColTop=xHeight(cCol);
	m=Math.max(cColTop, colH);

	if(xIE && m<h-xHeight(xGetElementById('lTop'))-xHeight(xGetElementById('lFooter'))-25){ 
      m = h-xHeight(xGetElementById('lTop'))-xHeight(xGetElementById('lFooter'))-25; }
	if(!xIE && m<h-xHeight(xGetElementById('lTop'))-xHeight(xGetElementById('lFooter'))-35){ 
      m = h-xHeight(xGetElementById('lTop'))-xHeight(xGetElementById('lFooter'))-35; }
	
	xGetElementById('lContainer').style.height= m+'px';
	adjustBorder();
}

function adjustBorder(){
	xGetElementById('lConTop').style.width= xWidth(cCol,true)+'px';
	xGetElementById('lConLeftB').style.height= xHeight(cCol,true)+'px';
	xGetElementById('lShLeft').style.height= xHeight(mCol)+'px';
	xGetElementById('lShRight').style.height= xHeight(mCol)+'px';
}

function dyplom(plik,szerokosc,wysokosc) { 
	nazwa=Math.floor(Math.random()*9999)+1;
	window.open("_adds/dyplom.php?plik=../"+plik,"dyplom"+nazwa,"location=no,toolbar=no,directories=no,status=no,scrolling=no,scrollbars=no,resizable=no,menubar=no,left=0,top=0,width="+szerokosc+",height="+wysokosc);
}

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);
}
