﻿function center(a) { $(a).css("left", Math.max(0, $(window).width() - $(a).width()) / 2 + "px"); $(a).css("top", Math.max(0, $(window).height() - $(a).height()) / 2 + "px") } function centerMain(a, b) { $(a).css("left", Math.max(0, $(window).width() - $(a).width()) / 2 + "px"); $(a).css("top", Math.max(0, $(window).height() - b - $(a).height()) / 2 + "px") } function vCenter(a, b) { $(a).css("top", (b - $(a).height()) / 2 + "px") } function showDlg(a, b) { $("body").append($("<div>").addClass("dlgMask").fadeTo("slow", 0.6)).append($("<div>").addClass("dlg").append($("<div>").addClass("dlgEdge").append($("<div>").addClass("dlgContent").append($("<img>").attr("src", "image/hint.png").addClass("dlgIcon")).append($("<div>").attr("dir", "rtl").addClass("dlgMessage").html(a))))); b != null && $("div.dlgContent").append($("<input>").attr("type", "button").attr("value", b).addClass("dlgButton").click(closeDlg)); $(window).resize(function () { center(".dlg") }); var c = $(".dlgMessage").width() + 70; $(".dlgButton").css("right", c + "px"); c += 85; $(".dlg").css("width", c + "px"); center(".dlg"); vCenter(".dlgButton", 86); vCenter(".dlgMessage", 86) } function closeDlg() { $("#dlgButton").attr("class", "dlgButton dlgButtonMouseDown"); var a = $("#dlgButton").position(); $("#dlgButton").css("top", a.top + 1 + "px"); $(".dlg,.dlgMask").fadeOut("slow", function () { $(".dlg").remove(); $(".dlgMask").remove() }) } function showDlgSuccess(a, b) { $("body").append($("<div>").addClass("dlgMask").fadeTo("slow", 0.6)).append($("<div>").addClass("dlg").append($("<div>").addClass("dlgEdge").append($("<div>").addClass("dlgContent").append($("<img>").attr("src", "image/ok.png").addClass("dlgIcon")).append($("<div>").attr("dir", "rtl").addClass("dlgMessage").html(a))))); b != null && $("div.dlgContent").append($("<input>").attr("type", "button").attr("value", b).addClass("dlgButton").click(closeDlg)); $(window).resize(function () { center(".dlg") }); var c = $(".dlgMessage").width() + 70; $(".dlgButton").css("right", c + "px"); c += 85; $(".dlg").css("width", c + "px"); center(".dlg"); vCenter(".dlgButton", 86); vCenter(".dlgMessage", 86) } function SHshowDlg(a, b) { $("body").append($("<div>").addClass("dlgMask").fadeTo("slow", 0.6)).append($("<div>").addClass("dlg").append($("<div>").addClass("dlgEdge").append($("<div>").addClass("dlgContent").append($("<div>").addClass("dlgIconExclamation")).append($("<div>").attr("dir", "rtl").addClass("dlgMessage").append($("<p>").addClass("dlgMessageText").html(a)))))); b != null && $("div.dlgContent").append($("<input>").attr("id", "dlgButton").attr("type", "button").attr("value", b).addClass("dlgButton").mouseover(function () { $("#dlgButton").attr("class", "dlgButton dlgButtonMouseOver") }).mouseout(function () { $("#dlgButton").attr("class", "dlgButton ") }).mouseup(function () { $("#dlgButton").attr("class", "dlgButton dlgButtonMouseUp") }).click(closeDlg)); $(window).resize(function () { center(".dlg") }); var c = $(".dlgMessage").width() + $(".dlgIconExclamation").width() + 30 + $("#dlgButton").width() + 60; $(".dlg").css("width", c + "px"); center(".dlg"); vCenter(".dlgButton", 90); vCenter(".dlgMessage", 90) } function SHshowDlgSuccess(a, b) { $("body").append($("<div>").addClass("dlgMask").fadeTo("slow", 0.6)).append($("<div>").addClass("dlg").append($("<div>").addClass("dlgEdge").append($("<div>").addClass("dlgContent").append($("<div>").addClass("dlgIconSuccess")).append($("<div>").attr("dir", "rtl").addClass("dlgMessage").append($("<p>").addClass("dlgMessageText").html(a)))))); b != null && $("div.dlgContent").append($("<input>").attr("id", "dlgButton").attr("type", "button").attr("value", b).addClass("dlgButton").mouseover(function () { $("#dlgButton").attr("class", "dlgButton dlgButtonMouseOver") }).mouseout(function () { $("#dlgButton").attr("class", "dlgButton ") }).mouseup(function () { $("#dlgButton").attr("class", "dlgButton dlgButtonMouseUp") }).click(closeDlg)); $(window).resize(function () { center(".dlg") }); var c = $(".dlgMessage").width() + $(".dlgIconSuccess").width() + 30 + $("#dlgButton").width() + 60; $(".dlg").css("width", c + "px"); center(".dlg"); vCenter(".dlgButton", 90); vCenter(".dlgMessage", 90) };
function SHshowDlgUnderConstruction(msg, button) {

    $("body").append(
                        $("<div>").addClass('dlgMask').fadeTo('slow', .6)
                    )
             .append(
                        $("<div>").addClass('dlgConstruction')
                                  .append(
                                              $('<div>').addClass('dlgEdge')
                                                        .append(
                                                                   $('<div>').addClass('dlgContent')
                                                                             .append(
                                                                                        $('<div>').addClass('dlgIconUnderConstruction')
                                                                                    )
                                                                             .append(
                                                                                        $('<div>').attr('dir', 'rtl').addClass('dlgMessage')
                                                                                                  .append(
                                                                                                            $('<p>').addClass('dlgConstructionMessageText').html(msg)
                                                                                                         )
                                                                                    )
                                                               )
                                         )
                     );

    if (button != null) {

        $('div.dlgContent').append(
                                    $('<input>')
                                    .attr('id', 'dlgButton')
                                    .attr('type', 'button')
                                    .attr('value', button)
                                    .addClass('dlgButton')
                                    .mouseover(function () {
                                        $("#dlgButton").attr('class', 'dlgButton dlgButtonMouseOver');
                                    })
                                    .mouseout(function () {
                                        $("#dlgButton").attr('class', 'dlgButton ');
                                    })
                                    .mouseup(function () {
                                        $("#dlgButton").attr('class', 'dlgButton dlgButtonMouseUp');
                                    })
                                    .click(closeDlg)

                                 )
    }

                                $(window).resize(function () { center('.dlgConstruction') });

    var width = $('.dlgMessage').width() + $('.dlgIconUnderConstruction').width() + 30 + $('#dlgButton').width() + 60;

    $('.dlgConstruction').css('width', width + 'px');
    center('.dlgConstruction');
    var h = 190;
    vCenter('.dlgButton', h);
    vCenter('.dlgMessage', h);

}

