// Tried doing this:  http://www.pjhyett.com/articles/2006/07/05/timeout-your-mouseovers
var RollIt = {
	showPopup : function(e)
	{
		if (document.getElementById)
		{
			obj = document.getElementById(e);
			if (obj.style.display == "" || obj.style.display == "none")
			{
				obj.style.display = "block";
			}
		}
	},
	hidePopup : function(e)
	{
		if (document.getElementById)
		{
			obj = document.getElementById(e);
			if (obj.style.display != "none")
			{
				obj.style.display = 'none';
			}
		}
	}    
}

// This grabs the keycode that was typed by the user
function getKeynum(e)
{
	var keynum = 0;

	if (e.keyCode)
	{
		if (window.event)	// IE
		{
			keynum=e.keyCode;
		}
		else
		{
			keynum = -1;	// Mozilla Control characters
		}
	}
	else if (e.charCode)		// Everything else
	{
		keynum=e.charCode;
	}

	return keynum;
}

// We only want to be able to input the following:  $ , . 0-9
function inputDollars(e)
{
	var keynum;
	var numcheck;

	keynum = getKeynum(e);
	if (keynum == -1) { return true; }

	numcheck = /[\$\d\,\.]/;
	return numcheck.test(String.fromCharCode(keynum));
}

function popupWindow(text, w, h)
{
	var text = (text == null) ? " " : text;
	var w = (w == null) ? 300 : w;
	var h = (h == null) ? 300 : h;

	myWin = window.open(text, "", "width="+w+", height="+h);

	return false;
}

function titleSlide(myId, baseId, timer, distance)
{
	if (document.getElementById)
	{
		myObj = document.getElementById(myId);
		baseObj = document.getElementById(baseId);
		myTop = myObj.offsetTop;
		baseTop = baseObj.offsetTop;

		if (baseTop > myTop)
		{
			myObj.style.top = (myTop + distance) + 'px';
			setTimeout("titleSlide('" + myId + "', '" + baseId + "', " + timer + ", " + distance + ")", timer);
		}
		else
		{
			myObj.style.top = baseTop + 'px';
		}
	}
}

function toggle(e)
{
	if (document.getElementById)
	{
		obj = document.getElementById(e);
		//obj.style.display = (obj.style.display != 'none' ? 'none' : '' );
		if (obj.style.display == "" || obj.style.display == "none")
		{
			obj.style.display = "block";
		}
		else
		{
			obj.style.display = "none";
		}
	}
}

function warn()
{
	alert("Please choose an option.");
}

function printPage()
{
	window.print();
}
