var WEBPATH = "http://diygranite.com/cslive/";
//-----------------------------------------------------------------
// File: livehelp.js : generated for department : 2
// - 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_2= new Image;
popcontrol_2= new Image;
popcontrol_22= new Image;
popcontrol_23= new Image;
keyhundreds_2= new Image;
keytens_2= new Image;
keyones_2= new Image;
keyhundreds_2_value= 0;
keytens_2_value= 0;
keyones_2_value= 0;
place_2 =1;
// this is a flag to control if the image is set on the page
// yet or not..
var csloaded_2 = 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_2 = 15;
// The id of the page request.
var csID_2 = null;
// if the operator requests a chat we only want to open one window reguardless of department:
var openLiveHelpalready = false;
var openDHTMLalready = false;
var openDHTMLlayer = false;
var ismac = navigator.platform.indexOf('Mac');
// ismac =1; // for debugging mac
var defaultlayer = 1;
///////////////////////////////////////////////////////////////
// BEGIN INCLUDED LIBRARY HIDE / SHOW
// detect browser
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
// W3C stands for the W3C standard
W3C = (document.getElementById) ? 1 : 0;
function makeVisible ( name ) {
var ele;
if ( W3C ) {
ele = document.getElementById(name);
} else if ( NS4 ) {
ele = document.layers[name];
} else { // IE4
ele = document.all[name];
}
if ( NS4 ) {
ele.visibility = "show";
} else { // IE4 & W3C & Mozilla
ele.style.visibility = "visible";
ele.style.display = "inline";
}
}
function makeInvisible ( name ) {
if (W3C) {
document.getElementById(name).style.visibility = "hidden";
document.getElementById(name).style.display = "none";
} else if (NS4) {
document.layers[name].visibility = "hide";
} else {
document.all[name].style.visibility = "hidden";
document.all[name].style.style.display = "none";
}
}
//END INCLUDED LIBRARY HIDE / SHOW
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
// BEGIN INCLUDED LIBRARY XHTML
var xmlhttp = false;
var XMLHTTP_supported = false;
function gettHTTPreqobj(){
try {
xmlhttp = new XMLHttpRequest();
} catch (e1) {
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e2) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e3) {
xmlhttp = false;
}
}
}
return xmlhttp;
}
function loadXMLHTTP() {
// account for cache..
randu=Math.round(Math.random()*99);
// load a test page page:
loadOK('xmlhttp.php?whattodo=ping&rand='+ randu);
}
function loadOK(fragment_url) {
xmlhttp = gettHTTPreqobj();
xmlhttp.open("GET", fragment_url, true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
isok = xmlhttp.responseText;
if(isok == "OK")
XMLHTTP_supported = true;
checkXMLHTTP();
}
}
try { xmlhttp.send(null); } catch(whocares){}
}
// XMLHTTP -----------------------------------------------------------------
function oXMLHTTPStateHandler() {
// only if req shows "loaded"
if(typeof oXMLHTTP!='undefined') {
if( oXMLHTTP.readyState==4 ) { // 4="completed"
if( oXMLHTTP.status==200 ) { // 'OK Operation successful
try {
resultingtext = oXMLHTTP.responseText;
} catch(e) {
resultingtext ="error=1;";
}
ExecRes(unescape(resultingtext));
delete oXMLHTTP;
oXMLHTTP=false;
//DEBUG:SetStatus('Response received... Now Processing',0);
} else {
return false;
//DEBUG:alert( "There was a problem receiving the data.\n"
// +"Please wait a few moments and try again.\n"
// +"If the problem persists, please contact us.\n"
// +oXMLHTTP.getAllResponseHeaders()
// );
}
}
}
}
// Submit POST data to server and retrieve results
function PostForm(sURL, sPostData) {
oXMLHTTP = gettHTTPreqobj();
if( typeof(oXMLHTTP)!="object" ) return false;
oXMLHTTP.onreadystatechange = oXMLHTTPStateHandler;
try {
oXMLHTTP.open("POST", sURL, true);
} catch(er) {
//DEBUG: alert( "Error opening XML channel\n"+er.description );
return false;
}
oXMLHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
try { oXMLHTTP.send(sPostData); } catch(whocares){}
return true;
}
// Submit GET data to server and retrieve results
function GETForm(sURL) {
oXMLHTTP = gettHTTPreqobj();
if( typeof(oXMLHTTP)!="object" ) return false;
oXMLHTTP.onreadystatechange = oXMLHTTPStateHandler;
try {
oXMLHTTP.open("GET", sURL, true);
} catch(er) {
//DEBUG: alert( "Error opening XML channel\n"+er.description );
return false;
}
try { oXMLHTTP.send(null); } catch(whocares){}
return true;
}
// getting started:
xmlhttp = gettHTTPreqobj();
//END INCLUDED LIBRARY xmlhttp
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//END INCLUDED LIBRARY
////////////////////////////////////////////////////////////////
function wherecslhisdue_2(){
var layerdoesnotexist_2 = 0;
var looking = 'tp://www.craf'+'tysynt'+'ax.c'+'om';
var maccrap = '';
var layerinvitecrap = '
';
var x_2=document.getElementById("craftysyntax_2");
if(x_2){
} else {
var x_2=document.getElementById("craftysyntax");
if(!(x_2=document.getElementById("craftysyntax"))){
layerdoesnotexist_2 = 1;
x_2 = 0;
}
}
if(layerdoesnotexist_2 != 1){
var y_2 = x_2.innerHTML;
} else {
var y_2 = looking;
}
// macs do not see images in cache:
if (ismac > -1) {
randu=Math.round(Math.random()*9999);
maccrap = '';
}
if (y_2.indexOf(looking)!=-1) {
} else {
var newHTML = ' |
';
newHTML = newHTML + '<'+'a hr'+'ef="ht'+'tp://w'+'ww.c'+'raft'+'ysynt'+'ax.com?ut'+'m_'+'so'+'ur'+'ce'+'=po'+'we'+'re'+'db'+'y&'+'ut'+'m_'+'cam'+'pa'+'ig'+'n=p'+'ow'+'er'+'ed'+'by" nam" alt="Craf'+'ty Syn'+'tax Li'+'ve He'+'lp" ta'+'rget="_bl'+'ank"> |
';
newHTML = newHTML + '
';
if(layerdoesnotexist_2 != 1){
x_2.innerHTML = newHTML + layerinvitecrap + maccrap;
}
}
}
//-----------------------------------------------------------------
// loop though checking the image for updates from operators.
function csrepeat_2()
{
// if the request has timed out do not do anything.
if (csTimeout_2 < 1){
return;
} else {
csTimeout_2--;
// update image for requests from operator.
csgetimage_2();
// do it again.
setTimeout('csrepeat_2()', 10000);
}
}
//-----------------------------------------------------------------
// Update the control image. This is the image that the operators
// use to communitate with the visitor.
function csgetimage_2()
{
// set a number to identify this page .
csID_2=Math.round(Math.random()*9999);
randu=Math.round(Math.random()*9999);
cscontrol_2 = 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_2 = WEBPATH + 'image.php?' +
'what=userstat' +
'&page=' + escape(locationvar) +
'&randu=' + randu +
'&pageid=' + csID_2 +
'&department=' + 2 +
'&cslhVISITOR=' + '96a1105e2126e3ff2b5ff249f81b9a92' +
'&title=' + escape(var_title) +
'&referer=' + escape(var_referrer) +
'&cslheg=1&serversession=1';
// alert(u_2);
if (ismac > -1){
document.getElementById("imageformac_2").src= u_2;
document.getElementById("imageformac_2").onload = cslookatimage_2;
} else {
cscontrol_2.src = u_2;
cscontrol_2.onload = cslookatimage_2;
}
}
// looks at the size of the control image and if the width is 55
// then open the chat.
//-----------------------------------------------------------------
function cslookatimage_2(){
if(typeof(cscontrol_2) == 'undefined' ){
return;
}
if (ismac > -1){
w_2 = document.getElementById("imageformac_2").width;
} else {
w_2 = cscontrol_2.width;
}
// if the browser is dumb:
if((ismac > -1) && (w_2 == 0)){
makeVisible('imagesfordumbmac_2');
w_2 = document.getElementById("imageformac_2").width;
makeInvisible('imagesfordumbmac_2');
}
// pop up window:
if ((w_2 == 55) && (openLiveHelpalready != 1)) {
openWantsToChat_2();
openLiveHelpalready = 1;
}
// layer invite:
if ((w_2 == 25) && !(openDHTMLalready)) {
loadKey_2();
}
delete cscontrol_2;
cscontrol_2 = new Image;
}
//-----------------------------------------------------------------
// opens live help
function openLiveHelp(department)
{
if(openDHTMLlayer == 1){
makeInvisible('layerinvite_2');
}
openDHTMLlayer = 0;
openDHTMLalready = true;
csTimeout_2=0;
window.open(WEBPATH + 'livehelp.php?department=' + department + '&website=0&&cslheg=1&serversession=1', 'chat54050872', 'width=600,height=450,menubar=no,scrollbars=1,resizable=1');
}
function getKeys_2(){
if (ismac > -1){
w3_2 = document.getElementById("imageformac_2_hun").width;
w2_2 = document.getElementById("imageformac_2_ten").width;
w1_2 = document.getElementById("imageformac_2_one").width;
if(w1_2 == 0){
makeVisible('imagesfordumbmac_2');
w1_2 = document.getElementById("imageformac_2_one").width;
makeInvisible('imagesfordumbmac_2');
}
if(w2_2 == 0){
makeVisible('imagesfordumbmac_2');
w2_2 = document.getElementById("imageformac_2_ten").width;
makeInvisible('imagesfordumbmac_2');
}
if(w3_2 == 0){
makeVisible('imagesfordumbmac_2');
w3_2 = document.getElementById("imageformac_2_hun").width;
makeInvisible('imagesfordumbmac_2');
}
} else {
w3_2 = keyhundreds_2.width;
w2_2 = keytens_2.width;
w1_2 = keyones_2.width;
}
if(w1_2<100) w1_2 = 100;
if(w2_2<100) w2_2 = 100;
if(w3_2<100) w3_2 = 100;
// alert('w1='+w1+'w2='+w2+'w3='+w3);
total = ((w3_2-100)*100) + ((w2_2-100)*10) + (w1_2-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_2 == 3){
var u3_2 = WEBPATH + 'image.php?' +
'what=getlayerinvite&whatplace=hundreds' +
'&randu=' + randu +
'&department=' + 2 +
'&cslhVISITOR=' + '96a1105e2126e3ff2b5ff249f81b9a92' +
'&cslheg=1&serversession=1';
if (ismac > -1){
document.getElementById("imageformac_2_hun").src= u3_2;
document.getElementById("imageformac_2_hun").onload = getKeys_2;
} else {
keyhundreds_2.src = u3_2;
keyhundreds_2.onload = getKeys_2; }
}
if(place_2 == 2){
place_2 = 3;
var u2_2 = WEBPATH + 'image.php?' +
'what=getlayerinvite&whatplace=tens' +
'&randu=' + randu +
'&department=' + 2 +
'&cslhVISITOR=' + '96a1105e2126e3ff2b5ff249f81b9a92' +
'&cslheg=1&serversession=1';
if (ismac > -1){
document.getElementById("imageformac_2_ten").src= u2_2;
document.getElementById("imageformac_2_ten").onload = loadKey_2;
} else {
keytens_2.src = u2_2;
keytens_2.onload = loadKey_2;
}
}
if(place_2 == 1){
place_2 = 2;
var u1_2 = WEBPATH + 'image.php?' +
'what=getlayerinvite&whatplace=ones' +
'&randu=' + randu +
'&department=' + 2 +
'&cslhVISITOR=' + '96a1105e2126e3ff2b5ff249f81b9a92' +
'&cslheg=1&serversession=1';
if (ismac > -1){
document.getElementById("imageformac_2_one").src= u1_2;
document.getElementById("imageformac_2_one").onload = loadKey_2;
} else {
keyones_2.src = u1_2;
keyones_2.onload = loadKey_2;
}
}
}
//-----------------------------------------------------------------
// opens DHTML help
function openDHTML_2(total)
{
var html = '';
if (total == 1)
html = ''
if (total == 2)
html = ''
if (total == 3)
html = ''
if (total == 4)
html = ''
if (total == 5)
html = ''
if (total == 6)
html = ''
if (total == 7)
html = ''
//alert(html);
makeVisible('layerinvite_2');
var w_2=document.getElementById('layerinvite_2');
w_2.innerHTML = html;
var u_2 = WEBPATH + 'image.php?' +
'what=changestat' +
'&towhat=invited' +
'&cslhVISITOR=' + '96a1105e2126e3ff2b5ff249f81b9a92' +
'&cslheg=1&serversession=1';
popcontrol_22.src = u_2;
stillopen = 1;
setTimeout('moveDHTML_2()', 9);
openDHTMLalready = true;
openDHTMLlayer = true;
}
//-----------------------------------------------------------------
// opens DHTML help
function closeDHTML()
{
makeInvisible('layerinvite_2');
openDHTMLlayer = 0;
stillopen = 0;
var u4_2 = WEBPATH + 'image.php?' +
'what=changestat' +
'&towhat=stopped' +
'&cslhVISITOR=' + '96a1105e2126e3ff2b5ff249f81b9a92' +
'&cslheg=1&serversession=1';
popcontrol_23.src = u4_2;
}
//-----------------------------------------------------------------
// 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;
}
slidingDiv = document.getElementById('layerinvite_2');
gox = parseInt(slidingDiv.style.left);
goy = parseInt(slidingDiv.style.top);
// alert('x:'+gox);
// alert('y:'+goy);
// done 3 times to move 3 times faster:
if(gox < myWidth+200){ gox++; }
if(gox > myWidth+200){ gox--; }
if(goy < myHeight+160){ goy++; }
if(goy > myHeight+160){ goy--; }
if(gox < myWidth+200){ gox++; }
if(gox > myWidth+200){ gox--; }
if(goy < myHeight+160){ goy++; }
if(goy > myHeight+160){ goy--; }
if(gox < myWidth+200){ gox++; }
if(gox > myWidth+200){ gox--; }
if(goy < myHeight+160){ goy++; }
if(goy > myHeight+160){ goy--; }
// alert('x:'+gox);
// alert('y:'+goy);
slidingDiv.style.left = gox + "px";
slidingDiv.style.top = goy + "px";
if(goy!= parseInt(myWidth+200) )
setTimeout('moveDHTML_2()', 7);
else
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_2 = WEBPATH + 'image.php?' +
'what=browse' +
'&page=' + escape(locationvar) +
'&title=' + escape(var_title) +
'&referer=' + escape(var_referrer) +
'&pageid=' + csID_2 +
'&department=' + 2 +
'&cslhVISITOR=' + '96a1105e2126e3ff2b5ff249f81b9a92' +
'&cslheg=1&serversession=1';
cscontrol_2.src = u_2;
// open the window..
window.open(WEBPATH + 'livehelp.php?what=chatinsession&department=2&website=0&cslhVISITOR=96a1105e2126e3ff2b5ff249f81b9a92&cslheg=1&serversession=1', 'chat54050872', 'width=600,height=450,menubar=no,scrollbars=1,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_2 = WEBPATH + 'image.php?what=getstate&department=2&nowis=20250205044054&cslhVISITOR=96a1105e2126e3ff2b5ff249f81b9a92' +
'&page=' + escape(locationvar) +
'&referer=' + escape(var_referrer) +
'&title=' + escape(var_title) +
'&leaveamessage=' + 'YES' +
'&cslheg=1&serversession=1';
var urltocslhimage_2 = WEBPATH + 'image.php?what=getcredit&department=2&nowis=20250205044054&cslhVISITOR=96a1105e2126e3ff2b5ff249f81b9a92' +
'&xy=' + 'Y' +
'&page=' + escape(locationvar) +
'&referer=' + escape(var_referrer) +
'&title=' + escape(var_title) +
'&leaveamessage=' + 'YES' +
'&cslheg=1&serversession=1';
document.write('');
document.write('');
document.write(' |
');
document.write('<'+'a hr'+'ef="ht'+'tp://w'+'ww.c'+'raft'+'ysynt'+'ax.com?ut'+'m_'+'so'+'ur'+'ce'+'=po'+'we'+'re'+'db'+'y&'+'ut'+'m_'+'cam'+'pa'+'ig'+'n=p'+'ow'+'er'+'ed'+'by" nam" alt="Craf'+'ty Syn'+'tax Li'+'ve He'+'lp" ta'+'rget="_bl'+'ank">');
document.write(' |
');
// macs do not see images in cache:
if (ismac > -1) {
randu=Math.round(Math.random()*9999);
document.write('');
}
// Layer invite DIV:
randu=Math.round(Math.random()*777);
document.write('');
setTimeout('csgetimage_2()', 4000);
setTimeout('wherecslhisdue_2()', 2000);