var Smsg=0;
var moveDiv=false;
var Y_timerID = null;
function Start_kf() {
GetXml();
Y_timerID = setTimeout("Start_kf()",2000);
}
function GetXml()
{
var Xml = new ActiveXObject("Microsoft.XMLHTTP");
Xml.open("POST", "yhkf/yhkf.asp?Get",false);
Xml.send();
Smsg=unescape(Xml.responseText);
Lxml(Smsg);
}
function Lxml(tmsg)
{
yhkf.style.cursor='pointer';
msg=tmsg.split(',');
if (msg[0]==0)
{
yhkf.style.filter='Gray';
yhkf.onclick=function(){NotOnline();};
}
else
{
yhkf.style.filter='';
yhkf.onclick=function(){IsOnline();};
}
switch (msg[1])
{
//发送消息
case "1":
alert("本站客服向您发送消息:\n\n"+msg[3] + "\n\n\n"+msg[4]);
break;
//跳转网址
case "2":
alert("本站客服让您跳转网址至:\n\n"+msg[3] + "\n\n\n"+msg[4]);
location.href=msg[3];
break;
//踢出网站
case "3":
alert("本站客服请您离开本网站:\n\n\n"+msg[4]);
window.opener=null;
window.close();
break;
//正常通话
case "4":
alert("本站客服要与您通话\n\n\n"+msg[4]);
var DivStr="";
DivStr+="
" ;
DivStr+="
";
DivStr+="
";
DivStr+="
本站客服要与您通话:
" + msg[3] + "
" + msg[4] +"
";
DivStr+="
";
DivStr+="
";
DivStr+="
";
DivStr+="
";
AddDiv("DivBox",DivStr);
showdiv();
break;
//强行通话
case "5":
alert("本站客服要与您强行通话:\n\n\n"+msg[3]+"\n\n\n"+msg[4]);
location.href="yhkf/MsgBox.asp";
break;
}
if(msg[1]!=0)
{
var T_Xml = new ActiveXObject("Microsoft.XMLHTTP");
var T_url="yhkf/yhkf.asp?Get=IsShell&id="+msg[2];
T_Xml.open("POST",T_url,false);
T_Xml.send();
}
}
function NotOnline()
{
alert('对不起,网站管理人员不在线!\n\n即将跳转留言页面!\n\n\n在此面页,请您输入详细信息!');
location.href='';
}
function IsOnline()
{
if (Smsg!=0){
DelDiv("DivBox");
window.open("yhkf/MsgBox.asp", "在线客服通话窗口", "height=400, width=502,scrollbars=no,top=0,left=0,menubar=no,toolbar=no,resizable=no,location=no,status=no");
}
}
function SendBox()
{
var DivStr="";
DivStr+="" ;
DivStr+="
";
DivStr+="
";
DivStr+="
水暖网客服
联系电话:88518870
";
DivStr+="
";
DivStr+="
";
DivStr+="
";
DivStr+="
";
AddDiv("DivBox",DivStr);
showdiv();
}
function DelDiv(obj)
{
if(document.getElementById(obj))
{
document.getElementById(obj).removeNode(true);
}
}
function AddDiv(nam,htmx)
{
if (!document.getElementById(nam))
{
var info=document.createElement("div");
info.id=nam;
info.innerHTML=htmx;
// info.style.position="absolute";
info.style.left="1400px";
info.style.top="150px";
info.width="400px";
info.height="160px";
// alert(info.width);
info.style.zIndex=1000;
document.body.appendChild(info);
}
}
function showdiv(){
document.getElementById("DivBox").style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("DivBox").offsetHeight)/2)+"px";
document.getElementById("DivBox").style.left=(document.documentElement.scrollLeft+(document.documentElement.clientWidth-document.getElementById("DivBox").offsetWidth)/2)+"px";
}
//
function StartDrag(obj) //定义准备拖拽的函数
{
obj.setCapture(); //对当前对象的鼠标动作进行跟踪
moveDiv=true;
}
function Drag(obj) //定义拖拽函数
{
if(moveDiv)
{
var oldwin=obj.parentNode; //定义父对象
var oldwin1=oldwin.parentNode
oldwin1.style.left=event.clientX-50;//定义父对象目前位置
oldwin1.style.top=event.clientY-10;
}
}
function StopDrag(obj) //定义停止拖拽函数
{
obj.releaseCapture(); //停止对当前对象的鼠标跟踪
moveDiv=false;
}
//