// Init variables
wiW=0;
wiH=0;
docW=0;
docH=0;

getOffsetPosition = function(inID, inTYPE)
{
	var iVal = 0;
	var oObj = document.getElementById(inID);
	var sType = 'oObj.offset' + inTYPE;
	while (oObj && oObj.tagName != 'BODY')
	{
		iVal += eval(sType);
		oObj = oObj.offsetParent;
	}
	return iVal;
}

function windowInnerHW()
{
	if( typeof( window.innerWidth ) == 'number' )
	{
		wiW = window.innerWidth;
		wiH = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) )
	{
		wiW = document.documentElement.clientWidth;
		wiH = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) )
	{
		wiW = document.body.clientWidth;
		wiH = document.body.clientHeight;
	}
	else
	{
		wiW = -1;
		wiH = -1;
	}
}

function documentHW()
{
	windowInnerHW();

	docW=document.width;
	if(wiW>=document.width)
	{
		docW=wiW;
	}

	docH=document.height;
	if(wiH>=docH)
	{
		docH=wiH;
	}
}

function getXYOffsets() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}