// Find the x,y location in pixels for a relatively positioned object
// returns an object with .x and .y properties.
function FindXY(obj){
	var x=0,y=0;
	while (obj!=null){
		x+=obj.offsetLeft-obj.scrollLeft;
		y+=obj.offsetTop-obj.scrollTop;
		obj=obj.offsetParent;
	}
	return {x:x,y:y};
}

// Find the x,y location in pixels for a relatively positioned object
// returns an object with .x, .y, .w (width) and .h (height) properties.
function FindXYWH(obj){
	var objXY = FindXY(obj);
	return objXY?{ x:objXY.x, y:objXY.y, w:obj.offsetWidth, h:obj.offsetHeight }:{ x:0, y:0, w:0, h:0 };
}

function getLeft(e) {
	var pos_x = (HM_IE) ? (e.clientX + HM_IEcanvas.scrollLeft - 1)  : e.pageX;
	var out_x = pos_x;

	// go thru all the navi1 elements, check if the x is within, if so, return that position
	var el = 0;
	while (document.getElementsByTagName("li")[el]) {
		if (document.getElementsByTagName("li")[el].id.substr(0,4) == 'nav1') {
			dim = FindXYWH(document.getElementsByTagName("li")[el]);
			if ((pos_x >= dim.x) && (pos_x <= dim.x + dim.w)) {
				out_x = dim.x;
				el = 100;
			}
		}
		el++;
	}

	return(out_x);
}
