function is_defined(variable) {
    return !(typeof(variable) == 'undefined');
}

function dhtmlLoadScript(url)
{
   var e = document.createElement("script");
   e.src = url;
   e.type="text/javascript";
   document.getElementsByTagName("head")[0].appendChild(e);
}

function livechat_refresh() {
    dhtmlLoadScript('http://chat.econosafe.be/livehelp/include/javascript.php');
    if (typeof(currentStatus) == 'undefined') return;
    if (currentStatus == window.chatStatus) return;
    var png = 'online';
    var txt = 'Live Help Chat - Online';
    if (currentStatus == 'Offline') {
       png = 'offline';
       txt = 'Live Help Chat - Offline';
    }
    var imgChat = document.getElementById('imgChat');
    var src = imgChat.src;
    src = src.replace('online.png', png + '.png');
    src = src.replace('offline.png', png + '.png');
    imgChat.src = src;
    imgChat.alt = txt;
    imgChat.title = txt;
    window.chatStatus = currentStatus;
}

window.chatStatus = '';
livechat_refresh();
window.setInterval(livechat_refresh, 2000);


