﻿function MessageBox() {

    this.OnClose = null;
    this.OnOk = null;
    this.OnCancel = null;

    this.show = function(smsg, icone, txbotao) {
        if (arguments.length > 1) {
            var img = $('#imgIcone').attr("src");
            $('#imgIcone').attr("src", img.substring(0, img.length - 5) + icone + ".gif");
        }
        if (arguments.length > 2)
            $("#rowbt1 span.botaoD:first").html(txbotao.toUpperCase());

        $('#rowbt1').show();
        $('#rowbt2').hide();
        $('#divMessageBox div:first').next().html(smsg);
        
        $('#divMessageBox').modal({ onClose: this.OnClose, onOk: null, onCancel: null });
    }
    this.confirm = function(smsg, icone, txyes, txno) {
        if (arguments.length > 1) {
            var img = $('#imgIcone').attr("src");
            $('#imgIcone').attr("src", img.substring(0, img.length - 5) + icone + ".gif");
        }
        if (arguments.length > 2)
            $("#rowbt2 span.botaoD:last").html(txyes.toUpperCase());
        if (arguments.length > 3)
            $("#rowbt2 span.botaoD:first").html(txno.toUpperCase());

        $('#rowbt2').show();
        $('#rowbt1').hide();
        $('#divMessageBox div:first').next().html(smsg);
        $('#divMessageBox').modal({ onClose: null, onOk: this.OnOk, onCancel: this.OnCancel });
    }
}

