﻿//<![CDATA[
var tips_cs;
var doHide_cs;
var online_cs;
function initFloatTips_CS(sDir) {
    document.write("<link href=\"" + sDir + "OKQQ/images/qq.css\" rel=\"stylesheet\" type=\"text/css\" />");
    document.write('<div class="QQbox" id="div_CSBox">');
    document.write('<div class="Qlist" id="div_CSOnline" onmouseover="OnlineOver_CS()" onmouseout="hideMsgBox_CS(event)" style="display: none;">');
    document.write('<div class="t"></div>');
    document.write('<div class="infobox">冬雷软件在线客服</div>');
    document.write('<div class="con">' + online_cs + '</div>');


    document.write('<div style="background-color:#fff; border-right:solid 1px #AFAFAF;"><div style="z-index:99;position:absolute;visibility:hidden;"><a href="http://www.comm100.cn">客服技术支持</a></div><a href="http://chatserver.comm100.cn/ChatWindow.aspx?siteId=80004201&planId=241&visitType=1&byHref=1" target="_blank"><img id="comm100_EmailImage" src="http://chatserver.comm100.cn/BBS.aspx?siteId=80004201&planId=241" border="0px" alt="在线交流" /></a><div style="z-index:99;visibility:hidden;"><span style="font-size:10px; font-family:Arial, Helvetica, sans-serif;"><a href="http://www.comm100.cn/livechat/" style="text-decoration:none;color:#000000;" target="_blank"><b>在线客服系统</b></a>由<a href="http://www.comm100.cn" style="text-decoration:none;color:#009999;" target="_blank">Comm100</a>提供</span></div></div>');


    //document.write('<div style="background-color:#fff; border-right:solid 1px #AFAFAF;"><a href=\"http://chat.53kf.com/company.php?arg=tt93d&style=1\" target=\"_blank\"><img src=\"' + sDir + 'OKQQ/images/qq2.gif\" alt="" /></a></div>');
    document.write('<div class="b"></div>');
    document.write('</div>');
    document.write('<div id="div_CSMenu" onmouseover="OnlineOver_CS()"><img src="' + sDir + 'OKQQ/images/qq_1.gif" class="press" alt="在线咨询"></div>');
    document.write('</div>');

    tips_cs = document.getElementById('div_CSBox');
    moveTips_CS();
};

function moveTips_CS() {
    var theTop = 145/*这是默认高度,越大越往下*/;
    var old = theTop;
    var tt = 50;
    if (window.innerHeight) {
        pos = window.pageYOffset
    }
    else if (document.documentElement && document.documentElement.scrollTop) {
        pos = document.documentElement.scrollTop
    }
    else if (document.body) {
        pos = document.body.scrollTop;
    }
    pos = pos - tips_cs.offsetTop + theTop;
    pos = tips_cs.offsetTop + pos / 10;

    if (pos < theTop) pos = theTop;
    if (pos != old) {
        tips_cs.style.top = pos + "px";
        tt = 10;
        //alert(tips_cs.style.top);
    }
    old = pos;
    setTimeout(moveTips_CS, tt);
}
//!]]>

function OnlineOver_CS() {
    clearTimeout(doHide_cs);
    document.getElementById("div_CSMenu").style.display = "none";
    document.getElementById("div_CSOnline").style.display = "block";
    document.getElementById("div_CSBox").style.width = "145px";
}

if (typeof (HTMLElement) != "undefined")    //给firefox定义contains()方法，ie下不起作用
{
    HTMLElement.prototype.contains = function(obj) {
        while (obj != null && typeof (obj.tagName) != "undefind") { //通过循环对比来判断是不是obj的父元素
            if (obj == this) return true;
            obj = obj.parentNode;
        }
        return false;
    };
}

function hideMsgBox_CS(theEvent) { //theEvent用来传入事件，Firefox的方式
    if (theEvent) {
        var browser = navigator.userAgent; //取得浏览器属性
        if (browser.indexOf("Firefox") > 0) { //如果是Firefox
            if (document.getElementById('div_CSOnline').contains(theEvent.relatedTarget)) { //如果是子元素
                return; //结束函式
            }
        }
        if (browser.indexOf("MSIE") > 0) { //如果是IE
            if (document.getElementById('div_CSOnline').contains(event.toElement)) { //如果是子元素
                return; //结束函式
            }
        }
    }
    /*要执行的操作*/
    doHide_cs = setTimeout(function() { exeHide_CS() }, 800);
}

function exeHide_CS() {
    document.getElementById("div_CSMenu").style.display = "block";
    document.getElementById("div_CSOnline").style.display = "none";
}