//Various dynamic text manipulation tools

function getText(element)
{
	var text = "";
	if (element)
	{
		if (element.firstChild)
		{
			text += element.firstChild.nodeValue;
		}
	}
	return text;
}

function getMultiText(element)
{
	var text = "";
	if (element != null)
	{
		if (element.childNodes)
		{
			for (i=0;i<element.childNodes.length;i++)
			{
				if (element.childNodes[i].nodeValue)
				{
					text += element.childNodes[i].nodeValue;
				}
			}
		}
	}
	return text;
}

function clearText(element)
{
	if (element)
	{
		if (element.childNodes)
		{
			while(element.hasChildNodes())
			{
				element.removeChild(element.firstChild);
			}
		}
	}
}

function replaceText(text,element)
{
	if (element)
	{
		clearText(element);
		var newText = document.createTextNode(text);
		element.appendChild(newText);
	}
}