/***************************************
************  Chris Meyer   ************ 
************ copyright 2003 ************ 
****************************************/
// set height
var navDistFromTop = 211;
var navDistFromBottom = 23;
var bannerHeight = 78	;
var diffCellHeight = 0;
var oldCellHeight = 0;

function reszieArea()
{
	reszieVerticle();
//	reszieHoriz();
	setNavPosTimout();
}

function reszieVerticle()
{
	var docHeight = 0;
	// check to see if the content is bigger than the window
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
		contentBigger = (window.innerHeight<document.body.offsetHeight);
	} else  if (document.documentElement.clientHeight) { // IE 6
	contentBigger = (document.documentElement.clientHeight<=document.body.offsetHeight);
	} else { // IE 4 - 5
	contentBigger = (document.body.clientHeight<=document.body.offsetHeight);
	}

	// get correct height based on conetentBigger
	if(contentBigger)
	{
	  if( typeof( window.innerHeight ) == 'number' ) {
		//Non-IE
			docHeight = document.body.offsetHeight;
	  } else {
		//IE 4+
		docHeight = document.body.offsetHeight
	  }
	}
	else
	{
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		docHeight = window.innerHeight;
	  } else if( document.documentElement &&
		  ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		docHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		docHeight = document.body.clientHeight;
	  }
	}
	
	var navCellObj = document.getElementById("navList");
	var contentObj = document.getElementById("contentArea");
	var introObj = document.getElementById("introText");
	var navContentArea = document.getElementById("navRecentColumns");
	
	oldCellHeight = navCellObj.height;
	navCellObj.height = docHeight-navDistFromTop-navDistFromBottom;
	diffCellHeight = navCellObj.height-oldCellHeight;

	navContentArea.style.top = navDistFromTop;

	// grow content area for pages that might be smaller than window size 
	//   (index.php isn't one of these)
	if(contentObj != null && introObj == null)
	{
		contentObj.height+=docHeight-bannerHeight;
	}
	checkNavPos();
}

function reszieHoriz()
{
	var docWidth = 0;
	// check to see if the content is bigger than the window
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
		contentBigger = (window.innerWidth<document.body.offsetWidth);
	} else  if (document.documentElement.clientWidth) { // IE 6
	contentBigger = (document.documentElement.clientWidth<=document.body.offsetWidth);
	} else { // IE 4 - 5
	contentBigger = (document.body.clientWidth<=document.body.offsetWidth);
	}

	// get correct width based on conetentBigger
	if(contentBigger)
	{
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
			docWidth = document.body.offsetWidth;
	  } else {
		//IE 4+
		docWidth = document.body.offsetWidth
	  }
	}
	else
	{
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		docWidth = window.innerWidth;
	  } else if( document.documentElement &&
		  ( document.documentElement.clientWidth || document.documentElement.clientWidth ) ) {
		//IE 6+ in 'standards compliant mode'
		docWidth = document.documentElement.clientWidth;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientWidth ) ) {
		//IE 4 compatible
		docWidth = document.body.clientWidth;
	  }
	}

	var mainWidth = 801;
	var cellObj = document.getElementById("topBanner");
	cellObj.width = docWidth - mainWidth;
}

function checkNavPos()
{
	var navContentArea = document.getElementById("navRecentColumns");
	var scrollPos = 0;

	if (window.innerHeight)
	{
		  scrollPos = window.pageYOffset
	}
	else if (document.documentElement && document.documentElement.scrollTop)
	{
		scrollPos = document.documentElement.scrollTop
	}
	else if (document.body)
	{
		  scrollPos = document.body.scrollTop
	}

	if(scrollPos > navDistFromTop)
	{
		navContentArea.style.top = scrollPos;
	}
	else 
	{
		navContentArea.style.top = navDistFromTop;
	}
	setNavPosTimout();
}
function setNavPosTimout()
{
	setTimeout('checkNavPos()',200);	
}
function controlLoad()
{
	controlResize();
}
function controlResize()
{
	var docHeight = 0;
	// check to see if the content is bigger than the window
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
		contentBigger = (window.innerHeight<document.body.offsetHeight);
	} else  if (document.documentElement.clientHeight) { // IE 6
	contentBigger = (document.documentElement.clientHeight<=document.body.offsetHeight);
	} else { // IE 4 - 5
	contentBigger = (document.body.clientHeight<=document.body.offsetHeight);
	}

	// get correct height based on conetentBigger
	if(contentBigger)
	{
	  if( typeof( window.innerHeight ) == 'number' ) {
		//Non-IE
			docHeight = document.body.offsetHeight;
	  } else {
		//IE 4+
		docHeight = document.body.offsetHeight
	  }
	}
	else
	{
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		docHeight = window.innerHeight;
	  } else if( document.documentElement &&
		  ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		docHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		docHeight = document.body.clientHeight;
	  }
	}
	
	controlHeaderHeight = 55;
	controlFooterHeight = 10;
	
	var contentObj = document.getElementById("controlContent");
	var controlNav = document.getElementById("controlNav");
	contentObj.height = docHeight-controlHeaderHeight-controlFooterHeight;
	controlNav.height = contentObj.height - 10;
}
