
	function findLivePageHeight() {
		if (window.innerHeight != null)
			return window.innerHeight;
		if (document.body.clientHeight != null)
			return document.body.clientHeight;
		return (null); 
	}

	function findLivePageWidth() {
		if (window.innerWidth != null)
			return window.innerWidth;
		if (document.body.clientWidth != null)
			return document.body.clientWidth;
		return (null); 
	}

	function findLeft(objectID) {
		var domStyle = findDOM(objectID, 1);
		var dom = findDOM(objectID, 0);
		if (domStyle.left)
			return domStyle.left;
		if (domStyle.pixelLeft)
			return domStyle.pixelLeft;
		if (dom.offsetLeft)
			return dom.offsetLeft;
		return (null);
	}
	function findTop(objectID) {
		var domStyle = findDOM(objectID, 1);
		var dom = findDOM(objectID, 0);
		if (domStyle.top)
			return domStyle.top;
		if (domStyle.pixelTop)
			return domStyle.pixelTop;
		if (dom.offsetTop)
			return dom.offsetTop;
		return (null);
	}

	function popUp(evt, objectID) {
		if (isDHTML) {
			var livePageWidth = findLivePageWidth();
			domStyle = findDOM(objectID, 1);
			dom = findDOM(objectID, 0);
			state = domStyle.visibility;

			if (dom.offsetWidth) elemWidth = dom.offsetWidth;
			else { if (dom.clipWidth) elemWidth = dom.clip.width; }

			if (state == "visible" || state == "show") { domStyle.visibility = "hidden"; }
			else {
				if (evt.pageY) {
					topVal = evt.pageY + 4;
					leftVal = evt.pageX - (elemWidth / 2);
				}
				else {
					if (evt.y) {
						topVal = evt.y + 4 + document.body.scrollTop;
						leftVal = evt.x - (elemWidth / 2) + document.body.scrollLeft;
					}
				}
				if (leftVal < 2) { leftVal = 2; }
				else {
					if ((leftVal + elemWidth) > livePageWidth) { leftVal = leftVal - (elemWidth / 2); }
				}
				domStyle.top = topVal; // positions the element from the top
				domStyle.left = leftVal; // positions the element from the left
				domStyle.visibility = "visible"; //shows it
			}
		}
	}


/* function to make popup object appear at specific location in relation to its link */
/* use length and height of link, do not use user's click position */
	function popUpHere(evt, objectID, lnkID, cntID) {
		
		if (isDHTML) {
			var livePageWidth = findLivePageWidth();
			domStyle = findDOM(objectID, 1);
			dom = findDOM(objectID, 0);
			state = domStyle.visibility;
			
			linkTop = findTop(lnkID);
			linkLeft = findLeft(lnkID);

			cntTop = findTop(cntID);
			cntLeft = findLeft(cntID);

			if (dom.offsetWidth) elemWidth = dom.offsetWidth;
			else { if (dom.clipWidth) elemWidth = dom.clip.width; }

			if (state == "visible" || state == "show") { domStyle.visibility = "hidden"; }
			else {
				if (evt.pageY) {
					topVal = linkTop + cntTop;  /* firefox     + 4; */
					leftVal = linkLeft + cntLeft;  /*  - (elemWidth / 2); */
				}
				else {
					if (evt.y) {
						topVal = linkTop + cntTop + 78;  /*  IE    + 4;  */
 						leftVal = linkLeft + cntLeft + 172;  /*  - (elemWidth / 2); */
						/* topVal = evt.y + 4 + document.body.scrollTop;
						leftVal = evt.x - (elemWidth / 2) + document.body.scrollLeft; */
					}
				}
				if (leftVal < 2) { leftVal = 2; }
				else {
					if ((leftVal + elemWidth) > livePageWidth) { leftVal = leftVal - (elemWidth / 2); }
				}
				domStyle.top = topVal; // positions the element from the top
				domStyle.left = leftVal; // positions the element fromt the left
				domStyle.visibility = "visible"; //shows it
			}
		}
	}


