//=======================================================================
/**********************************************************************************
* Help Center Live! – http://www.helpcenterlive.com *
* by Digital Frontiers, UTO *
***********************************************************************************
* Software Version: Help Center Live! v 2.1.7 *
* Software by: Digital Frontiers, UTO (http://www.helpcenterlive.com) *
* Copyright 2008 by: Digital Frontiers, UTO (http://www.helpcenterlive.com) *
* Support, News, Updates at: http://www.helpcenterlive.com *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under *
* the terms of the provided license as published by Digital Frontiers, UTO. *
* *
* This program is distributed in the hope that it is and will be useful, but *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY *
* or FITNESS FOR A PARTICULAR PURPOSE. *
* *
* See the "license.txt" file for details of the Help Center Live! license. *
* The latest version can always be found at http://www.helpcenterlive.com. *
***********************************************************************************
* File Comments: *
* This file is used to track visitors using javascript *
**********************************************************************************/
var ChatConnection1 = new Aardvark('ChatConnection1'); var ChatConnection2 = new Aardvark('ChatConnection2'); function Chat() { this.time = Misc.epoch(); this.mac = navigator.platform.indexOf('Mac'); this.image_width = 0; this.typing_flag = false; this.focus_flag = true; this.exit_flag = false; this.sounds_flag = true; this.close_flag = false; this.save_flag = false; this.size = ; this.span = ''; this.chat_timer = new Date(); this.start_timer = new Date(); this.total_time = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.chat_message = ''; this.left_chat = false; this.encode = ''; this.chr = ''; this.busy = false; this.confirm = false; this.guest = ''; this.operator = ''; this.department = ''; this.chatid = ''; this.win = false; getpage($chatid)) { ?>
this.cobrowse = true;
this.cobrowse = false;
this.coforms_current = ''; this.checksum = 0; this.allow_redisplay = true; this.allow_refresh = true; this.allow_cobrowse = false; this.sound_n = 0; this.copageurl = ''; this.check = function(variables)
{ var i = 0; var max = 0; var message = false; var typing = false; var operator = ''; var department = ''; var response = ''; var regex = new RegExp(); var match; var regex2 = new RegExp(); var match2; if (ChatConnection1.vars.chat_) { response = ChatConnection1.vars.chat_; regex = new RegExp(); match = regex.exec(response); regex2 = new RegExp(); match2 = regex2.exec(response); regex = new RegExp(/\|message\:([^\|]*)\|/); if (match = regex.exec(response)) { if (match[1]) { message = true; this.checksum++; match[1] = match[1].replace(/\+/g, " ");
this.write('true', 'g', match[1]);
this.write('false', 'o', match[1]);
}
}
regex = new RegExp(/\|push\:([^\|]*)\|/); if (match = regex.exec(response)) { if (match[1]) { this.push(match[1]);}
}
regex = new RegExp(/\|download\:([^\:]*):([^\|]*)\|/); if (match = regex.exec(response)) { if (match[1]) { this.download(unescape(match[1]), match[2]);}
}
regex = new RegExp(/\|transfer-operator\:([^\|]*)\|/); if (match = regex.exec(response)) { if (match[1]) { operator = match[1];}
}
regex = new RegExp(/\|transfer-department\:([^\|]*)\|/); if (match = regex.exec(response)) { if (match[1]) { department = match[1];}
}
regex = new RegExp(/\|copage\:([^\|]*)\|/); if (match = regex.exec(response)) { if (match[1]) { this.copage(match[1]);}
}
regex = new RegExp(/\|coforms\:([^\:]*):([^\:]*):([^\|]*)\|/); if (match = regex.exec(response)) { if (match[1]) { this.coforms(match[1], unescape(match[2]), unescape(match[3]));}
}
regex = new RegExp(/\|comarker\:([^\:]*):([^\:]*):([^\|]*)\|/); if (match = regex.exec(response)) { if (match[1]) { this.comarker(match[1], match[2], match[3]);}
}
var action = response.split('|'); max = action.length - 1; for (i = 0; i < max; ++i) { switch (action[i]) { case 'typing':
if (!message) { typing = true;
if (parent.window.chat_type.document.getElementById('typing').innerHTML !== this.parse_names('', 'guest')) { parent.window.chat_type.document.getElementById('typing').innerHTML = this.parse_names('', 'guest');}
if (parent.window.chat_type.document.getElementById('typing').innerHTML !== this.parse_names('', 'operator')) { parent.window.chat_type.document.getElementById('typing').innerHTML = this.parse_names('', 'operator');}
}
break; case 'hold':
this.chat_hold(); break; case 'resume':
this.chat_resume(); break; case 'display':
parent.window.chat_display.document.location.href = '/live/chat/display.php?chatid=&admin&time='+this.time; break; case 'upload':
this.upload(); break; case 'cobrowse':
this.cobrowse_started(); break; case 'cobrowse-allow':
this.allow_cobrowse = true; break; case 'cobrowse-disallow':
this.allow_cobrowse = false; break; case 'cobrowse-disconnect':
if (this.cobrowse == true && parent.window.opener.CoBrowse.track == false) { this.cobrowse_disconnect();}
break; case 'comarker-clear':
this.comarker_clear(); break; case 'transfer-yes':
this.set_names(operator, department); this.transfer('yes'); break; case 'transfer-no':
this.transfer('no'); break; case 'close':
if (!this.close_flag) { this.close_window();}
break;}
}
}
if (!message && !typing && parent.window.chat_type.document.getElementById('typing')) { parent.window.chat_type.document.getElementById('typing').innerHTML = '';}
if (this.typing_flag && parent.window.chat_send.document.getElementById('chat_box').value == '') { this.typing_flag = false;}
if (!this.close_flag) { window.setTimeout('parent.window.Chat.refresh();', );}
}
this.refresh = function()
{ ChatConnection1.add('admin', '');
ChatConnection1.add('chat', ''); ChatConnection1.add('chatid', ''); ChatConnection1.add('checksum', this.checksum); ChatConnection1.add('copage', this.copageurl); ChatConnection1.add('time', Misc.epoch()); if (this.typing_flag) { ChatConnection1.add('typing', '');}
ChatConnection1.send('/live/chat/response.php', 'Chat.check(variables)', 'reset');}
this.set_names = function(operator, department)
{ this.operator = operator; this.department = department;}
this.parse_names = function(string, person)
{ if (person == 'operator') { string = string.replace('PERSON', this.operator);}
if (person == 'guest') { string = string.replace('PERSON', this.guest);}
string = string.replace('GUEST', this.guest); string = string.replace('OPERATOR', this.operator); string = string.replace('DEPARTMENT', this.department); return string;}
this.empty = function()
{ alert(''); window.close();}
this.font_larger = function()
{ this.size = this.size + 2; this.font_apply();}
this.font_smaller = function()
{ this.size = this.size - 2; this.font_apply();}
this.font_apply = function()
{ this.span = parent.window.chat_display.document.getElementsByTagName('span'); for (i = 0; i < this.span.length; i++) { this.span[i].style.fontSize = this.size + 'px';}
parent.window.chat_display.scroll(0,10000000);}
this.focus = function(x, on, off)
{ this.time = Misc.epoch(); if (x == 'img') { if (parent.window.chat_top.document.getElementById('focus').src == on) { parent.window.chat_top.document.getElementById('focus').src = off; this.focus_flag = false;} else { parent.window.chat_top.document.getElementById('focus').src = on; this.focus_flag = true;}
} else { if (x == 'on') { this.focus_flag = true; parent.window.chat_top.document.getElementById('focus_on').className = 'selected'; parent.window.chat_top.document.getElementById('focus_off').className = 'not_selected';}
if (x == 'off') { this.focus_flag = false; parent.window.chat_top.document.getElementById('focus_on').className = 'not_selected'; parent.window.chat_top.document.getElementById('focus_off').className = 'selected';}
}
}
this.sounds = function(x, on, off)
{ if (x == 'img') { if (parent.window.chat_top.document.getElementById('sounds').src == on) { parent.window.chat_top.document.getElementById('sounds').src = off; this.sounds_flag = false;} else { parent.window.chat_top.document.getElementById('sounds').src = on; this.sounds_flag = true;}
} else { if (x == 'on') { this.sounds_flag = true; parent.window.chat_top.document.getElementById('sounds_on').className = 'selected'; parent.window.chat_top.document.getElementById('sounds_off').className = 'not_selected';}
if (x == 'off') { this.sounds_flag = false; parent.window.chat_top.document.getElementById('sounds_on').className = 'not_selected'; parent.window.chat_top.document.getElementById('sounds_off').className = 'selected';}
}
}
this.timer = function()
{ this.chat_timer = new Date(); this.total_time = this.chat_timer.getTime() - this.start_timer.getTime(); this.chat_timer.setTime(this.total_time); if (this.chat_timer.getMinutes() < 10) { this.minutes = '0'+this.chat_timer.getMinutes();} else { this.minutes = this.chat_timer.getMinutes();}
if (this.chat_timer.getSeconds() < 10) { this.seconds = '0'+this.chat_timer.getSeconds();} else { this.seconds = this.chat_timer.getSeconds();}
if (this.minutes < 60) { parent.window.chat_top.document.getElementById('time').innerHTML = this.minutes+':'+this.seconds;} else { this.hours = Math.floor(this.minutes / 60); this.minutes = this.minutes - (this.hours * 60); parent.window.chat_top.document.getElementById('time').innerHTML = this.hours+':'+this.minutes+':'+this.seconds;}
setTimeout('parent.window.Chat.timer()', 1000);}
this.save = function()
{ if (parent.window.opener.CoBrowse) { parent.window.opener.CoBrowse.track = false;}
if (!this.save_flag) { this.save_flag = true; autosave_transcripts() && !isset($_GET['opchat'])) { ?>
this.time = Misc.epoch(); this.exit_flag = confirm(''); if (this.exit_flag) { parent.window.location.href = '/live/chat/end.php?save&admin&chatid=&time='+this.time;} else { parent.window.location.href = '/live/chat/end.php?chatid=&admin&time='+this.time;}
} else { return true;}
if (parent.window.opener.Live) { parent.window.opener.Live.end_chat = true;} else { parent.window.location.href = '/live/chat/end.php?chatid=&admin&opchat&time='+this.time;}
}
this.push = function(page)
{ this.win = window.open(page, 'chat_push', 'toolbar=yes, location=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes'); if (!this.win) { this.confirm = confirm(''); if (this.confirm) { setTimeout('Chat.push(page);', 10000);} else { return false;}
}
}
this.upload = function()
{ this.time = Misc.epoch(); this.win = window.open('/live/chat/upload.php?chatid=&admin&time='+this.time, 'chat_upload', 'toolbar=no, location=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, width=400, height=200'); if (!this.win) { this.confirm = confirm(''); if (this.confirm) { setTimeout('Chat.upload();', 5000);} else { return false;}
}
}
this.download = function(size, id)
{ this.time = Misc.epoch(); parent.window.chat_download.location.href = '/live/chat/download.php?chatid=&id='+id+'&admin&time='+this.time; message = '