if (typeof(browserDetect) == 'undefined') {
	var browserDetect = detectBrowser('', '');
}

if (typeof(myVersionInfo) == 'undefined') {
	var myVersionInfo = detectDoctype();
}

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if (typeof(window.pageYOffset) == 'number') {
    // Netscape, Firefox, Safari, Opera, Chrome
    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)) {
    // IE
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  
  return [scrOfX, scrOfY ];
}

function getDocumentSize(container) {
  	var width = 0, height = 0;
  	if (typeof(window.innerWidth) == 'number') {
    	// Non-IE
		width = document.body.scrollWidth;
		if (document.body.clientHeight > document.body.scrollHeight) {
			height = document.body.clientHeight;
	 	}
	 	else {
			height = document.body.scrollHeight;
	}
	
	if ((browserDetect[0] == 'firefox') || (browserDetect[0] == 'opera')) {
		if ((myVersionInfo != null) && ((container != 'undefined') && (container != null))) {
			if (container.offsetWidth > document.body.scrollWidth) {
				width = container.offsetWidth;
			}
			if (container.offsetHeight > height) {
				height = container.offsetHeight;
			}
		}
	}
	
	if ((browserDetect[0] == 'safari') || (browserDetect[0] == 'chrome')) {
		width = document.body.scrollWidth;
		height = document.body.scrollHeight;
	}
  } // end if (typeof(window.innerWidth) == 'number')
  else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight )) {
    // IE 6+ in 'standards compliant mode' ?? DOCTYPE
    width = document.documentElement.scrollWidth;
	if (document.documentElement.clientHeight > document.documentElement.scrollHeight) {
		height = document.documentElement.clientHeight;
	}
	else {
		height = document.documentElement.scrollHeight;
	}
  }
  else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
    // IE 4 compatible ???? ????? DOCTYPE
   	width = document.body.scrollWidth;
	if (document.body.clientHeight > document.body.scrollHeight) {
		height = document.body.clientHeight;
	}
	else {
		height = document.body.scrollHeight;
	}
  }
  
  return [width, height];
}

function getDocumentAreaShowSize() {
	var width = 0, height = 0;
	if (typeof(window.innerWidth) == 'number') {
	 	// Non-IE
		width = document.body.clientWidth;
		if (myVersionInfo != null) {
			height = window.innerHeight;
			if (document.body.clientHeight > window.innerHeight) {
				height -= 17;
			}
		}
		else {
			height = document.body.clientHeight;
		}
		// alert(window.innerWidth + ' ' + document.body.clientWidth + ' ' + document.body.scrollWidth);
		// alert(window.innerHeight + ' ' + document.body.clientHeight + ' ' + document.body.scrollHeight);
	}
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
	 	 // IE 6+ in 'standards compliant mode' ?? DOCTYPE
	 	width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	}
	else if (document.body &&  (document.body.clientWidth || document.body.clientHeight)) {
	 	// IE 4 compatible ???? ????? DOCTYPE
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	 
	return [width, height];
}