function isIE() {
	version=0
	if (navigator.appVersion.indexOf("MSIE")!=-1){
	//temp=navigator.appVersion.split("MSIE")
	//version=parseFloat(temp[1])
	return true;
	}else return false;
//}
//return (version && (version < 7));
}
function isIE6() {
	version=0
	if (navigator.appVersion.indexOf("MSIE")!=-1){
	temp=navigator.appVersion.split("MSIE")
	version=parseFloat(temp[1]);
}
return (version && (version < 7));
}

function equalHeightbot () {

	var elements = $$('.box div');
	var maxHeight = 0;
	/* Get max height */
	elements.each(function(item, index){
		var height = parseInt(item.getStyle('height'));
		if(height > maxHeight){ maxHeight = height; }
	});
	elements.setStyle('height', maxHeight+'px');

}
function reassignHeight(x, dh) {
		y = lastDiv(x);
		h = y.offsetHeight + max - dh;
		y.style.height = h + "px";
	}
	
	function lastDiv(x) {
		y = x.lastChild;
		while (y.nodeName != "DIV") y = y.previousSibling;
		return y;
	}
	function equalHeight() {
			var main = document.getElementById('wrapper');
			var left = document.getElementById('leftcol');		
			var content = document.getElementById('mainbody')			
			leftH = (left) ? left.offsetHeight : 0;
			contentH = (content) ? content.offsetHeight : 0;
			max = main.offsetHeight;
			if(isIE()){
				if (leftH < max && left) reassignHeight(left,leftH+109);
			}else 
				if (leftH < max && left) reassignHeight(left,leftH+119);
			if(isIE6()){
				if (contentH < max && content) reassignHeight(content, contentH-13);
			}else 
				if (contentH < max && content) reassignHeight(content, contentH);
	}

window.addEvent ('load', function() {
	equalHeightbot();
	equalHeight();
});
