/*
 *
 * This file contains snippets that I cut and pasted from:
 * http://www.quirksmode.org/
 * There really is a lot of good stuff on that site. I wish the person who maintains it
 * would write a nice js library that I could use instead. But hey, I'm not complaining!
 *
 * The scripts were copied from these two pages (and minor modifications were added)
 * http://www.quirksmode.org/js/dhtmloptions.html
 * http://www.quirksmode.org/js/fixedmenu.html#expl
 */

/*
 * DHTML Micro API
 */
function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

/*
 * Sticky Menu
 */
var menu;
var theTop = 30;
var old = theTop;

function initButton()
{
	menu = new getObj('topButton');
	movemenu();
}

function movemenu()
{
	if (window.innerHeight)
	{
		  pos = window.pageYOffset
	}
	else if (document.documentElement && document.documentElement.scrollTop)
	{
		pos = document.documentElement.scrollTop
	}
	else if (document.body)
	{
		  pos = document.body.scrollTop
	}
	if (pos < theTop) pos = theTop;
	else pos += 30;
	if (pos == old)
	{
		menu.style.top = pos + "px";
	}
	old = pos;
	
	if(pos == 30)
		menu.style.visibility = "hidden";
	else
		menu.style.visibility = "visible";

	temp = setTimeout('movemenu()',250);
}

function displayFloatButton(){
	   document.write(
	   	"<div id='topButton'><a href='javascript: window.scrollTo(0,0);void 0'><b>Top</b></a></div>"
	   );
}