var WEBPATH = "/chat/"; //----------------------------------------------------------------- // File: livehelp.js : generated for department : // - 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; popcontrol_2= new Image; popcontrol_3= 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_ = 10; // The id of the page request. var csID_ = 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_(){ var layerdoesnotexist_ = 0; var looking = 'tp://www.craf'+'tysynt'+'ax.c'+'om'; var maccrap = ''; var layerinvitecrap = ''; var x_=document.getElementById("craftysyntax_"); if(x_){ } else { var x_=document.getElementById("craftysyntax"); if(!(x_=document.getElementById("craftysyntax"))){ layerdoesnotexist_ = 1; x_ = 0; } } if(layerdoesnotexist_ != 1){ var y_ = x_.innerHTML; } else { var y_ = looking; } // macs do not see images in cache: if (ismac > -1) { randu=Math.round(Math.random()*9999); maccrap = ''; } var newHTML = ''; newHTML = newHTML + '
Live Help
'; if(layerdoesnotexist_ != 1){ x_.innerHTML = newHTML + layerinvitecrap + maccrap; } if(layerdoesnotexist_ == 1){ alert('Crafty Sytnax Live Help Error: DIV layer with the id of: craftysyntax_ does not exist. This is needed order to put the live help icon on your page. please add
[[your javascript for your live help ]]
around your live help code'); } } //----------------------------------------------------------------- // 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; } else { csTimeout_--; // update image for requests from operator. csgetimage_(); // do it again. setTimeout('csrepeat_()', 10000); } } //----------------------------------------------------------------- // 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 . 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=userstat' + '&page=' + escape(locationvar) + '&randu=' + randu + '&pageid=' + csID_ + '&department=' + 0 + '&cslhVISITOR=' + '69213140f79c7561eaca49014614319e' + '&title=' + escape(var_title) + '&referer=' + escape(var_referrer) + '&cslheg=1&serversession=1'; // alert(u_); if (ismac > -1){ document.getElementById("imageformac_").src= u_; document.getElementById("imageformac_").onload = cslookatimage_; } else { cscontrol_.src = u_; cscontrol_.onload = cslookatimage_; } } // 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; } if (ismac > -1){ w_ = document.getElementById("imageformac_").width; } else { w_ = cscontrol_.width; } // if the browser is dumb: if((ismac > -1) && (w_ == 0)){ makeVisible('imagesfordumbmac_'); w_ = document.getElementById("imageformac_").width; makeInvisible('imagesfordumbmac_'); } // pop up window: if ((w_ == 55) && (openLiveHelpalready != 1)) { openWantsToChat_0(); openLiveHelpalready = 1; } // layer invite: if ((w_ == 25) && !(openDHTMLalready)) { loadKey_0(); } delete cscontrol_; cscontrol_ = new Image; } //----------------------------------------------------------------- // opens live help function openLiveHelp(department) { if(openDHTMLlayer == 1){ makeInvisible('layerinvite_0'); } openDHTMLlayer = 0; openDHTMLalready = true; csTimeout_=0; window.open(WEBPATH + 'livehelp.php?department=' + department + '&website=1&&cslheg=1&serversession=1', 'chat54050872', 'width=600,height=450,menubar=no,scrollbars=1,resizable=1'); } function getKeys_0(){ if (ismac > -1){ w3_ = document.getElementById("imageformac__hun").width; w2_ = document.getElementById("imageformac__ten").width; w1_ = document.getElementById("imageformac__one").width; if(w1_ == 0){ makeVisible('imagesfordumbmac_'); w1_ = document.getElementById("imageformac__one").width; makeInvisible('imagesfordumbmac_'); } if(w2_ == 0){ makeVisible('imagesfordumbmac_'); w2_ = document.getElementById("imageformac__ten").width; makeInvisible('imagesfordumbmac_'); } if(w3_ == 0){ makeVisible('imagesfordumbmac_'); w3_ = document.getElementById("imageformac__hun").width; makeInvisible('imagesfordumbmac_'); } } 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_0(total); } //----------------------------------------------------------------- // gets primary key of layerinvite sent using 3 images.. could use XML HTTP // but this is more compatable... function loadKey_0(){ randu=Math.round(Math.random()*9999); if(place_ == 3){ var u3_ = WEBPATH + 'image.php?' + 'what=getlayerinvite&whatplace=hundreds' + '&randu=' + randu + '&department=' + 0 + '&cslhVISITOR=' + '69213140f79c7561eaca49014614319e' + '&cslheg=1&serversession=1'; if (ismac > -1){ document.getElementById("imageformac__hun").src= u3_; document.getElementById("imageformac__hun").onload = getKeys_0; } else { keyhundreds_.src = u3_; keyhundreds_.onload = getKeys_0; } } if(place_ == 2){ place_ = 3; var u2_ = WEBPATH + 'image.php?' + 'what=getlayerinvite&whatplace=tens' + '&randu=' + randu + '&department=' + 0 + '&cslhVISITOR=' + '69213140f79c7561eaca49014614319e' + '&cslheg=1&serversession=1'; if (ismac > -1){ document.getElementById("imageformac__ten").src= u2_; document.getElementById("imageformac__ten").onload = loadKey_0; } else { keytens_.src = u2_; keytens_.onload = loadKey_0; } } if(place_ == 1){ place_ = 2; var u1_ = WEBPATH + 'image.php?' + 'what=getlayerinvite&whatplace=ones' + '&randu=' + randu + '&department=' + 0 + '&cslhVISITOR=' + '69213140f79c7561eaca49014614319e' + '&cslheg=1&serversession=1'; if (ismac > -1){ document.getElementById("imageformac__one").src= u1_; document.getElementById("imageformac__one").onload = loadKey_0; } else { keyones_.src = u1_; keyones_.onload = loadKey_0; } } } //----------------------------------------------------------------- // opens DHTML help function openDHTML_0(total) { var html = ''; if (total == 1) html = '' if (total == 2) html = '' if (total == 3) html = '' if (total == 4) html = '' if (total == 5) html = '' //alert(html); makeVisible('layerinvite_0'); var w_=document.getElementById('layerinvite_0'); w_.innerHTML = html; var u_ = WEBPATH + 'image.php?' + 'what=changestat' + '&towhat=invited' + '&cslhVISITOR=' + '69213140f79c7561eaca49014614319e' + '&cslheg=1&serversession=1'; popcontrol_2.src = u_; stillopen = 1; setTimeout('moveDHTML_0()', 9); openDHTMLalready = true; openDHTMLlayer = true; } //----------------------------------------------------------------- // opens DHTML help function closeDHTML() { makeInvisible('layerinvite_0'); openDHTMLlayer = 0; stillopen = 0; var u4_ = WEBPATH + 'image.php?' + 'what=changestat' + '&towhat=stopped' + '&cslhVISITOR=' + '69213140f79c7561eaca49014614319e' + '&cslheg=1&serversession=1'; popcontrol_3.src = u4_; } //----------------------------------------------------------------- // opens DHTML help function moveDHTML_0() { 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_0'); 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_0()', 7); else setTimeout('moveDHTML_0()', 9000); } } //----------------------------------------------------------------- // The Operator wants to chat with the visitor about something. function openWantsToChat_0() { // 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=' + 0 + '&cslhVISITOR=' + '69213140f79c7561eaca49014614319e' + '&cslheg=1&serversession=1'; cscontrol_.src = u_; // open the window.. window.open(WEBPATH + 'livehelp.php?what=chatinsession&department=0&website=1&cslhVISITOR=69213140f79c7561eaca49014614319e&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_ = WEBPATH + 'image.php?what=getstate&department=0&nowis=20171214071256&cslhVISITOR=69213140f79c7561eaca49014614319e' + '&page=' + escape(locationvar) + '&referer=' + escape(var_referrer) + '&title=' + escape(var_title) + '&leaveamessage=' + 'YES' + '&cslheg=1&serversession=1'; var urltocslhimage_ = WEBPATH + 'image.php?what=getcredit&department=0&nowis=20171214071256&cslhVISITOR=69213140f79c7561eaca49014614319e' + '&xy=' + 'N' + '&page=' + escape(locationvar) + '&referer=' + escape(var_referrer) + '&title=' + escape(var_title) + '&leaveamessage=' + 'YES' + '&cslheg=1&serversession=1'; // 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_()', 4000); setTimeout('wherecslhisdue_()', 2000);