
//Notes popup***************************************************************

var mouseoverTimer = null;

window.document.onmousemove = TrackMousePosition;

var mouseXCoord;
var mouseYCoord;

function TrackMousePosition()
{
	mouseXCoord = event.clientX;
	mouseYCoord = event.clientY;
}


function Note_MouseOverHandler(divID)
{
	mouseoverTimer = setTimeout("ShowNote('" + divID + "');", 400); 
}

function ShowNote(divID)
{
	var noteItem = document.getElementById(divID);
	var visW = parseInt(document.body.clientWidth);
	var visH = parseInt(document.body.clientHeight);
	var popLeft = parseInt(mouseXCoord) + parseInt(document.body.scrollLeft);
	var popTop = parseInt(mouseYCoord) + parseInt(document.body.scrollTop);
	var popWidth = parseInt(noteItem.style.width) + 8; //Add on for shadow.
	var popHeight = parseInt(noteItem.offsetHeight);
	
	if((parseInt(mouseXCoord) + popWidth) > visW) //Try to move left of the cursor.
		popLeft -= popWidth;
		
	if((parseInt(mouseYCoord) + popHeight) > visH) //Try to move above the cursor.
		popTop -= popHeight;
	
  	noteItem.style.left = popLeft; 
  	noteItem.style.top = popTop; 
  	
	noteItem.style.visibility = 'visible';
	noteItem.style.display = 'block';
}

function CloseDiv(divID)
{
	var noteItem = document.getElementById(divID);
	noteItem.style.visibility = 'hidden';
	
	//Show the drop downs again.
	for(var i=0; i<document.forms.length; i++)
	{
		for(var k=0; k<document.forms[i].length; k++)
		{
			if(document.forms[i].elements[k].type == "select-one")
			{
				document.forms[i].elements[k].style.visibility='visible';
			}
		}
		
	}
}

function ShowNoteAtTop(divID)
{
	var noteItem = document.getElementById(divID);
	
	//Hide the drop down boxes.
	for(var i=0; i<document.forms.length; i++)
	{
		for(var k=0; k<document.forms[i].length; k++)
		{
			if(document.forms[i].elements[k].type == "select-one")
			{
				document.forms[i].elements[k].style.visibility='hidden';
			}
		}
		
	}
	
	/*
	var visW = parseInt(document.body.clientWidth);
	var visH = parseInt(document.body.clientHeight);
	var popLeft = parseInt(mouseXCoord) + parseInt(document.body.scrollLeft);
	var popTop = parseInt(mouseYCoord) + parseInt(document.body.scrollTop);
	var popWidth = parseInt(noteItem.style.width) + 8; //Add on for shadow.
	var popHeight = parseInt(noteItem.offsetHeight);
	
	if((parseInt(mouseXCoord) + popWidth) > visW) //Try to move left of the cursor.
		popLeft -= popWidth;
		
	if((parseInt(mouseYCoord) + popHeight) > visH) //Try to move above the cursor.
		popTop -= popHeight;
*/
  	noteItem.style.left = 60; 
  	noteItem.style.top = 10; 
  	
	noteItem.style.visibility = 'visible';
	noteItem.style.display = 'block';
}

function Note_MouseOutHandler(divID)
{
	if(mouseoverTimer != null)
	{
		clearTimeout(mouseoverTimer);
		mouseOverTimer = null;
	}

  	document.all[divID].style.visibility = "hidden"; 
}
		
		
		
		
//**************************************************************************
