title: How do I move an element up/down one position in tree
body: <p>I cannot seem to find what should be a basic function of JavaScript. I want to move an element up one position or down one position by a button click. jQuery and other proprietary libraries are not an option.</p>
  <pre><code>function moveDown()
  {
      if (document.getElementById('CMSeditingNode'))
      {
          var node = document.getElementById('CMSeditingNode'),
          parent = node.parentNode,
          nextNode = node.nextSibling,
          secondNode = nextNode.nextSibling,
          oldChild = parent.removeChild(node);
          parent.insertBefore(oldChild, secondNode);
      }
  }
  </code></pre>
  <p>The answer worked perfectly and I have add to this post a supplement for insertAfter().</p>