var chatURL,companyName,isChatServiceAvailable,testStatus;Wt=function(){return};Wt.chat=function(){return};Wt.chat.PublicChat=function(){return{enablePublicChat:!0,site:"",statusExpireMinutes:null,statusCallback:"",msgChatBegun:"Please wait for the chat to begin.",msgPopUpWarn:"Please unblock pop-ups for this chat.",msgUnavailable:"Sorry, chat is temporarily unavailable",crsChatSystem:"",msg:"",wsUrl:"",useInfoForm:null,startOptions:{},getStatus:function(){var t={},n,i;this.msg="";try{this.enablePublicChat!==!0&&(this.status="offline",this.msg=this.msgUnavailable,this._setCookie("chatStatus"+this.site,this.status,this.statusExpireMinutes),this._setCookie("chatStatusMsg"+this.site,this.msg,this.statusExpireMinutes))}catch(r){}try{if(this.status=this._getCookie("chatStatus"+this.site),this.msg=this._getCookie("chatStatusMsg"+this.site),this.useInfoForm=this._getCookie("chatUseForm"+this.site),this.status!==null){this.msg===null&&(this.msg=this.status!=="ready"?"":this.msgUnavailable);this.statusCallback&&this.statusCallback.call();return}}catch(r){}t.site=this.site||"";n=this._urlEncode(t);n!==""&&(n="&"+this._urlEncode(t));this.msg=this.msgUnavailable;i=this.wsUrl+"webspeed/public/chat/wsPublicChatStatus.w?upRespFormat=json"+n;this._jsonp(i,"Wt.chat.PublicChat.getStatus_callback")},getStatus_callback:function(n){try{this.status=this._evalJson(n,"status");try{this.useInfoForm=this._evalJson(n,"useForm")}catch(t){}}catch(t){this.status="offline";this.msg=this.msgUnavailable}this.status==="ready"&&this.msg===this.msgUnavailable&&(this.msg="");this._setCookie("chatStatus"+this.site,this.status,this.statusExpireMinutes);this._setCookie("chatStatusMsg"+this.site,this.msg,this.statusExpireMinutes);this._setCookie("chatUseForm"+this.site,this.useInfoForm,this.statusExpireMinutes);this.statusCallback&&this.statusCallback.call()},getWsUrl_callback:function(n){var t="";try{t=this._evalJson(n,"wsUrl")||this.wsUrl}catch(i){}t!==""&&(this.wsUrl=t);this.wsUrl.lastIndexOf("/")+1<this.wsUrl.length&&(this.wsUrl+="/");this.statusCallback=this.initParams.statusCallback||this.statusCallback;this.startOptions=this.initParams.startOptions||{};this.site=this.initParams.startOptions.site||this.initParams.site||"";this.getStatus()},init:function(n){if(this.initParams=n,this.msgUnavailable=this.initParams.msgUnavailable||this.msgUnavailable,this.chatStartInProcess=!1,this.crsChatSystem!==""){var t="http://crslogin.com/php/getUrlAsJsonp.php?system="+this.crsChatSystem;this._jsonp(t,"Wt.chat.PublicChat.getWsUrl_callback")}else this.getWsUrl_callback()},start:function(n){var l,u,r,a,v,y,n,t,h,p,i,c,e,w,o;if(this.status==="ready"){if(r={},this.chatStartInProcess){alert(this.msgChatBegun);return}try{if(this.chatSessionWindow&&!this.chatSessionWindow.closed)try{this.chatSessionWindow.focus();return}catch(g){return}}catch(g){}var f=this.startOptions.window||{},b=f.top||0,k=f.left||0,d=f.width||350,s=window.screen.width>800&&window.screen.height>600?540:window.screen.availHeight-48;if(s=f.height||s,a="status=yes,resizable=yes,scrollbars=yes,titlebar=yes,width="+d+",height="+s+",top="+b+",left="+k,y=new Date,v=f.name||"crs"+y.getTime(),this.chatSessionWindow=window.open("about:blank",v,a),this.chatSessionWindow){if(this.chatSessionWindow.name===undefined){alert(this.msgPopUpWarn);return}}else{alert(this.msgPopUpWarn);return}this.useInfoForm!=="true"&&(this.chatStartInProcess=!0);try{this.chatSessionWindow.document.body.innerHTML=this.msgChatBegun}catch(g){}n=n||{};n=typeof n=="object"?n:{};t=this.startOptions;for(i in n)if(typeof t[i]=="undefined")t[i]=n[i];else for(h in n[i])t[i][h]=n[i][h];p=t.clickStream||[];r.clickStream=p.toString()||"";r.initialText=t.initialText||"";r.shoppingCart=t.shoppingCart||"";r.site=t.site||this.site||"";for(i in t.info)r[i]=t.info[i];if(t.form)for(c=t.form.elements,e=0,w=c.length;e<w;++e)u=c.item(e),u.value&&(l=u.id||u.name,r[l]=u.value);if(this.useInfoForm==="true"){this._openChatInfoForm(r);return}o=this.wsUrl+"webspeed/public/chat/wsChatsessionNew.w?upRespFormat=json&upAction=update&chatAction=getMessage&upLock=no&"+this._urlEncode(r);this._jsonp(o,"Wt.chat.PublicChat._postChatsessionComplete")}},_copyDataFromServer:function(n){this.sessionData={};for(var t in n)if(t!=="err"&&t!=="info"&&t!=="warn")try{this.sessionData[t]=this._getResponseValue(n,t)}catch(i){}return!0},_evalJson:function(jsonString,returnField){var err,msg,response,result,aInfoMsg,i,len;try{result=eval(jsonString);response=result.wtResponse!==undefined?result.wtResponse:result}catch(e){return returnField==="status"?(this.msgUnavailable&&(this.msg=this.msgUnavailable),"offline"):void 0}if(msg=this._getResponseValue(response,"infoMsg"),msg)for(aInfoMsg=[],aInfoMsg=msg.split("|"),i=0,len=aInfoMsg.length;i<len;++i)if(aInfoMsg[i]!=="")switch(i){case 0:this.msgChatBegun=aInfoMsg[i];break;case 1:this.msgPopUpWarn=aInfoMsg[i]}return err=this._getResponseValue(response,"err"),err&&(msg=this._getResponseValue(response,"errMsg")||err,this.msg=msg),this._getResponseValue(response,returnField)},_getCookie:function(n){for(var r=document.cookie.split("; "),i,t=0;t<r.length;t++)if(i=r[t].split("="),n==i[0])return unescape(i[1]);return null},_getResponseValue:function(n,t){var i="";try{i=n[t]}catch(r){}return i},_jsonp:function(n,t,i){n+=n.indexOf("?")>-1?"&callback=":"?callback=";n+=t+"&";i&&(n+=encodeURIComponent(i)+"&");n+=(new Date).getTime().toString();var r=document.createElement("script");r.setAttribute("src",n);r.setAttribute("type","text/javascript");document.body.appendChild(r)},_openChatInfoForm:function(n){var i,t=this.startOptions.window||{};this.sessionData=n||{};this.sessionData.mode="edit";this.sessionData.chatrequestor="initiator";this.sessionData.cssUrl=t.cssUrl||"";this.sessionData.MobileCssUrl=t.MobileCssUrl||"";this.sessionData.footerHtml=t.footerHtml||"";this.sessionData.headerHtml=t.headerHtml||"";this.sessionData.logoUrl=t.logoUrl||"";this.sessionData.title=t.title||"";this.sessionData.site=this.site||"";i=this.wsUrl+"webspeed/public/ntOpen.w?upHtmlFile=webspeed/public/chat/pubChatInfoForm.htm&"+this._urlEncode(this.sessionData);this.chatSessionWindow.location.replace(i);try{this.chatSessionWindow.closed||this.chatSessionWindow.focus()}catch(r){}},_openChatsession:function(){var t,n=this.startOptions.window||{};if(this.sessionData.mode="edit",this.sessionData.chatrequestor="initiator",this.sessionData.cssUrl=n.cssUrl||"",this.sessionData.MobileCssUrl=n.MobileCssUrl||"",this.sessionData.footerHtml=n.footerHtml||"",this.sessionData.headerHtml=n.headerHtml||"",this.sessionData.logoUrl=n.logoUrl||"",this.sessionData.title=n.title||"",this.sessionData.site=this.site||"",t=this.wsUrl+"webspeed/public/ntOpen.w?upHtmlFile=webspeed/public/chat/pubChatSession.htm&"+this._urlEncode(this.sessionData),this.chatSessionWindow.location.replace(t),this.chatSessionWindow&&!this.chatSessionWindow.closed)try{this.chatSessionWindow.focus()}catch(i){}},_postChatsessionComplete:function(jsonString){var err,errMsg,msg="",response,result,status,chatAvailable;this.chatStartInProcess=!1;try{result=eval(jsonString);response=result.wtResponse}catch(e){return this.msgUnavailable&&(this.status="offline",this.msg=this.msgUnavailable,this.statusCallback.call()),!1}if(err=this._getResponseValue(response,"err"),err)return msg=this._getResponseValue(response,"errMsg")||err,this.status="offline",this.msg=msg,this.statusCallback&&this.statusCallback.call(),!1;chatAvailable=this._copyDataFromServer(response);chatAvailable&&this._openChatsession()},_setCookie:function(n,t,i){var r=new Date;r.setDate(r.getDate()+i);document.cookie=n+"="+escape(t)+";path=/"+(i==null?"":";expires="+r.toGMTString())},_urlEncode:function(n){var t,f,r,o;if(!n)return"";t=[];for(f in n){var i=n[f],u=encodeURIComponent(f),e=typeof i;if(e=="undefined")t.push(u,"=&");else if(e!="function"&&e!="object")t.push(u,"=",encodeURIComponent(i),"&");else if(i.constructor.toString().indexOf("Array")>-1)if(i.length)for(r=0,o=i.length;r<o;r++)t.push(u,"=",encodeURIComponent(i[r]===undefined?"":i[r]),"&");else t.push(u,"=&")}return t.pop(),t.join("")}}}();Wt.chat.PublicChat.enablePublicChat=!0;Wt.chat.PublicChat.crsChatSystem="";chatURL="https://h6.consumercare.net/scripts/kcc.wsc";companyName="Kimberly Clark";window.location.href.indexOf("www")>-1?(chatURL="https://h6.consumercare.net/scripts/kcc.wsc",companyName="Kimberly Clark"):(chatURL="https://h6.consumercare.net/scripts/testkcc.wsc",companyName="Kimberly Clark TEST");Wt.chat.PublicChat.wsUrl=chatURL;Wt.chat.PublicChat.companyName=companyName;isChatServiceAvailable=!1;testStatus=function(){return chat.status=="ready"?(isChatServiceAvailable=!0,!0):(isChatServiceAvailable=!1,!1)};$(".liveChat").on("click",function(){var i,n,t;isChatServiceAvailable?chat.start({info:{product:"Depend"}}):(i=window.open("","chatWindow","top=100,left=100,height=670,width=375,menubar=0,resizable=0,location=0,status=0,scrollbars=0"),n="",n+="<html><head><title>Popup<\/title><link href='/../../assets/styles/livechat/chat.css' rel='stylesheet' /><\/head>",t=chat.msg,(t==null||t=="")&&(t="Live chat is currently unavailable.  Please check back with us later or you can call 1-877-413-3736."),n+="<body><div id='offTitle'><span><em>Sorry.<\/em><\/span><\/div><div id='offMessage'>"+t+"<\/div><\/body>",n+="<\/html>",i.document.write(n))});var cssFilePath="/assets/styles/livechat/livechatstyle.css",cssFile="https://"+window.location.host+cssFilePath,mobileCSSFile="https://"+window.location.host+"/assets/styles/livechat/livechat_mobile.css",siteName="www.depend.com";siteName=window.location.href.indexOf("/en-ca")>-1?"www.depend.com/en-ca":window.location.href.indexOf("/fr-ca")>-1?"www.depend.com/fr-ca":"www.depend.com/en-us";chat=Wt.chat.PublicChat;chat.init({site:siteName,statusCallback:testStatus,startOptions:{window:{top:100,left:100,width:375,height:670,cssUrl:cssFile,MobileCssUrl:mobileCSSFile,logoUrl:"",headerHtml:"",footerHtml:"<p>Your comments will be treated in confidence.<\/p>",title:"Chat with a Live Representative! "},initialText:"init_text",info:{subject:"Depend"}}})