var recalcImage = function(){
	// get textBox height
	try{
		var textboxheight = $('textBox').getHeight();
		var sectionHeight = $('section').getHeight();
		var windowHeight = window.getHeight();
		var _addOffset = 192 + 24 + 24 + 32;
		
		//console.log(textboxheight + ' | ' + sectionHeight + ' | ' + windowHeight + ' | ' +_addOffset + ' | ' + (sectionHeight - _addOffset));
		
		if (textboxheight >= (windowHeight - _addOffset)) {
			$('section').setStyle('height', (textboxheight + _addOffset ) + 'px');
		} else if ($('section').getStyle('height') != '100%') {
			$('section').setStyle('height', '100%');
		}
		
		// Set the siteSection to full height @IE 
		if (window.isIE) {
			$$('div.sideSection').setStyle('height', (windowHeight - 200) + 'px');
		}
		
		// Set the teaserBox to full height if there is only one 
		if ( $$($$('.sideSection').getChildren('div.teaserBox')).length == 1) {
			$$('div.sideSection div.teaserBox').setStyle('height', '100%');
		}
	} catch(e){
		alert('something goes wrong! Perhaps there\'s no textbox or section element on page');
	}

}

window.addEvent('domready', recalcImage);
window.addEvent('resize', recalcImage);