__replaceChild__ = function(nodelist, newChild, refChildIndex) {
    var ret = null;

    // bounds check
    if ((refChildIndex >= 0) && (refChildIndex < nodelist.length)) {
        // preserve old child for return
        ret = nodelist[refChildIndex];

        if (newChild.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {
            // node is a DocumentFragment
            // get array containing children prior to refChild
            Array.prototype.splice.apply(nodelist,
                [refChildIndex, 1].concat(newChild.childNodes.toArray()));
        }
        else {
            // simply replace node in array (links between Nodes are
            // made at higher level)
            nodelist[refChildIndex] = newChild;
        }
    }
    // return replaced node
    return ret;
}
@method __replaceChild__
     replace the specified Node in the NodeList at the specified index
     Used by Node.replaceChild(). Note: Node.replaceChild() is responsible
     for Node Pointer surgery __replaceChild__ simply modifies the internal
     data structure (Array).

@param  newChild      : Node - the Node to be inserted
@param  refChildIndex : int     - the array index to hold the Node