// created by After Hours Teleconsulting
// developed for the Christ Alive Church skin package

interval = setInterval("fixSkin()",'250')

function fixSkin ()
{
	iMinPos = 385;
	iHeight = getHeight("logoWrap");
	iHeight = (iHeight + getHeight("shadowBoxWrap"));
	iHeight = (iHeight + getHeight("panesWrap"));
	if(getHeight("dnn_SubFooterPane") > 0)
	{
			iHeight = (iHeight - getHeight("dnn_SubFooterPane"));
	}
	iHeight = (iHeight - 362); // 362px represents the height of the swirl and the height of the footertokens area + padding totaled
	var aPosition = getOffSet("backgroundWrap")
	iHeight = (iHeight + aPosition[1]);
	iMinPos = (iMinPos + aPosition[1]); 
	iHeight = (iHeight + 5);	//+ 5px shadowBoxWrap bottom-margin
	if (iHeight < iMinPos)
	{
		iHeight = (iMinPos);
	}
	sHeight = iHeight.toString() + "px";
	document.getElementById("backgroundSwirlLeft").style.top = sHeight;
	document.getElementById("backgroundSwirlRight").style.top = sHeight;
}

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;
}

function getOffSet(sID) // array[0] = left array[1] = top
{ 
	var oElement = document.getElementById(sID);
	var curleft = 0;
	var curtop = 0;
	if (oElement.offsetParent) 
	{
		do 
		{
			curleft += oElement.offsetLeft;
			curtop += oElement.offsetTop;
		} while (oElement = oElement.offsetParent);
	}
	return [curleft,curtop];
}