
// Alternative to m.offsetLeft as some browsers take their offsets from the body while others take it from the parent element
function FindPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) { curleft += obj.x; }
	return curleft;
}

// Alternative to m.offsetTop as some browsers take their offsets from the body while others take it from the parent element
function FindPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y) { curtop += obj.y; }
	return curtop;
}

// get the height of the window
function GetWindowHeight() {
	if (window.innerHeight) 
		var window_height = window.innerHeight;
	else {
		if (document.documentElement.clientHeight)
			var window_height = document.documentElement.clientHeight;
		else
			var window_height = document.body.clientHeight;
	}
	return window_height;
}

// get the position of the scroll bar
function GetScrollTop() {
	if (window.pageYOffset)
		var window_top = window.pageYOffset;
	else {
		if (document.documentElement.scrollTop)
			var window_top = document.documentElement.scrollTop;
		else
			var window_top = document.body.scrollTop;
	}
	return window_top;
}
