

function GetPosition(object, offset)
{
	var totaloffset = ((offset == 'top') ? object.offsetTop : object.offsetLeft );
	var parent = object.offsetParent;
	if (parent != null)
		totaloffset += GetPosition(parent, offset);
	
	return totaloffset;
}
function GetWindowInfo()
{
	var top, left, width, height;
	
	if( typeof( window.pageYOffset ) == 'number' ) {
		top = window.pageYOffset;
		left = window.pageXOffset;
	} else if( document.documentElement) {
		top = document.documentElement.scrollTop;
		left = document.documentElement.scrollLeft;
	} else if( document.body) {
		top = document.body.scrollTop;
		left = document.body.scrollLeft;
	}
	
	if( typeof( window.innerWidth ) == 'number' ) {
		width = window.innerWidth;
		height = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	
	return {top:top, left:left, width:width, height:height};
}
function GetObjectInfo(o)
{
	var top, left, width, height;
	if( typeof( o.innerWidth ) == 'number' ) {
		width = o.innerWidth;
		height = o.innerHeight;
	} else if( o && ( o.clientWidth || o.clientHeight ) ) {
		width = o.clientWidth;
		height = o.clientHeight;
	} else if(o.style.width){
		width = parseInt(o.style.width, 10)
		height = parseInt(o.style.height, 10)
	}
	top = GetPosition(o, 'top');
	left = GetPosition(o, 'left');

	return {top:top, left:left, width:width, height:height};
}

