function staticButton(objName,divID,buttonName,buttonId,config,state,butHtmlTemplate,server,site,protocol,servlet,windowWidth,windowHeight,windowPrefix,LEAppID){this.CHAT=1;this.VOICE=2;this.BUTTON=1;this.CHATBOX=2;this.TEXTLINK=3;this.OFFLINE=1;this.ONLINE=2;this.OCCUPIED=3;this.AWAY=4;this.TOP_LEFT=2;this.TOP_RIGHT=3;this.BOTTOM_LEFT=4;this.BOTTOM_RIGHT=5;this.stateImage=[];this.stateImage[this.OFFLINE]='repoffline.gif';this.stateImage[this.ONLINE]='reponline.gif';this.stateImage[this.OCCUPIED]='repoccupied.gif';this.stateImage[this.AWAY]='repoffline.gif';this.config=config;if(this.config.buttonType==this.CHATBOX&&this.config.buttonContent==1){this.config.cb_height=100;this.config.cb_width=150;this.config.cb_borderWidth=0;this.config.cb_borderColor=''}this.objName=objName;this.divID=divID;this.buttonName=buttonName;this.buttonId=buttonId;this.state=state;this.butHtmlTemplate=butHtmlTemplate;this.server=server;this.site=site;this.protocol=protocol;this.servlet=servlet;this.windowWidth=windowWidth;this.windowHeight=windowHeight;this.LEAppID=LEAppID;this.LEAppPrefix='staticB:';this.targetPrefix=this.config.chanel==this.CHAT?'chat':'call';this.randomNum=Math.round(Math.random()*9999999999);this.connErrorCnt=0;this.maxErrorRequests=3;this.ErrorRequestDelay=5;this.imgID='lpChatBtnImgID'+this.randomNum;this.chatBoxSubmitImgID='LPsubmit'+this.randomNum;this.chatBoxTextAreaID='lp_msgfield'+this.randomNum;this.hrefID='lpChatBtnHref'+this.randomNum;this.tableID='lpChatBtnTbl'+this.randomNum;this.poweredbyDivID='lpPoweredByID'+this.randomNum;this.txtLinkSpan='lpTextLinkSpan'+this.randomNum;if(this.config.chanel==this.VOICE){for(var name in this.stateImage){this.stateImage[name]='voice_'+this.stateImage[name]}}if(!this.EventHandler('init')){return true}this.Start()}staticButton.prototype.Start=function(){if(!this.EventHandler('start')){return true}var that=this;var div=this.GetObj(this.divID);if(div!=null){var content=this.GetHTML();var htmlContainerElement=this.config.buttonType==this.TEXTLINK?'span':'div';var tmpDiv=document.createElement(htmlContainerElement);tmpDiv.innerHTML=content.html;div.appendChild(tmpDiv);this.addStyleSheet(content.css);var href=this.GetObj(this.hrefID);if(href!=null){href.onclick=function(){that.Clicked();return false}}if(this.config.buttonType==this.CHATBOX){this.attachEventsToChatBox()}this.addToolTip()}if(typeof(lpMTagStatic.stateChangeCallbacks)=='undefined'){lpMTagStatic.stateChangeCallbacks=[]}lpMTagStatic.stateChangeCallbacks[lpMTagStatic.stateChangeCallbacks.length]=function(){that.StateChangeCallback()};this.Display()};staticButton.prototype.attachEventsToChatBox=function(){var that=this;var txtArea=this.GetObj(this.chatBoxTextAreaID);if(txtArea!=null){txtArea.onblur=function(){if(txtArea.value==''){txtArea.value=that.config.chatBoxText}};txtArea.onfocus=function(){if(txtArea.value==that.config.chatBoxText){txtArea.value=''}};txtArea.value=this.config.chatBoxText}};staticButton.prototype.StateChangeCallback=function(){this.makeCall()};staticButton.prototype.makeCall=function(){var that=this;if(!this.EventHandler('makeCall')){return true}if(typeof(lpConnLib)!='undefined'){var url=this.protocol+'://'+this.server+'/'+this.servlet+this.site+'/';var params=new hcArrayStorage();params.add('site',this.site);params.add('cmd','mTagRepstate');params.add('c',this.config.chanel);params.add('bt',this.config.buttonType);params.add('buttonID',this.config.id);params.add('subCmd','getState');params.add('monitor',1);if(lpMTag.mtagAddToQueue){lpMTag.mtagAddToQueue(url,params,function(dataObj,request){that.callResponseHandler(dataObj,request)},false)}else{lpConnLib.addToQueue(url,params,function(dataObj,request){that.callResponseHandler(dataObj,request)},false)}}};staticButton.prototype.callResponseHandler=function(dataObj){var that=this;if(typeof(dataObj.ResultSet.lpCallError)!='undefined'){this.connErrorCnt++;if(this.connErrorCnt'}}else{clickStr+=''}}}return clickStr};staticButton.prototype.GetUDEString=function(){var udeStr='';for(var i=0;i'}}else{udeStr+=''}}}return udeStr};staticButton.prototype.isDynamicUDE=function(u){return(u.name.indexOf('{')==0||u.value.indexOf('{')==0)};staticButton.prototype.expandDynamicUDE=function(u){var name='';var value='';try{if(u.name.indexOf('{')==0){this.log('Found dynamic ude name: '+u.name);name=this.getDynamicProp(u.name);this.log('Expanded dynamic ude name: '+name)}else{name=u.name}if(u.value.indexOf('{')==0){this.log('Found dynamic ude value: '+u.value);value=this.getDynamicProp(u.value);this.log('Expanded dynamic ude value: '+value)}else{value=u.value}}catch(e){this.log('exception in expandDynamicUDE: '+e,'WARN');return null}return{'name':name,'value':value,'scope':u.scope}};staticButton.prototype.getDynamicProp=function(prop){prop=prop.substr(1);prop=prop.substr(0,prop.length-1);return eval(prop)};staticButton.prototype.GetHTML=function(){var css=[];var html=this.butHtmlTemplate;html=html.replace(/\{IMAGENAME\}/g,this.stateImage[this.state]);html=html.replace(/\{ON_CLICK_HANDLER\}/g,'');html=html.replace(/\{RANDOMNUM\}/g,this.randomNum);html=html.replace(/\{EXTRACSSFORAA\}/g,'');if(this.config.buttonType==this.CHATBOX){html=html.replace(/\{customWantToChatNONJSParams\}/g,this.GetClickhtmlString()+this.GetUDEhtmlString());css=this.getChatBoxCss()}else{html=html.replace(/\{customWantToChatNONJSParams\}/g,this.GetClickString()+this.GetUDEString())}html=html.replace(/\{targetPrefix\}/g,this.targetPrefix);html=html.replace(/\{textLinkValue\}/g,this.getTextLinkText(this.state));html=html.replace(/\{chatBoxText\}/g,'');return{'html':html,'css':css};};staticButton.prototype.getChatBoxCss=function(){var css=[];css[css.length]={'name':'#lp_msgfield'+this.randomNum,'css':'padding-left: 3px;font-family:Arial, Helvetica, sans-serif;font-size: 11px;background-color:#ffffff;width:'+this.config.cb_width+'px;height:'+this.config.cb_height+'px;border:'+this.config.cb_borderWidth+'px solid '+this.config.cb_borderColor+';'};css[css.length]={'name':'#LPChatBoxSubmitTDid'+this.randomNum,'css':'background-repeat:no-repeat;padding-left: 3px;padding-right: 0px;padding-top: 0px;padding-bottom: 0px;vertical-align: top;height: 29px;'};css[css.length]={'name':'#LPChatBoxTxtTDid'+this.randomNum,'css':'padding-left:5px;padding-right: 0px;padding-top: 0px;padding-bottom: 0px;'};css[css.length]={'name':'#lpChatBtnHref'+this.randomNum,'css':'margin-top: 2px;'};css[css.length]={'name':'#lpChatBtnImgID'+this.randomNum,'css':'display: block;'};return css};staticButton.prototype.Display=function(){if(!this.EventHandler('beforeDisplay')){return true}if(this.config.buttonType!=this.TEXTLINK){var tbl=this.GetObj(this.tableID);if(tbl!=null){tbl.style.display=''}else{this.log('staticButton '+this.buttonName+' objName='+this.objName+' Can not find tableID:'+this.tableID,'ERROR')}}if(!this.voice){this.reportImpression()}this.makeItSticky();if(!this.EventHandler('afterDisplay')){return true}};staticButton.prototype.reportImpression=function(msg,level){var that=this;if(typeof(lpMTagStatic.onInitMonitor)=='undefined'){lpMTagStatic.onInitMonitor=[]}lpMTagStatic.onInitMonitor.push(function(){that.log('Delaying impression sending','DEBUG');if(typeof(lpMTagConfig.ifVisitorCode)=='undefined'){lpMTagConfig.ifVisitorCode=[]}lpMTagConfig.ifVisitorCode.push(function(){that.sendImpression()})})};staticButton.prototype.sendImpression=function(){if(typeof(lpMTagConfig.LEeventsAPI)!='undefined'&&lpMTagConfig.LEeventsAPI){this.initLEeventsAPI();if(typeof(lpMTagConfig.liveEngage)!='undefined'){lpMTagConfig.liveEngage.sendImpression(this.LEAppID,this.LEAppPrefix+this.buttonId)}}else{this.log('lpMTagConfig.LEeventsAPI is false','DEBUG')}};staticButton.prototype.initLEeventsAPI=function(){if(typeof(lpMTagConfig)!='undefined'&&typeof(lpMTagConfig.liveEngage)=='undefined'){lpMTagConfig.liveEngage={type:{impression:"impression",engage:"engage"},rdrDefault:{url:"",name:"_self",specs:""},_sendEvent:function(appId,type,strData,redirectData){if(typeof(appId)=='undefined'){this._log("appId was not defined","ERROR");return false}if(typeof(lpMTagConfig.LEeventsAPI)=='undefined'||!lpMTagConfig.LEeventsAPI){this._log("Older app server version unified reports not supported (lpMTagConfig.LEeventsAPI != true)","ERROR");return false}this._log("Sending"+type+" event for application: "+appId);var params=new hcArrayStorage();params.add('site',lpMTagConfig.lpNumber);params.add('cmd','leVisitorEvent');params.add('type',type);params.add('appKey',appId);params.add('data',strData);var url=lpMTagConfig.lpProtocol+'://'+lpMTagConfig.lpServer+'/hc/'+lpMTagConfig.lpNumber+'/';if(typeof(redirectData)=='undefined'||redirectData==null){if(typeof(lpConnLib)!='undefined'&&typeof(lpConnLib.addToQueue)!='undefined'){lpConnLib.addToQueue(url,params,null,true,3,true,true,5);return true}else{this._log("lpConnLib or lpConnLib.addToQueue are not defined","ERROR");return false}}else{var rdrObj={};this._objectClone(this.rdrDefault,rdrObj);if(typeof(redirectData)=='string'){rdrObj.url=redirectData}else{this._objectClone(redirectData,rdrObj)}return this._sendEventRedirect(url,params,rdrObj)}},_sendEventRedirect:function(url,params,rdrObj){if(typeof(rdrObj.url)=='undefined'||rdrObj.url==null||rdrObj.url==""){this._log("redirect url was not defined or empty");return false}params.add('redirect',rdrObj.url);return window.open(this._getRedirectUrl(url,params),rdrObj.name,rdrObj.specs)},_getRedirectUrl:function(url,params){var request=new lpRequest(lpConnLib.protocolVer,url,params,null,false,null,lpConnLib.prunIdentify,5,"UTF-8",lpConnLib.browser,false,null,undefined,0,0,true,false,undefined,undefined,undefined,undefined);request.BuildCallUrl('get',lpConnLib.maxurlgetlength,true);return request.fullUrl},_objectClone:function(source,target){var key;for(key in source){target[key]=source[key]}},_log:function(msg,type){type=(type?type:'DEBUG');if(typeof(lpMTagDebug)!='undefined'&&typeof(lpMTagDebug.Display)=='function'){lpMTagDebug.Display(msg,type,'LiveEngage.Report')}},sendImpression:function(appId,strData){return this._sendEvent(appId,this.type.impression,strData)},sendEngagement:function(appId,strData,redirectData){return this._sendEvent(appId,this.type.engage,strData,redirectData)}}}};staticButton.prototype.log=function(msg,level){if(typeof(lpMTagDebug)!='undefined'&&lpMTagDebug.Display){lpMTagDebug.Display(msg,level,'STATIC_BUTTON')}};staticButton.prototype.Clicked=function(){if(!this.EventHandler('click')){return true}var fileCmd=(this.config.chanel==this.CHAT)?'visitorWantsToChat':'visitorWantsToTalk';this.winURL=this.protocol+'://'+this.server+'/'+this.servlet+this.site+'/?cmd=file&file='+fileCmd+'&site='+this.site;if(this.config.routingSkill>0){this.winURL+='&SV!skill='+encodeURIComponent(this.config.routingSkillName)}if(this.config.routingAgent>0){this.winURL+='&SV!opid='+this.config.routingAgent}this.winURL=(typeof(lpAppendVisitorCookies)!='undefined'?lpAppendVisitorCookies(this.winURL):this.winURL);this.winURL=((typeof(lpMTag)!='undefined'&&typeof(lpMTag.addFirstPartyCookies)!='undefined')?lpMTag.addFirstPartyCookies(this.winURL):this.winURL);this.winURL+=this.GetClickString();this.winURL+=this.GetUDEString();if(this.config.chanel==this.CHAT){this.winURL+="&LEAppKey="+this.LEAppID}if(this.config.buttonType==this.CHATBOX){var el=document.getElementById('lp_msgfield'+this.randomNum);if(el!=null){if(typeof(this.config.blockCCPattern)!='undefined'){el.value=el.value.replace(this.config.blockCCPattern,"****************")}this.winURL+='&SV!message='+el.value}this.winURL+='&SV!survey_pre-chat_enable=Off';this.winURL+='&SV!source=chatbox'}this.winURL+='&referrer='+escape(document.location);this.winURL+='&referrer='+escape(document.location);this.winURL+='&bId='+this.buttonId;if(this.winURL.length>2000){this.winURL=this.winURL.substr(0,2000)}if(!this.EventHandler('windowOpen')){return true}window.open(this.winURL,this.targetPrefix+this.site,'width='+this.windowWidth+',height='+this.windowHeight+',resizable=yes');return false};staticButton.prototype.EventHandler=function(ev){this.log('staticButton '+this.buttonName+' objName='+this.objName+' EVENT: '+ev+' STATE:'+this.state,'DEBUG');var that=this;if(ev=='start'){this.mTagEvent('LP_STATBUTTON_START')}else if(ev=='beforeDisplay'){this.mTagEvent('LP_STATBUTTON_SHOWN')}else if(ev=='click'){this.mTagEvent('LP_STATBUTTON_CLICKED')}else if(ev=='state'){this.mTagEvent('LP_STATBUTTON_STATE')}if(typeof(lpMTagStatic.chatButtonEventHandler)=='function'){return lpMTagStatic.chatButtonEventHandler(ev,that,this.buttonName,this.buttonId)}return true};staticButton.prototype.GetObj=function(id){if(document.getElementById){return document.getElementById(id)}else{if(document.all){return document.all(id)}}};staticButton.prototype.makeItSticky=function(){if(this.config.stickyType!=this.TOP_LEFT&&this.config.stickyType!=this.TOP_RIGHT&&this.config.stickyType!=this.BOTTOM_LEFT&&this.config.stickyType!=this.BOTTOM_RIGHT){return}var div=this.GetObj(this.divID);if(div!=null){div.style.position='fixed';if(this.config.stickyType==this.TOP_LEFT){div.style.top=0;div.style.left=0}else if(this.config.stickyType==this.TOP_RIGHT){div.style.top=0;div.style.right=0}else if(this.config.stickyType==this.BOTTOM_LEFT){div.style.bottom=0;div.style.left=0}else if(this.config.stickyType==this.BOTTOM_RIGHT){div.style.bottom=0;div.style.right=0}}};staticButton.prototype.getStateStr=function(state){if(state==this.ONLINE){return 'online'}else if(state==this.OFFLINE){return 'offline'}else if(state==this.OCCUPIED){return 'busy'}else if(state==this.AWAY){return 'away'}};staticButton.prototype.mTagEvent=function(evName){if(typeof(lpMTag)!='undefined'&&typeof(lpMTag.events)!='undefined'&&typeof(lpMTag.events.publish)=='function'){var stateStr=this.getStateStr(this.state);var evData={id:this.buttonId,name:this.buttonName,channel:(this.config.chanel==this.VOICE?'voice':'chat'),buttonState:stateStr};lpMTag.events.publish(evName,evData)}};staticButton.prototype.addStyleSheet=function(css){for(var i=0;iOur live chat agents are available to assist you Mon-Fri 9am-5pm EST.
Click to chat wherever you see this chat button!",addTextToButtonPosition:1,routingSkill:-1,routingSkillName:'',routingAgent:-1,mouseoverOnline:"Click here to chat live with a real online representative",mouseoverOccupied:"All our live chat agents are currently occupied. Please try again later or click here to leave us a message.",mouseoverOffline:"Our live chat service is currently offline. Please try again during business hours or click here to leave us a message.",defaultButton:true,imageFolder:"https://liveperson1.websiteseguro.com/teste/villaggio/imagens",chatBoxTemplate:"",chatBoxText:"",displayTextOnline:"",displayTextOccupied:"",displayTextOffline:"",ude: [],cb_width:0,cb_height:0,cb_borderWidth:0,cb_borderColor:"",smartType:2,time_in_queue:10},1, "