var XMLSender = new ActiveXObject("Microsoft.XMLHTTP"); var isChat = false; function getServerData(){ if (isChat) {return false;} XMLSender.Open("POST","/admin/webservice_manager.asp",false); XMLSender.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); XMLSender.send('SessionID=518418848&SubmitType=Client&Chat=0'); //SessionID:SessionID|SubmitType:提交类型(Client:客户|Service:客服)|Chat:是否正在交流(0:否|1:是) result=XMLSender.responseText; var xmlDoc = new ActiveXObject("Microsoft.xmldom"); xmlDoc.loadXML(result); if (xmlDoc.selectSingleNode("UserAction/Request").text == "1"){ showAccept(); return false; } if (xmlDoc.selectSingleNode("UserAction/ChatStatus").text == "1"){ isChat = true; } setTimeout(getServerData,1000); } function SendRequest(){ if (isChat){return false;} XMLSender.Open("POST","/admin/webservice_manager.asp",false); XMLSender.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); XMLSender.send('SessionID=518418848&SubmitType=Client&Chat=0&Request=2'); //SessionID:SessionID|SubmitType:提交类型(Client:客户|Service:客服)|Chat:是否正在交流(0:否|1:是) result=XMLSender.responseText; isChat = true; showChatWindow(); } function showChatWindow(){ var winWidth = 475; var winHeight = 383; window.open("/Chat.asp","WebServiceChatWindow","height=" + winHeight + ",width=" + winWidth + ",top=" + (window.screen.height - winHeight) / 2 + ",left=" + (window.screen.width - winWidth) / 2 + ",toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no"); } function acceptRequest(){ document.getElementById('confirmWindow').removeNode(true); XMLSender.Open("POST","/admin/webservice_manager.asp",false); XMLSender.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); XMLSender.send('SessionID=518418848&SubmitType=Client&Chat=1&Request=0&Accept=1'); showChatWindow(); return false; } function passRequest(){ document.getElementById('confirmWindow').removeNode(true); XMLSender.Open("POST","/admin/webservice_manager.asp",false); XMLSender.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); XMLSender.send('SessionID=518418848&SubmitType=Client&Chat=0&Request=3'); setTimeout(getServerData,1000); } setTimeout(getServerData,100); function showAccept(){ var oDiv=document.createElement("span"); oDiv.id = "confirmWindow"; oDiv.style.top = (document.body.clientHeight - 107) / 2; oDiv.style.left = (document.body.clientWidth - 395) / 2; oDiv.style.position = "absolute"; oDiv.innerHTML = '
'; document.body.appendChild(oDiv); }