﻿var zhWindow =
{
    Window:
    {
        Open: function(_Url, _Title) {
            window.open(_Url, _Title);
        },
        Close: function() {
            window.opener.window.location.reload();
            self.close();
        }
    },
    ModelDialog:
    {
        Open: function(_Url, _Width, _Height) {
            window.showModalDialog(_Url, window, 'resizable:yes;scroll:yes;status:no;dialogWidth=' + _Width + 'px;dialogHeight=' + _Height + 'px;center=yes;help=no');
        },
        Close: function() {
            window.close();
        }
    },
    Dialog:
    {
        Open: function(_Url, _Title, _Width, _Height) {
            var tag = "?";
            if (_Url.indexOf("?") >= 0)
            { tag = "&"; }
            var w = _Width;
            var h = _Height;
            if (w == null)
            { w = 780; }
            if (h == null) {
                h = 460;
            }
            var url_suffix = tag + "keepThis=true&TB_iframe=true&height="+h+"&width="+w;
            tb_show(_Title, _Url + url_suffix, "thickbox");
        },
        Close: function() {
            window.top.tb_remove();
        },
        CloseThenRefresh: function() {
            window.top.tb_remove();
            window.parent.location.reload();
            window.location.reload();
        },
        Redirect: function(_Url) {
            location.href = _Url;
        },
        CloseThenGetAjaxDataByOriginallyPage: function() {
            var OriginallyPageIndex = $("span[class='current']").eq(0).text();
            if (OriginallyPageIndex != null && OriginallyPageIndex > 0) {
                GetDataToAjax(OriginallyPageIndex);
            }
            else {
                if (parent.GetDataToAjax != null) {
                    OriginallyPageIndex = parent.$("span[class='current']").eq(0).text();
                    if (OriginallyPageIndex != null && OriginallyPageIndex > 0) {
                        parent.GetDataToAjax(OriginallyPageIndex);
                    }
                    else {
                        parent.GetDataToAjax(1);
                    }
                }
                else {
                    window.parent.location.reload();
                    window.location.reload();
                }
            }
            parent.window.tb_remove();
        }
    }
}


