var tempHeight=0;

function fixHeight(){
	var m = document.getElementById('main');
	var s = document.getElementById('sidebar');

	var winH = 0;
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {winH = window.innerHeight;}
		if (navigator.appName.indexOf("Microsoft")!=-1) {winH = document.body.offsetHeight;}
	}
	
	var mHeight = parseInt(m.offsetHeight);
	var sHeight = parseInt(s.offsetHeight);

	//alert(mHeight + " m+:" + (mHeight+226) + ' s:' + sHeight + ' w:' + winH);

	m.style.height = 'auto';
	if( (mHeight+226) < sHeight ) {
		m.style.height = (sHeight - 226) + 'px';
	}
	else if( (mHeight+226) < winH ) {
		m.style.height = (winH - 266) + 'px';
	}
	if( (mHeight%5)!=1 ) {
		mHeight = parseInt(m.offsetHeight);
		m.style.height = (mHeight - 21 - (mHeight % 5)) + 'px';
	}
}

if (window.addEventListener){
	window.addEventListener("load", fixHeight, false); 
	window.addEventListener("resize", fixHeight, false);
}
else if (window.attachEvent){
	window.attachEvent("onload", fixHeight);
	window.attachEvent("onresize", fixHeight); 
}
