(function(){function k(){}function s(){}function ha(a){k.prototype.init.call(this,a,k.TYPE.STANDARD)}function ia(a){l[a]||(l[a]=new ha(a));return l[a]}function R(a,b){k.prototype.init.call(this,b+"_"+a,k.TYPE.AGENT)}function K(a,b){var c=b+"_"+a;l[c]||(l[c]=new R(a,b));return l[c]}function S(a,b){s.prototype.init.call(this,a,b)}function T(a,b){s.prototype.init.call(this,a,b)}function h(a){k.prototype.init.call(this,a,k.TYPE.INVITE);this.active=!1;this.filterLogic=null;this.rules={};this.autoRejectTimeout=
this.inviteTimeout=this.inviteDelay=this.ruleTree=null}function t(a){l[a]||(l[a]=new h(a));return l[a]}function z(a,b,c,e,d,g,B,x){s.prototype.init.call(this,a,b);this.hasInviteAfterAccept=g;this.hasInviteAfterReject=B;this.rejectTime=x;null!==f.getCssAnimation(b)||"Custom"==c?this.renderer=new h.RENDERER[c].renderClass(a,b,h.START_POSITION[e],h.END_POSITION[d]):this.renderer=new h.RENDERER.Appear.renderClass(a,b,h.START_POSITION[e],h.END_POSITION[d])}function C(a){return t(a)?t(a).getTracker():null}
function r(){}function I(a,b,c,e){r.prototype.init.call(this,a,b,c,e)}function J(a,b,c,e){r.prototype.init.call(this,a,b,null,e)}function L(a,b,c,e){r.prototype.init.call(this,a,b,null,e)}function D(a,b,c,e){D.prototype.init.call(this,a,b,null,null)}function m(){}function M(a,b,c,e,d){m.prototype.init.call(this,a,b,c,e,d)}function N(a,b,c,e,d){m.prototype.init.call(this,a,b,c,e,d)}function U(a,b,c,e,d){m.prototype.init.call(this,a,b,c,e,d)}function E(a){ja++;if(1E3<ja)throw Error("Error processing rule filter logic, preventing recursion");
for(var b=0,c=0,e=0;e<a.length;e++)"("==a.charAt(e)?c++:")"==a.charAt(e)&&c--,","==a.charAt(e)&&1==c&&(b=e);if(0==a.indexOf("AND("))return c=E(a.substring(4,b)),a=E(a.substring(b+1,a.length-1)),new V(c,a);if(0==a.indexOf("OR("))return c=E(a.substring(3,b)),a=E(a.substring(b+1,a.length-1)),new W(c,a);if(0==a.indexOf("NOT("))return c=E(a.substring(4,a.length-1)),new X(c);if(!isNaN(parseInt(a,10)))return new Y(parseInt(a,10));throw Error("Encountered unexpected character in filter logic");}function y(){}
function Y(a){this.ruleId=a;y.prototype.init.call(this,null,null)}function V(a,b){y.prototype.init.call(this,a,b)}function W(a,b){y.prototype.init.call(this,a,b)}function X(a){y.prototype.init.call(this,a,null)}function xa(a,b,c,e){var d=document.createElement("div");d.id="liveagent_invite_button_"+a;var g=document.createElement("img");g.style.cursor="pointer";g.style.position="absolute";g.style.right="-20px";g.style.top="-20px";g.src=p.contentServerUrl+"/images/x.png";f.addEventListener(g,"click",
function(){n.rejectChat(a)});d.appendChild(g);g=document.createElement("img");g.style.cursor="pointer";g.style.clear="right";g.src=b;g.width=c;g.height=e;f.addEventListener(g,"click",function(){n.startChat(a)});d.appendChild(g);document.body.appendChild(d);return d}function ka(a,b,c){"undefined"==typeof c&&(c=!0);this.getLabel=function(){return a};this.getValue=function(){return b};this.getDisplayToAgent=function(){return c};var e=new Z;this.getMapper=function(){return e};this.doKnowledgeSearch=!1;
this.getDoKnowledgeSearch=function(){return this.doKnowledgeSearch};this.setDoKnowledgeSearch=function(){this.doKnowledgeSearch=!0}}function Z(){var a=[],b=[];this.getEntityMaps=function(){return a};this.getTranscriptFields=function(){return b}}function la(a,b,c,e,d){this.getEntityName=function(){return a};this.getFieldName=function(){return b};this.getFastFill=function(){return c};this.getAutoQuery=function(){return e};this.getExactMatch=function(){return d}}function ma(a){this.saveToTranscript=
"";this.showOnCreate=!1;this.linkToEntityField=this.linkToEntityName="";var b=new na;this.getEntityName=function(){return a};this.getSaveTranscript=function(){return this.saveTranscript};this.getShowOnCreate=function(){return this.showOnCreate};this.getLinkToEntityName=function(){return this.linkToEntityName};this.getLinkToEntityField=function(){return this.linkToEntityField};this.getEntityMapper=function(){return b};this.setSaveTranscript=function(a){this.saveTranscript=a};this.setShowOnCreate=function(a){this.showOnCreate=
a};this.setLinkToEntityName=function(a){this.linkToEntityName=a};this.setLinkToEntityField=function(a){this.linkToEntityField=a}}function na(){var a=[];this.getEntityFieldsMaps=function(){return a}}function oa(a,b,c,e,d){this.getFieldName=function(){return a};this.getLabel=function(){return b};this.getDoFind=function(){return c};this.getIsExactMatch=function(){return e};this.getDoCreate=function(){return d}}function O(){if(!pa){pa=!0;f.log("DOM is ready. Setting up environment.");null==u.getOref()&&
u.setOref(document.referrer);null==u.getVisitCount()&&u.setVisitCount(1);if(window._laq_c_to_call)for(var a=0;a<window._laq_c_to_call.length;a++)window._laq_c_to_call[a].call(window);q.connection.setCallback("liveagentclicktocall._.handlePing");qa()}}function qa(){var a=[],b={};$&&(b.chatted=1);v?(b.sid=v,f.log("Reusing existing session.")):(a.push(new q.Noun("VisitorId")),f.log("Requesting new session."));a.push(new q.Noun("Settings",{buttonIds:"["+ra()+"]",updateBreadcrumb:1}));q.connection.send(a,
b)}function sa(a,b){b.endpointUrl&&a.setEndpoint(b.endpointUrl);b.prechatUrl&&a.setPrechat(b.prechatUrl);b.language&&a.setLanguage(b.language);a.setOnlineState(b.isAvailable)}function ya(){if(q.connection.isRunning())if(null==v)qa();else{f.log("Pinging server to keep presence");P=null;var a={};a.sid=v;$&&(a.chatted=1);a.r=(new Date).getMilliseconds();var b=[new q.Noun("Availability",{ids:"["+ra()+"]"})];q.connection.send(b,a)}}function aa(){f.log("Disconnecting from Live Agent");q.connection.setIsRunning(!1);
for(var a in l)l.hasOwnProperty(a)&&l[a].setOnlineState(!1)}function ra(){var a=[],b={},c;for(c in l)l.hasOwnProperty(c)&&l[c].getType()==k.TYPE.STANDARD&&(b[c]=l[c]);for(var e in b)a.push(e);var b={},d;for(d in l)l.hasOwnProperty(d)&&l[d].getType()==k.TYPE.AGENT&&(b[d]=l[d]);for(e in b)a.push(e);d={};for(var g in l)l.hasOwnProperty(g)&&l[g].getType()==k.TYPE.INVITE&&(d[g]=l[g]);for(e in d)a.push(e);e="";for(g=0;g<a.length;g++)e+=a[g],g<a.length-1&&(e+=",");return e}function ta(a,b,c,e){document.cookie=
"liveagent_chatted\x3d1;path\x3d/;";$=!0;var d;d="deployment_id\x3d"+p.deploymentId;d=d+"\x26org_id\x3d"+p.orgId;d+="\x26button_id\x3d";d+=a;c&&(d+="\x26agent_id\x3d",d+=c);e&&(d+="\x26do_fallback\x3d1");d+="\x26session_id\x3d";d+=v;a=c?l[c+"_"+a].getEndpoint(d):l[a].getEndpoint(d);c="height\x3d"+p.chatWindowHeight;c=c+",width\x3d"+p.chatWindowWidth;c+=",menubar\x3dno";c+=",toolbar\x3dno";c+=",location\x3dno";c+=",personalbar\x3dno";window.open("",b,c);za(b,a)}function za(a,b){function c(a,b,c){var d=
document.createElement("input");d.name=b;d.value=c;a.appendChild(d)}var e=u.getVisitCount();null==e&&(e="0");var d=document.createElement("form");d.style.display="none";c(d,"deploymentId",p.deploymentId);c(d,"orgId",p.orgId);c(d,"vc",e);c(d,"sid",v);c(d,"ptid",u.getPermanentId());c(d,"det",f.jsonEncode(ua));c(d,"oref",u.getOref());c(d,"pages",f.jsonEncode(A.getPages()));c(d,"sessionStart",(new Date).getTime()-A.getSessionStart());c(d,"ent",f.jsonEncode(va));ba&&c(d,"visitorName",ba);d.method="POST";
d.action=b;d.target=a;document.body.appendChild(d);d.submit()}function ca(a){a?f.log("Server Warning: "+a):f.log("Server sent an anoymous warning.")}function wa(a){a?f.log("Server Error: "+a):f.log("Server responded with an error.");aa()}if(!window.liveAgentClickToCallDeployment){window.liveAgentClickToCallDeployment=!0;var n={};window.liveagentclicktocall&&(n=window.liveagentclicktocall);window.liveagentclicktocall=n;var f={getCookie:function(a){var b=document.cookie,c=b.indexOf(a+"\x3d");if(-1==
c)return null;c+=(a+"\x3d").length;a=b.indexOf(";",c);-1==a&&(a=b.length);return b.substring(c,a)},setCookie:function(a,b,c){a=a+"\x3d"+b+";";c&&(c=new Date,c.setFullYear(c.getFullYear()+10),a+="expires\x3d"+c.toGMTString()+";");document.cookie=a+"path\x3d/;"},addEventListener:function(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent("on"+b,c,!1);else throw Error("Could not add event listener");},log:function(a){},logGroupStart:function(a){},logGroupEnd:function(){},
getLanguage:function(){return"undefined"!=typeof window.navigator.language?window.navigator.language:"undefined"!=typeof window.navigator.userLanguage?window.navigator.userLanguage:""},arrayHasItem:function(a,b){if(Array.prototype.indexOf)return-1<a.indexOf(b);for(var c=0;c<a.length;c++)if(a[c]==b)return!0},jsonEncode:function(a,b,c){function e(a){g.lastIndex=0;return g.test(a)?'"'+a.replace(g,function(a){var b=f[a];return"string"===typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+
'"':'"'+a+'"'}function d(a,b){var c,g,f,B,x=w,m,h=b[a];h&&("object"===typeof h&&"function"===typeof h.toJSON)&&(h=h.toJSON(a));"function"===typeof l&&(h=l.call(b,a,h));switch(typeof h){case "string":return e(h);case "number":return isFinite(h)?String(h):"null";case "boolean":case "null":return String(h);case "object":if(!h)return"null";w+=k;m=[];if("[object Array]"===Object.prototype.toString.apply(h)){B=h.length;for(c=0;c<B;c+=1)m[c]=d(c,h)||"null";f=0===m.length?"[]":w?"[\n"+w+m.join(",\n"+w)+"\n"+
x+"]":"["+m.join(",")+"]";w=x;return f}if(l&&"object"===typeof l){B=l.length;for(c=0;c<B;c+=1)"string"===typeof l[c]&&(g=l[c],(f=d(g,h))&&m.push(e(g)+(w?": ":":")+f))}else for(g in h)Object.prototype.hasOwnProperty.call(Object(h),g)&&(f=d(g,h))&&m.push(e(g)+(w?": ":":")+f);f=0===m.length?"{}":w?"{\n"+w+m.join(",\n"+w)+"\n"+x+"}":"{"+m.join(",")+"}";w=x;return f}}if("undefined"!==typeof window.JSON)return window.JSON.stringify(a,b,c);if(void 0===a||null===a)return"null";var g=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
f={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},x,w="",k="",l=b;if("number"===typeof c)for(x=0;x<c;x+=1)k+=" ";else"string"===typeof c&&(k=c);if(b&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("Error during JSON.stringify");return d("",{"":a})},jsonDecode:function(a){a=String(a);if("undefined"!==typeof window.JSON)return window.JSON.parse(a);var b=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
b.lastIndex=0;b.test(a)&&(a=a.replace(b,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+a+")");throw Error("Error during JSON.parse");},getCssAnimation:function(a){var b=["Webkit","Moz","O","ms","Khtml"];if(void 0!==a.style.animationName)return"";for(var c=0;c<b.length;c++)if(void 0!==
a.style[b[c]+"AnimationName"])return b[c].toLowerCase();return null}},u={getVisitCount:function(){var a=parseInt(f.getCookie("liveagent_vc"),10);return isNaN(a)?null:a},getOref:function(){return f.getCookie("liveagent_oref")},getPermanentId:function(){var a=f.getCookie("liveagent_ptid");return null!=a?a:""},setVisitCount:function(a){f.setCookie("liveagent_vc",a,!0)},setOref:function(a){return f.setCookie("liveagent_oref",a,!0)},setPermanentId:function(a){f.setCookie("liveagent_ptid",a,!0)}},A=new function(){function a(){return window.localStorage?
window.localStorage:window.sessionStorage}function b(){var a=document.createElement("div");a.style.display="none";document.body.appendChild(a);a.id="liveagent_userdata_provider";a.addBehavior("#default#userData");a.load("liveagentclicktocall");return{getItem:function(b){return a.getAttribute(b)},setItem:function(b,c){a.setAttribute(b,c);a.save("liveagentclicktocall")},removeItem:function(b){a.removeAttribute(b);a.save("liveagentclicktocall")}}}function c(){var a={};return{getItem:function(b){return a[b]},
setItem:function(b,c){a[b]=c},removeItem:function(b){delete a[b]}}}function e(){g.setItem(d.SESSION_ID,v);g.setItem(d.PAGE_COUNT,"0");g.setItem(d.SESSION_START,(new Date).getTime().toString())}var d={SESSION_ID:"liveAgentSid",PAGE_COUNT:"liveAgentPc",SESSION_START:"liveAgentStart",PAGE:"liveAgentPage_",PAGE_TIME:"liveAgentPageTime_"};a.isSupported=function(){try{return window.localStorage||window.sessionStorage}catch(a){return!1}};b.isSupported=function(){return document.createElement("div").addBehavior};
var g;g=a.isSupported()?a():b.isSupported()?b():c();this.init=function(){if(g.getItem(d.SESSION_ID)){if(g.getItem(d.SESSION_ID)!=v){g.removeItem(d.SESSION_START);for(var a=g.getItem(d.PAGE_COUNT),b=25>a?0:a-25;b<a;b++)g.removeItem(d.PAGE+b),g.removeItem(d.PAGE_TIME+b);e()}}else e();a=parseInt(g.getItem(d.PAGE_COUNT),10);25<=a&&(g.removeItem(d.PAGE+(a-25)),g.removeItem(d.PAGE_TIME+(a-25)));g.setItem(d.PAGE_COUNT,(a+1).toString());g.setItem(d.PAGE+a.toString(),window.location.href);g.setItem(d.PAGE_TIME+
a.toString(),(new Date).getTime())};this.getPageCount=function(){return parseInt(g.getItem(d.PAGE_COUNT),10)};this.getSessionStart=function(){return g.getItem(d.SESSION_START)};this.getPages=function(){for(var a=[],b=this.getPageCount(),c=25>b?0:b-25;c<b;c++)a.unshift({location:g.getItem(d.PAGE+c.toString()),time:((new Date).getTime()-parseInt(g.getItem(d.PAGE_TIME+c.toString()),10)).toString()});return a};this.getCurrentPage=function(){return g.getItem(d.PAGE+(this.getPageCount()-1).toString())};
this.clear=function(){g.clear()}};k.TYPE={STANDARD:"STANDARD",INVITE:"INVITE",AGENT:"AGENT"};k.EVENT={BUTTON_AVAILABLE:"BUTTON_AVAILABLE",BUTTON_UNAVAILABLE:"BUTTON_UNAVAILABLE",BUTTON_ACCEPTED:"BUTTON_ACCEPTED",BUTTON_REJECTED:"BUTTON_REJECTED"};k.prototype.init=function(a,b){this.buttonId=a;this.type=b;this.onlineState=null;this.trackers=[];this.language=this.prechat=this.endpoint=null};k.prototype.getType=function(){return this.type};k.prototype.getOnlineState=function(){return this.onlineState};
k.prototype.setOnlineState=function(a){this.onlineState=a;for(var b=0;b<this.trackers.length;b++)this.trackers[b].setState(a)};k.prototype.addTracker=function(a){this.trackers.push(a)};k.prototype.setPrechat=function(a){this.prechat=a};k.prototype.setEndpoint=function(a){this.endpoint=a};k.prototype.getEndpoint=function(a){function b(){return(null!=this.endpoint?this.endpoint:p.contentServerUrl+p.chatPage)+"?language\x3d"+(this.language?this.language:"")+"#"+a}var c=null,c=null==this.prechat?b.call(this):
this.prechat+"?endpoint\x3d"+encodeURIComponent(b.call(this));return p.contentServerUrl+p.prechatHandler+"?endpoint\x3d"+encodeURIComponent(c)};k.prototype.setLanguage=function(a){this.language=a};k.prototype.startChat=function(a){return this.dispatchEvent(k.EVENT.BUTTON_ACCEPTED)?(ta(this.buttonId,a),!0):!1};k.prototype.rejectChat=function(){return this.dispatchEvent(k.EVENT.BUTTON_REJECTED)?!0:!1};k.prototype.dispatchEvent=function(a){return da.hasOwnProperty(this.buttonId)?!1===da[this.buttonId].call(this,
a)?!1:!0:!0};s.prototype.init=function(a,b){this.buttonId=a;this.element=b};s.prototype.getId=function(){return this.buttonId};s.prototype.setState=function(a){f.log("Setting state for button "+this.buttonId+" to "+(a?"online":"offline"));return l[this.buttonId].dispatchEvent(a?k.EVENT.BUTTON_AVAILABLE:k.EVENT.BUTTON_UNAVAILABLE)?!0:!1};ha.prototype=new k;R.prototype=new k;R.prototype.startChat=function(a,b){if(this.dispatchEvent(k.EVENT.BUTTON_ACCEPTED)){var c=this.buttonId.split("_");ta(c[1],a,
c[0],b);return!0}return!1};S.prototype=new s;S.prototype.setState=function(a){s.prototype.setState.call(this,a)&&(this.element.style.display=a?"":"none")};T.prototype=new s;T.prototype.setState=function(a){s.prototype.setState.call(this,a)&&(this.element.style.display=a?"none":"")};var ea=!1,F=null,fa={},G={};h.prototype=new k;h.RENDERER={Slide:{renderClass:I},Fade:{renderClass:J},Appear:{renderClass:L},Custom:{renderClass:D}};h.START_POSITION={TopLeft:{xPercent:0,xPosition:-1,xOffset:-1,yPercent:0,
yPosition:-1,yOffset:-1},TopLeftTop:{xPercent:0,xPosition:0,xOffset:1,yPercent:0,yPosition:-1,yOffset:-1},Top:{xPercent:.5,xPosition:-.5,xOffset:0,yPercent:0,yPosition:-1,yOffset:-1},TopRightTop:{xPercent:1,xPosition:-1,xOffset:-1,yPercent:0,yPosition:-1,yOffset:-1},TopRight:{xPercent:1,xPosition:0,xOffset:1,yPercent:0,yPosition:-1,yOffset:-1},TopRightRight:{xPercent:1,xPosition:0,xOffset:1,yPercent:0,yPosition:0,yOffset:1},Right:{xPercent:1,xPosition:0,xOffset:1,yPercent:.5,yPosition:-.5,yOffset:0},
BottomRightRight:{xPercent:1,xPosition:0,xOffset:1,yPercent:1,yPosition:-1,yOffset:-1},BottomRight:{xPercent:1,xPosition:0,xOffset:1,yPercent:1,yPosition:0,yOffset:1},BottomRightBottom:{xPercent:1,xPosition:-1,xOffset:-1,yPercent:1,yPosition:0,yOffset:1},Bottom:{xPercent:.5,xPosition:-.5,xOffset:0,yPercent:1,yPosition:0,yOffset:1},BottomLeftBottom:{xPercent:0,xPosition:0,xOffset:1,yPercent:1,yPosition:0,yOffset:1},BottomLeft:{xPercent:0,xPosition:-1,xOffset:-1,yPercent:1,yPosition:0,yOffset:1},BottomLeftLeft:{xPercent:0,
xPosition:-1,xOffset:-1,yPercent:1,yPosition:-1,yOffset:-1},Left:{xPercent:0,xPosition:-1,xOffset:-1,yPercent:.5,yPosition:-.5,yOffset:0},TopLeftLeft:{xPercent:0,xPosition:-1,xOffset:-1,yPercent:0,yPosition:0,yOffset:1}};h.END_POSITION={TopLeft:{xPercent:0,xOffset:1,yPercent:0,yOffset:1},Top:{xPercent:.5,xOffset:0,yPercent:0,yOffset:1},TopRight:{xPercent:1,xOffset:-1,yPercent:0,yOffset:1},Left:{xPercent:0,xOffset:1,yPercent:.5,yOffset:0},Center:{xPercent:.5,xOffset:0,yPercent:.5,yOffset:0},Right:{xPercent:1,
xOffset:-1,yPercent:.5,yOffset:0},BottomLeft:{xPercent:0,xOffset:1,yPercent:1,yOffset:-1},Bottom:{xPercent:.5,xOffset:0,yPercent:1,yOffset:-1},BottomRight:{xPercent:1,xOffset:-1,yPercent:1,yOffset:-1}};h.prototype.setRules=function(a,b){if(a&&b){for(var c in a){var e=a[c],d=null;switch(e.type){case m.TYPE.NUMBER_OF_PAGE_VIEWS:d=new M(e.order,this.buttonId,A.getPageCount(),e.operator,parseInt(e.value,10));break;case m.TYPE.URL_MATCH:d=new M(e.order,this.buttonId,A.getCurrentPage(),e.operator,e.value);
break;case m.TYPE.SECONDS_ON_PAGE:d=new N(e.order,this.buttonId,(new Date).getTime(),e.operator,1E3*parseInt(e.value,10));break;case m.TYPE.SECONDS_ON_SITE:d=new N(e.order,this.buttonId,parseInt(A.getSessionStart(),10),e.operator,1E3*parseInt(e.value,10));break;case m.TYPE.CUSTOM_VARIABLE:d=new U(e.order,this.buttonId,e.name,e.operator,e.value),G.hasOwnProperty(e.name)||(G[e.name]=[]),G[e.name].push(this.buttonId)}null!=d&&this.addRule(d)}this.filterLogic=b;this.ruleTree=E(b)}};h.prototype.setOnlineState=
function(a){!a&&null!==this.inviteTimeout&&(clearTimeout(this.inviteTimeout),this.inviteTimeout=null);!a&&null!==this.autoRejectTimeout&&(clearTimeout(this.autoRejectTimeout),this.autoRejectTimeout=null);k.prototype.setOnlineState.call(this,a)};h.prototype.isActive=function(){return this.active};h.prototype.setActive=function(a){this.active=a};h.prototype.addTracker=function(a){this.trackers=[];k.prototype.addTracker.call(this,a)};h.prototype.getTracker=function(){if(1!=this.trackers.length)throw Error("InviteButtons should have exactly 1 tracker");
return this.trackers[0]};h.prototype.startChat=function(a){return this.active&&k.prototype.startChat.call(this,a)?(this.getTracker().accept(),!0):!1};h.prototype.rejectChat=function(){return this.active&&k.prototype.rejectChat.call(this)?(this.getTracker().reject(),!0):!1};h.prototype.trigger=function(){if(f.getCookie("liveagent_invite_rejected_"+this.buttonId))return!1;var a=!0;null!=this.ruleTree&&(f.logGroupStart("Invite "+this.buttonId+" Rule Evaluation"),f.log("Filter Logic: "+this.filterLogic),
a=this.ruleTree.evaluate(this),f.logGroupEnd());if(!a&&null!=this.inviteDelay){var b=this;this.inviteTimeout=window.setTimeout(function(){b.setOnlineState(!0)},this.inviteDelay);this.inviteDelay=null}return a};h.prototype.addRule=function(a){this.rules[a.getId()]=a};h.prototype.getRule=function(a){return this.rules[a]};h.prototype.getInviteDelay=function(){return this.inviteDelay};h.prototype.setInviteDelay=function(a){f.log("Setting invite delay to: "+a);this.inviteDelay=a};h.prototype.setAutoRejectTimeout=
function(a){this.autoRejectTimeout=a};z.prototype=new s;z.prototype.setState=function(a){a&&!ea&&t(this.buttonId).trigger()&&s.prototype.setState.call(this,!0)?(ea=!0,F=this.buttonId,this.renderer.render()):!a&&(t(this.buttonId).isActive()&&s.prototype.setState.call(this,!1))&&(ea=!1,this.remove(!0))};z.prototype.renderFinish=function(){t(this.buttonId).setActive(!0);if(-1!=this.rejectTime){var a=this.buttonId;t(this.buttonId).setAutoRejectTimeout(window.setTimeout(function(){t(a).rejectChat()},1E3*
this.rejectTime))}this.renderer.renderFinish()};z.prototype.accept=function(){this.hasInviteAfterAccept||f.setCookie("liveagent_invite_rejected_"+this.buttonId,!0,!1);this.remove(!1)};z.prototype.reject=function(){this.hasInviteAfterReject||f.setCookie("liveagent_invite_rejected_"+this.buttonId,!0,!1);this.remove(!0)};z.prototype.remove=function(a){t(this.buttonId).setActive(!1);this.renderer.remove(a)};z.prototype.removeFinish=function(){this.renderer.remove(!1)};r.prototype.init=function(a,b,c,
e){window.innerWidth?this.realWidth=window.innerWidth:document.documentElement&&document.documentElement.clientWidth?this.realWidth=document.documentElement.clientWidth:document.body&&(this.realWidth=document.body.clientWidth);window.innerHeight?this.realHeight=window.innerHeight:document.documentElement&&document.documentElement.clientHeight?this.realHeight=document.documentElement.clientHeight:document.body&&(this.realHeight=document.body.clientHeight);this.offset=25;this.buttonId=a;this.animationPrefix=
f.getCssAnimation(b);this.element=b;this.element.style.position=null!==this.animationPrefix?"fixed":"absolute";this.element.style.left="-1000px";this.element.style.top="-1000px";this.element.style.zIndex="10000";this.element.style.display="";this.width=this.element.offsetWidth;this.height=this.element.offsetHeight;this.startPosition=c;this.endPosition=e};r.prototype.render=function(){this.element.style.display=""};r.prototype.renderFinish=function(){};r.prototype.remove=function(a){this.element.style.left=
"-1000px";this.element.style.top="-1000px"};r.prototype.addRenderListeners=function(){var a=this.buttonId,b="AnimationIteration",c="AnimationEnd";""==this.animationPrefix?(b=b.toLowerCase(),c=c.toLowerCase()):(b=this.animationPrefix+b,c=this.animationPrefix+c);f.addEventListener(this.element,b,function(){C(a).renderFinish()});f.addEventListener(this.element,c,function(){C(a).removeFinish()})};I.prototype=new r;I.prototype.render=function(){r.prototype.addRenderListeners.call(this);var a=this.width*
this.startPosition.xPosition+this.offset*this.startPosition.xOffset,b=this.height*this.startPosition.yPosition+this.offset*this.startPosition.yOffset,c=-1*this.width*this.endPosition.xPercent+this.offset*this.endPosition.xOffset,e=-1*this.height*this.endPosition.yPercent+this.offset*this.endPosition.yOffset,d="";""!==this.animationPrefix&&(d="-"+this.animationPrefix+"-");var g=document.createElement("style");g.innerHTML="@"+d+"keyframes slide"+this.buttonId+"{from { margin-left: "+a+"px; margin-top: "+
b+"px; left: "+100*this.startPosition.xPercent+"%; top: "+100*this.startPosition.yPercent+"%; }to { margin-left: "+c+"px; margin-top: "+e+"px; left: "+100*this.endPosition.xPercent+"%; top: "+100*this.endPosition.yPercent+"%; }}";document.getElementsByTagName("head")[0].appendChild(g);this.element.style[d+"animation-name"]="slide"+this.buttonId;this.element.style[d+"animation-duration"]="1s";this.element.style[d+"animation-iteration-count"]="2";this.element.style[d+"animation-direction"]="alternate";
this.element.style[d+"animation-timing-function"]="ease-in-out";this.element.style.setProperty(d+"animation-name","slide"+this.buttonId,"");this.element.style.setProperty(d+"animation-duration","1s","");this.element.style.setProperty(d+"animation-iteration-count","2","");this.element.style.setProperty(d+"animation-direction","alternate","");this.element.style.setProperty(d+"animation-timing-function","ease-in-out","");r.prototype.render.call(this)};I.prototype.renderFinish=function(){var a="";""!==
this.animationPrefix&&(a="-"+this.animationPrefix+"-");this.element.style[a+"animation-play-state"]="paused";this.element.style.setProperty(a+"animation-play-state","paused","")};I.prototype.remove=function(a){var b="";""!==this.animationPrefix&&(b="-"+this.animationPrefix+"-");a?(this.element.style[b+"animation-play-state"]="running",this.element.style.setProperty(b+"animation-play-state","running","")):(this.element.style[b+"animation-name"]="",this.element.style.setProperty(b+"animation-name",
"",""),r.prototype.remove.call(this,a))};J.prototype=new r;J.prototype.render=function(){r.prototype.addRenderListeners.call(this);var a="";""!==this.animationPrefix&&(a="-"+this.animationPrefix+"-");var b=document.createElement("style");b.innerHTML="@"+a+"keyframes fade"+this.buttonId+"{from { opacity: 0; }to { opacity: 1; }}";document.getElementsByTagName("head")[0].appendChild(b);this.element.style[a+"animation-name"]="fade"+this.buttonId;this.element.style[a+"animation-duration"]="1s";this.element.style[a+
"animation-iteration-count"]="2";this.element.style[a+"animation-direction"]="alternate";this.element.style[a+"animation-timing-function"]="ease-in-out";this.element.style.setProperty(a+"animation-name","fade"+this.buttonId,"");this.element.style.setProperty(a+"animation-duration","1s","");this.element.style.setProperty(a+"animation-iteration-count","2","");this.element.style.setProperty(a+"animation-direction","alternate","");this.element.style.setProperty(a+"animation-timing-function","ease-in-out",
"");this.element.style.marginLeft=-1*this.width*this.endPosition.xPercent+this.offset*this.endPosition.xOffset+"px";this.element.style.left=100*this.endPosition.xPercent+"%";this.element.style.marginTop=-1*this.height*this.endPosition.yPercent+this.offset*this.endPosition.yOffset+"px";this.element.style.top=100*this.endPosition.yPercent+"%";r.prototype.render.call(this)};J.prototype.renderFinish=function(){var a="";""!==this.animationPrefix&&(a="-"+this.animationPrefix+"-");this.element.style[a+"animation-play-state"]=
"paused";this.element.style.setProperty(a+"animation-play-state","paused","")};J.prototype.remove=function(a){var b="";""!==this.animationPrefix&&(b="-"+this.animationPrefix+"-");a?(this.element.style[b+"animation-play-state"]="running",this.element.style.setProperty(b+"animation-play-state","running",""),this.element.style.opacity=0):(this.element.style[b+"animation-name"]="",this.element.style.setProperty(b+"animation-name","",""),r.prototype.remove.call(this,a))};L.prototype=new r;L.prototype.render=
function(){this.element.style.marginLeft=-1*this.width*this.endPosition.xPercent+this.offset*this.endPosition.xOffset+"px";this.element.style.left=100*this.endPosition.xPercent+"%";this.element.style.marginTop=-1*this.height*this.endPosition.yPercent+this.offset*this.endPosition.yOffset+"px";this.element.style.top=100*this.endPosition.yPercent+"%";r.prototype.render.call(this);C(this.buttonId).renderFinish()};L.prototype.remove=function(a){a?C(this.buttonId).removeFinish():r.prototype.remove.call(this,
a)};D.prototype=new r;D.prototype.render=function(){C(this.buttonId).renderFinish()};D.prototype.renderFinish=function(){};D.prototype.remove=function(a){a&&C(this.buttonId).removeFinish()};m.TYPE={NUMBER_OF_PAGE_VIEWS:"NUMBER_OF_PAGE_VIEWS",URL_MATCH:"URL_MATCH",SECONDS_ON_PAGE:"SECONDS_ON_PAGE",SECONDS_ON_SITE:"SECONDS_ON_SITE",CUSTOM_VARIABLE:"CUSTOM_VARIABLE"};m.OPERATOR={EQUALS:"EQUALS",NOT_EQUAL:"NOT_EQUAL",START_WITH:"START_WITH",CONTAINS:"CONTAINS",NOT_CONTAIN:"NOT_CONTAIN",LESS_THAN:"LESS_THAN",
GREATER_THAN:"GREATER_THAN",LESS_OR_EQUAL:"LESS_OR_EQUAL",GREATER_OR_EQUAL:"GREATER_OR_EQUAL"};m.prototype.init=function(a,b,c,e,d){this.ruleId=a;this.buttonId=b;this.compareFrom=c;this.operator=e;this.compareTo=d};m.prototype.getId=function(){return this.ruleId};m.prototype.evaluate=function(a,b){switch(this.operator){case m.OPERATOR.EQUALS:return f.log("Evaluate: "+a+" \x3d\x3d "+b),a==b;case m.OPERATOR.NOT_EQUAL:return f.log("Evaluate: "+a+" !\x3d "+b),a!=b;case m.OPERATOR.START_WITH:return f.log("Evaluate: "+
a+" indexOf "+b+" \x3d\x3d 0"),0==a.indexOf(b);case m.OPERATOR.CONTAINS:return f.log("Evaluate: "+a+" indexOf "+b+" !\x3d -1"),-1!=a.indexOf(b);case m.OPERATOR.NOT_CONTAIN:return f.log("Evaluate: "+a+" indexOf "+b+" \x3d\x3d -1"),-1==a.indexOf(b);case m.OPERATOR.LESS_THAN:return f.log("Evaluate: "+parseFloat(a)+" \x3c "+parseFloat(b)),parseFloat(a)<parseFloat(b);case m.OPERATOR.GREATER_THAN:return f.log("Evaluate: "+parseFloat(a)+" \x3e "+parseFloat(b)),parseFloat(a)>parseFloat(b);case m.OPERATOR.LESS_OR_EQUAL:return f.log("Evaluate: "+
parseFloat(a)+" \x3c\x3d "+parseFloat(b)),parseFloat(a)<=parseFloat(b);case m.OPERATOR.GREATER_OR_EQUAL:return f.log("Evaluate: "+parseFloat(a)+" \x3e\x3d "+parseFloat(b)),parseFloat(a)>=parseFloat(b)}};M.prototype=new m;M.prototype.evaluate=function(){f.log("Evaluating StandardInviteRule");return m.prototype.evaluate.call(this,this.compareFrom,this.compareTo)};N.prototype=new m;N.prototype.evaluate=function(){f.log("Evaluating TimerInviteRule");var a=(new Date).getTime()-this.compareFrom,b=m.prototype.evaluate.call(this,
a,this.compareTo);!b&&a<=this.compareTo&&(a=this.compareTo-a,(null==t(this.buttonId).getInviteDelay()||a<t(this.buttonId).getInviteDelay())&&t(this.buttonId).setInviteDelay(a));return b};U.prototype=new m;U.prototype.evaluate=function(){if(fa.hasOwnProperty(this.compareFrom))return f.log("Evaluating CustomInviteRule"),m.prototype.evaluate.call(this,fa[this.compareFrom].toString(),this.compareTo);f.log("CustomInviteRule evaluation failed due to missing custom variable");return!1};var ja=0;y.prototype.init=
function(a,b){this.left=a;this.right=b};y.prototype.evaluate=function(a){return!1};Y.prototype=new y;Y.prototype.evaluate=function(a){f.log("Evaluating Atom Node: "+this.ruleId);return a.getRule(this.ruleId).evaluate()};V.prototype=new y;V.prototype.evaluate=function(a){f.logGroupStart("Evaluating And Node");a=this.left.evaluate(a)&&this.right.evaluate(a);f.logGroupEnd();return a};W.prototype=new y;W.prototype.evaluate=function(a){f.logGroupStart("Evaluating Or Node");a=this.left.evaluate(a)||this.right.evaluate(a);
f.logGroupEnd();return a};X.prototype=new y;X.prototype.evaluate=function(a){f.logGroupStart("Evaluating Not Node");a=!this.left.evaluate(a);f.logGroupEnd();return a};ka.prototype.toJSON=function(){return{label:this.getLabel(),value:this.getValue(),displayToAgent:this.getDisplayToAgent(),entityMaps:this.getMapper().getEntityMaps(),transcriptFields:this.getMapper().getTranscriptFields(),doKnowledgeSearch:this.getDoKnowledgeSearch()}};Z.prototype.map=function(a,b,c,e,d){"undefined"==typeof c&&(c=!0);
"undefined"==typeof e&&(e=!0);"undefined"==typeof d&&(d=!0);this.getEntityMaps().push(new la(a,b,c,e,d))};Z.prototype.saveToTranscript=function(a){this.getTranscriptFields().push(a)};la.prototype.toJSON=function(){return{entityName:this.getEntityName(),fieldName:this.getFieldName(),fastFill:this.getFastFill(),autoQuery:this.getAutoQuery(),exactMatch:this.getExactMatch()}};var H={};n._=H;H.handlePing=function(a){q.connection.handlePing(a)};H.error=function(a){a?f.log("Server Error: "+a):f.log("Server responded with an error.");
aa()};H.warning=function(a){a?f.log("Server Warning: "+a):f.log("Server sent an anoymous warning.")};H.setNewPtid=function(a){u.setPermanentId(a)};H.clearStorage=function(){A.clear()};n.init=function(a,b,c){if("string"!=typeof a||"string"!=typeof b||"string"!=typeof c)throw Error("The parameters to init must be strings");p.url=a;p.deploymentId=b;p.orgId=c;f.log("System Initialized. Waiting for the DOM to be ready");"complete"===document.readyState?setTimeout(O,1):document.addEventListener?(document.addEventListener("DOMContentLoaded",
O,!1),window.addEventListener("load",O,!1)):window.attachEvent?window.attachEvent("onload",O):f.log("No available event model. Exiting.")};n.getSid=function(){return v};n.enableLogging=function(){Q=!0};n.setLocation=function(a){};n.setChatWindowWidth=function(a){p.chatWindowWidth=a};n.setChatWindowHeight=function(a){p.chatWindowHeight=a};n.disconnect=function(){aa()};n.startChat=function(a,b,c){(b?K(a,b):l[a]).startChat("liveagentclicktocall"+Math.round(1E5*Math.random())+(new Date).getTime(),c)};
n.startChatWithWindow=function(a,b,c,e){(c?K(a,c):l[a]).startChat(b,e)};n.rejectChat=function(a){l[a].rejectChat()};n.showWhenOnline=function(a,b,c){if(q.connection.isRunning())throw Error("You cannot add a button after page initialization.");a=c?K(a,c):ia(a);a.addTracker(new S(a.buttonId,b))};n.showWhenOffline=function(a,b,c){if(q.connection.isRunning())throw Error("You cannot add a button after page initialization.");a=c?K(a,c):ia(a);a.addTracker(new T(a.buttonId,b))};n.addCustomDetail=function(a,
b,c){if(q.connection.isRunning())throw Error("You cannot add a detail after page initialization.");if("undefined"==typeof a||"undefined"==typeof b||null===a||null===b)throw Error("CustomDetail contains null value");var e=new ka(a,b,c);ua.push(e);var d={map:function(a,b,c,f,h){if("undefined"==typeof a||null===a||"undefined"==typeof b||null===b||null===c||null===f||null===h)throw Error("CustomDetail.map contains null value");e.getMapper().map(a,b,c,f,h);return d},saveToTranscript:function(a){if("undefined"==
typeof a||null===a)throw Error("CustomDetail.saveToTranscript contains null value");e.getMapper().saveToTranscript(a);return d},doKnowledgeSearch:function(){e.setDoKnowledgeSearch();return d}};return d};n.setName=function(a){if(q.connection.isRunning())throw Error("You cannot set the name after page initialization.");ba=a};n.addButtonEventHandler=function(a,b){"function"==typeof b&&(da[a]=b)};n.BUTTON_EVENT=k.EVENT;n.setCustomVariable=function(a,b){fa[a]=b;if(G.hasOwnProperty(a))for(var c=0;c<G[a].length;c++){var e=
t(G[a][c]);e.getOnlineState()&&e.setOnlineState(!0)}};n.findOrCreate=function(a){if(q.connection.isRunning())throw Error("You cannot find or create after page initialization.");var b=new ma(a);va.push(b);var c={map:function(a,d,g,f,h){b.getEntityMapper().map(a,d,g,f,h);return c},saveToTranscript:function(a){b.setSaveTranscript(a);return c},showOnCreate:function(){b.setShowOnCreate(!0);return c},linkToEntity:function(a,d){if(ga.hasOwnProperty(a)&&ga[a]==b.getEntityName())return ca("Warning: Recursive links detected, skip link "+
b.getEntityName()+" to "+a),c;b.setLinkToEntityName(a);b.setLinkToEntityField(d);ga[b.getEntityName()]=a;return c}};return c};var q={VisitorMessage:{ERROR:"Error",WARNING:"Warning"},SystemMessage:{ASYNC_RESULT:"AsyncResult",SWITCH_SERVER:"SwitchServer"}};(function(){var a=null,b=!1,c=null,e=null,d={};(function(){d.send=function(b,f){if(null!==c)d.onError.call(window,"Did not handle response before sending another message");else{"undefined"==typeof f&&(f={});var h="Visitor",k="",l=!1;1<b.length?(h=
"System",k="MultiNoun",f.nouns="",l=!0):k=b[0].getName();h=p.url+"/rest/"+h+"/"+k+".jsonp?";for(k=0;k<b.length;k++){l&&(f.nouns+=b[k].getName()+",");f[b[k].getName()+".prefix"]="Visitor";for(var m in b[k].getData())b[k].getData().hasOwnProperty(m)&&(f[b[k].getName()+"."+m]=b[k].getData()[m])}l&&(f.nouns=f.nouns.substr(0,f.nouns.length-1));for(var n in f)f.hasOwnProperty(n)&&(h+=n+"\x3d"+f[n]+"\x26");h+="callback\x3d"+a;h+="\x26deployment_id\x3d"+p.deploymentId;h+="\x26org_id\x3d"+p.orgId;h+="\x26version\x3d31";
l=document.createElement("script");l.type="text/javascript";l.src=h;c=document.body.appendChild(l);e=window.setTimeout(function(){d.onError.call(window,"Server failed to respond.")},p.pingTimeout)}};d.handlePing=function(a){e&&(clearTimeout(e),e=null);b=!0;a=a.messages;for(var f=0;f<a.length;f++)d.messageHandler.call(window,a[f].type,a[f].message);d.onSuccess.call(window);null!==c&&(document.body.removeChild(c),c=null)};d.messageHandler=function(a,b){};d.onSuccess=function(){};d.onError=function(a){};
d.isRunning=function(){return b};d.setIsRunning=function(a){b=a};d.setCallback=function(b){a=b}})();q.connection=d;q.Noun=function(a,b){this.getName=function(){return a};this.getData=function(){return b}}})();ma.prototype.toJSON=function(){return{entityName:this.getEntityName(),saveToTranscript:this.getSaveTranscript(),showOnCreate:this.getShowOnCreate(),linkToEntityName:this.getLinkToEntityName(),linkToEntityField:this.getLinkToEntityField(),entityFieldsMaps:this.getEntityMapper().getEntityFieldsMaps()}};
na.prototype.map=function(a,b,c,e,d){"undefined"==typeof c&&(c=!0);"undefined"==typeof e&&(e=!0);"undefined"==typeof d&&(d=!0);this.getEntityFieldsMaps().push(new oa(a,b,c,e,d))};oa.prototype.toJSON=function(){return{fieldName:this.getFieldName(),label:this.getLabel(),doFind:this.getDoFind(),isExactMatch:this.getIsExactMatch(),doCreate:this.getDoCreate()}};var v=f.getCookie("liveagent_sid"),$=f.getCookie("liveagent_chatted"),pa=!1,Q=!1,l={},ua=[],va=[],ba=null,da={},P=null,ga={},p={url:null,deploymentId:null,
orgId:null,pingRate:null,pingTimeout:5E3,chatWindowWidth:482,chatWindowHeight:350,contentServerUrl:null,chatPage:"/s/chat",prechatHandler:"/s/prechatVisitor"};q.connection.messageHandler=function(a,b){switch(a){case "VisitorId":b.sessionId&&(f.log("Received new session ID"),v=b.sessionId,document.cookie="liveagent_sid\x3d"+encodeURIComponent(v)+";path\x3d/;",null!=u.getVisitCount()&&u.setVisitCount(u.getVisitCount()+1),u.getPermanentId()||u.setPermanentId(v));break;case "Settings":A.init();f.log("Ping rate set to "+
b.pingRate+"ms");p.pingRate=b.pingRate;p.contentServerUrl=b.contentServerUrl;for(var c=0;c<b.buttons.length;c++)switch(b.buttons[c].type){case "ToAgent":case "Standard":var e=b.buttons[c],d=l[e.id];d&&sa(d,e);break;case "Invite":var e=b.buttons[c],g=null,g=e.inviteImageUrl?xa(e.id,e.inviteImageUrl,e.inviteImageWidth,e.inviteImageHeight):document.getElementById("liveagent_invite_button_"+e.id);null==g?ca("Warning: Button "+e.id+" disabled because HTML element was not found"):(d=t(e.id),d.addTracker(new z(e.id,
g,e.inviteRenderer,e.inviteStartPosition,e.inviteEndPosition,e.hasInviteAfterAccept,e.hasInviteAfterReject,e.inviteRejectTime)),g=f.jsonDecode(e.inviteRules),d.setRules(g.rules,g.filter),sa(d,e))}break;case "Availability":c={};for(e=0;e<b.results.length;e++)(d=l[b.results[e].id])&&(c[b.results[e].id]={button:d,isAvailable:b.results[e].isAvailable});null!=F&&c.hasOwnProperty(F)&&(c[F].button.setOnlineState(c[F].isAvailable),delete c[F]);for(g in c)c.hasOwnProperty(g)&&c[g].button.setOnlineState(c[g].isAvailable);
break;case q.VisitorMessage.WARNING:ca(b.text);break;case q.VisitorMessage.ERROR:wa(b.text);break;case q.SystemMessage.SWITCH_SERVER:c=b.newUrl;if("string"===typeof c)p.url=c,f.log("Received updated LiveAgent server url: "+c+"! Consider updating this site's deployment code.");else throw Error("Trying to set invalid LiveAgent server url: "+c);v=null}};q.connection.onSuccess=function(){null!==P&&clearTimeout(P);P=window.setTimeout(ya,p.pingRate)};q.connection.onError=function(a){wa(a)}}})();