function AppletObject(code, width, height) {
    var obj = document.createElement("object");
    obj.setAttribute("width", width);
    obj.setAttribute("height", height);
    obj.setAttribute("type", "application/x-java-applet");
    if (window.ActiveXObject) {
        obj.setAttribute("classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
        obj.setAttribute("codebase", "http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0");
    }
    this.addParam = function(name, value) {
        var p = document.createElement("param");
        p.setAttribute("name", name);
        p.setAttribute("value", value);
        obj.appendChild(p);
    };
    this.addParam("code", code);
    this.addAlt = function (alt) {
        if (!window.ActiveXObject) {
           obj.appendChild(document.createTextNode(alt));
        }
    };
    this.write = function(el, clearFirst) {
        if (typeof clearFirst != "boolean") {
            clearFirst = true;
        }
        if (clearFirst) {
            while (el.hasChildNodes()) {
                el.removeChild(el.lastChild);
            }
        }
        var ref = el.appendChild(obj);
        if (window.ActiveXObject) {
            ref.outerHTML = ref.outerHTML;
            ref = el.getElementsByTagName("object");
            return ref[ref.length - 1];
        }
        return ref;
    };
};