/**********************************************************************
HOW TO USE POPUP HINT WINDOWS
//*********************************************************************

1.) Include this file and 'finddom.js' in the site and link to them on 
the page using the following statments(make sure finddom.js comes first).

	<script src="javascripts/finddom.js"></script>
	<script src="javascripts/popupwindow.js"></script>
	
	
2.) Right after these scripts include the necessary style section 
(below). It can come after the mandatory style sheet link tag.
However, you will need to include a "#ht" object for each pop-up
on the page, ex: #ht1,#ht2,#ht3,#ht4,#ht5,#ht6  - for six popups

<style media="screen" type="text/css"><!--
	#ht1,#ht2,#ht3 {
		position: absolute;
		z-index: 100;
		top: 0px;
		left: 10px;
		visibility: hidden 
		}
	.hyperText  {
		font: 10px/12px "Trebuchet MS", Arial, Helvetica, Geneva, sans-serif;
		background-color: #FFFFFF;
		padding: 5px;
		border: solid 2px #CCCCCC;
		width: 250px;
		layer-background-color: #CCCCCC 
		}
  --></style>
	
	
3.) After the <BODY> tag, place the popups. Actually, they
can be placed anywhere since their styling makes them invisible

	<SPAN ID="ht1" CLASS="hyperText">
	Popup message number 1</SPAN> 
	<SPAN ID="ht2" CLASS="hyperText">
	Popup message number 2</SPAN> 
	<SPAN ID="ht3" CLASS="hyperText">
	Popup message number 3</SPAN> 
	
	
4.) Finally you set up stock links bearing the name of the pop-up
it uses (in this case ht2). ONMOUSEOVER causes the popup to appear
ONMOUSEOUT causes it to disappear. These pop-up links can be used
over and over in many different locations.

<A HREF="#" ONMOUSEOUT="popUp(event,'ht2')" ONMOUSEOVER="popUp(event,'ht2')"></A>
	
**********************************************************************/

function findLivePageWidth() {
	if (window.innerWidth != null)
		return window.innerWidth;
	if (document.body.clientWidth != null)
		return document.body.clientWidth;
	return (null);
  }
	
function popUp(evt,objectID){
  //initiate if findDOM says we are working in a safe environment.
	if (isDHTML) { 
	  //grab variables, hidden object text, visibility, style etc....
		var livePageWidth = findLivePageWidth();
		domStyle = findDOM(objectID,1);
		dom = findDOM(objectID,0);
		state = domStyle.visibility;
		//protect against appearing off screen
		if (dom.offsetWidth) elemWidth = dom.offsetWidth;
		  else { if (dom.clip.width)	elemWidth = dom.clip.width; }
		//toggle the pop-ups visibility
		if (state == "visible" || state == "show")  { 
		  //hide
			domStyle.visibility = "hidden"; 
			}
		else {
		  //show
			if (evt.pageY) { //Calculates the position for Navigator 4 
				topVal = evt.pageY + 15;
				leftVal = evt.pageX - (elemWidth / 2); 
			}
			else { 
				if (evt.y) { // Calculates the position for IE4
					topVal = evt.y + 15 + document.body.scrollTop;
					leftVal = evt.x - (elemWidth / 2) + document.body.scrollLeft;
				}
			}
		/*If the element goes off the page to the left, this moves it back */
			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"; // Makes the element visable 
		}
	}
}
		

