
// JavaScript Document
//判断客户机是否有.Net Framework
function hasDotNetFramework(baseVersion) {
    if (typeof baseVersion == "undefined") return false;
    var useragent = window.navigator.userAgent.toLowerCase();
    for (var i = baseVersion * 10; i < 50; i++) {
        if (useragent.indexOf("msie") > -1) {//ie
            if (useragent.indexOf('.net clr ' + i / 10 + '.') > -1
                    || useragent.indexOf('.net' + i / 10 + '.') > -1)
                return true;
        }
        else if (useragent.indexOf("firefox") > -1) {//ff
            var winWPF = window.navigator.plugins["Windows Presentation Foundation"];
            if (winWPF && winWPF.version.indexOf(i / 10 + '.') > -1)
                return true;
        }
        else if (useragent.indexOf("opera") > -1) {//opera
            if (window.navigator.plugins["Windows Presentation Foundation"])
                return true;
        }
    }
    return false;
}
//列表页面页码跳转
function pageClick(pageIndex) {
    if (document.getElementById("page").value == pageIndex)
        return;
    document.getElementById("page").value = pageIndex;
    document.getElementById("postBackType").value = "page";
    document.forms.item(0).submit();
}
function specialPageClick(control, pageIndex) {
    if (document.getElementById(control).value == pageIndex)
        return;
    document.getElementById(control).value = pageIndex;
    document.forms.item(0).submit();
}
//显示指定DIV（id=parentDivId）中的指定的DIV(id=showDivId)。
function showDiv(parentDivId, showDivId) {
    oContentDiv = document.getElementById(parentDivId);
    oDivs = oContentDiv.getElementsByTagName("div");
    for (var i = 0; i < oDivs.length; i++) {
        if (oDivs[i].id == showDivId)
            oDivs[i].style.display = "";
        else
            oDivs[i].style.display = "none";
    }
}
/**选中导航切换样式**/
function selMenu(parentDivId, menuId) {
    var oDiv = document.getElementById(parentDivId);
    var oLis = oDiv.getElementsByTagName("li");
    for (var i = 0; i < oLis.length; i++) {
        if (oLis[i].id == menuId)
            oLis[i].className = "selectedMenu";
        else
            oLis[i].className = "notSelectedMenu";
    }
}
/**显示制定的标签,strDivId为指定标签的id，多个以“,(半角)”隔开**/
function showDivs(strDivId) {
    var ids = strDivId.split(",");
    for (var i = 0; i < ids.length; i++) {
        var oo = document.getElementById(ids[i]);
        oo.style.display = oo.style.display == "" ? "none" : "";
    }
}


//加入收藏
function addFavorite(sURL, sTitle) {
    try {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e) {
        try {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e) {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
//设为首页
function setHome(obj, vrl) {
    try {
        obj.style.behavior = 'url(#default#homepage)'; obj.setHomePage(vrl);
    }
    catch (e) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            }
            catch (e) {
                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");
            }
            var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
            prefs.setCharPref('browser.startup.homepage', vrl);
        }
    }
}

//只能输入数字
function numIntTxtChange(obj) {
    var txtVal = $(obj).val();
    txtVal = txtVal.replace(/\D/g, '');
    $(obj).val(txtVal);
}

