
	// make sure the following line is in the head section of your document:
	// <script Language="javascript" src="includes/sizeObjToFooter.js" Type="text/javascript"></script>

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function sizeObject(objectID, bottomMargin) {
  var objectTop = 0, browserHeight = 0;

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE works with FireFox
    objectTop = new Number(findPosY(document.getElementById(objectID)));
    browserHeight = window.innerHeight;
    document.getElementById(objectID).style.minHeight = (browserHeight - objectTop - bottomMargin) + 'px';
    //showAlerts();
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    
    var bVer = checkVersion()
    
    if (bVer >= 7)
    {
      //alert("Your browser is IE " + bVer);
      //IE 7 in 'standards compliant mode'
      objectTop = new Number(findPosY(document.getElementById(objectID)));
      browserHeight = new Number(document.documentElement.clientHeight);    
      document.getElementById(objectID).style.minHeight = browserHeight - objectTop - bottomMargin;
      //showAlerts();
    } else
    {
      //alert("Your browser is IE " + bVer)
      //IE 6 in 'standards compliant mode'
      objectTop = new Number(findPosY(document.getElementById(objectID)));
      browserHeight = new Number(document.documentElement.clientHeight);    
      document.getElementById(objectID).style.posHeight = browserHeight - objectTop - bottomMargin;
      //showAlerts();
    }
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    objectTop = new Number(findPosY(document.getElementById(objectID)));
    browserHeight = document.body.clientHeight;
    document.getElementById(objectID).style.posHeight = browserHeight - objectTop - bottomMargin;
    //showAlerts();  
  }

  function showAlerts() {
  window.alert( 'posHeight = ' + (browserHeight - objectTop - bottomMargin)); 
  window.alert( 'browserHeight = ' + browserHeight);
  window.alert( 'objectTop = ' + objectTop);
  window.alert( 'objectid = ' + objectID);
  }   
}

function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
{
  var rv = -1; // Return value assumes failure
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
}

function checkVersion()
{
  var msg = "You're not using Internet Explorer.";
  var ver = getInternetExplorerVersion();

  if ( ver > -1 )
  {
    if ( ver >= 7.0 ) 
      msg = "You're using a recent copy of Internet Explorer " + ver
    else
      msg = "You should upgrade your copy of Internet Explorer.";
  }
  //alert( msg );
  return ver;
}