function _GE(id) {
    return document.getElementById(id);
}
window.shadow = {
    /*public*/
    width: 450,
    height: 200,
    content: null,
    extfun: null,
    ifrsrc: 'about:blank',
    opener: null,
    show: function() {
        _GE('ifr_shadow').src = this.ifrsrc;
        _GE('ifr_shadow').width = this.width + 'px';
        _GE('ifr_shadow').height = this.height + 'px';
        this.content = _GE('ifr_shadow');
        if (this.content == null) return;
        this._setContent();
        this._showhide(true);
    },
    hide: function() {
        this._showhide(false);
        if (this.extfun != undefined) {
            this.extfun();
            this.extfun == null;
        }
        _GE('ifr_shadow').src = "about:blank";
    },
    fit: function() {
        _GE("ActionContent").style.height = this.height + "px";
        _GE("ActionWindowHolder").style.width = this.width + "px";
        this._showhide(true);
    },
    /*private*/
    _contentObjParent: null,
    _setContent: function() {
        try {
            if (this._contentObjParent != null) {
                this._contentObjParent.appendChild(_GE("ActionContent").firstChild);
                this._contentObjParent == null;
            }
        }
        catch (e) { }
        if (typeof (this.content) == "string") {
            _GE("ActionContent").innerHTML = this.content;
            this._contentObjParent = null;
        }
        else if (typeof (this.content) == "object") {
            this._contentObjParent = this.content.parentNode;
            _GE("ActionContent").appendChild(this.content);
        }
        _GE("ActionContent").style.height = this.height + "px";
        _GE("ActionWindowHolder").style.width = this.width + "px";
    },
    _showhide: function(b) {
        var loadingholder = _GE("ActionWindowHolder");
        var loading = _GE("ActionWindow");
        var loadingmask = _GE("ActionMask");
        var scrolltop = document.documentElement.scrollTop;
        var scrollleft = document.documentElement.scrollLeft;
        var scrollwidth = document.documentElement.scrollWidth;
        var scrollheight = document.documentElement.scrollHeight;
        var clientwidth = document.documentElement.clientWidth;
        var clientheight = document.documentElement.clientHeight;

        loadingmask.style.display = b ? '' : 'none';
        loadingmask.style.width = (scrollwidth > clientwidth ? scrollwidth : clientwidth) + 'px';
        loadingmask.style.height = (scrollheight > clientheight ? scrollheight : clientheight) + 'px';

        loadingholder.style.display = b ? '' : 'none';
        if ((scrollleft + (clientwidth - loading.offsetWidth) / 2) > 0) {
            loadingholder.style.left = (scrollleft + (clientwidth - loading.offsetWidth) / 2) + 'px';
        }
        else {
            loadingholder.style.left = "0";
        }
        if ((scrolltop + (clientheight - loading.offsetHeight) / 2) > 0) {
            loadingholder.style.top = (scrolltop + (clientheight - loading.offsetHeight) / 2) + 'px';
        }
        else {
            loadingholder.style.top = '0';
        }
    }
};
document.writeln('<div id="ActionWindowHolder" style="margin: 0; padding: 0; position: absolute; left: 0; top: 0; z-index: 999; display: none;">');
document.writeln('    <div id="ActionWindow" style="margin: 0; padding: 0; background-color: #fff;">');
document.writeln('        <div id="ActionContent"></div>');
document.writeln('    </div>');
document.writeln('</div>');
document.writeln('<div id="ActionMask" style="margin: 0; padding: 0; position: absolute; left: 0; top: 0; z-index: 998; background-color: #000; filter: alpha(opacity=10); opacity: 0.1; display: none;"><iframe id="markifr" style="margin: 0; padding: 0; width: 100%; background-color: #000; -moz-opacity: 0.1; filter: alpha(opacity=10); height: 100%;" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></iframe></div>');
document.writeln('<div style="display: none;"><iframe frameborder="0" height="300px" id="ifr_shadow" marginheight="0" marginwidth="0" scrolling="no" src="about:blank" width="400px"></iframe></div>');