/* 
    Based on code by Peter-Paul Koch of QuirksMode.org, available at:
    http://www.quirksmode.org/index.html?/viewport/compatibility.html
    
    2006.06.13
    Modified by Linus Rachlis <linus@flowingcreativity.net> to account
    for scrollbar width, though not perfect -- assumes scrollbar width
    is 20px.
*/
function getWindowDims() {
	var x,y;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
		
		// +20px if document is scrolling because these values don't account for
		// the scrollbar width, but the zero-point of the CSS property 'right' does.
		var vScroll = document.body.scrollHeight > y;
		var hScroll = document.body.scrollWidth > x;
		if (vScroll) // if scrolling vertically
			x -= 20;
		if (hScroll) // if scrolling horizontally
			y -= 20;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return [x, y];
}
