// Define some global variables indicating the kind
// of features supported by the browser.

var isDHTML = 0;
var isID = 0;
var isLayers = 0;
var isAll = 0;

var browserVersion = -1;

// Get the browser version for later use.
browserVersion = parseInt(navigator.appVersion);

if (document.getElementById)
{
	isID = 1;
	isDHTML = 1;
}
else
{
	if (document.all)
	{
		isAll = 1;
		isDHTML = 1;
	}
	else
	{
		if (navigator.appName.indexOf('Netscape' != -1) &&
			(browserVersion == 4))
		{
			isLayers = 1;
			isDHTML = 1;		
		}
	}
}

// 
//	Given the ID of an object, the function finds that object
//	from the dicument and rrturn to user.
//
function findObject(objectID)
{
	if (isID)
	{
		return document.getElementById(objectID);
	}
	else if (isAll)
	{
		document.all[objectID]
	}
	else if (isLayers)
	{
		return document.layers[objectID];
	}
	
	return null;
}

// 
//	Given the ID of an object, the function finds that object
//	from the document and returns its style.
//
function findObjectStyle(objectID)
{
	var ob = findObject(objectID);
	if (ob != null)
	{
		return ob.style;
	}
	
	return null;
}

//
//	Function returns the pixel depth value of the colors
//	used by browser.
//
function getColorDepth()
{
	return screen.colorDepth;
}

//
//	Function returns the height of browser window, including the
//	controls and menus around the visible area.
//	This function only works in Netscape.
//
function getBrowserHeight()
{
	if (window.outerHeight != null)
	{
		return window.outerHeight;
	}
	
	return null;
}

//
//	Function returns the width of browser window, including the
//	controls around the visible area.
//	This function only works in Netscape.
//
function getBrowserWidth()
{
	if (window.outerWidth != null)
	{
		return window.outerWidth;
	}
	
	return null;
}

//
//	Function returns the height of browser window.
//
function getLivePageHeight()
{
	if (window.innerHeight != null)
	{
		return window.innerHeight;
	}
	
	if (document.body.clientHeight != null)
	{
		return document.body.clientHeight;
	}
	
	return null;
}

//
//	Function returns the width of browser window.
//
function getLivePageWidth()
{
	if (window.innerWidth != null)
	{
		return window.innerWidth;
	}
	
	if (document.body.clientWidth != null)
	{
		return document.body.clientWidth;
	}
}

function getScrollLeft()
{
	if (window.pageXOffset != null)
	{
		return window.pageXOffset;
	}
	
	if (document.body.scrollWidth != null)
	{
		return document.body.scrollLeft;
	}
	
	return null;
}

function getScrollTop()
{
	if (window.pageYOffset != null)
	{
		return window.pageYOffset;
	}
	
	if (document.body.scrollHeight != null)
	{
		return document.body.scrollTop;
	}
	
	return null;
}