//-----------------------------------------------------------
// 文件名称: Web25175_Hotel2.operate.v1.1.js
// 页面名称: Web25175_Hotel2.operate.v1.1
//
// 描    述: 导航按钮 operate
//
// 创建标识: Add By 吴希 2011-12-13
//-----------------------------------------------------------
uiOperat = function() {}
uiOperat.prototype = {
    Insert: function(title, target, width, height) {
        uiWindow(title, '', target, width, height);
        return false;
    },
    Update: function(title, target, width, height) {
        var num = 0;
        if (chk.length <= 0) {
            uiMessagebox("很抱歉!没有记录!");
            return false;
        }
        var id = 0;
        for (i = 0; i < chk.length; i++) {
            var arr = chk[i];
            if (uiGet(arr[0]) != null) {
                var f = uiGet(arr[0]).checked;
                if (f) {
                    num++;
                    id = arr[1];
                }
            }
        }
        if (num <= 0) {
            uiMessagebox("很抱歉!请选择要修改的记录!");
            return false;
        } else if (num > 1) {
            uiMessagebox("很抱歉!您只能选择一条记录进行修改!");
            return false;
        }
        uiWindow(title, '', target + id, width, height);
        return false;
    },
    Delete: function() {
        var num = 0;
        if (chk.length <= 0) {
            uiMessagebox("很抱歉!没有记录!");
            return false;
        }
        for (i = 0; i < chk.length; i++) {
            var arr = chk[i];
            if (uiGet(arr[0]) != null) {
                var f = uiGet(arr[0]).checked;
                if (f) {
                    num++;
                }
            }
        }
        if (num <= 0) {
            uiMessagebox("很抱歉!请选择要删除的记录!");
            return false;
        }
        uiMessagebox("您确认要删除所选择的记录吗？",
        function() {
            uidoPostBack("btnDelete", "");
        });
        return false;
    },
    View: function(title, target, width, height) {
        var num = 0;
        if (chk.length <= 0) {
            uiMessagebox("很抱歉!没有记录!");
            return false;
        }
        var id = 0;
        for (i = 0; i < chk.length; i++) {
            var arr = chk[i];
            if (uiGet(arr[0]) != null) {
                var f = uiGet(arr[0]).checked;
                if (f) {
                    num++;
                    id = arr[1];
                }
            }
        }
        if (num <= 0) {
            uiMessagebox("很抱歉!请选择要查看的记录!");
            return false;
        } else if (num > 1) {
            uiMessagebox("很抱歉!您只能选择一条记录进行查看");
            return false;
        }
        uiWindow(title, '', target + id, width, height);
        return false;
    },
    Window: function(title, target, width, height) {
        uiWindow(title, '', target, width, height);
        return false;
    },
    AllCancel: function(obj) {
        var flag = obj.checked;
        if (chk.length <= 0) {
            uiMessagebox("很抱歉!没有记录!");
        }
        for (i = 0; i < chk.length; i++) {
            var arr = chk[i];
            if (uiGet(arr[0]) != null) {
                uiGet(arr[0]).checked = flag;
            }
        }
    },
    Choose: function() {
        var num = 0;
        if (chk.length <= 0) {
            uiMessagebox("很抱歉!没有记录!");
            return false;
        }
        for (i = 0; i < chk.length; i++) {
            var arr = chk[i];
            if (uiGet(arr[0]) != null) {
                var f = uiGet(arr[0]).checked;
                if (f) {
                    num++;
                }
            }
        }
        if (num <= 0) {
            uiMessagebox("很抱歉!请选择记录!");
            return false;
        }
        return true;
    }
}
var Operat = new uiOperat();
