// Keep Track of Mouse Position -----------------------------
if (!document.all)
document.captureEvents(Event.MOUSEMOVE)

// On the move of the mouse, it will call the function getPosition
document.onmousemove = getPosition;

// These varibles will be used to store the position of the mouse
var mouseX = 0
var mouseY = 0

// This is the function that will set the position in the above varibles 
function getPosition(args) 
{
  // Gets IE browser position
  if (document.all) 
  {
    mouseX = event.clientX + f_scrollLeft()
    mouseY = event.clientY + f_scrollTop()
  }
  
  // Gets position for other browsers
  else 
  {  
    mouseX = args.pageX
    mouseY = args.pageY
  }
}
// END Keep track of mouse positions =========================





// Blue Help Buttons -------------------------

function ShowHelp()
{
	document.getElementById("helpPopUp").style.display = ""
	
	xOffset = 50;
	
	if(mouseX > (f_clientWidth() - 400)) xOffset = -400
		
	document.getElementById("helpPopUp").style.top = mouseY - 150 +'px'
	document.getElementById("helpPopUp").style.left = mouseX + xOffset +'px'
}

function HideHelp()
{
	document.getElementById("helpPopUp").style.display = "none"
}
// END Blue Help Buttons =========================

function ShowH(ID)
{
	var ts = new Date()
	
	document.getElementById('headingIFrame').src = "../../headingDescription.php?ID="+ID+"&ts="+ts.getTime();
	
	yOffset = 12
	xOffset = 20
	
	
	if(mouseX > (f_clientWidth() - 420)) xOffset = -420
	if(mouseY > (f_clientHeight() - 120)) yOffset = -120
	
	/*
	else if((mouseY - f_scrollTop()) < 100) yOffset = -40
	else if((mouseY - f_scrollTop()) < 200) yOffset = -140
	else if((mouseY - f_scrollTop()) < 300) yOffset = -190
	else if((mouseY - f_scrollTop()) < 350) yOffset = -240
	else if((mouseY - f_scrollTop()) < 400) yOffset = -290
	
	//document.getElementById("xPos").innerHTML = "X:"+mouseX+" Y:"+mouseY+" scrollTop:"+f_scrollTop();
	*/
	
	document.getElementById("headingPopUp").style.top = mouseY + yOffset +'px'
	document.getElementById("headingPopUp").style.left = mouseX + xOffset +'px'
	
	document.getElementById('headingPopUp').style.display = "";
	
}
function HideH()
{
	document.getElementById('headingPopUp').style.display = "none";
	document.getElementById('headingIFrame').src = "../../blank.html";
}

function ShowC(ID)
{
	var ts = new Date()
	
	document.getElementById('headingIFrame').src = "../../eventDescription.php?ID="+ID+"&ts="+ts.getTime();
	
	yOffset = 12
	xOffset = 20
	
	if(mouseX > (f_clientWidth() - 420)) xOffset = -420
	if(mouseY > (f_clientHeight() - 120)) yOffset = -120
	
	document.getElementById("headingPopUp").style.top = mouseY + yOffset +'px'
	document.getElementById("headingPopUp").style.left = mouseX + xOffset +'px'
	
	document.getElementById('headingPopUp').style.display = "";
	
}
function HideC()
{
	document.getElementById('headingPopUp').style.display = "none";
	document.getElementById('headingIFrame').src = "../../blank.html";
}

// Drop Down Menu Control -------------------------

onSub = new Array()
onButton = new Array()

function ShowMenu(dropdownID)
{
    var dropdown = document.getElementById("dropdown"+dropdownID).style
 
 	onButton[dropdownID] = 1
	dropdown.display=""

}

function HideMenu(dropdownID)
{
	var dropdown = document.getElementById("dropdown"+dropdownID).style

	dropdown.display="none"
}

// END Drop Down Menu Control ======================








var newWindow=""

function emailPage(f,m,s,ID,nodeID,description)
{
	if(newWindow == "" || newWindow.closed)
	{
		newWindow = window.open("../../emailPage.php?f="+f+"&m="+m+"&s="+s+"&ID="+ID+"&description="+description,"new","height=480,width=415,scrollbars=1,resizeable=1")
	}
	else
	{ 
		newWindow.location.href="../../emailPage.php?f="+f+"&m="+m+"&s="+s+"&ID="+ID
		newWindow.focus()
	}
}



// This functions adjusts the formatting of the page for 800x600 browsers
function HidePanel()
{
	
	if(document.documentElement.clientWidth < 900)
	{
		var rightPanel = document.getElementById("rightPanel")
		rightPanel.style.display = "none";
	}
}



var sendEmail=""

function sendEmailButton(ID)
{
	if(sendEmail == "" || sendEmail.closed)
	{
		sendEmail = window.open("../../sendEmailButton.php?ID="+ID,"new","height=440,width=405,scrollbars=1,resizeable=1")
	}
	else
	{ 
		sendEmail.location.href="../../sendEmailButton.php?ID="+ID
		sendEmail.focus()
	}
}



function ShowRow(rowID)
{
    var chunk = document.getElementById(rowID).style
	
    if(chunk.display == "")
	{
		chunk.display="none"
	}
	else
	{
		chunk.display=""
	}
}




// BEGIN - FONT SIZE CONTROLS ------------------------------

var min=0.8;
var max=2.0;

function increaseFontSize() 
{
	var p = document.getElementById('pageBody');
		
	var s = parseFloat(p.style.fontSize.replace("em",""));
	
	if(s!=max)
	{
		s += 0.2;
	}
	p.style.fontSize = s+"em"
	
	document.cookie = "emhFontSize="+s+"; expires=Thu, 2 Aug 2020 1:01:01 UTC; path=/";

   
}
function decreaseFontSize() 
{
	var p = document.getElementById('pageBody');
	
	var s = parseFloat(p.style.fontSize.replace("em",""));
	
	if(s!=min) 
	{
		s -= 0.2;
	}
	p.style.fontSize = s+"em"
     
	document.cookie = "emhFontSize="+s+"; expires=Thu, 2 Aug 2020 1:01:01 UTC; path=/";
}

// END FONT SIZING ======================================



// Browser Proof Window and Scroll Calculations -------------------------------------
function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
// END Browser Proof Window and Scroll Calculations ====================================