/*
 Provides cross-browser wrappers for:
 - window (viewport) size
 - scroll distances
 */
// Namespace existence test
try 
{
	var test = (NETJOHNHENRY.name == 'NETJOHNHENRY');
} 
catch (e) 
{
	NETJOHNHENRY = {};
}


NETJOHNHENRY.Window = {

	innerWidth: function()
	{
		// viewport width
		if (typeof(window.innerWidth) == 'number') 
		{
			//Non-IE
			return window.innerWidth;
		}
		else 
		{
			if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
			{
				//IE 6+ in 'standards compliant mode'
				return document.documentElement.clientWidth;
			}
			else 
			{
				if (document.body && (document.body.clientWidth || document.body.clientHeight)) 
				{
					//IE 4, or 5+ in 'quirks mode'
					return document.body.clientWidth;
				}
			}
		};
		return undefined;
	},
	
	innerHeight: function()
	{
		// viewport height
		if (typeof(window.innerHeight) == 'number') 
		{
			//Non-IE
			return window.innerHeight;
		}
		else 
		{
			if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
			{
				//IE 6+ in 'standards compliant mode'
				return document.documentElement.clientHeight;
			}
			else 
			{
				if (document.body && (document.body.clientWidth || document.body.clientHeight)) 
				{
					//IE 4, or 5+ in 'quirks mode'
					return document.body.clientHeight;
				}
			}
		};
		return undefined;
	},
	
	pageYOffset: function()
	{
		// window vertical scroll distance
		if (typeof(window.pageYOffset) == 'number') 
		{
			//Netscape compliant
			return window.pageYOffset;
		}
		else 
		{
			if (document.body && (document.body.scrollLeft || document.body.scrollTop)) 
			{
				//DOM compliant
				return document.body.scrollTop;
			}
			else 
			{
				if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) 
				{
					//IE6 standards compliant mode
					return document.documentElement.scrollTop;
				}
			}
		}
		return undefined;
	},
	
	pageXOffset: function()
	{
		// window horizontal scroll distance
		if (typeof(window.pageYOffset) == 'number') 
		{
			//Netscape compliant
			return window.pageXOffset;
		}
		else 
		{
			if (document.body && (document.body.scrollLeft || document.body.scrollTop)) 
			{
				//DOM compliant
				return document.body.scrollLeft;
			}
			else 
			{
				if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) 
				{
					//IE6 standards compliant mode
					return document.documentElement.scrollLeft;
				}
			}
		}
		return undefined;
	}
	
	
};
