$(function () {
    //传入tbody的ID对象,表格换行变色(even为偶数，odd为奇数)
    $("tbody tr:even").addClass("odd");
    $("tbody tr:odd").addClass("even");


    $("input[type='text'],input[type='password'],textarea").live("focus", function () {
        $(this).addClass("focus");
    }).blur(function () {
        $(this).removeClass("focus");
    })

    $(".images-1 li,.images-2 li").hover(function () {
        $(this).addClass("focus");
    }, function () {
        $(this).removeClass("focus");
    })

    //控制弹层
    $("#ouBox a[class='close']").click(function () {
        $("#ouBox").slideToggle(150);
        $("#ouBox .content").html("");
    })

})

//写三级导航指示
function setNaviSpan(name,href) {
        if ($("#tabSpan3", top.document).length <= 0) {
            $("#divMenusNavi", top.document).append("<span id='tabSpan3' class=\"arrow\"><a href=\"" + href + "\">" + name + "</a></span>");
        } else {
            $("#tabSpan3", top.document).html("<a href=\"" + href + "\">" + name + "</a>");
        }
}

//添加导航指示
function addMenusNavi() {
    if (window.location.pathname == "Home.aspx") $("#divMenusNavi", top.document).find("span").remove();
    
    var isNone = false;
    $("#divMenusNavi span", top.document).each(function () {
        var $object = $(this);
        if ($object.text() == $("title").html()) {
            $object.prev().nextAll().remove();
            return false;
        }
    });

    $("#divMenusNavi", top.document).append("<span class=\"arrow\"><a target=\"iframeMenus\" href=\"" + window.location.pathname + window.location.search + "\">" + $("title").html() + "</a></span>");
    return false;
}
addMenusNavi();

//加载当前tab选项卡
function showTab(obj) {
    if (window.location.hash != "") {
        obj.find("a").removeClass("active");
        obj.find("a[href='" + window.location.hash + "']").addClass("active");
    }
    obj.find("a").live("click", function () {
        obj.find("a").removeClass("active");
        $(this).addClass("active");
        obj.find("a").each(function () {
            if ($(this).attr("class") == "active") {
                $("" + $(this).attr("href") + "").show();
            } else {
                $("" + $(this).attr("href") + "").hide();
            }
        });
    })
    obj.find("a").each(function () {
        if ($(this).attr("class") == "active") {
            $("" + $(this).attr("href") + "").show();
        } else {
            $("" + $(this).attr("href") + "").hide();
        }
    });

}

//计算容量
function Capacity(obj) {
    if (obj > 1047527424) {
        obj = (obj / 1024 / 1024 / 1024).toFixed(2) + " G";
    } else {
        obj = (obj / 1024 / 1024).toFixed(2) + " MB";
    }
    return obj;
}

//截取字符串
function cutStr(str,length) {
    var objlength = str.length;
    if (objlength > length) {
        str = str.substring(0, length) + "..";
    }
    return str;
}


//清空登录提示文本
function delSubmitBtnMsg() {
    $("input:submit").next("span").attr("class", "");
    $("input:submit").next("span").text("");
}


//通用提示
function showMsg(msgStr, isShow) {
    $(function () {
        var obj = $("#LoadingBox", top.document);
        if (isShow) {
            obj.html("<img src=\"Images/Loading.gif\" align=\"middle\" /> " + msgStr + "...");

            //计算位置

            obj.css("left", "" + $("body", top.document).width() / 2 - 40 + "px");
            obj.css("margin-left", "-" + obj.width() / 2 + "px");
            obj.show();
        } else {
            obj.hide();
        }
    })
}