function fixContainer() {
	var browserHeight, divHeight, containerDiv;
	var bottomMargin = 55;
	browserHeight = getBrowserHeight();

	if (browserHeight>350) {
		//alert('test');
		containerDiv = document.getElementById('contentContainer');
		divHeight = browserHeight - getPosY(containerDiv) - bottomMargin;
		if (divHeight>500) { divHeight = 500; }
		containerDiv.style.height = divHeight+"px";
		//document.getElementById('containerDiv').style.top = Math.round(browserHeight/2-xHeight('containerDiv')/2)+"px";
		//$('#slideshow').height($('#containerDiv').height()-216);
		return true;
	}
	return false;
}

function getPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function getBrowserHeight() {
	var browserHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
    	//Non-IE
    	browserHeight = window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
    	//IE 6+ in 'standards compliant mode'
    	browserHeight = document.documentElement.clientHeight;
	} else if (document.body && document.body.clientHeight) {
    	//IE 4 compatible
    	browserHeight = document.body.clientHeight;
	}
	return browserHeight;
}

xAddEventListener(window, 'resize', fixContainer);
xAddEventListener(window, 'scroll', fixContainer);
xAddEventListener(window, 'load', initPage);