function showPopup(popupDomId, anchor, xOffset, yOffset) {
	// get the position of the anchor element
	var pos = getPositionOnPage( anchor );

	// get the DOM object with the specified DOM Id
	var popupDomObj = document.getElementById(popupDomId);

	// reposition the DOM object
	if( popupDomObj && pos ) {
		popupDomObj.style.left = pos[0] + xOffset;
		popupDomObj.style.top = pos[1] + yOffset;

		// show the DOM object
		popupDomObj.style.display = "block";
	}


}

function getPositionOnPage(obj) {

	var x = y = 0;

	if (obj.offsetParent) {
		x = obj.offsetLeft
		y = obj.offsetTop

		var parent = obj.offsetParent;
		while (parent) {
			x += parent.offsetLeft
			y += parent.offsetTop

			parent = parent.offsetParent
		}
	}
	return [x,y];
}

function hidePopup(popupDomId) {
	var popupDomObj = document.getElementById( popupDomId );

	if( popupDomObj ) {
		popupDomObj.style.display = "none";
	}
}

