﻿function YesNoDialog(title, message, yesMethod, noMethod) {
    $('<div></div>')
    .html(message)
    .dialog({
        buttons: {
            "No": function() {
                $(this).dialog("close");
            },
            "Yes": function() {
                noMethod = null;
                $(this).dialog("close");

                if (yesMethod)
                    yesMethod();
            }
        },
        close: function() {
            if (noMethod)
                noMethod();
        },
        modal: true,
        title: title,
        resizable: false,
        draggable: false
    });
}

function OkDialog(title, message, okMethod) {
    $('<div></div>')
    .html(message)
    .dialog({
        buttons: {
            "OK": function() {
                $(this).dialog("close");

                if (okMethod)
                    okMethod();
            }
        },
        modal: true,
        title: title,
        resizable: false,
        draggable: false
    });
}

function OkCancelDialog(title, message, okMethod, cancelMethod) {
    $('<div></div>')
    .html(message)
    .dialog({
        buttons: {
            "Cancel": function() {
                $(this).dialog("close");
            },
            "OK": function() {
                cancelMethod = null;
                $(this).dialog("close");

                if (okMethod)
                    okMethod();
            }
        },
        close: function() {
            $(this).dialog("close");

            if (cancelMethod)
                cancelMethod();
        },
        modal: true,
        title: title,
        resizable: false,
        draggable: false
    });
}
