﻿/**
* Tabs
**/

var TabsUtil = {
    ID: "tabs", //包含标签页和内容页的块ID
    SelectedIndex: 0, //选中的元素的ID，从0开始
    Cache: true, //是否缓存页面
    AjaxOptions: true, //是否异步获取数据

    Init: function() {
        var _ID = arguments[0] == undefined || arguments[0] == null ? this.ID : arguments[0];
        var _SelectedIndex = arguments[1] == undefined || arguments[1] == null ? this.SelectedIndex : arguments[1];
        var _Cache = arguments[2] == undefined || arguments[2] == null ? this.Cache : arguments[2];
        var _AjaxOptions = arguments[3] == undefined || arguments[3] == null ? this.AjaxOptions : arguments[3];

        var tabs = $('#' + _ID);
        var loading = $("#Contentpanel");
        tabs.tabs();
        tabs.tabs("option", "selected", _SelectedIndex);
        tabs.tabs("option", "cache", _Cache);
        tabs.tabs("option", "ajaxOptions", {
            async: _AjaxOptions,
            beforeSend: function(XMLHttpRequest) {
                loading.html("<img src=\"css/ui-lightness/images/ui-anim_basic_16x16.gif\"></img>");
            },
            complete: function(XMLHttpRequest, textStatus) {
                loading.html("");
            },
            error: function() {
                loading.html("出错了！");
            }
        });
    }
};



