/********************************************************************************/
/***** FULL WINDOW DIMENSIONS AND VALUES ***************************************/
/******************************************************************************/

//Visible window width
	var getWindowWidth = 
		function() {
			return window.offsetWidth || document.documentElement.clientWidth;
		};
//Visible window height
	var getWindowHeight = 
		function() {
			return self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
		};
//Visible window width + scroll
	var getTotalWidth = 
		function() {
			return (window.innerWidth + window.scrollMaxX) || document.body.scrollWidth;
		};
//Visible window height + scroll
	var getTotalHeight = 
		function() {
			if (document.body.scrollHeight > document.documentElement.scrollHeight) {
				return document.body.scrollHeight;
			} else {
				return document.documentElement.scrollHeight;
			}
		};
//Scrollable width
	var getScrollWidth = 
		function() {
			return getTotalWidth() - getWindowWidth();
		};
//Scrollable height
	var getScrollHeight = 
		function() {
			return getTotalHeight() - getWindowHeight();
		};
// Distance scrolled from top
	var getScrollTop = 
		function() {
			return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
		};
// Distance scrolled from top
	var getScrollLeft = 
		function() {
			return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
		};
// Set the top scroll distance
	var setScrollTop = 
		function(value) {
			var y = value;
			var x = getScrollTop();
			window.scrollTo(x,y);
		};
// Set the left scroll distance
	var setScrollLeft = 
		function(value) {
			var y = getScrollLeft();
			var x = value;
			window.scrollTo(x,y);
		};
// Set the left and top scroll distance
	var setScroll = 
		function(x,y) {
			window.scrollTo(x,y);
			return true;
		};
// Get total occupied width of element
	var getOffsetWidth = 
		function(obj) {
			return obj.offsetWidth;			
		};
// Get total occupied height of element
	var getOffsetHeight = 
		function(obj) {
			return obj.offsetHeight;
		};
	

/********************************************************************************/
/***** GET ALL MOUSE COORDINATES ***********************************************/
/******************************************************************************/

/***** MOUSE POSITION WITHIN A WINDOW *****/

// X position of mouse
	var getMousePositionX = function(evt) {
		return Event.pointerX(evt);
	}

// Y position of mouse
	var getMousePositionY = function(evt) {
		return Event.pointerY(evt);
	}

/***** MOUSE POSITION WITHIN AN ELEMENT ****/

// X position of mouse
	var getMouseOffsetX = function(obj) {
		var mousePos = getMouseOffset(obj);
		return mousePos.x
		};

// Y position of mouse
	var getMouseOffsetY = function(obj) {
		var mousePos = getMouseOffset(obj);
		return mousePos.y
		};

// Get mouse position within element
	var getMouseOffset = function(obj) {
		var posX = obj.offsetLeft;
		var posY = obj.offsetTop;
		
		while(obj.offsetParent) {
			if(obj == document.getElementsByTagName('body')[0]) {
				break
			} else {
				posX	= posX + obj.offsetParent.offsetLeft;
				posY	= posY + obj.offsetParent.offsetTop;
				obj		= obj.offsetParent;
			}
		}
		var mouseOffset = {
				x: posX,
				y: posY
				};
		return mouseOffset;
	}