Document.prototype.VLC_ns = "http://www.w3.org/1999/xhtml";
HTMLObjectElement.prototype.VLC_addParam = function (name, value) {
    var p = this.ownerDocument.createElementNS(this.ownerDocument.VLC_ns, "param");
    p.setAttributeNS(null, "name", name);
    p.setAttributeNS(null, "value", value);
    this.appendChild(p);
};
HTMLObjectElement.prototype.VLC_addLink = function (href, content) {
    var link = this.ownerDocument.createElementNS(this.ownerDocument.VLC_ns, "a");
    link.setAttributeNS(null, "href", href);
    link.textContent = content;
    this.appendChild(link);
};
HTMLObjectElement.prototype.VLC_addText = function (s) {
    var text = this.ownerDocument.createTextNode(s);
    this.appendChild(text);
};
Document.prototype.VLC_createObject = function (file, width, height, params) {
    var obj = this.createElementNS(this.VLC_ns, "object");
    obj.setAttributeNS(null, "type", "application/x-vlc-plugin");
    obj.setAttributeNS(null, "width", width);
    obj.setAttributeNS(null, "height", height);
    obj.VLC_addParam("version", "VideoLAN.VLCPlugin.2");
    obj.VLC_addParam("mrl", file);
    for (var i in params) {
        obj.VLC_addParam(i, params[i]);
    }
    obj.VLC_addText("Error: Embedding ");
    obj.VLC_addLink(file, file);
    obj.VLC_addText(" with the ");
    obj.VLC_addLink("http://videolan.org/", "Mozilla VLC plug-in");
    obj.VLC_addText(" failed.");
    return obj;
};
Element.prototype.VLC_replaceContentWith = function (obj) {
    while (this.hasChildNodes()) {
        this.removeChild(this.lastChild);
    }
    this.appendChild(obj);
};
Document.prototype.VLC_waitForElement = function (id, func) {
    this.addEventListener("DOMContentLoaded", function (e) {
        func(e.target.getElementById(id), e.target.getElementById(id + "_file").getAttributeNS(null, "href"));
    }, false);
};
