var protocol = window.parent.document.location.protocol;
var domain = protocol + "//" + window.location.hostname + "/";
var fullsysurl = "http://www.ufhosting.org/whmcs/";
var lesssysurl = "http://ufhosting.org/whmcs/";
var fullsslsysurl = "/";
var lesssslsysurl = "/";
if(fullsysurl == domain || lesssysurl == domain || fullsslsysurl == domain || lesssslsysurl == domain){
var external = "false";
}else{
var external = "true";
if(protocol == 'https:'){
var externaldomain = fullsslsysurl;
}else{
var externaldomain = fullsysurl;
}}
function getDir(url){
if(external == 'true'){
var result = 'http://www.ufhosting.org/whmcs/';
}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&prot=" + protocol);
}}
if(document.getElementById('whmcslivetxt') != undefined){
if(external == 'true'){
document.getElementById('whmcslivetxt').innerHTML = "Live Support Offline";
}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 declineInitiate(){
updateElem("none","chat.php?declineinitiate");
document.getElementById('whmcsliveinitiate').style.display = 'none';
}
function acceptInitiate(){
document.getElementById('whmcsliveinitiate').style.display = 'none';
updateElem("none","chat.php?acceptinitiate");
window.open('http://www.ufhosting.org/whmcs/chat.php?initiated&admin=','livechat','resizable=0,width=460,height=420');
}
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");
}