var ApplicationDomain = 'http://www.smartjabber.com/'; var ApplicationBy = 'SmartJabber'; var ApplicationName = 'Paris'; var ClientName = 'You'; var AlertMessage = "Hold on! A live agent would like to offer you a limited time special discount.\nPlease click 'Cancel' on the next window to chat with them."; var CancelMessage = "\n\nPress 'CANCEL' Below To Speak with our Agent!\n\n"; var HeaderMessage = "PushTraffic Special Offer"; var InitialMessage = "Hi%2C+my+name+is+Paris+and+I+have+a+special+offer+for+YOU%21%3Cbr%3E%3Cbr%3EI+want+to+save+you+%2410+on+your+first+purchase+with+PushTraffic%21%3Cbr%3E%3Ca+href%3D%22http%3A%2F%2Fwww.smartjabber.com%2Fchat%2Flink%2F11%2F%3Fcid%3D%22+target%3D%22_blank%22%3Ehttps%3A%2F%2Fwww.pushtraffic.com%2Forder_10off.html%3C%2Fa%3E"; var SessionId = 0; var UniqueIdentifier = '532'; var ServerId = '548'; var ApplicationElementTime = 50; var ApplicationPause = 2500; var ApplicationMessageTimeout = 90000; // ============================================================================ // Do not edit below this line! // ============================================================================ var validClickThrough = false; var ApplicationTimeoutLaunch = true; var ApplicationLaunchTimer = 580000; var ApplicationInitiated = 'false'; var validClickThrough = 'false'; var ApplicationMessageQueue = new Array(); var MessageProcessed = 'false'; var InitiateObj = null; var ApplicationTimeouts = 0; var ApplicationTimeoutFunction; var LoadingMessage = ''; var ApplicationMessageTimer = null; var ApplicationCurrentTime = new Date(); var ApplicationJumpTime = ApplicationCurrentTime.getTime(); var ApplicationAllowContinue = 'true'; function DisplayNextItem() { if(MessageProcessed == 'false' && ApplicationInitiated == 'true') { if(ApplicationMessageQueue.length > 0) { MessageProcessed = 'true'; setTimeout("DoServerPause()",ApplicationMessageQueue[0]['time'] + ApplicationPause) setTimeout("DisplayNextItem()",ApplicationMessageQueue[0]['time'] + ApplicationPause + 20); LoadingMessage = ApplicationMessageQueue[0]['message']; ApplicationMessageTimer = setTimeout("ApplicationShowMessage('"+ ApplicationMessageQueue[0]['agent'] +"');",ApplicationMessageQueue[0]['time']); SetNotificationBar(); ApplicationMessageQueue.shift(); } } }; function DoServerPause() { MessageProcessed = 'false' }; function ApplicationShowMessage(agent) { ApplicationShowMessage2(agent, LoadingMessage) } if (!Object.prototype.toJSONString) { Array.prototype.toJSONString = function(w) { var a = [], i, l = this.length, v; for (i = 0; i < l; i += 1) { v = this[i]; switch (typeof v) { case 'object': if (v && typeof v.toJSONString === 'function') { a.push(v.toJSONString(w)) } else { a.push('null') } break; case 'string': case 'number': case 'boolean': a.push(v.toJSONString()); break; default: a.push('null') } } return '[' + a.join(',') + ']' }; Boolean.prototype.toJSONString = function() { return String(this) }; Date.prototype.toJSONString = function() { function f(n) { return n < 10 ? '0' + n: n } return '"' + this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z"' }; Number.prototype.toJSONString = function() { return isFinite(this) ? String(this) : 'null' }; Object.prototype.toJSONString = function(w) { var a = [], k, i, v; if (w) { for (i = 0; i < w.length; i += 1) { k = w[i]; if (typeof k === 'string') { v = this[k]; switch (typeof v) { case 'object': if (v) { if (typeof v.toJSONString === 'function') { a.push(k.toJSONString() + ':' + v.toJSONString(w)) } } else { a.push(k.toJSONString() + ':null') } break; case 'string': case 'number': case 'boolean': a.push(k.toJSONString() + ':' + v.toJSONString()) } } } } else { for (k in this) { if (typeof k === 'string' && Object.prototype.hasOwnProperty.apply(this, [k])) { v = this[k]; switch (typeof v) { case 'object': if (v) { if (typeof v.toJSONString === 'function') { a.push(k.toJSONString() + ':' + v.toJSONString()) } } else { a.push(k.toJSONString() + ':null') } break; case 'string': case 'number': case 'boolean': a.push(k.toJSONString() + ':' + v.toJSONString()) } } } } return '{' + a.join(',') + '}' }; (function(s) { var m = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' }; s.parseJSON = function(filter) { var j; function walk(k, v) { var i; if (v && typeof v === 'object') { for (i in v) { if (Object.prototype.hasOwnProperty.apply(v, [i])) { v[i] = walk(i, v[i]) } } } return filter(k, v) } if ('/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/'.test(this.replace('/\\./g', '@').replace('/"[^"\\\n\r]*"/g', ''))) { j = eval('(' + this + ')'); return typeof filter === 'function' ? walk('', j) : j } throw new SyntaxError('parseJSON'); }; s.toJSONString = function() { if ('/["\\\x00-\x1f]/'.test(this)) { return '"' + this.replace('/[\x00-\x1f\\"]/g', function(a) { var c = m[a]; if (c) { return c } c = a.charCodeAt(); return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16) }) + '"' } return '"' + this + '"' } })(String.prototype) }; function DisableApplication() { clearTimeout(ApplicationEnableTimer); window.onbeforeunload = function() {}; if (ApplicationInitiated !== 'true') { ApplicationEnableTimer = setTimeout("EnableApplication()", 1000) } }; function ForceDisableApplication() { window.onbeforeunload = function() {} }; ServerScriptRequest.scriptCounter = 1; function ServerScriptRequest(fullUrl) { this.fullUrl = fullUrl; this.noCacheIE = '&noCacheIE=' + (new Date()).getTime(); this.headLoc = document.getElementsByTagName("head").item(0); this.scriptId = 'ScriptId' + ServerScriptRequest.scriptCounter++ }; ServerScriptRequest.prototype.buildScriptTag = function() { this.scriptObj = document.createElement("script"); this.scriptObj.setAttribute("type", "text/javascript"); this.scriptObj.setAttribute("charset", "utf-8"); this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE); this.scriptObj.setAttribute("id", this.scriptId) }; ServerScriptRequest.prototype.removeScriptTag = function() { this.headLoc.removeChild(this.scriptObj) }; ServerScriptRequest.prototype.addScriptTag = function() { this.headLoc.appendChild(this.scriptObj) }; function EnableApplication() { if (ApplicationInitiated !== 'true') { window.onbeforeunload = function() { return ApplicationLaunch() } } }; function InitiateActions(jsonData) { SessionId = jsonData.ChatId; ApplicationInitiated = 'true'; ApplicationSendRequest(' '); InitiateObj.removeScriptTag() }; function ApplicationSendRequest(msg) { if (ApplicationInitiated == 'true' && ApplicationAllowContinue == 'true') { try { ApplicationJumpTime = ApplicationCurrentTime.getTime(); var req = ApplicationDomain + 'chat/recv/' + SessionId + '/?msg=' + URLEncode(msg); bObj = new ServerScriptRequest(req); bObj.buildScriptTag(); bObj.addScriptTag() } catch(e) { // Empty } } }; function ApplicationTimeoutMessage() { if (ApplicationMessageQueue.length == 0 && ApplicationInitiated == 'true') { var req = ApplicationDomain + 'chat/timeout/' + SessionId + '/?a=1'; ApplicationTimeouts++; bObj = new ServerScriptRequest(req); bObj.buildScriptTag(); bObj.addScriptTag() } else { ResetApplicationTimeout() } }; function SuspendApplication() { ApplicationAllowContinue = 'false'; document.getElementById('NotificationBar').style.color = '#B20000'; document.getElementById('NotificationBar').style.fontWeight = 'Bold'; document.getElementById('NotificationBar').innerHTML = 'The Agent Has Left This Chat' } function ReceiveServerMessages(jsonData) { try { for (i = 1; i <= jsonData.responses; i++) { ReceiveRemoteData(jsonData['m' + i].message, jsonData['m' + i].ignorable, i) } bObj.removeScriptTag() } catch(e) { // nothing } }; function URLEncode(input) { var SAFECHARS = "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "-_.!~*'()"; var HEX = "0123456789ABCDEF"; var plaintext = input; var encoded = ""; for (var i = 0; i < plaintext.length; i++) { var ch = plaintext.charAt(i); if (ch == " ") { encoded += "+" } else if (SAFECHARS.indexOf(ch) !== -1) { encoded += ch } else { var charCode = ch.charCodeAt(0); if (charCode > 255) { alert("Unicode Character '" + ch + "' cannot be encoded using standard URL encoding.\n" + "(URL encoding only supports 8-bit characters.)\n" + "A space (+) will be substituted."); encoded += "+" } else { encoded += "%"; encoded += HEX.charAt((charCode >> 4) & 0xF); encoded += HEX.charAt(charCode & 0xF) } } } return encoded }; function URLDecode(input) { var HEXCHARS = "0123456789ABCDEFabcdef"; var encoded = input; var plaintext = ""; var i = 0; while (i < encoded.length) { var ch = encoded.charAt(i); if (ch == "+") { plaintext += " "; i++ } else if (ch == "%") { if (i < (encoded.length - 2) && HEXCHARS.indexOf(encoded.charAt(i + 1)) !== -1 && HEXCHARS.indexOf(encoded.charAt(i + 2)) !== -1) { plaintext += unescape(encoded.substr(i, 3)); i += 3 } else { plaintext += "%[ERROR]"; i++ } } else { plaintext += ch; i++ } } return plaintext }; function InitiateChat() { var req = ApplicationDomain + 'chat/init/' + UniqueIdentifier + '/?a=' + ServerId; InitiateObj = new ServerScriptRequest(req); InitiateObj.buildScriptTag(); InitiateObj.addScriptTag() }; function ApplicationLaunchChatWindow() { SetNotificationBar(); var applicationwindow = document.getElementById('application-main-window'); var applicationshadow = document.getElementById('application-main-window-shadow'); applicationshadow.style.top = ((window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0) + 100) + 'px'; applicationshadow.style.display = 'block'; ApplicationMakeDraggable(applicationshadow); try { document.onmousemove = ApplicationMouseMove; document.onmouseup = ApplicationMouseUp; document.getElementById('application-content-area').onmousedown = function() { applicationshadow.onmousedown = function() {} }; document.getElementById('application-content-area').onmouseup = function() { ApplicationMakeDraggable(applicationshadow) }; document.getElementById('application-window-close').onmousedown = function() { applicationshadow.onmousedown = function() {} }; document.getElementById('application-window-close').onmouseup = function() { ApplicationMakeDraggable(applicationshadow) }; document.getElementById('application-window-close').onmouseover = function() { CloseApplicationWindow() }; document.getElementById('application-window-header').onclick = function() { ApplicationDragObject = null }; document.getElementById('application-window-header').onmouseup = function() { ApplicationDragObject = null } } catch(e) { // nothing } }; function ApplicationLaunch(noAlert) { if (ApplicationInitiated !== 'true' && (validClickThrough !== true || validClickThrough !== 'true')) { try { ApplicationInitiated = 'true'; clearTimeout(ApplicationTimeoutFunction); clearTimeout(ApplicationEnableTimer); ApplicationShowMessage2('server', InitialMessage); document.getElementById('application-window-header').innerHTML = '
' + agent + ':' + URLDecode(message) + '
' } else { document.getElementById('ApplicationLog').innerHTML += '' + agent + ' Says:' + URLDecode(message) + '
' } var intY = document.getElementById("ApplicationLog").scrollTop; var intH = document.getElementById("ApplicationLog").scrollHeight; document.getElementById("ApplicationLog").scrollTop = intH; ResetApplicationTimeout() } } }; function ResetApplicationTimeout() { clearTimeout(ApplicationTimeoutFunction); ApplicationTimeoutFunction = setTimeout("ApplicationTimeoutMessage()", ApplicationMessageTimeout + (ApplicationMessageTimeout * ApplicationTimeouts)) }; function ApplicationSend() { var msg = document.getElementById('ApplicationMessage').value; if (msg.length > 0) { if (msg == 'exit') { CloseApplicationWindow() } else { document.getElementById('ApplicationMessage').value = ''; clearTimeout(ApplicationMessageTimer); ApplicationShowMessage2('You', msg); ApplicationRemoveIgnores(); ApplicationSendRequest(msg); ResetApplicationTimeout() } } return false }; function ReceiveRemoteData(msg, ignorable, i) { var time = 0; if (msg.length !== 0) { time = msg.length * ApplicationElementTime } if (i == 1) { time = time - (ApplicationCurrentTime.getTime() - ApplicationJumpTime) } var currentMessage = new Array(); currentMessage['agent'] = 'server'; currentMessage['message'] = msg; currentMessage['ignorable'] = ignorable; currentMessage['time'] = time; ApplicationMessageQueue.push(currentMessage); setTimeout("DisplayNextItem()", ApplicationPause) }; function ApplicationRemoveIgnores() { for (i = 0; i < ApplicationMessageQueue.length; i++) { if (ApplicationMessageQueue[i]['ignorable'].length < 4) { break } if (ApplicationMessageQueue[i]['ignorable'] == 'true') { ApplicationMessageQueue.splice(i, 1); i = i - 1 } } }; function SetNotificationBar() { if (ApplicationAllowContinue == 'true') { document.getElementById('NotificationBar').innerHTML = ApplicationName + ' is typing a message...' } }; function ClearNotificationBar() { if (ApplicationAllowContinue == 'true') { document.getElementById('NotificationBar').innerHTML = '' } }; function ApplicationMouseUp(ev) { ApplicationDragObject = null }; function ApplicationGetMouseOffset(target, ev) { ev = ev || window.event; var docPos = ApplicationGetPosition(target); var mousePos = ApplicationMouseCoords(ev); return ( { x: mousePos.x - docPos.x, y: mousePos.y - docPos.y }); }; function ApplicationGetPosition(e) { var left = 0; var top = 0; while (e.offsetParent) { left += e.offsetLeft; top += e.offsetTop; e = e.offsetParent } left += e.offsetLeft; top += e.offsetTop; return ( { x: left, y: top }); }; function ApplicationMouseMove(ev) { ev = ev || window.event; var mousePos = ApplicationMouseCoords(ev); if (ApplicationDragObject) { ApplicationDragObject.style.position = 'absolute'; ApplicationDragObject.style.top = mousePos.y - ApplicationMouseOffset.y - 6; ApplicationDragObject.style.left = mousePos.x - ApplicationMouseOffset.x; return false } }; function ApplicationMakeDraggable(item) { if (!item) return; item.onmousedown = function(ev) { ApplicationDragObject = this; ApplicationMouseOffset = ApplicationGetMouseOffset(this, ev); return false } }; function CloseApplicationWindow() { if (confirm('Are you sure you wish to close this chat?')) { document.getElementById('application-main-window-shadow').style.display = 'none' } else { return "\n\nPlease click 'CANCEL' to continue chatting\n\n" } }; var applicationwindowshadow = document.createElement('div'); var applicationwindow = document.createElement('div'); var applicationwindowheader = document.createElement("div"); var applicationwindowclose = document.createElement("div"); var applicationcontent = document.createElement("div"); var applicationlog = document.createElement("div"); var notificationbar = document.createElement("div"); var applicationpowered = document.createElement("div"); var applicationphoto = document.createElement("div"); var applicationclear = document.createElement("div"); var applicationclear2 = document.createElement("div"); var applicationclear3 = document.createElement("div"); var applicationmessage = document.createElement("input"); var applicationform = document.createElement("form"); var applicationsubmitbutton = document.createElement("input"); applicationwindowshadow.setAttribute('id', 'application-main-window-shadow'); applicationwindow.setAttribute('id', 'application-main-window'); applicationwindowheader.setAttribute('id', 'application-window-header'); applicationcontent.setAttribute('id', 'application-content-area'); applicationlog.setAttribute('id', 'ApplicationLog'); applicationmessage.setAttribute('id', 'ApplicationMessage'); notificationbar.setAttribute('id', 'NotificationBar'); applicationpowered.setAttribute('id', 'ApplicationPoweredBy'); applicationsubmitbutton.setAttribute('id', 'ApplicationSubmitButton'); applicationphoto.setAttribute('id', 'applicationPhoto'); applicationclear.setAttribute('class', 'clear'); applicationclear2.setAttribute('class', 'clear'); applicationclear3.setAttribute('class', 'clear'); if (navigator.appName == "Microsoft Internet Explorer") { applicationclear.innerHTML = " "; applicationclear2.innerHTML = " "; } applicationpowered.innerHTML = ApplicationBy; notificationbar.innerHTML = 'Agent Is Typing...'; applicationmessage.setAttribute('type', 'text'); applicationmessage.setAttribute('size', '46'); applicationsubmitbutton.setAttribute('type', 'image'); applicationsubmitbutton.setAttribute('src', 'http://static.smartjabber.com/images/theme/standard/bg_chatScreen_sendBtn.png'); applicationsubmitbutton.setAttribute('name', 'ApplicationSubmitButton'); applicationsubmitbutton.setAttribute('value', ' '); applicationwindowshadow.appendChild(applicationwindow); applicationwindow.appendChild(applicationwindowheader); applicationwindow.appendChild(applicationform); applicationform.appendChild(applicationclear2); applicationform.appendChild(applicationlog); applicationform.appendChild(applicationphoto); applicationform.appendChild(applicationclear3); applicationform.appendChild(notificationbar); applicationform.appendChild(applicationmessage); applicationform.appendChild(applicationsubmitbutton); applicationform.appendChild(applicationclear); applicationform.appendChild(applicationpowered); applicationform.onsubmit = function() { return ApplicationSend() }; ApplicationAddLoadEvent(function() { document.body.appendChild(applicationwindowshadow); ApplicationLaunchOnTimeout(); window.onunload = function() { // nothing }; window.onbeforeunload = function() { return ApplicationLaunch() } }); window.onerror = ApplicationError; function ApplicationError() { return true }; document.documentElement.onclick = DisableApplication; document.write("");