var open=false; var uc=0; ajaxchat_init(); if (window.addEventListener) { window.addEventListener('onload', ajaxchat_init, false); } else if (window.attachEvent) { window.attachEvent('onload', ajaxchat_init); } function ajaxchat_init() { var cook,split,tmp,i; cook=document.cookie.split(";"); for(i=0;i
Loading..
\n"; document.body.appendChild(el); loadEl(el,"http://"+location.host+"/wp-content/plugins/ajaxchat/ajaxchat_xml.php?action=online&t="+new Date().getTime(),openCB); } function loadEl(el, url, cb) { if(!el || !url) { return false; } var req=getXML(); req.onreadystatechange=function() { if(req.readyState==4 && req.status==200) { el.innerHTML=req.responseText; cb(); } }; req.open("GET",url); req.send(null); } function getXML() { try { httpreq=new XMLHttpRequest(); } catch(err) { try { httpreq=new ActiveXObject("Microsoft.XMLHTTP"); } catch(err) { try { httpreq=new ActiveXObject("Msxml2.XMLHTTP"); } catch(err) { } } } if(!httpreq) { alert("XMLHttpRequest not supported"); return false; } return httpreq; } function pingIM() { var pingReq=getXML(); pingReq.open("GET","http://"+location.host+"/wp-content/plugins/ajaxchat/ajaxchat_ping.php?"+new Date().getTime()); pingReq.send(null); } function msg_kp(el,e) { if(!e) { e=window.event; } if(e.keyCode==13 && el.value.length) { sendMsg(el.value); el.value=""; } } function sendMsg(txt) { var sendReq=getXML(); sendReq.onreadystatechange=function() { if(sendReq.readyState==4 && sendReq.status==200) { if(sendReq.responseText.match("ERROR")) { alert("There was an error sending your message."); return false; } } } sendReq.open("GET","http://"+location.host+"/wp-content/plugins/ajaxchat/ajaxchat_xml.php?action=send&msg="+escape(txt)); sendReq.send(null); }