/**
 * Forces browser to correctly re-render an element
 *
 * fix_height() corrects overflow problems occuring when a child of an element
 * is floating (ie. have their CSS `float` property set to something
 * other than 'none') and end up having a calculated height greater than
 * that of the containing element.
 *
 * Date Created: 2005-02-22
 *
 * @author   Peter-Paul Koch (taken from his site, www.quirksmode.org)
 * @author   Sean McCann (modifications to the original code)
 * @version  1.0
 *
 * @param string element_id   The `id` attribute of the element needing to be resized
 *
 * Changelog
 * - 2005-07-27:  Generalized names used in this function (McCann)
 */
function fix_height(element_id)
{
	var container;
	var y_offset;

	container = document.getElementById(element_id);
	container.style.height = 'auto';

	y_offset = container.offsetHeight;
	container.style.height = y_offset + "px";
	return true;
}

/**
 * Gets the scrolling offset for the height of a page
 * @author   Peter-Paul Koch (taken from his site, www.quirksmode.org)
 * @author   Sean McCann (modifications to the original code)
 */
function getPageYOffset()
{
	// pageYOffset is the standard property used to get
	// the scrolling offset for a page's height.  However,
	// IE uses its own properties.

	if (self.pageYOffset) // all except Explorer
	{
		return self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict
	{
		return document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		return document.body.scrollTop;
	}
	else return false;

}

/**
 * Gets the actual width of a page
 * @author   Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
 * @author   Sean McCann (modifications to the original code)
 */
function getPageWidth() {
	// pageYOffset is the standard property used to get
	// the scrolling offset for a page's height.  However,
	// IE uses its own properties.
	if (window.innerWidth != null) {
		return window.innerWidth;
	}

	// for Explorer 6 Strict ...
	if (document.documentElement && document.documentElement.clientWidth) {
		return document.documentElement.clientWidth;
	}

	// all other Explorers
	if (document.body != null) {
		return document.body.clientWidth;
	}
	else return null;
}
/**
 * Gets the actual height of a page
 * @author   Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
 * @author   Sean McCann (modifications to the original code)
 *
 * The source is almost identical to getPageWidth().
 */
function getPageHeight() {
	// most browsers
	if (window.innerHeight != null) {
		return window.innerHeight;
	}

	// IE 6 Strict
	if (document.documentElement && document.documentElement.clientHeight) {
		return document.documentElement.clientHeight;
	}

	// most other IE's
	if (document.body != null) {
		return document.body.clientHeight;
	}
	else return null;
}
