// Set the height of given iframe such that the iframe fits exactly into the available space.
function SetIFrameHeight(IFrameId)
{
	// Does the iframe with the given id exist?
	var IFrameElement = document.getElementById? document.getElementById(IFrameId): document.all? document.all[IFrameId]: null;
	if (IFrameElement)
	{
		// Retrieve the window inner height.
		var wih = GetWindowInnerHeight();

		// Adjust the window inner height such that the iframe fits exactly into the available space.
		var awih = (wih-146);

		// Make sure the frameborder of the iframe is set to "0", otherwise the adjusted height would not correct.
		IFrameElement.frameBorder = "0";

		// Set the new iframe height.
		IFrameElement.style.height = awih + "px";
	}
}

// Set the heigth of the left navigation bar such that the contained table fills the available window space completely.
function SetLNBHeight(LNBId)
{
	// Does the LNB with the given id exist?
	var LNBElement = document.getElementById? document.getElementById(LNBId): document.all? document.all[LNBId]: null;
	if (LNBElement)
	{
		// Retrieve window inner height.
		var wih = GetWindowInnerHeight();

		// Adjust height such that the LNB fits exactly into the available space.
		var awih = (wih-146);
		
		// Get current lnb height..
		var clnbh = LNBElement.style.height;

		// Check if the current lnb height is shorter than the available height.
		if(clnbh<awih)
		{
			// Replace the current lnb height with the available height.
			LNBElement.style.height = awih + "px";
		}
	}
}

// Retrieve the windows inner height.
// Various Internet Explorer versions and modes require different procedures...   
function GetWindowInnerHeight()
{
  var iHeight = 0;
  if(typeof(window.innerWidth) == 'number')
  {
    // All browsers except Internet Explorer...
    iHeight = window.innerHeight;
  }
  else
  if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
  {
    // Internet Explorer 6 and up in standards compliant mode...
    iHeight = document.documentElement.clientHeight;
  }
  else
  if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
  {
    // Internet Explorer 4...
    // Internet Explorer 5 and up in quirks mode...
    iHeight = document.body.clientHeight;
  }
  return iHeight;
}

