/**
 * Method inserts an element after an existing element.
 * @note DOM does not provide a insertAfter method.
 * @usage `Core.insertAfter(newElement, targetElement);`
 * @param {Object} newElement New element object reference.
 * @param {Object} targetElement Target element object reference.
 */
Core.insertAfter = function(newElement, targetElement) {
  var parent = targetElement.parentNode;
  // Is target element the last child of the parent?
  if (parent.lastChild === targetElement) {
    parent.appendChild(newElement);
  } else {
    // Otherwise the new element needs to be inserted between the target
    // element abd the next child of parent.
    parent.insertBefore(newElement, targetElement.nextSibling);
  }
};
