/**
 * QLIB 1.0 Message Box
 * Serge Dolgov (C) 2002
 * studio.quazzle.com
 */

function QMessageBox_content() {
    with (document) {
        write('<div class="messagebox">');
        this.parent.label = new QLabel(this.parent, "label", this.parent.value);
        this.parent.button = new QButton(this.parent, "button", this.parent.buttonres);
        write('</div>');
    }
    this.parent.button.onClick = QMessageBox_doClick;
}

function QMessageBox_doClick() {
    this.parent.show(false);
}

function QMessageBox_set(text) {
    this.label.set(this.value = text);
}

function QMessageBox_show(show) {
    this.box.show(this.visible = show);
}

function QMessageBox_focus() {
    this.box.focus();
}

function QMessageBox_moveTo(x, y) {
    this.box.moveTo(this.posx = x, this.posy = y);
}

function QMessageBox_doShow() {
    with (this.parent) {
        if (this.parent.onShow) onShow(visible, tag);
    }
}

function QMessageBox(parent, name, posx, posy, boxres, buttonres, text) {
    this.init(parent, name);
    this.posx = posx;
    this.posy = posy;
    this.value = text;
    this.buttonres = buttonres;
    this.set = QMessageBox_set;
    this.show = QMessageBox_show;
    this.focus = QMessageBox_focus;
    this.moveTo = QMessageBox_moveTo;
    this.box = new QBox(this, "box", posx, posy, boxres, QMessageBox_content);
    this.box.onShow = QMessageBox_doShow;
    this.visible = this.box.visible;
}
QMessageBox.prototype = new QControl();
