/////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
/*   
//Screen handling version 1.0 (c) 10/12/07 
getInnerX - returns the browser's visible width (on IE needs to run after load)
getInnerY - returns the browser's visible height (on IE needs to run after load)
ResizeToInner - resizes the window to the requested size
*/
////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
var Screen = {};


Screen.getInnerX = function()
{
	try
	{
		if (self.innerHeight) // all except Explorer
			return self.innerWidth;
		else if (document.documentElement && (document.documentElement.clientHeight != 0))
			// Explorer 6 Strict Mode
			return document.documentElement.clientWidth;
		else if (document.body) // other Explorers
			return document.body.clientWidth;
	}
	catch(e)
	{ alert(e);}
}

Screen.getInnerY = function()
{
	try
	{
		if (self.innerHeight) // all except Explorer
			return self.innerHeight;
		else if (document.documentElement && (document.documentElement.clientHeight != 0))
			// Explorer 6 Strict Mode
			return document.documentElement.clientHeight;
		else if (document.body) // other Explorers
			return document.body.clientHeight;
	}
	catch(e)
	{ alert(e);}
}


Screen.ResizeToInner = function(innerWidth, innerHeight)
{
	try
	{
		var frameWidth,frameHeight;
		if (self.innerHeight) // all except Explorer
		{
			frameWidth = self.innerWidth;
			frameHeight = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight) // Explorer 6 Strict Mode
		{
			frameWidth = document.documentElement.clientWidth;
			frameHeight = document.documentElement.clientHeight;
		}
		else if (document.body) // other Explorers
		{
			frameWidth = document.body.clientWidth;
			frameHeight = document.body.clientHeight;
		}
	
		var innerWidth = ( innerWidth!=null ? innerWidth : frameWidth );
		var innerHeight = ( innerHeight!=null ? innerHeight : frameHeight );
	
		difWidth = 0 + innerWidth - frameWidth;
		difHeight = 0 + innerHeight - frameHeight;
	
		if (difWidth != 0 )
			window.resizeBy(difWidth,0);
		if (difHeight != 0)
			window.resizeBy(0,difHeight);
	}
	catch(e)
	{ alert(e);}
}


Screen.ElementX = function(PdivId)
{
	//verifying that the PDivId is an object and not name
 	try
 	{
 		divId = document.getElementById(PdivId);
 	}
 	catch(e)
 	{
 		divId = PDivId;
 	}
 	divId = divId == null ? PdivId : divId;
	var counterX = divId.offsetLeft;
 	divIdX = divId;
 	while (divIdX.offsetParent)
 	{
 	counterX += divIdX.offsetParent.offsetLeft;
 	divIdX = divIdX.offsetParent;
 	}
 	return counterX;
}

Screen.ElementY = function(PdivId)
{
 	//verifying that the PDivId is an object and not name
	try
 	{
 		divId = document.getElementById(PdivId);
 	}
 	catch(e)
 	{
 		divId = PDivId;
 	}
 	divId = divId == null ? PdivId : divId;
	var counterY = divId.offsetTop;
 	divIdY = divId;
 	while (1)
	{
 		if (!divIdY.offsetParent)
 		{
 			break;
 		}
 		divIdY = divIdY.offsetParent;
 		counterY += divIdY.offsetTop;
 	}
 	return counterY;
}
