﻿/*
文件名：base.js
功能说明：全站通用的全局变量及公用方法
创建者：刘建忠
创建日期：2010-09-26
*/
//引入jquery库文件
//全局配置
var GlobalSetting = {
    //站点名称
    SiteName: "沈阳莱蒽科技有限公司",
    //管理后台名称
    ManageName: "沈阳莱蒽科技有限公司后台管理系统",
    //版权信息
    CopyRight: "Copyright @2010-2012 沈阳莱蒽网络科技有限公司 All Rights Reserved.",
    //使用的主题
    Theme:"Default"    
};
//错误提示信息
var ErrorInfo = {
    //ajax超时错误
    Ajax_TimeOut: "服务器忙，数据通信超时！"
};
//成功提示信息    
var SuccessInfo = {
    RegisterSuccess: "注册成功！"
};
//如果页面没有标题，则使用全局设置中的标题
if (document.title == "") {
    document.title = GlobalSetting.SiteName;
}
//如果页面有标题，则页面标题等于原标题+"-"+全局配置标题
else {
    document.title = document.title + "-" + GlobalSetting.SiteName;
}

//当前页面完整域名
var PathInfo = location.href.replace("http://", "").split("/")[0];
//添加收藏夹
function addFav() {
    if (document.all) {
        window.external.addFavorite("http://" + PathInfo, "沈阳莱蒽科技有限公司");
    } else if (window.sidebar) {
        window.sidebar.addPanel("沈阳莱蒽科技有限公司", "http://" + PathInfo, "");
    }
}
//设为首页
function setHome() {
    if (document.all) {
        document.body.style.behavior = "url(#default#homepage)";
        document.body.setHomePage("http://" + PathInfo);
    } else if (window.sidebar) {
        if (window.netscape) {
            try {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
            } catch (e) {
                alert("抱歉，此操作被浏览器拒绝！\n\n请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'");
            }
        } else {
            var prefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
            prefs.setCharPref("browser.startup.homepage", "http://" + PathInfo);
        }
    }
}
//加载主题样式，加载页头页尾
$(
    function()
    {          
        //加载完页头，动态控制导航菜单处于选中状态
        $("#header").load("Inc/header.html", function () {
            //得到当前哪个导航菜单项应处于选中状态
            var menuSelect = $("#menuSelect").val();
            //控制选中项
            $("#nav li").removeClass("current").eq(menuSelect).addClass("current"); 
            //修复png图片在ie6下不透明bug
            if($.browser.msie && $.browser.version=="6.0")
            {
            DD_belatedPNG.fix('background,#nav a');
            }
        });

        $("#footer").load("Inc/footer.html?v=3",function()
            {  
            if($.browser.msie && $.browser.version=="6.0")
            {            
                DD_belatedPNG.fix('background,.png');           
            }
            }
        );
    }
);
