﻿//添加到收藏
function add() {
    window.external.AddFavorite("http://www.bluegrid.biz", "蓝格软件_www.bluegrid.biz");
}

//添加到收藏
function addBookmark(title, url) {
    if (window.sidebar) {
        window.sidebar.addPanel(title, url, "");
    }
    else if (document.all) {
        window.external.AddFavorite(url, title);
    }
    else if (window.opera && window.print) {
        return true;
    }
    else {
        alert('您可以尝试通过快捷键CTRL + D 添加书签~');
    }
}


//关闭客户服务窗口
var isClose = false;
function CloseDiv(sender) {
    var adInfo = document.getElementById("ad");
    adInfo.style.display = "none";
    isClose = true;
}

//执行滚动事件
function Call() {

    RollDiv();
    SetLiBg();
}

window.onscroll = Call;
window.onresize = Call;
window.onload = Call;

//窗口滚动
function RollDiv() {
    var posX, posY, clientX, clientY;
    if (window.innerHeight) {
        posX = window.pageXOffset;
        posY = window.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop) {
        posX = document.documentElement.scrollLeft;
        posY = document.documentElement.scrollTop;

        clientX = document.documentElement.clientWidth;
        clientY = document.documentElement.clientHeight;
    }
    else if (document.body) {
        posX = document.body.scrollLeft;
        posY = document.body.scrollTop;

        clientX = document.body.clientWidth;
        clientY = document.body.clientHeight;
    }
    if (!isClose) {
        var adInfo = document.getElementById("ad");
        //adInfo.style.display = "block";
        if (adInfo != null) {
            adInfo.style.top = (posY + document.documentElement.clientHeight - adInfo.offsetHeight - 10) + "px";
            adInfo.style.left = (posX + document.documentElement.clientWidth - adInfo.offsetWidth) + "px";
        }
    }
}

//新闻列表设置onmouseover事件
function SetLiBg() {
    var catid = document.getElementById("category");

    if (catid != null) {
        var li_o = catid.getElementsByTagName("li");
        for (var i = 0; i < li_o.length; i++) {
            li_o[i]['i'] = i;
            li_o[i].onmouseover = function() {
                this.className = "s1";
            }
            li_o[i].onmouseout = function() {
                this.className = "s2";
            }
        }
    }
}

//ht = document.getElementsByTagName("html"); 
//ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";


