/* Document javascript */
window.addEvent('domready', function () {
	$$('.mega_bots h3' ).each(function (item) {
		var parts  = item.getText().split(' ');
		parts[0] = "<span>" + parts[0] + "</span>";
		
		item.setHTML(parts.join(' '));
	});
});
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 setHeight(a, b) {
	a.style.height = b + "px";
}
function equalheight(){
	main_body = document.getElementById('mega_main_body');		
	content = document.getElementById('hcontent');
	news = document.getElementById('hnews');
	right = document.getElementById('hright');
	
	contentH = (content) ? content.offsetHeight : 0;
	newsH = (news) ? news.offsetHeight : 0;
	rightH = (right) ? right.offsetHeight: 0;
	
	max = main_body.offsetHeight - 55;

	if (contentH < max && content) reassignHeight(content, contentH);
	if (newsH < max && news) reassignHeight(news, newsH);
	if (rightH < max && right) reassignHeight(right, rightH);
}
window.addEvent ('load', function() {
	equalheight();
});
