﻿/// <reference path="jquery-1.3.2.js" />

function ShowInfo(id, _title, message, callback, _width, _height) {
    if (_width == null) {
        _width = 400;
    }
    if (_height == null) {
        _height = 250;
    }
    $("#" + id).dialog({
        autoOpen: false,
        bgiframe: true,
        buttons: {
            "OK": function() { $(this).dialog("destroy"); if (callback) { callback(); } }
        },
        closeOnEscape: true,
        draggable: true,
        height: _height,
        width: _width,
        modal: true,
        resizable: false,
        title: _title,
        close: function() { $(this).dialog("destroy"); if (callback) { callback(); } }
    })
    .html(message)
    .dialog("open");
}
function ShowInfo2(_title, message, callback, _width, _height) {
    if (_width == null) {
        _width = 400;
    }
    if (_height == null) {
        _height = 250;
    }
    $("<div></div>")
        .appendTo("body")
        .dialog({
            autoOpen: false,
            bgiframe: true,
            buttons: {
                "OK": function() { $(this).dialog("destroy").remove(); if (callback) { callback(); } }
            },
            closeOnEscape: true,
            draggable: true,
            height: _height,
            width: _width,
            modal: true,
            resizable: false,
            title: _title,
            close: function() { $(this).dialog("destroy").remove(); if (callback) { callback(); } }
        })
    .html(message)
    .dialog("open");
}

function ShowError(id, _title, message, callback, _width, _height) {
    if (_width == null) {
        _width = 400;
    }
    if (_height == null) {
        _height = 250;
    }
    $("#" + id).dialog({
        autoOpen: false,
        bgiframe: true,
        buttons: {
            "OK": function() { $(this).dialog("destroy"); if (callback) { callback(); } }
        },
        closeOnEscape: true,
        draggable: true,
        height: _height,
        width: _width,
        modal: true,
        resizable: false,
        title: _title,
        close: function() { $(this).dialog("destroy"); if (callback) { callback(); } }
    })
    .html(message)
    .dialog("open");
}
function ShowError2(_title, message, callback, _width, _height) {
    if (_width == null) {
        _width = 400;
    }
    if (_height == null) {
        _height = 250;
    }
    var jdivError = $("<div></div>");
    jdivError.appendTo("body");
    jdivError.dialog({
        autoOpen: false,
        bgiframe: true,
        buttons: {
            "OK": function() { $(this).dialog("destroy").remove(); if (callback) { callback(); } }
        },
        closeOnEscape: true,
        draggable: true,
        height: _height,
        width: _width,
        modal: true,
        resizable: false,
        title: _title,
        close: function() { $(this).dialog("destroy").remove(); if (callback) { callback(); } }
    })
    .html(message)
    .dialog("open");
}

function ShowSuccess(id, _title, message, callback, _width, _height) {
    if (_width == null) {
        _width = 400;
    }
    if (_height == null) {
        _height = 250;
    }
    $("#" + id).dialog({
        autoOpen: false,
        bgiframe: true,
        buttons: {
            "OK": function() { $(this).dialog("destroy"); if (callback) { callback(); } }
        },
        closeOnEscape: true,
        draggable: true,
        height: _height,
        width: _width,
        modal: true,
        resizable: false,
        title: _title,
        close: function() { $(this).dialog("destroy"); if (callback) { callback(); } }
    })
    .html(message)
    .dialog("open");
}

function ShowConfirm(id, _title, message, callback, _width, _height) {
    if (_width == null) {
        _width = 400;
    }
    if (_height == null) {
        _height = 250;
    }
    $("#" + id).dialog({
        autoOpen: false,
        bgiframe: true,
        buttons: {
            "Yes": function() { $(this).dialog("destroy"); if (callback) { callback(); } },
            "No": function() { $(this).dialog("destroy"); }
        },
        closeOnEscape: true,
        draggable: true,
        height: _height,
        width: _width,
        modal: true,
        resizable: false,
        title: _title
    })
    .html(message)
    .dialog("open");
}
function ShowConfirm2(id, _title, message, callback, _width, _height, callbackNo) {
    if (_width == null) {
        _width = 400;
    }
    if (_height == null) {
        _height = 250;
    }
    $("<div/>")
        .appendTo("body")
        .dialog({
            autoOpen: false,
            bgiframe: true,
            buttons: {
                "Yes": function() { $(this).dialog("destroy").remove(); if (callback) { callback(); } },
                "No": function() { $(this).dialog("destroy").remove(); if (callbackNo) { callbackNo(); } }
            },
            closeOnEscape: true,
            draggable: true,
            height: _height,
            width: _width,
            modal: true,
            resizable: false,
            title: _title
        })
    .html(message)
    .dialog("open");
}
