function GetOffsets2( testElement, originID ) {
	// Get each element's X and Y, recurse and add to parent. Ultimately,
	//	return total X/Y offsets relative to specified origin, or the <body>
	var XsoFar = 0;
	var YsoFar = 0;
	while (testElement != null) {
		if (originID == null) {
			// assume we want coordinates relative to the <body> tag
			if (testElement.tagName == 'body') {
				alert ("stopping at element '" + testElement.tagName + "'");
				// this is the origin element, return the offsets we've collected
				break;
			}
		} else {
			// reckon relative to the specified element
			if (testElement.id == originID) {
				///alert ("stopping at element '" + testElement.tagName + "'");
				// this is the origin element, return the offsets we've collected
				break;
			}
		}

		// this is another element in the chain, add its offsets and keep going
		XsoFar += testElement.offsetLeft - testElement.scrollLeft;
		YsoFar += testElement.offsetTop - testElement.scrollTop;

		var newXdelta = testElement.offsetLeft - testElement.scrollLeft;
		var newYdelta = testElement.offsetTop - testElement.scrollTop;
		///alert( "adjusting for a " + testElement.tagName + " (" + newXdelta + ", " + newYdelta + ")" );

		testElement = testElement.offsetParent;
	}

	// return global (page) coordinates relative to found origin (or the <body>)
	return {X:XsoFar, Y:YsoFar};
}

function setMenuPosition(){
	var reference = document.getElementById('mainBackground');
	var target = document.getElementById('iconmenu');
	var triggerOffsets = GetOffsets2(reference);
	
	target.style.left = triggerOffsets.X + 555 + document.body.scrollLeft;
	target.style.top  = triggerOffsets.Y + 35 + document.body.scrollTop;

	
	reference = document.getElementById('mainText');
	if(reference != null){
		if(reference.offsetHeight < 200){
			reference.style.height = "200px";
		}
	}
	
	//target.style.display = 'block';
	
	target.innerHTML = '<li id="panel1"><a title="About Merchant Technologies" href="http://www.merchanttechnologies.com/mtpos/company.php" onclick="this.blur()"></a></li><li id="panel2"><a title="Merchant Technologies Point of Sale Systems" href="http://www.merchanttechnologies.com/mtpos/retail-solutions.php" onclick="this.blur()"></a></li><li id="panel3"><a title="Merchant Technologies Customers" href="http://www.merchanttechnologies.com/mtpos/customers.php" onclick="this.blur()"></a></li><li id="panel4"><a title="Order Merchant Technologies Supplies" href="http://www.merchanttechnologies.com/mtpos/categories/support/login.bis.php?osc" onclick="this.blur()"></a></li><li id="panel5"><a title="Merchant Technologies Support" href="http://www.merchanttechnologies.com/mtpos/support.php" onclick="this.blur()"></a></li>';
}

onresize = setMenuPosition;