
var XD=function(){var interval_id,last_hash,cache_bust=1,attached_callback,window=this;return{postMessage:function(message,target_url,target){if(!target_url){return;}
target=target||parent;if(window['postMessage']){target['postMessage'](message,target_url.replace(/([^:]+:\/\/[^\/]+).*/,'$1'));}else if(target_url){target.location=target_url.replace(/#.*$/,'')+'#'+(+new Date)+(cache_bust++)+'&'+message;}},receiveMessage:function(callback,source_origin){if(window['postMessage']){if(callback){attached_callback=function(e){if((typeof source_origin==='string'&&e.origin!==source_origin)||(Object.prototype.toString.call(source_origin)==="[object Function]"&&source_origin(e.origin)===!1)){return!1;}
callback(e);};}
if(window['addEventListener']){window[callback?'addEventListener':'removeEventListener']('message',attached_callback,!1);}else{window[callback?'attachEvent':'detachEvent']('onmessage',attached_callback);}}else{interval_id&&clearInterval(interval_id);interval_id=null;if(callback){interval_id=setInterval(function(){var hash=document.location.hash,re=/^#?\d+&/;if(hash!==last_hash&&re.test(hash)){last_hash=hash;callback({data:hash.replace(re,'')});}},100);}}}};}();

if(LiveAgentTracker==undefined){PostAssoc=function(){};var LiveAgentTracker=new function(){var integrationElementId='la_x2s6df8d';var x=0;var y=0;function computeServerUrl(){var url=new String(document.getElementById(integrationElementId).src);return url.substr(0,url.lastIndexOf('scripts/'));}
function registerMouseMoveHandler(){if(!document.all){document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove=initMouseXY;}
function initMouseXY(e){if(document.all){x=event.clientX+document.body.scrollLeft;y=event.clientY+document.body.scrollTop;}else{x=e.pageX;y=e.pageY;}
if(x<0){x=0;}
if(y<0){y=0;}}
registerMouseMoveHandler();this.serverUrl=computeServerUrl();this.trackUrl=this.serverUrl+'scripts/track.php';this.buttons=new PostAssoc();this.scriptTag=null;this.inviteScriptTag=null;this.invitationTimers=new PostAssoc();this.timeOffset=null;this.requestId=0;this.invitation=null;this.embeddedChatIframe=null;this.getTrackingParams=function(){var title=document.title;if(typeof(document.title)=="string"){title=document.title.replace(/\|/g," ");}
return"&pt="+escape(title)+"&pu="+this.encodeUrl(document.location.href)
+"&ref="+this.encodeUrl(document.referrer)+"&sr="
+screen.width+'x'+screen.height;}
this.encodeUrl=function(url){if(url==null){return'';}
if(url.substring(0,7)=='http://'){return escape('H_'+url.substring(7));}
if(url.substring(0,8)=='https://'){return escape('S_'+url.substring(8));}
return escape(url);}
this.getUpdateParams=function(){var buttonsString="[";for(var name in this.buttons){buttonsString+=this.buttons[name].toJson()+",";}
if(buttonsString.length>1){buttonsString=buttonsString.substring(0,buttonsString.length-1)
+"]";}else{buttonsString+="]";}
return"&bts="+buttonsString;}
this.startTimer=function(timeout){clearTimeout(this.timer);this.timer=setTimeout("LiveAgentTracker.sendRequest()",timeout);}
this.sendRequest=function(){this.removeScript();this.addScript();this.requestId++;}
this.removeScript=function(){var headTag=document.getElementsByTagName("head").item(0);if(this.scriptTag!=null){try{headTag.removeChild(this.scriptTag);}catch(err){}
this.scriptTag=null;}}
this.addScript=function(){var headTag=document.getElementsByTagName("head").item(0);this.scriptTag=document.createElement("script");this.scriptTag.setAttribute("type","text/javascript");this.scriptTag.setAttribute("src",this.getUrl());headTag.appendChild(this.scriptTag);}
this.getUrl=function(){var url=this.trackUrl+"?rc="+this.requestId;if(this.requestId==0){url+=this.getTrackingParams();}
return url+this.getUpdateParams();}
this.createButton=function(bid,element,note){if(bid==undefined){bid="";}
var button=new LiveAgentButton(bid,element,note);this.buttons[button.elementId]=button;this.startTimer(500);}
this.setButtonHtml=function(id,html){if(this.buttons[id]!=undefined){this.buttons[id].setHtml(html);return;}
for(elementId in this.buttons){if(this.buttons[elementId].id==id){this.buttons[elementId].setHtml(html);}}}
this.setButtonChatWindowParams=function(elementId,width,height,position){this.buttons[elementId].setChatWindowParams(width,height,position);}
this.setButtonInitialized=function(elementId){this.buttons[elementId].setInitialized();}
this.openButtonChat=function(elementId){this.buttons[elementId].open(this.serverUrl,x,y);this.clearInvitationTimes();if(this.invitation!=null){this.invitation.hide();}}
this.openInvitationChat=function(){this.invitation.open(this.serverUrl,x,y);}
this.initTimeOffset=function(year,month,day,hod,min,sec){var serverDate=new Date(year,month-1,day,hod,min,sec);var curDate=new Date();this.timeOffset=curDate.getTime()-serverDate.getTime();}
this.createInvitation=function(invitationAgentId){this.invitation=new LiveAgentInvitation(invitationAgentId);this.clearInvitationTimes();}
this.setInvitationValidTo=function(year,month,day,hod,min,sec){this.invitation.setValidTo(new Date(new Date(year,month-1,day,hod,min,sec).getTime()+this.timeOffset));}
this.setInvitationParams=function(width,height,position,animation){this.invitation.setInvitationParams(width,height,position,animation);}
this.setInvitationChatWindowParams=function(width,height,position){this.invitation.setChatWindowParams(width,height,position);}
this.showInvitation=function(html){this.invitation.show(html,x,y);}
this.closeInvitation=function(invitationId){this.invitation.hide();var closedInvitations=this.getCookie("closedInvitations");if(closedInvitations!=null&&closedInvitations!=""){closedInvitations+=','+invitationId;}else{closedInvitations=invitationId;}
this.setCookie("closedInvitations",closedInvitations);}
this.setCookie=function(name,value){document.cookie=name+"="+escape(value)+"; path=/";}
this.getCookie=function(name){var i,x,y,ARRcookies=document.cookie.split(";");for(i=0;i<ARRcookies.length;i++){x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x==name){return unescape(y);}}
return null;}
this.initInvitationTimes=function(times){for(i=0;i<times.length;i++){timeoutInSec=times[i];this.invitationTimers[timeoutInSec]=setTimeout("LiveAgentTracker.sendInviteRequest("+timeoutInSec+")",timeoutInSec*1000);}}
this.clearInvitationTimes=function(){for(timeoutInSec in this.invitationTimers){clearTimeout(this.invitationTimers[timeoutInSec]);}}
this.sendInviteRequest=function(timeOnPage){this.removeInviteScript();this.addInviteScript(timeOnPage);}
this.removeInviteScript=function(){var headTag=document.getElementsByTagName("head").item(0);if(this.inviteScriptTag!=null){try{headTag.removeChild(this.inviteScriptTag);}catch(err){}
this.inviteScriptTag=null;}}
this.addInviteScript=function(timeOnPage){var headTag=document.getElementsByTagName("head").item(0);this.inviteScriptTag=document.createElement("script");this.inviteScriptTag.setAttribute("type","text/javascript");this.inviteScriptTag.setAttribute("src",this.serverUrl+'scripts/invite.php?timeOnPage='+timeOnPage+"&currentUrl="+escape(document.location.href));headTag.appendChild(this.inviteScriptTag);}
this.openEmbeddedChat=function(params){if(this.embeddedChatIframe==null){this.embeddedChatIframe=document.createElement('iframe');document.body.appendChild(this.embeddedChatIframe);}
this.embeddedChatIframe.setAttribute('src',this.serverUrl+'chat/embed.php?'+params+'&parentUrl='+encodeURIComponent(document.location.href));this.embeddedChatIframe.setAttribute('style',this.getIframeStyle());}
this.getIframeStyle=function(){var style="";style+="position: fixed; right: 0px; bottom: 0px; z-index: 999999;";style+="width: 260px; height: 400px; margin-right: 2px;";style+="border: 0px; border-style: solid; border-top-left-radius: 5px; border-top-right-radius: 5px;";style+="box-shadow: 0 0 2px 1px #B0B0B0;";style+="background: url('"+this.serverUrl+"install/resources/loading.gif') no-repeat center transparent;"
return style;}
this.closeEmbeddedChat=function(){if(this.embeddedChatIframe!=null){document.body.removeChild(this.embeddedChatIframe);this.embeddedChatIframe=null;}
this.setCookie('LaRunningChat','');}
this.onEmbeddedChatOpened=function(cid){this.setCookie('LaRunningChat',cid);}
this.getHostname=function(url){var list=url.split('/');if(list[0].substring(0,4)=='http'){return list[0]+'//'+list[2]}
return'http://'+list[0];}
this.startTimer(100);var runningChatCookie=this.getCookie('LaRunningChat');if(runningChatCookie!=null&&runningChatCookie!=''){setTimeout("LiveAgentTracker.openEmbeddedChat('cid="+runningChatCookie+"')",50);}
XD.receiveMessage(function(message){if(message.data=='closeEmbeddedChat'){LiveAgentTracker.closeEmbeddedChat();}else if(message.data.substring(0,20)=='onEmbeddedChatOpened'){LiveAgentTracker.onEmbeddedChatOpened(message.data.substring(21));}},this.getHostname(this.serverUrl));}}

LiveAgentChatBaseObject=function(){};LiveAgentChatBaseObject.prototype.windowWidth;LiveAgentChatBaseObject.prototype.windowHeight;LiveAgentChatBaseObject.prototype.windowPosition;LiveAgentChatBaseObject.prototype.initHtml=function(html){if("https:"==document.location.protocol){html=html.replace('http://','https://');}
return html;}
LiveAgentChatBaseObject.prototype.setChatWindowParams=function(width,height,position){this.windowWidth=width;this.windowHeight=height;this.windowPosition=position;}
LiveAgentChatBaseObject.prototype.createChatWindowParams=function(x,y){var size=this.getWindowSize();var width=this.windowWidth;var height=this.windowHeight;if(this.windowWidth>size[0]){width=size[0];}
if(this.windowHeight>size[1]){height=size[1];}
var left=0;var top=size[1]/2-height/2;if(this.windowPosition=='R'){left=size[0]-width;}
if(this.windowPosition=='C'){left=size[0]/2-width/2;}
if(this.windowPosition=='O'){left=x;top=y;}
return'width='+width+',height='+height
+',left='+left+',top='+top+',scrollbars=yes';}
LiveAgentChatBaseObject.prototype.openPopupWindow=function(serverUrl,params,x,y){window.open(serverUrl+'chat/index.php?'+params,"_blank",this.createChatWindowParams(x,y));}
LiveAgentChatBaseObject.prototype.getWindowSize=function(){var wWidth=0,wHeight=0;if(typeof(window.innerWidth)=='number'){wWidth=window.innerWidth;wHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){wWidth=document.documentElement.clientWidth;wHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){wWidth=document.body.clientWidth;wHeight=document.body.clientHeight;}
return[wWidth,wHeight];}

LiveAgentButton=function(id,element,note){this.id=id;this.note=note;this.elementId="b_"+id+"_"
+Math.round((Math.random()*1000)).toString();this.initialized='N';this.windowWidth="500";this.windowHeight="800";this.windowPosition="C";this.insertButtonElement(element);};LiveAgentButton.prototype=new LiveAgentChatBaseObject;LiveAgentButton.prototype.constructor=LiveAgentButton;LiveAgentButton.prototype.insertButtonElement=function(element){buttonDiv=document.createElement('div');buttonDiv.setAttribute('id',this.elementId);buttonDiv.onclick=function(){LiveAgentTracker.openButtonChat(this.getAttribute('id'));};buttonDiv.style.cursor='pointer';if(element==undefined){element=document.getElementById('la_x2s6df8d');element.parentNode.insertBefore(buttonDiv,element.nextSibling);}else{element.parentNode.insertBefore(buttonDiv,element.nextSibling);element.parentNode.removeChild(element);}}
LiveAgentButton.prototype.setHtml=function(html){document.getElementById(this.elementId).innerHTML=this.initHtml(html);}
LiveAgentButton.prototype.open=function(serverUrl,x,y){var params='bid='+this.id;if(this.note!=undefined&&this.note!=''){params+='&note='+escape(this.note);}
if(this.windowPosition=='E'){LiveAgentTracker.openEmbeddedChat(params);}else{this.openPopupWindow(serverUrl,params);}}
LiveAgentButton.prototype.toJson=function(){return'{"i":"'+this.id+'","e":"'+this.elementId+'","s":"'
+this.initialized+'"}';}
LiveAgentButton.prototype.setInitialized=function(){this.initialized='Y';}

LiveAgentInvitation=function(id){this.id=id;this.width="200";this.height="200";this.position="C";this.windowWidth="500";this.windowHeight="800";this.windowPosition="C";this.animation="N";this.scrollX=0;this.scrollY=0;this.element;};LiveAgentInvitation.prototype=new LiveAgentChatBaseObject;LiveAgentInvitation.prototype.constructor=LiveAgentInvitation;LiveAgentInvitation.prototype.insertInvitationElement=function(){if(this.element==undefined){this.element=document.createElement('div');this.element.setAttribute('id','_invitationcode');document.body.appendChild(this.element);}}
LiveAgentInvitation.prototype.setHtml=function(html){this.element.innerHTML=this.initHtml(html);}
LiveAgentInvitation.prototype.setInvitationParams=function(width,height,position,animation){this.width=width;this.height=height;this.position=position;this.animation=animation;}
LiveAgentInvitation.prototype.setValidTo=function(validTo){var self=this;setTimeout(function(){self.hide();},validTo.getTime()-new Date().getTime());}
LiveAgentInvitation.prototype.open=function(serverUrl,x,y){if(this.windowPosition=='E'){LiveAgentTracker.openEmbeddedChat('iaid='+this.id);}else{this.openPopupWindow(serverUrl,'iaid='+this.id,x,y);}
this.hide();}
LiveAgentInvitation.prototype.hide=function(){if(this.element!=undefined){document.body.removeChild(this.element);this.element=null;}}
LiveAgentInvitation.prototype.show=function(html,x,y){this.insertInvitationElement();this.setHtml(html);if(this.animation=='Y'){this.animate(1000,1,x,y);}else{this.setStyle(100,x,y);}}
LiveAgentInvitation.prototype.animate=function(time,step,x,y){this.setStyle(step,x,y);if(step<100){var self=this;setTimeout(function(){self.animate(time,++step,x,y);},time/100);}}
LiveAgentInvitation.prototype.setStyle=function(step,x,y){this.element.style.position='fixed';this.element.style.zIndex='99999';this.element.style.width=this.width+'px';this.element.style.height=this.height+'px';if(this.position=='TL'){this.setPosition((-this.height+this.height/100*step)+'px',null,null,'0px');}
if(this.position=='TC'){this.setPosition((-this.height+this.height/100*step)+'px',null,null,'50%');this.setMargin(null,(-this.width/2)+'px');}
if(this.position=='TR'){this.setPosition((-this.height+this.height/100*step)+'px','0px',null,null);}
if(this.position=='BL'){this.setPosition(null,null,(-this.height+this.height/100*step)+'px','0px');}
if(this.position=='BC'){this.setPosition(null,null,(-this.height+this.height/100*step)+'px','50%');this.setMargin(null,(-this.width/2)+'px');}
if(this.position=='BR'){this.setPosition(null,'0px',(-this.height+this.height/100*step)+'px',null);}
if(this.position=='O'){this.initScrollXY();xAnimation=-this.height/25+this.height/100*step/25;this.setPosition((y-this.scrollY)+'px',null,null,(x-this.scrollX+(step%2==0?+xAnimation:-xAnimation))+'px');}
if(this.position=='CL'){this.setPosition('50%',null,null,(-this.width+this.width/100*step)+'px');this.setMargin((-this.height/2)+'px',null);}
if(this.position=='CR'){this.setPosition('50%',(-this.width+this.width/100*step)+'px',null,null);this.setMargin((-this.height/2)+'px',null);}
if(this.position=='C'){this.setPosition('50%',null,null,'50%');xAnimation=-this.height/25+this.height/100*step/25;this.setMargin((-this.height/2)+'px',(-this.width/2+(step%2==0?+xAnimation:-xAnimation))+'px');}}
LiveAgentInvitation.prototype.setPosition=function(top,right,bottom,left){if(top!=null){this.element.style.top=top;}
if(right!=null){this.element.style.right=right;}
if(bottom!=null){this.element.style.bottom=bottom;}
if(left!=null){this.element.style.left=left;}}
LiveAgentInvitation.prototype.setMargin=function(top,left){if(top!=null){this.element.style.marginTop=top;}
if(left!=null){this.element.style.marginLeft=left;}}
LiveAgentInvitation.prototype.initScrollXY=function(){if(typeof(window.pageYOffset)=='number'){this.scrollY=window.pageYOffset;this.scrollX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){this.scrollY=document.body.scrollTop;this.scrollX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){this.scrollY=document.documentElement.scrollTop;this.scrollX=document.documentElement.scrollLeft;}}

