//*******************************************************************/
// 																	*/
// Filename: floatingdiv.js											*/
// Author: Ricky McAlister											*/
// Created: 10/07/2006												*/
// Updated: 11/07/2006												*/
// 																	*/
// Description: Used to create a floating div object at the mouse  	*/
//              pointer co-ordinates or 							*/
//				pre-defined x, y co-ordinates						*/
// 																	*/
// Use: Initially setup as a JavaScript src and called from within 	*/
//      the HTML code - onMouseOver, onMouseOut, onClick, etc.		*/
//		e.g. onMouseOver="showHide('hiddenDiv')"					*/
//																	*/
// Notes:	The div object may contain text or images and can have 	*/
//			any other style elements defined. The div must have  	*/
//			it's display element set to 'none' within the div tag  	*/
//			(NOT set within the style - see example.html)			*/											 	
//																	*/
// Amendments:	1) Created second function 							*/
//				showHidePos(obj, xpos, ypos), to show the div at a	*/
//				specified x, y position								*/
//																	*/
/********************************************************************/

// monitor mouse co-ordinates with a dedicated handler:
// declare variables to hold mouse co-ordinates

    var mouseX, mouseY;

 	function getMousePos(e)
	{

   		if (!e)
		{
        	var e = window.event||window.Event;
		}

 		if('undefined'!=typeof e.pageX)
		{

         	mouseX = e.pageX;
			mouseY = e.pageY;

      	}else{

        	mouseX = e.clientX + document.body.scrollLeft;
			mouseY = e.clientY + document.body.scrollTop;

    	}

 	}

	// tell Mozilla/FireFox to start listening:

  	if(window.Event && document.captureEvents)
	{
   		document.captureEvents(Event.MOUSEMOVE);
	}
 	
	// assign the mouse handler

   	document.onmousemove = getMousePos;


	function showHide(obj, othObj)
	{
		var el = document.getElementById(obj);
		
		if ( el.style.display == "none" ) 
		{
			mouseX = mouseX + 10;

			
			// show the element at the mouse pointer
			el.style.display = '';
			el.style.position = 'absolute';
			//el.style.left = event.clientX;
			//el.style.top = event.clientY;
			el.style.left = mouseX + "px";

        	el.style.top = mouseY + "px";
		}else {
			// make the element disappear
			el.style.display = 'none';
		}// end if else !=
		
		// remove the other calendar element
		var othEl = document.getElementById(othObj);
		
		if ( el.style.display == "" ) 
		{
			// make the element disappear
			othEl.style.display = 'none';
		}// end if
	}// end functon showHide()
	
	
	function showDiv(obj, loop)
	{
		var theDiv = "div" + obj;
	
		var el = document.getElementById(theDiv);
			
		if (el.style.display == "none")
		{
			for(i=1; i<=loop; i++){
				
				var div = "div" + i;
		
				hide = document.getElementById(div);
				hide.style.display = "none";
			}
		}
		
		el.style.display = '';
	}// end functon showHide()
