/**
 * QLIB 1.0 Popup Box
 * Serge Dolgov (C) 2002
 * studio.quazzle.com
 */

function QBox_content() {
    with (this.parent.res) {
        document.write('<table class="box" border="0" cellspacing="0" cellpadding="0" width="' + width +
            '"><tr><td width="' + width + '" height="' + headersize + '"><img src="' + header.src +
            '" border="0" width="' + width + '" height="' + headersize + '"></td></tr><tr><td width="' +
            width + '" background="' + body.src + '">');
        if (typeof this.parent.content == "function") {
            this.parent.content();
        } else {
            document.write(this.parent.content);
        }
        document.write('</td></tr><tr><td width="' + width + '" height="' + footersize + '"><img src="' +
            footer.src + '" border="0" width="' + width + '" height="' + footersize + '"></td></tr></table><br>');
    }
}

function QBox_show(show) {
    this.layer.show(this.visible = show);
}

function QBox_focus() {
    this.layer.focus();
}

function QBox_moveTo(x, y) {
    this.layer.moveTo(this.posx = x, this.posy = y);
}

function QBox_doShow() {
    with (this.parent) {
        if (this.parent.onShow) onShow(visible, tag);
    }
}

function QBox(parent, name, posx, posy, res, content) {
    this.init(parent, name);
    this.posx = posx;
    this.posy = posy;
    this.visible = false;
    this.res = res;
    this.content = content || res.content;
    this.show = QBox_show;
    this.focus = QBox_focus;
    this.moveTo = QBox_moveTo;
    this.layer = new QLayer(this, "layer", posx, posy, res.width + 10, null, this.visible, QBox_content);
    this.layer.effects = res.effects;
    this.layer.setFilter(res.filter);
    this.layer.setOpacity(res.opacity);
    this.layer.onShow = QBox_doShow;
}
QBox.prototype = new QControl();