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 = 320;
var minheight = 240;
var maxheight = 520;
var height = 350;

if(BrowserDetect.browser=="Chrome" || BrowserDetect.browser=="Safari" || BrowserDetect.browser=="MSIE" || BrowserDetect.browser=="Explorer"){
	 space += 30;
	 minheight -= 30;
	 maxheight -= 30;
	 height -= 30;
}

var winheight = getWinHeight()*1;
var fullheight = winheight-space;

if(fullheight<maxheight && fullheight>minheight){
	height = fullheight;
}
else if(fullheight<minheight){
	height = minheight;
}
else {
	height = maxheight;
}


function loadApps(){
	resizeDiv();
}

function resizeDiv(){
	if(BrowserDetect.browser=="Chrome" || BrowserDetect.browser=="Safari" || BrowserDetect.browser=="MSIE" || BrowserDetect.browser=="Explorer"){
	//	 space -= 30;
		 height -= 30;
	}
	var winheight = getWinHeight()*1;
	var fullheight = winheight-space;
	
	if(fullheight<maxheight && fullheight>minheight){
		document.getElementById('main').style.height = fullheight+"px";
		height = fullheight;
	}
	else if(fullheight<minheight){
		document.getElementById('main').style.height = minheight+"px";
		height = minheight;
	}
	else {
		document.getElementById('main').style.height = maxheight+"px";
		height = maxheight;
		//height = fullheight;
	}
	//alert(height);
}

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