embedded_svc.defineFeature("Invite",function(f){function J(a){var b;if(void 0!==a.style.animationName)return"";["Webkit","Moz","O","ms","Khtml"].forEach(function(c){void 0!==a.style[c+"AnimationName"]&&(b=c.toLowerCase())});return b}function K(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");}function p(){}function n(){}function e(){}function B(a){this.ruleId=a;n.prototype.init.call(this,null, null)}function C(a,b){n.prototype.init.call(this,a,b)}function D(a,b){n.prototype.init.call(this,a,b)}function E(a){n.prototype.init.call(this,a,null)}function w(a){return m(a)?m(a).getTracker():null}function k(){}function t(a,b,c,d){k.prototype.init.call(this,a,b,c,d)}function u(a,b,c,d){k.prototype.init.call(this,a,b,null,d)}function x(a,b,c,d){k.prototype.init.call(this,a,b,null,d)}function g(a){p.prototype.init.call(this,a,p.TYPE.INVITE);this.active=!1;this.filterLogic=null;this.rules={};this.autoRejectTimeout= this.inviteTimeout=this.inviteDelay=this.ruleTree=null}function m(a){F[a]||(F[a]=new g(a));return F[a]}function y(a,b,c,d,h){e.prototype.init.call(this,a,b,c,d,h)}function z(a,b,c,d,h){e.prototype.init.call(this,a,b,c,d,h)}function G(a,b,c,d,h){e.prototype.init.call(this,a,b,c,d,h)}function r(a){var b=0,c=0,d;L+=1;if(1E3 "+parseFloat(b)),parseFloat(a)>parseFloat(b);case e.OPERATOR.LESS_OR_EQUAL:return f.log("Evaluate: "+parseFloat(a)+" <= "+parseFloat(b)),parseFloat(a)<=parseFloat(b);case e.OPERATOR.GREATER_OR_EQUAL:return f.log("Evaluate: "+parseFloat(a)+" >= "+parseFloat(b)),parseFloat(a)>=parseFloat(b)}};B.prototype=new n;B.prototype.evaluate=function(a){f.log("Evaluating Atom Node: "+this.ruleId);return a.getRule(this.ruleId).evaluate()};C.prototype=new n;C.prototype.evaluate=function(a){f.log("Evaluating And Node"); return this.left.evaluate(a)&&this.right.evaluate(a)};D.prototype=new n;D.prototype.evaluate=function(a){a=this.left.evaluate(a)||this.right.evaluate(a);f.log("Evaluating Or Node");return a};E.prototype=new n;E.prototype.evaluate=function(a){a=!this.left.evaluate(a);f.log("Evaluating Not Node");return a};k.prototype.init=function(a,b,c,d){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=J(b);this.element=b;this.element.style.position=this.animationPrefix?"fixed":"absolute";this.element.style.left="-1000px";this.element.style.top="-1000px";this.element.style.zIndex= "10000";this.element.style.display="";this.element.style.visibility="visible";this.width=this.element.offsetWidth;this.height=this.element.offsetHeight;this.startPosition=c;this.endPosition=d};k.prototype.render=function(){this.element.style.display=""};k.prototype.renderFinish=function(){};k.prototype.remove=function(a){this.element.style.left="-1000px";this.element.style.top="-1000px"};k.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);K(this.element,b,function(){w(a).renderFinish()});K(this.element,c,function(){w(a).removeFinish()})};t.prototype=new k;t.prototype.render=function(){var a=this.width*this.startPosition.xPosition+this.offset*this.startPosition.xOffset,b=this.height*this.startPosition.yPosition+this.offset*this.startPosition.yOffset,c=this.width*this.endPosition.xPercent*-1+this.offset*this.endPosition.xOffset,d=this.height*this.endPosition.yPercent* -1+this.offset*this.endPosition.yOffset,h=document.createElement("style"),l="";k.prototype.addRenderListeners.call(this);""!==this.animationPrefix&&(l="-"+this.animationPrefix+"-");h.innerHTML="@"+l+"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: "+d+"px; left: "+100*this.endPosition.xPercent+"%; top: "+100*this.endPosition.yPercent+"%; }}"; document.getElementsByTagName("head")[0].appendChild(h);this.element.style[l+"animation-name"]="slide"+this.buttonId;this.element.style[l+"animation-duration"]="1s";this.element.style[l+"animation-iteration-count"]="2";this.element.style[l+"animation-direction"]="alternate";this.element.style[l+"animation-timing-function"]="ease-in-out";this.element.style.setProperty(l+"animation-name","slide"+this.buttonId,"");this.element.style.setProperty(l+"animation-duration","1s","");this.element.style.setProperty(l+ "animation-iteration-count","2","");this.element.style.setProperty(l+"animation-direction","alternate","");this.element.style.setProperty(l+"animation-timing-function","ease-in-out","");k.prototype.render.call(this)};t.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","")};t.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","",""),k.prototype.remove.call(this,a))};u.prototype=new k;u.prototype.render=function(){var a="",b=document.createElement("style"),c=this.width*this.endPosition.xPercent*-1+this.offset*this.endPosition.xOffset,d=this.height*this.endPosition.yPercent* -1+this.offset*this.endPosition.yOffset;k.prototype.addRenderListeners.call(this);""!==this.animationPrefix&&(a="-"+this.animationPrefix+"-");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=c+"px";this.element.style.left=100*this.endPosition.xPercent+ "%";this.element.style.marginTop=d+"px";this.element.style.top=100*this.endPosition.yPercent+"%";k.prototype.render.call(this)};u.prototype.renderFinish=function(){var a="";""!==this.animationPrefix&&(a="-"+this.animationPrefix+"-");this.element.style[a+"animation-name"]="";this.element.style.setProperty(a+"animation-name","","")};u.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","",""),k.prototype.remove.call(this,a))};x.prototype=new k;x.prototype.render=function(){var a=this.height*this.endPosition.yPercent*-1+this.offset*this.endPosition.yOffset;this.element.style.marginLeft=this.width*this.endPosition.xPercent*-1+this.offset*this.endPosition.xOffset+"px";this.element.style.left=100*this.endPosition.xPercent+"%"; this.element.style.marginTop=a+"px";this.element.style.top=100*this.endPosition.yPercent+"%";k.prototype.render.call(this);w(this.buttonId).renderFinish()};x.prototype.remove=function(a){a?w(this.buttonId).removeFinish():k.prototype.remove.call(this,a)};g.prototype=new p;g.RENDERER={Slide:{RenderClass:t},Fade:{RenderClass:u},Appear:{RenderClass:x}};g.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}};g.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:-3}};y.prototype=new e;y.prototype.evaluate=function(){f.log("Evaluating StandardInviteRule");return e.prototype.evaluate.call(this,this.compareFrom,this.compareTo)};z.prototype=new e;z.prototype.evaluate=function(){var a=(new Date).getTime()-this.compareFrom,b=e.prototype.evaluate.call(this,a,this.compareTo);f.log("Evaluating TimerInviteRule");!b&&a<=this.compareTo&&(a= this.compareTo-a,(null===m(this.buttonId).getInviteDelay()||a["liveagent_invite_rejected_"].indexOf(a)||0>c.indexOf(window.location.host);return b&&a};q.prototype.accept=function(){!this.hasInviteAfterAccept&&this.hasCookieConsent("liveagent_invite_rejected_")&&f.setCookie("liveagent_invite_rejected_"+this.buttonId,!0,!1);this.remove(!1)};q.prototype.reject=function(){!this.hasInviteAfterReject&&this.hasCookieConsent("liveagent_invite_rejected_")&&f.setCookie("liveagent_invite_rejected_"+ this.buttonId,!0,!1);this.remove(!0)};q.prototype.remove=function(a){m(this.buttonId).setActive(!1);this.renderer.remove(a)};q.prototype.removeFinish=function(){this.renderer.remove(!1)};g.prototype.setRules=function(a,b){var c;if(a&&b){for(c in a)if(a.hasOwnProperty(c)){var d=a[c];var h=null;switch(d.type){case e.TYPE.NUMBER_OF_PAGE_VIEWS:h=new y(d.order,this.buttonId,A.getPageCount(),d.operator,parseInt(d.value,10));break;case e.TYPE.URL_MATCH:h=new y(d.order,this.buttonId,A.getCurrentPage(),d.operator, d.value);break;case e.TYPE.SECONDS_ON_PAGE:h=new z(d.order,this.buttonId,(new Date).getTime(),d.operator,1E3*parseInt(d.value,10));break;case e.TYPE.SECONDS_ON_SITE:h=new z(d.order,this.buttonId,parseInt(A.getSessionStart(),10),d.operator,1E3*parseInt(d.value,10));break;case e.TYPE.CUSTOM_VARIABLE:h=new G(d.order,this.buttonId,d.name,d.operator,d.value),v.hasOwnProperty(d.name)||(v[d.name]=[]),v[d.name].push(this.buttonId)}null!==h&&this.addRule(h)}this.filterLogic=b;this.ruleTree=r(b)}};g.prototype.setOnlineState= function(a){a||null===this.inviteTimeout||(clearTimeout(this.inviteTimeout),this.inviteTimeout=null);a||null===this.autoRejectTimeout||(clearTimeout(this.autoRejectTimeout),this.autoRejectTimeout=null);p.prototype.setOnlineState.call(this,a)};g.prototype.isActive=function(){return this.active};g.prototype.setActive=function(a){document.getElementById("snapins_invite")&&(document.getElementById("snapins_invite").inert=!a);this.active=a};g.prototype.addTracker=function(a,b){a=/Mobi/.test(navigator.userAgent)? new q(b.id,a,"Fade",void 0,"BottomRight",b.hasInviteAfterAccept,b.hasInviteAfterReject,b.inviteRejectTime):new q(b.id,a,b.inviteRenderer,b.inviteStartPosition,b.inviteEndPosition,b.hasInviteAfterAccept,b.hasInviteAfterReject,b.inviteRejectTime);this.trackers=[];this.trackers.push(a)};g.prototype.getTracker=function(){if(1