// created by After Hours Teleconsulting
// developed for the Clearwater Baptist Church skin package

fixPanes();
fixUserBackground();

function fixPanes ()
{
		if (getHeight("dnn_ContentPane")<=1)
		{
			document.getElementById("contentPaneWrap").style.display = "none"; // ensures no whitespace is seen
		}
		if (getHeight("dnn_BottomPane")<=1)
		{
			document.getElementById("bottomPaneWrap").style.padding = "12"; // if empty adjust padding so image / content pane have same padding top and bottom
		}
		if (getHeight("dnn_LinkPane")<=1)
		{
			document.getElementById("conditionalDivider").style.display = "none"; // if link pane is not rendered then remove the additonal divider
			document.getElementById("dnn_LinkPane").style.padding = "0"; // clears padding
		}
}

function fixUserBackground ()
{
	iUser = getWidth("userWrap");
	iLink = getWidth("dnn_LinkPane");
	iUserWrapWidth = iUser + iLink + 20; // 10 + 10 for the left and right positions
	if (iUserWrapWidth >= 391) // corrects issue with userBackground element getting very large width = userSearchWrap width +1
	{
		setTimeout("fixUserBackground();",10);
	}
	else
	{
		document.getElementById("userCapRight").style.width = iUserWrapWidth;
		document.getElementById("userCapLeft").style.width = iUserWrapWidth;
		document.getElementById("userBackground").style.width = iUserWrapWidth;
		document.getElementById("userBackground").style.top = 0; // makes element visable again
	}
}

function getWidth(sID) 
{
	var iReturnValue = 0;
	if(sID != null) 
	{
		iReturnValue = parseInt(document.getElementById(sID).offsetWidth); // removes the "px" at the end
	}
	return iReturnValue;
}

function getHeight(sID) 
{
	var iReturnValue = 0;
	if(sID != null) 
	{	
		iReturnValue = parseInt(document.getElementById(sID).offsetHeight); // removes the "px" at the end
	}
	return iReturnValue;
}