/**
	This script resizes the page to fit the window if it's too small.
*/
function getStyle( elem, name ) {
	if (elem.style[name])
		return elem.style[name];
	else if (elem.currentStyle)
		return elem.currentStyle[name];
	else if (document.defaultView && document.defaultView.getComputedStyle) {
		name = name.replace(/(A-Z)/g,"-$1");
		name = name.toLowerCase();
		
		var s = document.defaultView.getComputedStyle(elem, "");
		return s && s.getPropertyValue(name);
	}
	else
		return null;
}
function getHeight( elem ) {
	return parseInt(getStyle( elem, 'height' ) );
}
function resetCSS( elem, prop ) {
	var old = {};
	for ( var i in prop) {
		old[i] = elem.style[i];
		elem.style[i] = prop[i];
	}
	
	return old;
}
function fullHeight( elem ) {
	if (getStyle( elem, 'display' ) != 'none' )
		return elem.offsetHeight || getHeight( elem );
		
	var old = resetCSS( elem, {
		display: '',
		visibility: 'hidden',
		position: 'absolute'
	});
}
function posY(elem) {
	return parseInt( getStyle( elem, "top" ) );
}
function pageResize() {
	// Get height of the window.
	var windowHeight = 0;
	//Non-IE
	if( typeof( window.innerWidth ) == 'number' )
		windowHeight = window.innerHeight;
	//IE 6+ in 'standards compliant mode'
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
		windowHeight = document.documentElement.clientHeight;
	//IE 4 compatible
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
		windowHeight = document.body.clientHeight;
	
	if (windowHeight > 0)
	{
		var contentElement = document.getElementById('content');
		
		// get the height of the container.
		var containerHeight = fullHeight(document.getElementById('container'));
		var contentHeight = fullHeight(contentElement);
		
		if (windowHeight > containerHeight)
			contentElement.style.height = (contentHeight + windowHeight - containerHeight - 20) + 'px';
	}
}
window.onload = pageResize;
window.onresize = pageResize;