function insertBefore(node, position)
{
	position.parentNode.insertBefore(node, position);
}

function insertAfter(node, position)
{
	if(position.nextSibling)
	{
		insertBefore(node, position.nextSibling);
	}
	else
	{
		if(position.parentNode)
		{
			appendChild(node, position.parentNode);
		}
	}
}

function appendChild(node, position)
{
	position.appendChild(node);
}

function appendChildFirst(node, position)
{
	if(position.firstChild)
	{
		insertBefore(node, position.firstChild);
	}
	else
	{
		appendChild(node, position);
	}
}


function removeNode(node)
{
	if(node && node.parentNode)
		node.parentNode.removeChild(node);
}



//supprime tout les noeuds enfant
function killAllChildren(parrentNode)
{
	while(parrentNode.hasChildNodes())
		parrentNode.removeChild(parrentNode.firstChild);
}
