var cabecalho_computedstyle = 0;
var menu_computedstyle = 0;
var corpo_computedstyle = 0;
var mural_computedstyle = 0;
var parceiros_computedstyle = 0;
var extras_computedstyle = 0;
var rodape_computedstyle = 0;
var control_computedstyle = 0;
var log_computedstyle = 0;

function dolayout() {
	/* ajuste da posicao e da largura do DIV ID='cabecalho' */
	cabecalho.style.top = pagetop + pagevmargin + 'px';
	cabecalho.style.left = pageleft + pagehmargin + 'px';
	cabecalho.style.width = wcorpo + wmural + blockhspacing + 'px';
	
	/* ajuste da posicao e da largura do DIV ID='menu' */
	cabecalho_computedstyle = myGetComputedStyle(cabecalho, null);
	menu.style.top = pagetop + pagevmargin + getElementHeight(cabecalho_computedstyle, cabecalho) + blockvspacing + 'px';
	menu.style.left = cabecalho.style.left;
	menu.style.width = wcorpo + wmural + blockhspacing + 'px';
	
	/* ajuste da posicao das listas dropbox do menu e da largura do DIV ID='menu' */
	
	/* ajuste da posicao e da largura do DIV ID='corpo_nucleo_mural' */
	menu_computedstyle = myGetComputedStyle(menu, null);
	corpo_nucleo_mural.style.top = parseInt(menu_computedstyle.top) + 
		getElementHeight(menu_computedstyle, menu) + blockvspacing + 'px';
	corpo_nucleo_mural.style.left = cabecalho.style.left;
	corpo_nucleo_mural.style.width = wcorpo + 'px';
	
	/* ajuste da posicao e da largura do DIV ID='corpo_nucleo' */
	corpo_nucleo.style.top = corpo_nucleo_mural.style.top;
	corpo_nucleo.style.left = pageleft + pagehmargin + 'px';
	corpo_nucleo.style.width = wcorpo + wmural + blockhspacing + 'px';
	
	/* ajuste da posicao e da largura do DIV ID='mural' */
	mural.style.top = corpo_nucleo_mural.style.top;
	mural.style.left = pageleft + pagehmargin + wcorpo + blockhspacing + 'px';
	mural.style.width = wmural + 'px';
	
	/* ajuste da posicao e da largura do DIV ID='parceiros' */
	mural_computedstyle = myGetComputedStyle(mural, null);
	parceiros.style.top = parseInt(mural_computedstyle.top) + 
		getElementHeight(mural_computedstyle, mural) + blockvspacing + 'px';
	parceiros.style.left = mural.style.left;
	parceiros.style.width = mural.style.width;

	/* Ajuste da posicao e da largura do DIV ID='extras' */
	var corpo_nucleo_mural_bottom = 0;
	var parceiros_bottom = 0;
	var corpo_nucleo_bottom = 0;
	corpo_nucleo_computedstyle = myGetComputedStyle(corpo_nucleo, null);
	if (corpo_nucleo_computedstyle.display == 'block') {
		extras.style.top = parseInt(corpo_nucleo_computedstyle.top) + 
			getElementHeight(corpo_nucleo_computedstyle, corpo_nucleo) + blockvspacing + 'px';
	} else {
		corpo_nucleo_mural_computedstyle = myGetComputedStyle(corpo_nucleo_mural, null);
		parceiros_computedstyle = myGetComputedStyle(parceiros, null);
		corpo_nucleo_mural_bottom = parseInt(corpo_nucleo_mural_computedstyle.top) + 
			getElementHeight(corpo_nucleo_mural_computedstyle, corpo_nucleo_mural);
		parceiros_bottom = parseInt(parceiros_computedstyle.top) + 
			getElementHeight(parceiros_computedstyle, parceiros);
		extras.style.top = Math.max(corpo_nucleo_mural_bottom, parceiros_bottom) + blockvspacing + 'px';
	}
	extras.style.left = corpo_nucleo_mural.style.left;
	extras.style.width = cabecalho.style.width;
	
	/* ajuste da posicao e da largura do DIV ID='rodape' */
	extras_computedstyle = myGetComputedStyle(extras, null);
	rodape.style.top = parseInt(extras_computedstyle.top) +
		getElementHeight(extras_computedstyle, extras) + blockvspacing + 'px';
	rodape.style.left = corpo_nucleo_mural.style.left;
	rodape.style.width = cabecalho.style.width;
	
	/* ajuste da posicao e da largura do DIV ID='control' */
	if(controltop == null)
		control.style.top = cabecalho.style.top;
	else
		control.style.top = controltop;
	if(controlleft == null)
		control.style.left = pageleft + pagehmargin + wcorpo + 
			blockhspacing + wmural + blockhspacing;
	else
		control.style.left = controlleft;
	if(wcontrol == null)
		control.style.width = '500px';
	else
		control.style.width = wcontrol + 'px';
	
	/* ajuste da posicao e da largura do DIV ID='logdiv' */
// 	if(logtop == null) {
// 		rodape_computedstyle = myGetComputedStyle(rodape, null);
// 		logdiv.style.top = parseInt("" + rodape.style.top) + parseInt("" + rodape_computedstyle.height) + blockvspacing;
// 	} else
// 		logdiv.style.top = logtop;
// 	if(logleft == null)
// 		logdiv.style.left = pageleft + pagehmargin;
// 	else
// 		logdiv.style.left = logleft;
// 	if(wlog == null)
// 		logdiv.style.width = '500px';
// 	else
// 		logdiv.style.width = wlog + 'px';
}

function refreshlayout(elements) {
	if (elements = 'extras,rodape,log') {
		/* ajuste da posicao e da largura do DIV ID='extras' */
		corpo_nucleo_mural_computedstyle = myGetComputedStyle(corpo_nucleo_mural, null);
		parceiros_computedstyle = myGetComputedStyle(parceiros, null);
		var corpo_bottom = parseInt(corpo_nucleo_mural_computedstyle.top) + 
			getElementHeight(corpo_nucleo_mural_computedstyle, corpo_nucleo_mural);
		var parceiros_bottom = parseInt(parceiros_computedstyle.top) + 
			getElementHeight(parceiros_computedstyle, parceiros);
		extras.style.top = Math.max(corpo_bottom, parceiros_bottom) + blockvspacing + 'px';
		extras.style.left = corpo_nucleo_mural.style.left;
		extras.style.width = cabecalho.style.width;
		
		/* ajuste da posicao e da largura do DIV ID='rodape' */
		extras_computedstyle = myGetComputedStyle(extras, null);
		rodape.style.top = parseInt(extras_computedstyle.top) +
			getElementHeight(extras_computedstyle, extras) + blockvspacing + 'px';
		rodape.style.left = corpo_nucleo_mural.style.left;
		rodape.style.width = cabecalho.style.width;
	
		/* ajuste da posicao e da largura do DIV ID='logdiv' */
// 		if(logtop == null) {
// 			rodape_computedstyle = myGetComputedStyle(rodape, null);
// 			logdiv.style.top = parseInt(rodape.style.top) + parseInt(rodape_computedstyle.height) + blockvspacing;
// 		} else
// 			logdiv.style.top = logtop;
// 		if(logleft == null)
// 			logdiv.style.left = pageleft + pagehmargin;
// 		else
// 			logdiv.style.left = logleft;
// 		if(wlog == null)
// 			logdiv.style.width = '500px';
// 		else
// 			logdiv.style.width = wlog + 'px';
	}
}

