﻿function newfoot() {
	var footerHeight=150;
	var k=getHeight();
	k = k - footerHeight;
	document.getElementById('oDiv').style.height='auto';
	var j=findPosY(document.getElementById('oDivTable'));
	var testIt=findPosY(document.getElementById('cleardiv'));
	testIt=testIt - footerHeight - 50;
	var oDivHeight=k-j;
	if (testIt>oDivHeight) {
		document.getElementById('oDiv').style.height=oDivHeight + 'px';
	}
	document.getElementById('table1').style.width='94.75%';
	document.getElementById('table2').style.width='94.75%';
}

function getHeight() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight;
  } else if( document.documentElement && document.documentElement.clientHeight ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && document.body.clientHeight ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}

function findPosY(obj) {
	var curtop = 0;
	if(obj.offsetParent)
		while(1) {
		curtop += obj.offsetTop;
		if(!obj.offsetParent)
			break;
		obj = obj.offsetParent;
		}
	else if(obj.y)
		curtop += obj.y;
	return curtop;
}

window.onload= function(){
    /* pass the function the id of the top level UL */
    newfoot();
}