// If server.php is not in the same folder with this page, // make sure you fix this URL! For instance: /supportmelive/server.php var server = "http://www.smmoving.com/wp-content/plugins/SM-Moving/Live-Support/server.php"; var req; function chatEntryNewRequest() { req = false; // For Safari, Firefox, and other non-MS browsers if (window.XMLHttpRequest) { try { req = new XMLHttpRequest(); } catch (e) { req = false; } } else if (window.ActiveXObject) { // For Internet Explorer on Windows try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { req = false; } } } } function chatEntryOpenChat() { window.open('http://www.smmoving.com/wp-content/plugins/SM-Moving/Live-Support/support-login.php','Live Support','toolbar=no,status=no,scrollbars=yes,location=no,menubar=no,directories=no,width=800,height=600'); return; } function chatEntryCheckAndShow() { //setTimeout('chatEntryCheckAndShow()', 3000); chatEntryNewRequest(); req.onreadystatechange = chatEntryPollStateChange; req.open("POST", server, true); req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); req.send(""); } function chatEntryPollStateChange() { if (req.readyState == 4) { try { if (req.status == 200) { var xml = req.responseXML; if (xml) { var is_ad = xml.getElementsByTagName("ad")[0].attributes.getNamedItem("isad").value; var el = document.getElementById('chatinvite'); if (is_ad) { document.getElementById("chatinvite").innerHTML = '
'; } else { document.getElementById("chatinvite").innerHTML = ''; } return; } else { alert(req.responseText); } } } catch (e) { } req = null; } }