var WEBPATH = "http://live.chat-professionnel.com/";
//-----------------------------------------------------------------
// File: livehelp.js :
// - This is the client side Javascript file to control the
// image shown on the clients website. It should be called
// on the clients HTML page as a javascript include such as:
// script src="http://yourwebsite.com/livehelp/livehelp_js.php"
// This js file will show the image of online.gif if an operator
// is online otherwise it will show offline.gif . Also a
// second image is placed on the site as a control image
// where the width of the image controls the actions made by
// the operator to the poor little visitor..
//
//-----------------------------------------------------------------
// GLOBALS..
//------------
// This is the control image where the width of it controls the
// actions made by the operator.
cscontrol= new Image;
popcontrol= new Image;
popcontrol2= new Image;
popcontrol3= new Image;
keyhundreds= new Image;
keytens= new Image;
keyones= new Image;
keyhundreds_value= 0;
keytens_value= 0;
keyones_value= 0;
place =1;
// this is a flag to control if the image is set on the page
// yet or not..
var csloaded = false;
// just to make sure that people do not just open up the page
// and leave it open the requests timeout after 99 requests.
var csTimeout = 15;
// The id of the page request.
var csID = null;
// if the operator requests a chat we only want to open one window...
var openLiveHelpalready = false;
var openDHTMLalready = false;
var openDHTMLlayer = false;
var ismac = navigator.platform.indexOf('Mac');
//ismac =1;
//-----------------------------------------------------------------
// loop though checking the image for updates from operators.
function csrepeat()
{
// if the request has timed out do not do anything.
if (csTimeout < 1)
return;
csTimeout--;
// update image for requests from operator.
csgetimage();
// do it again.
setTimeout('csrepeat()', 7000);
}
//-----------------------------------------------------------------
// Update the control image. This is the image that the operators
// use to communitate with the visitor.
function csgetimage()
{
// set a number to identify this page .
if (csID==null) csID=Math.round(Math.random()*9999);
randu=Math.round(Math.random()*9999);
cscontrol = new Image;
locationvar = '' + document.location;
locationvar = locationvar.replace(new RegExp("[^A-Za-z0-9_)\+\^{}~( ',\.\&\%=/\\?#:-]","g"),"");
locationvar = locationvar.replace(new RegExp("=[a-z0-9]{32}","g"),"x=1");
locationvar = locationvar.replace(new RegExp("[\.]","g"),"--dot--");
locationvar = locationvar.replace(new RegExp("http://","g"),"");
locationvar = locationvar.replace(new RegExp("https://","g"),"");
locationvar = locationvar.substr(0,250);
var_title = '' + document.title;
var_title = var_title.replace(new RegExp("[^A-Za-z0-9_)\+\^{}~( ',\.\&\%=/\\?#:-]","g"),"");
var_title = var_title.substr(0,100);
var_referrer = '' + document.referrer;
var_referrer = var_referrer.replace(new RegExp("[^A-Za-z0-9_)\+\^{}~( ',\.\&\%=/\\?#:-]","g"),"");
var_referrer = var_referrer.replace(new RegExp("=[a-z0-9]{32}","g"),"x=1");
var_referrer = var_referrer.replace(new RegExp("[\.]","g"),"--dot--");
var_referrer = var_referrer.replace(new RegExp("http://","g"),"");
var_referrer = var_referrer.replace(new RegExp("https://","g"),"");
var_referrer = var_referrer.substr(0,250);
var u = WEBPATH + 'image.php?' +
'what=getstate' +
'&page=' + escape(locationvar) +
'&randu=' + randu +
'&pageid=' + csID +
'&department=' + 2 +
'&netkomVISITOR=' + 'cc7987d43c768b2a1a63babf3f796b74' +
'&title=' + escape(var_title) +
'&referer=' + escape(var_referrer) +
'&netkomeg=1&serversession=0';
if (ismac > -1){
document.getElementById("imageformac").src= u;
document.getElementById("imageformac").onload = cslookatimage;
} else {
cscontrol.src = u;
cscontrol.onload = cslookatimage;
}
//alert(document.getElementById('csIcon'));
document.getElementById('csIcon').src=u;
//alert(document.getElementById('csIcon').src);
}
// looks at the size of the control image and if the width is 55
// then open the chat.
//-----------------------------------------------------------------
function cslookatimage(){
if(typeof(cscontrol) == 'undefined' ){
return;
}
var w = 0;
if (ismac > -1)
w = document.getElementById("imageformac").width;
else
w = cscontrol.width;
// pop up window:
if ((w == 55) && (openLiveHelpalready != 1)) {
openWantsToChat_2();
openLiveHelpalready = 1;
}
// layer invite:
if ((w == 25) && !(openDHTMLalready)) {
loadKey_2(1);
}
delete cscontrol;
}
//-----------------------------------------------------------------
// opens live help
function openLiveHelp(department)
{
if(openDHTMLlayer == 1)
destroyLayer('mylayer2Div');
openDHTMLlayer = 0;
openDHTMLalready = true;
csTimeout=0;
window.open(WEBPATH + 'livehelp.php?department=' + department + '&netkomeg=1&serversession=0', 'chat54050872', 'width=585,height=390,menubar=no,scrollbars=0,resizable=1');
}
function getKeys_2(){
if (ismac > -1){
w3 = document.getElementById("imageformac_hun").width;
w2 = document.getElementById("imageformac_ten").width;
w1 = document.getElementById("imageformac_one").width;
} else {
w3 = keyhundreds.width;
w2 = keytens.width;
w1 = keyones.width;
}
if(w1<100) w1 = 100;
if(w2<100) w2 = 100;
if(w3<100) w3 = 100;
// alert('w1='+w1+'w2='+w2+'w3='+w3);
total = ((w3-100)*100) + ((w2-100)*10) + (w1-100);
// alert(total);
openDHTML_2(total);
}
//-----------------------------------------------------------------
// gets primary key of layerinvite sent using 3 images.. could use XML HTTP
// but this is more compatable...
function loadKey_2(){
randu=Math.round(Math.random()*9999);
if(place == 3){
var u3 = WEBPATH + 'image.php?' +
'what=getlayerinvite&whatplace=hundreds' +
'&randu=' + randu +
'&department=' + 2 +
'&netkomVISITOR=' + 'cc7987d43c768b2a1a63babf3f796b74' +
'&netkomeg=1&serversession=0';
if (ismac > -1){
document.getElementById("imageformac_hun").src= u3;
document.getElementById("imageformac_hun").onload = getKeys_2;
} else {
keyhundreds.src = u3;
keyhundreds.onload = getKeys_2; }
}
if(place == 2){
place = 3;
var u2 = WEBPATH + 'image.php?' +
'what=getlayerinvite&whatplace=tens' +
'&randu=' + randu +
'&department=' + 2 +
'&netkomVISITOR=' + 'cc7987d43c768b2a1a63babf3f796b74' +
'&netkomeg=1&serversession=0';
if (ismac > -1){
document.getElementById("imageformac_ten").src= u2;
document.getElementById("imageformac_ten").onload = loadKey_2;
} else {
keytens.src = u2;
keytens.onload = loadKey_2;
}
}
if(place == 1){
place = 2;
var u1 = WEBPATH + 'image.php?' +
'what=getlayerinvite&whatplace=ones' +
'&randu=' + randu +
'&department=' + 2 +
'&netkomVISITOR=' + 'cc7987d43c768b2a1a63babf3f796b74' +
'&netkomeg=1&serversession=0';
if (ismac > -1){
document.getElementById("imageformac_one").src= u1;
document.getElementById("imageformac_one").onload = loadKey_2;
} else {
keyones.src = u1;
keyones.onload = loadKey_2;
}
}
}
//-----------------------------------------------------------------
// opens DHTML help
function openDHTML_2(total)
{
var html = '';
if (total == 2)
html = ''
if (total == 4)
html = '
'
if (total == 5)
html = '
'
//alert(html);
createLayer('mylayer2Div',null,100,200,550,400,html,null,null,999)
mylayer2 = new aDynLayer('mylayer2Div');
var u = WEBPATH + 'image.php?' +
'what=changestat' +
'&towhat=invited' +
'&netkomVISITOR=' + 'cc7987d43c768b2a1a63babf3f796b74' +
'&netkomeg=1&serversession=0';
popcontrol2.src = u;
stillopen = 1;
setTimeout('moveDHTML_2()', 9000);
openDHTMLalready = true;
openDHTMLlayer = true;
}
//-----------------------------------------------------------------
// opens DHTML help
function closeDHTML()
{
destroyLayer('mylayer2Div');
openDHTMLlayer = 0;
stillopen = 0;
var u4 = WEBPATH + 'image.php?' +
'what=changestat' +
'&towhat=stopped' +
'&netkomVISITOR=' + 'cc7987d43c768b2a1a63babf3f796b74' +
'&netkomeg=1&serversession=0';
popcontrol3.src = u4;
}
//-----------------------------------------------------------------
// opens DHTML help
function moveDHTML_2()
{
if(stillopen==1){
if(navigator.appName.indexOf("Netscape") != -1){
myWidth = window.pageXOffset;
myHeight = window.pageYOffset
} else {
myWidth = document.body.scrollLeft;
myHeight = document.body.scrollTop;
}
mylayer2.moveTo(myWidth+200,myHeight+100);
setTimeout('moveDHTML_2()', 9000);
}
}
//-----------------------------------------------------------------
// The Operator wants to chat with the visitor about something.
function openWantsToChat_2()
{
// ok we asked them .. now lets not ask them again for awhile...
locationvar = '' + document.location;
locationvar = locationvar.replace(new RegExp("[^A-Za-z0-9_)\+\^{}~( ',\.\&\%=/\\?#:-]","g"),"");
locationvar = locationvar.replace(new RegExp("=[a-z0-9]{32}","g"),"x=1");
locationvar = locationvar.replace(new RegExp("[\.]","g"),"--dot--");
locationvar = locationvar.replace(new RegExp("http://","g"),"");
locationvar = locationvar.replace(new RegExp("https://","g"),"");
locationvar = locationvar.substr(0,250);
var_title = '' + document.title;
var_title = var_title.replace(new RegExp("[^A-Za-z0-9_)\+\^{}~( ',\.\&\%=/\\?#:-]","g"),"");
var_title = var_title.substr(0,100);
var_referrer = '' + document.referrer;
var_referrer = var_referrer.replace(new RegExp("[^A-Za-z0-9_)\+\^{}~( ',\.\&\%=/\\?#:-]","g"),"");
var_referrer = var_referrer.replace(new RegExp("=[a-z0-9]{32}","g"),"x=1");
var_referrer = var_referrer.replace(new RegExp("[\.]","g"),"--dot--");
var_referrer = var_referrer.replace(new RegExp("http://","g"),"");
var_referrer = var_referrer.replace(new RegExp("https://","g"),"");
var_referrer = var_referrer.substr(0,250);
var u = WEBPATH + 'image.php?' +
'what=browse' +
'&page=' + escape(locationvar) +
'&title=' + escape(var_title) +
'&referer=' + escape(var_referrer) +
'&pageid=' + csID +
'&department=' + 2 +
'&netkomVISITOR=' + 'cc7987d43c768b2a1a63babf3f796b74' +
'&netkomeg=1&serversession=0';
cscontrol.src = u;
// open the window..
window.open(WEBPATH + 'livehelp.php?what=chatinsession&department=2&netkomVISITOR=cc7987d43c768b2a1a63babf3f796b74&netkomeg=1&serversession=0', 'chat54050872', 'width=585,height=390,menubar=no,scrollbars=0,resizable=1');
}
locationvar = '' + document.location;
locationvar = locationvar.replace(new RegExp("[^A-Za-z0-9_)\+\^{}~( ',\.\&\%=/\\?#:-]","g"),"");
locationvar = locationvar.replace(new RegExp("=[a-z0-9]{32}","g"),"x=1");
locationvar = locationvar.replace(new RegExp("[\.]","g"),"--dot--");
locationvar = locationvar.replace(new RegExp("http://","g"),"");
locationvar = locationvar.replace(new RegExp("https://","g"),"");
locationvar = locationvar.substr(0,250);
var_title = '' + document.title;
var_title = var_title.replace(new RegExp("[^A-Za-z0-9_)\+\^{}~( ',\.\&\%=/\\?#:-]","g"),"");
var_title = var_title.substr(0,100);
var_referrer = '' + document.referrer;
var_referrer = var_referrer.replace(new RegExp("[^A-Za-z0-9_)\+\^{}~( ',\.\&\%=/\\?#:-]","g"),"");
var_referrer = var_referrer.replace(new RegExp("=[a-z0-9]{32}","g"),"x=1");
var_referrer = var_referrer.replace(new RegExp("[\.]","g"),"--dot--");
var_referrer = var_referrer.replace(new RegExp("http://","g"),"");
var_referrer = var_referrer.replace(new RegExp("https://","g"),"");
var_referrer = var_referrer.substr(0,250);
var urltohelpimage = 'http://live.chat-professionnel.com/image.php?what=getstate&department=2&nowis=20100729141106&netkomVISITOR=cc7987d43c768b2a1a63babf3f796b74' +
'&page=' + escape(locationvar) +
'&referer=' + escape(var_referrer) +
'&title=' + escape(var_title) +
'&netkomeg=1&serversession=0';
var urltocreditimage = 'http://live.chat-professionnel.com/image.php?what=getcredit&department=2&nowis=20100729141106&netkomVISITOR=cc7987d43c768b2a1a63babf3f796b74' +
'&page=' + escape(locationvar) +
'&referer=' + escape(var_referrer) +
'&title=' + escape(var_title) +
'&netkomeg=1&serversession=0';
// document.write(urltohelpimage);
document.write('
');// macs do not see images in cache:
if (ismac > -1) {
randu=Math.round(Math.random()*9999);
document.write('
![]() ![]() ![]() ![]() | ');
document.write('