var windowWidth = 0;
var windowHeight = 0;
var windowSizeChanged = false;

function getWindowSize()
{
	var newWidth;
	var newHeight;
	
	//newWidth = bottomRight.offsetLeft;
	//newHeight = bottomRight.offsetTop;
	
	
	if (self.innerHeight) // all except Explorer
	{
		newWidth = self.innerWidth;
		newHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		newWidth = document.documentElement.clientWidth;
		newHeight = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		newWidth = document.body.clientWidth;
		newHeight = document.body.clientHeight;
	}

	windowSizeChanged = false;
	if ((newWidth!=windowWidth) || (newHeight!=windowHeight))
	{
		windowWidth = newWidth;
		windowHeight = newHeight;
		windowSizeChanged = true;
	}
	
}
function getXYWH(obj)
{
	var x = 0;
	var y = 0;
	var w = 0;
	var h = 0;
	if (obj.pixelWidth)
	{
		alert('Pixelwidth');
		w = obj.pixelWidth;
		h = obj.pixelHeight;

		while (obj!=null)
		{
			x+=obj.pixelLeft-obj.scrollLeft;
			y+=obj.pixelTop-obj.scrollTop;
			
			obj=obj.offsetParent;
		}		
	}
	else if (obj.offsetParent)
	{
		w = obj.offsetWidth;
		h = obj.offsetHeight;

		while (obj!=null)
		{
			x+=obj.offsetLeft; //-obj.scrollLeft;
			y+=obj.offsetTop; //-obj.scrollTop;
			//alert(obj.offsetLeft);
			obj=obj.offsetParent;
		}
	}
	else if (obj.style.left)
	{
		w = parseInt(obj.style.width);
		h = parseInt(obj.style.height);

		while (obj!=null)
		{
			x+=parseInt(obj.style.left); //-(obj.scrollLeft?obj.scrollLeft:0);
			y+=parseInt(obj.style.top); //-(obj.scrollTop?obj.scrollTop:0);
			
			obj=obj.offsetParent;
		}
	}
		
	return {x:x,y:y,w:w,h:h};
}
