var IME = function (swf) {
    return this.init(swf);
};

IME.prototype = {
    id: "externalIME",

    init: function (swf) {
        var tag = [
            '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1" height="1" id="' + this.id + '" align="middle">',
            '<param name="allowscriptaccess" value="always" />',
            '<param name="movie" value="' + swf + '" />',
            '<param name="quality" value="high" />',
            '<param name="bgcolor" value="#ffffff" />',
            '<embed src="' + swf + '" quality="high" bgcolor="#ffffff" width="1" height="1" name="' + this.id + '" align="middle" allowscriptaccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />',
            '</object>'
        ];

        var div = document.createElement("div");
        with (div.style) {
            width = height = margin = padding = "0px";
            border = "none";
        }

        document.body.appendChild(div);
        div.innerHTML = tag.join('');
    },

    obj: function () {
        return navigator.userAgent.match(/MSIE/) ? window[this.id] : document[this.id];
    },

    on: function () {
        return this.obj().on();
    },
    
    off: function () {
        return this.obj().off();
    }
};

