var MaxWidth = 999;
var MinWidth = 800;
var SliderWidth = 18;
var BarWidth = 180;
	
function calcLayoutWidth() {

	var LayoutWidth = MaxWidth;
	if(window.document.body.clientWidth < MaxWidth) {
		if(window.document.body.clientWidth > MinWidth)
			LayoutWidth = (window.document.body.clientWidth - SliderWidth);
		else
			LayoutWidth = MinWidth - SliderWidth;
	}	
	return LayoutWidth - 2;
}

function calcBrandingImageWidth() {

	var LayoutWidth = MaxWidth;

	if(window.document.body.clientWidth < 1020) {
		if(window.document.body.clientWidth > MinWidth)
			LayoutWidth = (window.document.body.clientWidth - SliderWidth);
		else
			LayoutWidth = MinWidth - SliderWidth;
	}
	
	return LayoutWidth - 2;
}

function calcContentAreaWidth() {

	if(document.getElementById('pnlRightBarPanel') == null & document.getElementById('pnlLeftBarPanel') == null)
	{
		return calcLayoutWidth();
	}
	
	if(document.getElementById('pnlRightBarPanel') == null)
	{
		return calcLayoutWidth() - BarWidth;
	}

	if(document.getElementById('pnlLeftBarPanel') == null)
	{
		return calcLayoutWidth() - BarWidth;
	}
	
	return calcLayoutWidth() - (2*BarWidth);
}


function calcContentAreaWidthFixed()
{

	if (document.getElementById('contentcenter') != null)
	{
		if(document.getElementById('pnlRightBarPanel') == null & document.getElementById('pnlLeftBarPanel') == null)
		{
			return MaxWidth;
		}
		
		if(document.getElementById('pnlRightBarPanel') == null)
		{
			return MaxWidth - BarWidth;
		}

		if(document.getElementById('pnlLeftBarPanel') == null)
		{
			return MaxWidth - BarWidth;
		}
		
		return MaxWidth - (2*BarWidth);
	}
	
	return MaxWidth - (2*BarWidth);
}


function adjustContentArea()
{

	if (document.getElementById('pagelayout') != null)
	{
	 	document.getElementById('pagelayout').style.width = calcLayoutWidth()+'px';
		document.getElementById('searchcontainer').style.left = (calcLayoutWidth() - 420)+'px';
		document.getElementById('contentcontainer').style.width = calcContentAreaWidth()+'px';
		if (document.getElementById('brandingimage') != null)
		{
			document.getElementById('brandingimage').style.width = calcBrandingImageWidth()+'px';
		}
		
		document.getElementById('bundfrise').style.width = document.getElementById('pagelayout').style.width;
	}
	
}		  


function adjustContentAreaFixed()
{
	if (document.getElementById('contentcenter') != null)
	{
		document.getElementById('contentcenter').style.width = calcContentAreaWidthFixed()+'px';
	}
}		  

