/**
 * common-browser-coordinates.js
 *  interfaces with the borwser window to get coordinates, transform points from relative
 *  to absolute and everything else coordinate and size related
 */



// screen size (resolution)

	function screenWidth()
	{
		return window.screen.width;
	}

	function screenHeight()
	{
		return window.screen.height;
	}
	
	function screenResolution()
	{
		return [screenWidth(), screenHeight()];
	}



// window sizes and positions

	function windowLeft()
	{
		var x = 0;

		if(isBrowserNetscape())
			x = window.screenX;
		else
			if(isBrowserExplorer())
				x = window.screenLeft;

		return x;
	}

	function windowTop()
	{
		var y = 0;

		if(isBrowserNetscape())
			y = window.screenY;
		else
			if(isBrowserExplorer())
				y = window.screenTop;

		return y;
	}

	function windowWidth()
	{
		var w = 0;
		
		w = isBrowserCSS1Compat() ? document.body.parentNode.offsetWidth : document.body.offsetWidth;

		if(w == 0)
			w = window.innerWidth;

		return w;
	}

	function windowHeight()
	{
		var h = 0;
		
		h = isBrowserCSS1Compat() ? document.body.parentNode.offsetHeight : document.body.offsetHeight;

		if(h == 0)
			h = window.innerHeight;

		return h;
	}



// client region sizes, where page is rendered, and scrolled positions

	function clientLeft()
	{
		var s_left = 0;

		if(typeof(window.pageYOffset) == 'number')
			s_left = window.pageXOffset; // Netscape compliant
		if(document.body && (document.body.scrollLeft || document.body.scrollTop))
			s_left = document.body.scrollLeft; // DOM compliant
		if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
			s_left = document.documentElement.scrollLeft; // IE6 standards compliant mode

		return s_left;
	}
	
	function clientTop()
	{
		var s_top = 0;

		if(typeof(window.pageYOffset) == 'number')
			s_top = window.pageYOffset; // Netscape compliant
		if(document.body && (document.body.scrollLeft || document.body.scrollTop))
			s_top = document.body.scrollTop; // DOM compliant
		if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
			s_top = document.documentElement.scrollTop; // IE6 standards compliant mode

		return s_top;
	}
	
	function clientWidth()
	{
		var w = 0;
		
		w = isBrowserCSS1Compat() ? document.body.parentNode.clientWidth : document.body.clientWidth;

		if(w == 0)
			w = window.innerWidth;

		return w;
	}

	function clientHeight()
	{
		var h = 0;
		
		h = isBrowserCSS1Compat() ? document.body.parentNode.clientHeight : document.body.clientHeight;

		if(h == 0)
			h = window.innerHeight;

		return h;
	}


//





