var domain = window.parent.document.location.protocol + "//" + window.location.hostname + "/"; var fullsysurl = "http://www.hostbrand.com/"; var lesssysurl = "http://hostbrand.com/"; if(fullsysurl == domain || lesssysurl == domain){ var external = "false"; }else{ var external = "true"; } function getDir(url){ if(external == 'true'){ var result = 'http://www.hostbrand.com/'; }else{ var result = unescape(url.substring(0,(url.lastIndexOf("/")) + 1)); } return result; } function updateElem(elementid,filesrc){ var xmlhttp; if (window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); }else if (window.ActiveXObject){ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }else{alert("Your browser does not support XMLHTTP!");} if(elementid != 'none'){ xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState==4){ document.getElementById(elementid).innerHTML=xmlhttp.responseText; if(elementid == 'messages'){ var box = document.getElementById('messages'); box.scrollTop = box.scrollHeight; }}}} xmlhttp.open("GET",getDir(window.location.href) + filesrc,true); xmlhttp.send(); } function repeat5(){ if(document.getElementById('live') != undefined){ updateElem("messages","chat.php?messages"); updateElem("typing","chat.php?typing"); } if(document.getElementById('whmcsliveimg') != undefined){ if(external == 'true'){ document.getElementById('whmcsliveimg').innerHTML = ""; }else{ updateElem("whmcsliveimg","chat.php?image"); }} if(document.getElementById('whmcslivetxt') != undefined){ if(external == 'true'){ document.getElementById('whmcslivetxt').innerHTML = ""; }else{ updateElem("whmcslivetxt","chat.php?text"); }} setTimeout("repeat5()", 5000); } function repeat1(){ if(document.getElementById('timer') != undefined){ updateElem("timer","chat.php?timer"); } setTimeout("repeat1()", 1000); } function sendIt(){ var message = document.getElementById('message').value; updateElem("none","chat.php?action=send&value=" + message); document.getElementById('message').value = ''; typing('no'); updateElem("messages","chat.php?messages"); return false; } function endIt(){ updateElem("none","chat.php?endchat"); window.location = "chat.php"; } function closeChat(){ updateElem("none","chat.php?closechat"); window.close(); } function keys() { if(document.getElementById('live') != undefined){ var timer; document.getElementById("message").onkeypress = function() { typing('is'); clearTimeout(timer); timer = setTimeout("typing('no')", 3000); }}} function typing(value) { updateElem("none","chat.php?typing=" + value); } window.onload=function() { repeat1(); repeat5(); updateElem("none","chat.php?track&url=" + location.href + "&referer=" + document.referrer); keys(); } window.onunload=function() { updateElem("none","chat.php?track&end"); }