function getWinHeight() {
  var 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;
}

var space = 335;
var minheight = 130;
var maxheight = 380;
var height = 350;

function loadApps(){
	initDhtmlGoodiesMenu();
	resizeDiv();
}

function resizeDiv(){
	var winheight = getWinHeight()*1;
	var fullheight = winheight-space;
	
	if(fullheight<maxheight && fullheight>minheight){
		document.getElementById('main').style.height = fullheight+"px";
		document.getElementById('wrapper').style.paddingTop = "20px";
		height = fullheight;
	}
	else if(fullheight<minheight){
		document.getElementById('main').style.height = minheight+"px";
		document.getElementById('wrapper').style.paddingTop = "10px";
		height = minheight;
	}
	else {
		document.getElementById('main').style.height = maxheight+"px";
		document.getElementById('wrapper').style.paddingTop = "30px";
		height = maxheight;
	}
}

window.onload = loadApps;
window.onresize = resizeDiv;

resizeDiv();
document.write('<style type="text/css">#wrapper{height: '+height+'px;}</style>');

