/**
 * @param target   dom node  a existing dom node where the code should be replaced
 * @param content  dom node  a existing dom node with the content to replace
 */
function replaceHTML (target, content)
{
	target.parentNode.insertBefore(content, target);
	target.style.display = "none";
}
function selectNthElement(node, name, n)
{
	var x = node.childNodes;
	var t = 0;
	for (var i = 0; i < x.length; i++)
	{
		if (x[i].nodeName.toLowerCase() != name.toLowerCase())
		{
			continue;
		}
		t++;
		if (t == n)
		{
			return x[i];
		}
	}
}

