/* courtesy JavaScript: The Definitive Guide */
	
/* WindowGeometry.js
 * functions:
 * getWindowX(), getWindowY() : returns the position of the window on the screen
 * getViewportWidth(), getViewportHeight() : returns the size of the browser viewport area
 * getDocumentWidth(), getDocumentHeight() : return the size of the document
 * getHorizontalScroll() : return the position of the horizontal scrollbar
 * getVerticalScroll() : return the position of the vertical scrollbar
 */

/* IMPORTANT: this code must be inserted in the BODY, not in the HEAD! */

var WindowGeometry={};
var DocumentGeometry={};
if (window.screenLeft){//IE and others
	WindowGeometry.getWindowX=function(){return window.screenLeft;};
	WindowGeometry.getWindowY=function(){return window.screenTop;};
}
else if (window.screenX) {// FireFox and others}
	WindowGeometry.getWindowX=function(){return window.screenX;};
	WindowGeometry.getWindowY=function(){return window.screenY;};
}

if (window.innerWidth){//All browsers but IE
	WindowGeometry.getViewportWidth=function(){return window.innerWidth;};
	WindowGeometry.getViewportHeight=function(){return window.innerHeight;};
	WindowGeometry.getHorizontalScroll=function(){return window.pageXOffset;};
	WindowGeometry.getVerticalScroll=function(){return window.pageYOffset;};
}
else if(document.documentElement && document.documentElement.clientWidth){
	//IE6 when there is a DOCTYPE
	WindowGeometry.getViewportWidth=function(){return document.documentElement.clientWidth;};
	WindowGeometry.getViewportHeight=function(){return document.documentElement.clientHeight;};
	WindowGeometry.getHorizontalScroll=function(){return document.documentElement.scrollLeft;};
	WindowGeometry.getVerticalScroll=function(){return document.documentElement.scrollTop;};
}
else if (document.body.clientWidth){
	//IE4,5 and 6 without a DOCTYPE
	WindowGeometry.getViewportWidth=function(){return document.body.clientWidth;};
	WindowGeometry.getViewportHeight=function(){return document.body.clientHeight;};
	WindowGeometry.getHorizontalScroll=function(){return document.body.scrollLeft;};
	WindowGeometry.getVerticalScroll=function(){return document.body.scrollTop;};
}

if (document.documentElement && document.documentElement.scrollWidth){
	DocumentGeometry.getDocumentWidth=function(){return document.documentElement.scrollWidth;};
	DocumentGeometry.getDocumentHeight=function(){return document.documentElement.scrollHeight;};
}
else if (document.body.scrollWidth){
	DocumentGeometry.getDocumentWidth=function(){return document.body.scrollWidth;};
	DocumentGeometry.getDocumentHeight=function(){return document.body.scrollHeight;};
}