Document.prototype.HTMLNS = "http://www.w3.org/1999/xhtml";
Document.prototype.createVideoButton = function(buttonText, func) {
    var button = this.createElementNS(this.HTMLNS, "button");
    button.textContent = buttonText;
    button.addEventListener("click", func, false);
    button.style.margin = "2px 10px";
    return button;
};
Element.prototype.addVideoButton = function(buttonText, func) {
    this.appendChild(this.ownerDocument.createVideoButton(buttonText, func));
};
Document.prototype.createVideo = function(src, name, width, height, uacontrols) {
    var video = this.createElementNS(this.HTMLNS, "video");
    video.setAttributeNS(null, "width", width);
    video.setAttributeNS(null, "height", height);
    video.setAttributeNS(null, "src", src);
    if (uacontrols) {
        video.setAttributeNS(null, "controls", "controls");
    }
    var link = this.createElementNS(this.HTMLNS, "a");
    link.textContent = name;
    link.setAttribute("href", src);
    video.textContent = "Embedding ";
    video.appendChild(link);
    video.appendChild(this.createTextNode(" with the video element failed."));
    return video;
};
Element.prototype.replaceContent = function(elements) {
    this.textContent = "";
    for (var i = 0; i < elements.length; ++i) {
        if (elements[i]) {
            this.appendChild(elements[i]);
        }
    }
};