﻿var Cluster = {
    Select: function(id) {
        var d = jQuery("#menuVDiv" + id);
        var s = jQuery("#menuTSpan" + id);
        var a = jQuery("#menuTADian" + id);
        s.addClass("display");
        s.siblings("span").removeClass("display");

        jQuery("A.dianPageAct").removeClass("dianPageAct");
        a.addClass("dianPageAct");

        if (d.prev().attr("id") == undefined) {//如果不存在下一个元素，改变“上一个”按钮的状态
            jQuery("#prePage").addClass("prePageNone");
        }
        else {
            jQuery("#prePage").removeClass("prePageNone");
        }

        if (d.next().attr("id") == undefined) {//如果不存在下一个元素，改变“下一个”按钮的状态
            jQuery("#nextPage").addClass("nextPageNone");
        }
        else {
            jQuery("#nextPage").removeClass("nextPageNone");
        }

        this.GetData(id);
    },
    Pre: function() {
        var id = jQuery("#menuV").children("Div.display").prev().attr("id"); //获得当前显示类别的上一个类别的id
        if (id != undefined) {
            id = id.replace("menuVDiv", "");
            this.Select(id);
        }
    },
    Next: function() {
        var id = jQuery("#menuV").children("Div.display").next().attr("id"); //获得当前显示类别的下一个类别的id
        if (id != undefined) {
            id = id.replace("menuVDiv", "");
            this.Select(id);
        }
    },
    GetData: function(id) {
        var e = jQuery("#menuVDiv" + id);
        e.siblings("div").removeClass("display");
        e.addClass("display");
        if (e.html() == "") {
            e.html("正在读取信息，请稍后...");
            jQuery.ajax({
                type: "post",
                url: "/e/default.aspx",
                data: "op=GetCluster&pid=" + id,
                success: function(msg) {
                    e.html(msg);
                },
                error: function(msg) {
                    alert("操作失败！");
                }
            });
        }
    }
}
