//Use childNodes[0].nodeValue in place of innerHTML (cross browser compatible)  - Taken From: http://alistapart.com/articles/imagegallery

// The currently selected text.
	var selectedText = '';
// Track the cursors position.
	var cursorPos = '';
// captures the current key pressed by the user, onkeyDown event.
	var curKey = '';

  
/* Used for debugging purposes. Follow steps on How to use.
	How to use:
		1. Call this method/function in the body of your HTML doc like so:
			<body onload="init();">
		2. Next create a textArea and give it the ID name:  id="debugWindow"
		2. Place the following if statement in your code where needed.
			if (dbgWin) dbgWin.value = (place your variables or string here);
*/
function init()
{
	//if (getObject("debugWindow")) dbgWin = getObject("debugWindow");
	dbgWin = (GetObject("debugWindow")) ?  GetObject("debugWindow") : dbgWin = false;

	return true;
}
/* Better way to detect browser methof and retrieve html objects,
	without putting redundant if statment all through your code.
	How to use:
		1. Call this method/function, replacing idString with an HTML elements id.
		2. Checks to make sure the string is not null and that the element exist
			ex: getObject("debugWindow");
*/
function GetObject(idString)
{
	var theObj = null;
	
	if(idString == null) return false;
	//else
	if (document.getElementById)
		theObj = document.getElementById(idString);
	else if (document.all)
		theObj = document.all[idString];
	else if (document.layers)
		theObj = document.layers[idString];

	if (theObj) return theObj;
	
	return false;
}

function SetFocus(elementID)
{
	// set a pointer to the object.
	theObject = GetObject(elementID);
	if (theObject)
	{
		theObject.focus();
		return true;
	}
	return false;
}

function SetCursor(elementID)
{
	// set a pointer to the object.
	theObject = GetObject(elementID)
	if (theObject)
		return theObject.focus = true;
}
