function ConnectionSignalR(){var n=$("#hdnSatisfiWebApiUrl").val()+"signalr";SignalrConnection=$.hubConnection(n,{useDefaultPath:!1});chatConnection=SignalrConnection.createHubProxy("ChatHub");SuperSolver.MessageMain.SignalRConnected();CreateConnection();SignalrConnection.disconnected(function(){isFailed||UserSignalRDisconnected()});SignalrConnection.reconnecting(function(){console.log("Reconnecting to server")});SignalrConnection.reconnected(function(){console.log("Reconnected");var n={SourceApp:1,SubmissionFeedbackId:$("#submittedFeedbackId").val(),CompanyId:$("#hdnCompanyId").val(),CustomerId:$("#hdnSatisfiCustID").val(),CompanyApiKey:$("#hdnCompanyApiKey").val()};chatConnection.invoke("getFeedbackId",n);SuperSolver.MessageMain.GetMessages();SendUnSendMessages()})}function UserSignalRDisconnected(){typeof Worker!="undefined"?worker.postMessage("start_reconnect_signalr"):(console.log("disconnected due to some reason!!!"),isFailed=!1,attemptedToConnect++,CreateConnection(!0))}function SendUnSendMessages(){unsendMessages&&$.each(unsendMessages,function(){SuperSolver.MessageMain.SendMessageToServer(this)})}function CheckSignalRConnection(){currentConnectionCounter++;var n=$("#hdnSatisfiWebApiUrl").val()+"api/signalRConnectivity?connectionId="+$("#hdnConnectionIdSignalR").val();$.ajax({type:"POST",url:n,contentType:"application/json",crossDomain:!0})}function CreateConnection(n){attemptedToConnect===0&&setTimeout(function(){isPageOpened||(console.log("Page Initate Method Name: CreateConnection, File Name: CommonSPA.js"),PageInitAfterConnection())},7e3);(n||!pageLoaded)&&SignalrConnection.start().done(function(){var t,i;if(SendUnSendMessages(),console.log("SignalR Started"),t=Number(getParameterByName("locationId")),pageId!==0||t!==0?GetCustomerFeedbackId(Number($("#hdnSatisfiCustID").val()),pageId,t):RedirectToPageNotFound(),n&&$('.Page[data-page="FeedbackMessagesWithChat"]').css("display")=="block"){worker.postMessage("stop_reconnect_signalr");console.log("Reconnected and on Chat page and try to get updated messages");try{i={SourceApp:1,SubmissionFeedbackId:$("#submittedFeedbackId").val(),CompanyId:$("#hdnCompanyId").val(),CustomerId:$("#hdnSatisfiCustID").val(),CompanyApiKey:$("#hdnCompanyApiKey").val()};chatConnection.invoke("getFeedbackId",i);console.log("Reconnected and on Chat page and try to get updated messages");SuperSolver.MessageMain.GetMessages()}catch(r){}}clearInterval(signalrInterval);signalrInterval=setInterval(function(){signalRCurrentCounter!==currentConnectionCounter?(currentConnectionCounter=0,signalRCurrentCounter=0,SignalrConnection.stop(),CreateConnection(!0)):CheckSignalRConnection()},1e4)}).fail(function(){isFailed=!0;console.log("SignalR Failed");typeof Worker!="undefined"&&(attemptedToConnect++,setTimeout(function(){attemptedToConnect<attemptToConnect?CreateConnection(n):ShowAlert("Unable to Connect to chat server due to some connection issues.")},1e4))})}function getParameterByName(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)","i"),t=i.exec(location.search);return t==null?SuperSolver.HeaderInfo[n.toLowerCase()]?SuperSolver.HeaderInfo[n.toLowerCase()]:"":decodeURIComponent(t[1].replace(/\+/g," "))}function inIframe(){try{return window.self!==window.top}catch(n){return!0}}function PageInitAfterConnection(){console.log("Page Initate Started. Method Name: PageInitAfterConnection, File Name: CommonSPA.js");isPageOpened=!0;SuperSolver.Search.Init(Number(getParameterByName("locationId")));SuperSolver.MessageMain.Init();BindNavigationMenuEvent();pageLoaded=!0;worker.onmessage=function(n){var t=n.data;if(t=="reconnect_signalr")SignalrConnection.state==4?CreateConnection(!0):worker.postMessage("stop_reconnect_signalr");else if(t=="is_page_active")worker.postMessage("page_active");else return}}function GetCustomerFeedbackId(n,t,i){try{var r={SourceApp:1,SubmissionFeedbackId:"",CompanyId:0,CustomerId:n,CompanyApiKey:""};$.ajax({type:"GET",url:"api/Home/RetrieveSubmittedFeedbackId?customerId="+n+"&pageId="+t+"&locationId="+i,success:function(t){if(t.Success){var i={SourceApp:1,SubmissionFeedbackId:t.customerFeedbackId,CompanyId:t.companyId,CustomerId:n,CompanyApiKey:t.companyApiKey};t.customerUnreadFeedbackId.trim()&&$("#hdnNewMessagesFeedbackIds").val(t.customerUnreadFeedbackId);chatConnection.invoke("getFeedbackId",i)}},error:function(u,f,e){console.log("Error Method Name: GetCustomerFeedbackId, File Name: CommonSPA.js");chatConnection.invoke("getFeedbackId",r);LogErrorClientSide("CommonSPA.js , Method Name : GetCustomerFeedbackId,Error: "+u.responseText+" request : "+JSON.stringify(request)+", Ajax Error: "+e+",customerId : "+n+",pageId : "+t+", locationId : "+i+", xhr: "+u+", status: "+f+", error: "+e)}})}catch(u){chatConnection.invoke("getFeedbackId",r);LogErrorClientSide("CommonSPA.js , Method Name : GetCustomerFeedbackId, Error: "+u.message)}}function ConvertShortUrlToActualUrlAndRedirect(n){window.SuperSolver.Loader.Show();$.ajax({type:"GET",url:"api/Messages/RetrieveUrlFromDatabase?shortUrl="+n,async:!0,success:function(n){n&&n.success&&n.realUrl!=""&&(window.location.href=n.realUrl)},complete:function(){window.SuperSolver.Loader.Hide()}})}function BindNavigationMenuEvent(){$(".MenuView li").click(function(n){var t=$(n.target).parent().attr("Id");switch(t){case"liHistoryLink":HideMenu();DeleteCookie("CurrentSubmissionIdForLoadChat");History.showMenu();SuperSolver.MessageMain.LoadFeedbacks(!0);break;case"liNewRequestLink":GetParameterByName("view").trim().toUpperCase()==="MESSAGES"&&DeleteMaintainStateAndRedirectToPageId();$("#chatThemeLink").removeAttr("href");HideMenu();GetCookie("LoadPage")=="true"?RedirectToSelectComplaintPage():(SetCookie("NewButtonClicked","true"),SuperSolver.Search.HandleLocationAndPageFunctionality(Number(getParameterByName("locationid")),!0),setContainerMinMaxSize.setMinMaxSize());break;case"liPrivacyPolicyLink":ShowLegalMenu()}})}function LogErrorClientSide(n){try{$.getJSON("api/Home/LogError",{message:n})}catch(t){console.log(t.message)}}function LogEventDetails(n){try{$.postJSON("api/Home/SaveEventDetail",{eventLogger:n})}catch(t){LogErrorClientSide(t.message)}}function RedirectToSelectComplaintPage(){DeleteCookie("LoadPage");ShowAllDefaultMenus();SetCookie("NewButtonClicked","true",1);SuperSolver.Search.HandleLocationAndPageFunctionality(Number(getParameterByName("locationid")),!0);setContainerMinMaxSize.setMinMaxSize();SuperSolver.IsSubmissionDone=!1}function AppendIfPrimaryPresent(n){return n.indexOf("?")>-1?"&":"?"}function HideMenu(){$(".MenuView").hide();$("body").removeClass("ShowMenu")}function ShowAlert(n,t,i,r){$("#divAlertText").html(n);$("#showAlertModal").modal("show");$("#showAlertModal .modalHeaderText").html(typeof t!="undefined"&&t!=""?t:companyDisplayName);$("#showAlertModal .btnAlertOk").html(typeof i!="undefined"&&i!=""?i:"Ok");typeof r!="undefined"&&r!=""&&$("#showAlertModal .btnAlertOk").click(function(){r()})}function ShowModal(n){$("#"+n).modal("show")}function HideModal(n){$("#"+n).modal("hide")}function ShowConfirmationModal(n,t,i,r,u,f){n.length>75&&$("#showConfirmModal .modal-body").css("overflow","auto");$("#divConfirmText").html(n);$("#showConfirmModal").modal("show");$("#showConfirmModal .modalHeaderText").html(typeof t!="undefined"&&t!=""?t:companyDisplayName);$("#showConfirmModal .btnConfirmOk").html(typeof i!="undefined"&&i!=""?i:"Ok");$("#showConfirmModal .btnConfirmCancel").html(typeof i!="undefined"&&i!=""?r:"Cancel");typeof u!="undefined"&&u!=""&&$("#showConfirmModal .btnConfirmOk").click(function(){u()});typeof f!="undefined"&&f!=""&&$("#showConfirmModal .btnConfirmCancel").click(function(){f()})}function MaxLengthCheck(n){n.value.length>n.maxLength&&(n.value=n.value.slice(0,n.maxLength))}function UpdateLocation(n){SuperSolver.Location=n;console.log(SuperSolver.Location);SuperSolver.Search.ConfigureNextButtonTexts()}function BindMenuItems(n){getParameterByName("locationId")>0||getParameterByName("pageId")>0?($("#liStartMenuLink").addClass("noDisplay"),$("#liNewRequestLink").removeClass("noDisplay")):($("#liStartMenuLink").removeClass("noDisplay"),$("#liNewRequestLink").addClass("noDisplay"));$("#showSatisfiLegalLinks").val(n.showSatisfiLegalLinks);$("#showCustomLegalLinks").val(n.showCustomLegalLinks);(n.showSatisfiLegalLinks||n.showCustomLegalLinks)&&$(".privacyPolicyLinks").removeClass("noDisplay");n.showCustomLegalLinks&&AppendCustomLegalEntries()}function RemoveLastBackpgAndRedirect(){var n=location.href;n.indexOf("backpg")>-1&&(location.href=GetNewUrlWithLastPackpgRemoved(n))}function GetMaxBackpgIndex(n){var i=n.substring(n.indexOf("backpg"),n.length),t=i.match(/[^[\]]+(?=])/g);return t=t.filter(function(n){return!isNaN(parseInt(n))}),Math.max.apply(Math,t)}function GetNewUrlWithLastPackpgRemoved(n){var t=GetMaxBackpgIndex(n),i=getParameterByName("backpg["+t+"]");return UpdateQueryStringParameter(n.substring(0,n.lastIndexOf("&backpg")),"pageId",i)}function UpdateQueryStringParameter(n,t,i){var r=new RegExp("([?&])"+t+"=.*?(&|$)","i"),u=n.indexOf("?")!==-1?"&":"?";return n.match(r)?n.replace(r,"$1"+t+"="+i+"$2"):n+u+t+"="+i}function GetMenuItemValues(){var n=0,t=0;getParameterByName("locationId")!=null&&getParameterByName("locationId").length!==0&&(t=getParameterByName("locationId"));getParameterByName("pageId")!=null&&getParameterByName("pageId").length!==0&&(n=getParameterByName("pageId"));$.getJSON("api/Home/GetMenuDetails",{pageId:n,locationId:t},function(n){n&&($("#newMenuLink").html(n.MenuLabelNew!==null&&n.MenuLabelNew.length!==0?n.MenuLabelNew:"New"),$("#historyMenuLink").html(n.MenuLabelHistory!==null&&n.MenuLabelHistory.length!==0?n.MenuLabelHistory:"History"),$("#privacyMenuLink").html(n.MenuLabelLegal!==null&&n.MenuLabelLegal.length!==0?n.MenuLabelLegal:"Privacy & Legal Policies"))})}function InputPayload(n){this.payload=new Payload(n)}function Payload(n){this.payload_version="20180416.01";this.action=n.Action;this.event_guid=$("#hdnEventGroupId").val();this.keys=new Key(n.CompanyID,$("#hdnSatisfiCustID").val(),n.PageID,n.CategoryID,n.UserNearSection,GetCurrentChainId(),GetCookie("customerCookieId"),n.AraId,n.FeedbackId);n.SelectedComplaints!=undefined&&(this.items=GetSelectedComplaintsForAPI(n.SelectedComplaints));this.additional_info=new AdditionalInfo(n.FirstName,n.LastName,n.UserEmail,n.MobileNumber,n.CustomFieldLabel,n.CustomFieldValue,n.UserLat,n.UserLng,n.UserAgent,n.ResolutionX,n.ResolutionY,n.AdditionalFeedback);n.Messages!=undefined&&(this.messages=GetComplaintMessages(n.Messages));this.settings=new Settings(n.SenderDisplayName);this.connection_id=$("#hdnConnectionIdSignalR").val()}function Settings(n){this.sender_display_name=n}function ButtonClickPayload(n){this.label=n.Label;this.response=n.Response;this.action=n.Action;this.contents=n.Contents}function SelectionConfirmPayload(n){this.selection_type=n.SelectionType;n.Selections!=undefined&&n.Selections!==""&&(this.selections=new Selections(n.Selections))}function Selections(n){this.selection_num=n.SelectionNum;this.label=n.Label;this.response=n.Response}function AdditionalInfo(n,t,i,r,u,f,e,o,s,h,c,l){this.first_name=n;this.last_name=t;this.email=i;this.mobile=r;this.custom_field_label=u;this.custom_field_value=f;this.user_lat=e;this.user_lng=o;this.user_agent=s;this.resolution_x=h;this.resolution_y=c;this.additional_feedback=l;this.user_ip=$("#hdnUserIPAddress").val()}function ComplaintItem(n,t,i){this.item_id=n;this.item_label=t;this.item_entry_text=i}function Key(n,t,i,r,u,f,e,o,s){this.company_id=n;this.customer_id=t;this.page_id=i;this.form_id=r;this.area=u;this.chain_id=f;this.customer_cookie=e;this.ara_id=o;this.submittedfeedback_id=s;this.source_type="Ara"}function ComplaintMessage(n,t,i,r,u,f){this.message_id=n;this.msg_type_id=t;this.message_text=i;this.message_guid=r;this.button_click_payload=u;this.selection_confirm_payload=f}function GetComplaintMessages(n){for(var i=[],t=0;t<n.length;t++)i.push(new ComplaintMessage(n[t].MessageId,n[t].MsgTypeId,n[t].MessageText,n[t].MessageGuid,n[t].ButtonClickPayload,n[t].SelectionConfirmPayload));return i}function GetSelectedComplaintsForAPI(n){function f(n){n=parseInt(n);t=t.filter(function(t){return t.item_id!==n})}function u(n,i){n=parseInt(n);t.every(function(t){return t.item_id==n?(t.item_entry_text=i,!1):!0})}var t=[],r=[],i;if($(".divTextEntry ul li.CSel,.divTextEntry ul li input:not(.enableTextEntry),.divTextEntry ul li textarea:not(.enableTextEntry)").each(function(){if($(this).find("input").length===1){var n=$(this).find("input");n.css("display")=="inline-block"&&n.parent().css("display")!="none"&&n.val()&&t.push(new ComplaintItem(n.attr("subComplaintId"),n.attr("placeholder"),n.val()))}else $(this).css("display")=="inline-block"&&$(this).parent().css("display")!="none"&&($(this).is("textarea")||$(this).is("input")?$(this).val()&&t.push(new ComplaintItem($(this).attr("subComplaintId"),$(this).attr("placeholder"),$(this).val())):t.push(new ComplaintItem($(this).attr("subComplaintId"),$(this).attr("placeholder"),$(this).html())))}),t.length===0){for(i=0;i<n.length;i++)n[i].enableTextEntry||(r.push(n[i].SubComplaintTypeID),t.push(new ComplaintItem(n[i].SubComplaintTypeID,n[i].sub_name,n[i].sub_name)));$("input[subComplaintId], textarea[subComplaintId]").each(function(){$(this).css("display")=="inline-block"&&$(this).parent().css("display")!="none"&&($(this).val().length==0?f($(this).attr("subComplaintId")):$(this).val().length!=0&&($(this).parent().hasClass("CSel")||!$(this).hasClass("enableTextEntry"))?r.indexOf(Number($(this).attr("subComplaintId")))===-1?(r.push(Number($(this).attr("subComplaintId"))),t.push(new ComplaintItem($(this).attr("subComplaintId"),$(this).attr("placeholder"),$(this).val(),$(this).attr("placeholder"),$(this).val()))):u($(this).attr("subComplaintId"),$(this).val()):$(this).val().length!=0&&u($(this).attr("subComplaintId"),$(this).val()))})}return console.log(JSON.stringify(t)),t}function HideAlert(){$(".modal-box, .modal-overlay").fadeOut(500,function(){$(".modal-overlay").remove()})}function StopEvent(n){n.preventDefault();n.stopPropagation()}function GetGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=Math.random()*16|0,i=n=="x"?t:t&3|8;return i.toString(16)})}function StartSaveSession(){setInterval(function(){SaveSession(GetCurrentChainId(),GetParameterByName("pageId"))},1e4)}function GetParameterByName(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)","i"),t=i.exec(location.search);return t==null?SuperSolver.HeaderInfo[n.toLowerCase()]?SuperSolver.HeaderInfo[n.toLowerCase()]:"":decodeURIComponent(t[1].replace(/\+/g," "))}function GetMaxBackpgIndex(n){var i=n.substring(n.indexOf("backpg"),n.length),t=i.match(/[^[\]]+(?=])/g);return t=t.filter(function(n){return!isNaN(parseInt(n))}),Math.max.apply(Math,t)}function AppendBackPageQuerystring(n,t,i){var r,u,s,h,c,l,f,e,o;return t===""?n:(r=1,n.toLowerCase().indexOf("pageid")>-1&&(c="pageid".replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),l=new RegExp("[\\?&]"+c+"=([^&#]*)","i"),f=l.exec(n),e=f===null?"":decodeURIComponent(f[1].replace(/\+/g," ")),e!=""&&Number(e)===Number(t)))?n:n.indexOf("backpg")!==-1&&(o=n.toLowerCase().split("backpg"),Number(o[o.length-1].split("=")[1].split("&")[0])===Number(t))?n:(i=typeof i!="undefined"&&i,n!=""&&typeof n!="undefined"&&(location.href.indexOf("backpg")>-1&&!i&&(n=AppendQuerystring(n,"?"+location.href.substring(location.href.indexOf("backpg"),location.href.length))),n.indexOf("backpg")>-1&&(r=GetMaxBackpgIndex(n)+1),r===11&&(r=10,u=n.substring(n.indexOf("backpg"),n.length).split("&"),$.each(u,function(n,t){if(n===9)return!1;s=t.split("=");u[n]=s[0]+"="+u[n+1].split("=")[1]}),u.pop(),h=u.join("&"),n=n.replace(n.substring(n.indexOf("backpg"),n.length),h)),n=n.indexOf("?")>-1?n+"&backpg["+r+"]="+t:n+"?backpg["+r+"]="+t),n)}function RemoveURLParameter(n,t){var u=n.split("?"),f,i,r;if(u.length>=2){for(f=encodeURIComponent(t)+"=",i=u[1].split(/[&;]/g),i=jQuery.map(i,function(n){return n.toLowerCase()}),r=i.length;r-->0;)i[r].lastIndexOf(f,0)!==-1&&i.splice(r,1);return u[0]+"?"+i.join("&")}return n}function SavePageEvent(n,t,i,r,u,f,e){var o=new PageEvents(n,t,i,r,u,f,document.referrer,e===undefined?window.location.href:e);jQuery.ajax({type:"POST",url:"/api/Home/SavePageEvent",context:document.body,traditional:!0,data:o})}function GetCurrentChainId(n){var t=GetCookie("PageTrackChainId");return(typeof t=="undefined"||t=="")&&(t=GetGuid(),SetChainIdInCookieAndCreateSession(t,n==undefined?GetParameterByName("pageid"):n)),t}function AppendQuerystring(n,t){return t==="?"?n:(n!=""&&typeof n!="undefined"&&(n=n.indexOf("?")>-1?n+t.replace("?","&"):n+t),n)}function RemoveAllBackPgParams(n){var t=n.match(/backpg\[(.*?)\]/g);return t==null?n:($.each(t,function(t,i){n=RemoveURLParameter(n,i.toUpperCase(),!1)}),n)}function PageEvents(n,t,i,r,u,f,e,o){this.ChainId=n;this.PageId=t;this.EventType=i;this.Details=r;this.DestPageId=u;this.SubmittedFeedbackId=f;this.Url=o;this.ReferralUrl=e}function RedirectToPageNotFound(){if(document.referrer==="")$("#ancPageNotFoundGoBack").hide();else{var n=location.href.indexOf("backpg")>-1?GetNewUrlWithLastPackpgRemoved(location.href):document.referrer;$("#ancPageNotFoundGoBack").attr("href",n)}$(".Page").hide();$(".Page[data-page=PageNotFound]").css("display","table");$(".loader").addClass("noDisplay");$("#divMainContainer").removeClass("noDisplay")}function LoadThemeWithPageId(n,t){var i,r;$.ajax({type:"GET",async:!0,url:"/api/Home/GetPageThemeDetails?pageId="+n,success:function(n){n.success&&n.page!=null&&n.page.IsUseThemes&&(i="pagetheme-"+n.page.ThemeId+".css",r=$("#hdnAWSServerURL").val()+$("#hdnAWSThemeFolder").val()+i+"?version="+n.page.VersionNo,$("#"+t).attr("href",r),$("body").css("visibility","visible"),$(".icon-menu").html(n.page.MenuCode),$("#IsUseThemes").val(!0))},error:function(){console.log("Unable to Get Page theme details")}})}function SetCookie(n,t,i){var r=new Date,u;r.setTime(r.getTime()+i*864e5);u="expires="+r.toUTCString();document.cookie=n+"="+t+"; "+u+";SameSite=None; Secure;"}function GetCookie(n){var u=n+"=",r,t;for(r=document.cookie.split(";"),i=0;i<r.length;i++){for(t=r[i];t.charAt(0)==" ";)t=t.substring(1);if(t.indexOf(u)==0)return t.substring(u.length,t.length)}return""}function DeleteCookie(n){document.cookie=n+'=; expires=Thu, 01 Jan 1970 00:00:01 GMT;SameSite=None; Secure;"'}function getParameterByName(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)","i"),t=i.exec(location.search);return t==null?SuperSolver.HeaderInfo[n.toLowerCase()]?SuperSolver.HeaderInfo[n.toLowerCase()]:"":decodeURIComponent(t[1].replace(/\+/g," "))}function SetChainIdInCookieAndCreateSession(n){SetCookie("PageTrackChainId",n,24)}function SaveSession(n,t){var i=new PageEvents(n,t,"","",0,0,document.referrer,window.location.href);jQuery.ajax({type:"POST",url:"/api/Home/SaveSession",traditional:!0,context:document.body,data:i})}function GetLookupValue(n,t,i,r){var u={lookupGroup:t,lookupKey:i};$.ajax({type:"POST",url:"/api/Home/GetLookupValue",async:n,data:u,success:function(n){n.Success&&r(n)}})}function LoadChatOrHistoryIfRequired(){var n=GetParameterByName("view");n!=""&n.trim().toUpperCase()==="MESSAGES"&&(DeleteCookie("CurrentSubmissionIdForLoadChat"),SuperSolver.MessageMain.LoadFeedbacks(!1),SuperSolver.MessageMain.ShowPage("FeedbackMessagesWithChat"),getParameterByName("submittedfeedbackid").length===0&&(History.showMenu(),History.showMessages()))}function MarkFeedbackReadByCustomer(n){$.get("api/Messages/MLBMarkFeedbackReadByCustomer?FeedbackID="+n)}function ShowLegalOnly(){$(".MenuViewInner ul:not(.legalLinks) li").hide();$("ul.MenuNav, #liPrivacyPolicyLink").css({"padding-top":"0","padding-bottom":"0"});$("#liPrivacyPolicyLink").show()}function ShowAllDefaultMenus(){$(".MenuViewInner ul li:not(.noDisplay)").show()}function DeleteMaintainStateAndRedirectToPageId(){DeleteCookie("MaintainStatePageView"+GetParameterByName("pageId"));var n=RemoveURLParameter(window.location.href,"submittedfeedbackid");window.location.href=RemoveURLParameter(n,"view")}function ShowNotification(){$("#hdnNewMessagesFeedbackIds").val().trim().length!==0?isSuppressNotification||($("#newMessageAvailable span").html(SuperSolver.NewMessageLabel),$("#newMessageAvailable").fadeIn("Slow"),$(":button.NextBtn").attr("disabled",!0)):$("#newMessageAvailable").hide()}function ShowPage(n){$("html,body").animate({scrollTop:0},"fast");$(".loader").addClass("noDisplay");$("#divMainContainer").removeClass("noDisplay");$(".Page").hide();$('.Page[data-page="'+n+'"]').show();$('.Page[data-page="'+n+'"]').removeClass("noDisplay");n!=="Feedbacks"&&n!=="LocationSelection"&&n!=="ConfirmComplaint"&&SetCookie("MaintainStatePageView"+GetParameterByName("pageId"),n,24);$("body").removeClass("ShowMenu");setContainerMinMaxSize.setMinMaxSize();n==="FeedbackMessagesWithChat"&&SuperSolver.MessageMain.MessagingAreaSize();ShowNotification()}function ShowNotifyAlert(n){var t;$("body").append("<div class='modal-overlay js-modal-close'><\/div>");$(".modal-overlay").fadeTo(500,.7);$("#notifyAlertMessageFor").html(n);t=$("#ancNotifyAlert").attr("data-modal-id");$("#"+t).fadeIn($("#ancNotifyAlert").data());$(".modal-overlay").height($(document).height());$("#ancNotifyAlert").show()}function HideNotifyAlert(){$("#divNotifyAlertModalBox").fadeOut(500)}function BrowseFile(){$("#fileUpload").trigger("click")}function BytesToSize(n){var t;return n==0?"0 Byte":(t=parseInt(Math.floor(Math.log(n)/Math.log(1024))),Math.round(n/Math.pow(1024,t),2)+" "+["Bytes","KB","MB","GB","TB"][t])}function DeleteCurrentFeedback(){$("span.ChatActionLink").trigger("click")}function ImagefileUploadChange(n){SuperSolver.MessageMain.ImagefileUpload(n)}function SetQuickReplyArrowPosition(){var n=$(".GeneralUI-QuickReply").css("font-size");n==="17px"||n==="18px"?SetArrowPostionAndFont("53px",n):n==="16px"||n==="15px"?SetArrowPostionAndFont("50px",n):n==="14px"?SetArrowPostionAndFont("47px",n):n==="12px"||n==="13px"?SetArrowPostionAndFont("45px",n):n==="10px"||n==="11px"?SetArrowPostionAndFont("43px",n):SetArrowPostionAndFont("55px",n)}function SetArrowPostionAndFont(n,t){$("#left-button").css("top",n).css("font-size",t);$("#right-button").css("top",n).css("font-size",t)}function ClosePreviewPhoto(){$(".Container").show();$("#tblPhotoPreviewWrapper").addClass("noDisplay");$("body>#tblPhotoPreviewWrapper").addClass("noDisplay");$(window).scrollTop(parseInt($("#hdnContainerScrollPos").val()))}function AppendCustomLegalEntries(){var n=0,t=0,i=JSON.parse($("#showSatisfiLegalLinks").val()),r=JSON.parse($("#showCustomLegalLinks").val());getParameterByName("locationId")!=null&&getParameterByName("locationId").length!==0&&(t=getParameterByName("locationId"));getParameterByName("pageId")!=null&&getParameterByName("pageId").length!==0&&(n=getParameterByName("pageId"));$.getJSON("api/Home/GetCompanyCustomLegalEntries",{locationId:t,pageId:n},function(n){if(n.success){if(n.customLegalEntries!=null&&n.customLegalEntries.length>0){var t="";$.each(n.customLegalEntries,function(n,u){(Number(u.CompanyId)===0&&i||Number(u.CompanyId)!==0&&r)&&(t+="<li class='Menu-ItemDividers'><a class='Menu-Items' target='_blank' href="+u.Url+">"+u.DisplayText+"<\/a><\/li>")});$(".legalLinks").html(t)}isCustomLegalLoaded=!0}})}function ShowLegalMenu(){$("body").addClass("ShowLegal");$(".menuData").addClass("noDisplay");$("#legalMenu").removeClass("noDisplay")}function getParameterByName(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)","i"),t=i.exec(location.search);return t==null?SuperSolver.HeaderInfo[n.toLowerCase()]?SuperSolver.HeaderInfo[n.toLowerCase()]:"":decodeURIComponent(t[1].replace(/\+/g," "))}var additionalInfoEnum={Never:0,OptionalAlwaysShow:1,RequiredAlwaysShow:2,OptionalShowifMissing:3,RequiredShowifMissing:4,RequireifMobileBlankAlwaysShow:5,RequireifEmailBlankAlwaysShow:6,RequireifMobileBlankShowifMissing:7,RequireifEmailBlankShowifMissing:8},sourceApp={Mobile:1},SignalRStatus={Connecting:0,Connected:1,Reconnecting:2,Disconnected:4},submissionRequestTypes={Submit:"SUBMIT",MsgToCustomer:"MSG-TO-CUSTOMER",MsgToAra:"MSG-TO-ARA",MsgToBusiness:"MSG-TO-BUSINESS"},SignalrConnection,chatConnection,pageId=Number(getParameterByName("pageId")).toString()=="NaN"?0:Number(getParameterByName("pageId")),isReloadModalOpen=!1,attemptToConnect=1e5,attemptedToConnect=0,intervalToConnectSignalr,pageInitiated=!1,isFailed=!1,pageLoaded=!1,pingSignalRClient,isSuppressNotification=!0,satisfiURL="http://biz.satis.fi/",companyDisplayName="",IframeHeight=0,scrollPositionUseInIframe=0,worker,placeHolderValue="Typing Message",unsendMessages=[],currentConnectionCounter=0,signalRCurrentCounter=0,signalrInterval,isPageOpened=!1,timeIntervalForDayChange=Math.abs(new Date-new Date((new Date).getFullYear(),(new Date).getMonth(),(new Date).getDate(),24,0,0)),History,CustomScriptPlaceTypes,isCustomLegalLoaded;$(document).ready(function(){if(window.onfocus=function(){CreateConnection(!0)},$("#hdnSatisfiWebApiUrl").val(SuperSolver.WebApiUrl),$.ajaxSetup({beforeSend:function(n){n.setRequestHeader("EventGroupId",$("#hdnEventGroupId").val())}}),$(".demo-icon.GeneralUI-ChatBubbleEndUserHeading").attr("style","font-family: satisfi !important"),DeleteCookie("NewButtonClicked"),window.location.href.toLowerCase().indexOf("backpg[")!==-1?$(".Page[data-page='FeedbackMessagesWithChat'] .PrevBtn, .Page[data-page='ResponsePage'] .PrevBtn").removeClass("noDisplay"):$(".Page[data-page='FeedbackMessagesWithChat'] .PrevBtn, .Page[data-page='ResponsePage'] .PrevBtn").addClass("noDisplay"),inIframe()&&(isPageUnderIframe=!0),window.location.href.indexOf("?")!==-1){$(".MenuBackButton").attr("style","font-family : satisfi !important; font-size: 22px !important;");$(window).resize(function(){var n=$("#container1").width();$("#MenuPopUp").width(n)});$(".LeftBarRegion").click(function(){var n=$("#container1").width();$("#MenuPopUp").width(0);$("#MenuPopUp").animate({width:n},100)});var n=getParameterByName("url");DeleteCookie("SubmitInProcess");$("#hdnIsSafariSubmitInProcess").val("false");n.length>0?ConvertShortUrlToActualUrlAndRedirect(n):(typeof Worker!="undefined"&&(worker=new Worker("Content/Scripts/Worker.js")),ConnectionSignalR());window.addEventListener("message",function(n){var t=n.origin||n.originalEvent.origin;if(n.data&&typeof n.data!="object")if(n.data.toLowerCase().includes("set_height"))IframeHeight=Number(n.data.toLowerCase().split(":")[1]),IframeHeight>0&&$('.Page[data-page="FeedbackMessagesWithChat"]').css({"min-height":IframeHeight+"px",height:IframeHeight+"px",overflow:"auto"});else if(n.data.toLowerCase().includes("set_width_header"))setTimeout(function(){SuperSolver.MessageMain.MessagingAreaSize();$('.Page[data-page="FeedbackMessagesWithChat"]').css("display")=="block"&&$(window).scrollTop(localStorage.getItem("ScrollPosition-"+getParameterByName("pageId")))},500);else if(n.data.toLowerCase().includes("get_scroll"))localStorage.setItem("ScrollPosition-"+getParameterByName("pageId"),$(window).scrollTop());else if(n.data.includes("set_scroll_show_always"))$("body").css("overflow-y","scroll"),console.log("iframe overflow set");else return;else return},!1)}else window.location.href=satisfiURL});History={hideMenu:function(){$(".FeedbackMessageList").removeAttr("style");$("#container2 #divHistoryContainer").css("display","none");$('.Page[data-page="FeedbackMessagesWithChat"]').css("display")=="block"?(isPageUnderIframe&&isMobileDevice?$('.Page[data-page="FeedbackMessagesWithChat"]').css({position:"",height:IframeHeight+"px"}):$('.Page[data-page="FeedbackMessagesWithChat"]').css({position:"relative",height:""}),SuperSolver.MessageMain.IsMessagesArrayEmpty()||($(".ChatActionLink").removeClass("NoAct"),$('.Page[data-page="FeedbackMessagesWithChat"] .MessageBottomAction').removeClass("noDisplay"))):$('.Page[data-page="ResponsePage"]').css("display")=="block"?$('.Page[data-page="ResponsePage"]').css({position:"relative",height:""}):$("#container1 [data-page] .Content").css("position","relative");setTimeout(function(){$(window).scrollTop(scrollPositionForPages)},200)},showMessages:function(){$(".loaderMessage").addClass("noDisplay");$(".FeedbackList").removeClass("noDisplay")},hideMessages:function(){$(".FeedbackList").addClass("noDisplay");$(".loaderMessage").removeClass("noDisplay")},showMenu:function(){$(".FeedbackMessageList").css("overflow","hidden");$(".loaderMessage").removeClass("noDisplay");$(".FeedbackList").addClass("noDisplay");$("body").removeClass("ShowMenu");$('.Page[data-page="FeedbackMessagesWithChat"]').css("display")=="block"?$('.Page[data-page="FeedbackMessagesWithChat"]').css("height","100px"):$('.Page[data-page="ResponsePage"]').css("display")=="block"?$('.Page[data-page="ResponsePage"]').css("height","100px"):($("#container1 .Page:visible").length===0&&$('.Page[data-page="SelectComplaint"]').css({display:"block"}),$("#container1 [data-page] .Content").css("position","absolute"));$("#container2 #divHistoryContainer").css("display","block");$('.Page[data-page="Feedbacks"]').css({display:"block",opacity:"0.9",position:"absolute"});FeedbackPositionTop=$("#container2 #divTopBar").height()+8;$('.Page[data-page="Feedbacks"]').css({"padding-top":FeedbackPositionTop.toString()+"px"});$(".Page.history .Content").css("height",window.innerHeight-FeedbackPositionTop);$('.Page[data-page="FeedbackMessagesWithChat"] .MessageBottomAction').addClass("noDisplay");$(".ChatActionLink").addClass("NoAct")}};$(function(){var n="<div class='modal-overlay js-modal-close'><\/div>";$(document).on("click","a[data-modal-id]",function(t){t.preventDefault();$("body").append(n);$(".modal-overlay").fadeTo(500,.7);var i=$(this).attr("data-modal-id");$("#"+i).fadeIn($(this).data());$(".modal-overlay").css("height",$(document).height())});$(".js-modal-close, .modal-overlay").click(function(){$(".modal-box, .modal-overlay").fadeOut(500,function(){$(".modal-overlay").remove()})});$(".js-modal-close-cookie, .modal-overlay").click(function(){$(".modal-box, .modal-overlay").fadeOut(500,function(){$(".modal-overlay").remove();window.location.replace("blank.html")})});$(window).resize(function(){$(".modal-box").css({position:"fixed",top:$(window).height()/2-$(".modal-box").outerHeight()/2,left:$(window).width()/2-$(".modal-box").outerWidth()/2})});$(window).resize()});$(function(){$.ajaxSetup({beforeSend:function(n){n.setRequestHeader("EventGroupId",$("#hdnEventGroupId").val())}})}),function(n){Array.min=function(n){return Math.min.apply(Math,n)};Array.max=function(n){return Math.max.apply(Math,n)};SuperSolver.Loader=function(){var t=".LoadingWrapper",i=".Msg";return n(document).ready(function(){var r=n(i,t).height(),u=n(i,t).width(),f=n(window).height(),e=n(window).width();n(t).hide();n(i,t).css({left:(e-u)/2+"px",top:(f-r)/2+"px"})}),n(window).load(function(){n(t).hide()}),{Show:function(){},Hide:function(){}}}();(typeof console=="undefined"||typeof console.log=="undefined")&&(console={log:function(){}});window.LogConsole=function(n){console.log(n)};String.prototype.Capitalize=function(){return this.replace(/(^|\s)([a-z])/g,function(n,t,i){return t+i.toUpperCase()})};String.format=function(){for(var t=arguments[0],i,n=0;n<arguments.length-1;n++)i=new RegExp("\\{"+n+"\\}","gm"),t=t.replace(i,arguments[n+1]);return t};jQuery.fn.reset=function(){jQuery(this).each(function(){try{this.reset()}catch(n){}})};SuperSolver.IsValidEmail=function(n){return/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-zA-Z0-9]{1}[a-zA-Z0-9\-]{0,62}[a-zA-Z0-9]{1})|[a-zA-Z])\.)+[a-zA-Z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/.test(n)==!0}}(jQuery),function(n){n.isFunction(String.prototype.format)===!1&&(String.prototype.format=function(){for(var n=this,t=arguments.length;t--;)n=n.replace(new RegExp("\\{"+t+"\\}","gim"),arguments[t]);return n});n.isFunction(Date.prototype.toISOString)===!1&&(Date.prototype.toISOString=function(){var t=function(n,t){n=n.toString();for(var i=n.length;i<t;i++)n="0"+n;return n},n=this;return"{0}-{1}-{2}T{3}:{4}:{5}.{6}Z".format(n.getUTCFullYear(),t(n.getUTCMonth()+1,2),t(n.getUTCDate(),2),t(n.getUTCHours(),2),t(n.getUTCMinutes(),2),t(n.getUTCSeconds(),2),t(n.getUTCMilliseconds(),3))});var t=function(i,r,u,f){var e,o;if(n.isPlainObject(i))for(e in i)(f===!0||typeof i[e]!="undefined"&&i[e]!==null)&&t(i[e],r,u.length>0?u+"."+e:e,f);else{if(n.isArray(i)){n.each(i,function(n,i){t(i,r,"{0}[{1}]".format(u,n))});return}if(!n.isFunction(i))if(i instanceof Date)r.push({name:u,value:i.toISOString()});else{o=typeof i;switch(o){case"boolean":case"number":o=i;break;case"object":if(f!==!0)return;default:o=i||""}r.push({name:u,value:o})}}};n.extend({toDictionary:function(i,r,u){i=n.isFunction(i)?i.call():i;arguments.length===2&&typeof r=="boolean"&&(u=r,r="");u=typeof u=="boolean"?u:!1;var f=[];return t(i,f,r||"",u),f}})}(jQuery);CustomScriptPlaceTypes={BeforeBodyEndTag:"Before Body End Tag",AfterBodyEndTag:"After Body End Tag",Head:"Head"};var isMobileDevice=!1,isPageUnderIframe=!1,scrollPositionForPages,setContainerMinMaxSize=function(n){function i(){n(".MenuToggle").click(function(){t(!0)})}function t(t){function h(){var f=n(".MenuViewInner").height(),o=n(window).height(),t=f>o?f:o,h=s(e,"top"),c={minHeight:t-h+r,maxHeight:t-h+r},l=s(u,"bottom");i.css(c);e.css(c);u.css({minHeight:t-(82+l)+r})}function o(){var t=n(window).height(),f,o;isPageUnderIframe&&isMobileDevice&&IframeHeight!=0&&(t=IframeHeight);f={minHeight:t+r,maxHeight:""};o=s(u,"bottom");i.css(f);e.css(f);u.css({minHeight:t-(42+o)+r})}function s(n,t){var i=n.css("padding-"+t);return i==undefined?"40px":parseInt(i.replace(r,""))}var i=n("body"),e=n(".Page"),u=n(".Content"),f="ShowMenu",r="px";i.hasClass(f)?(t?(n(".MenuView").hide(),i.removeClass(f),n(".BottomAction").removeClass("absolutePosition"),o()):h(),n(window).scrollTop(scrollPositionForPages)):(scrollPositionForPages=n(window).scrollTop(),console.log(scrollPositionForPages),t?(n(".MenuView").show(),n(".menuData").removeClass("noDisplay"),n("#legalMenu").addClass("noDisplay"),i.addClass(f),n(".BottomAction").addClass("absolutePosition"),h()):o());n('.Page[data-page="ResponsePage"]').css("min-height",n(document).height());n(document).click(function(t){var r=n(t.target);r.parents().addBack().is(".MenuView")||r.parents().addBack().is(".MenuToggle")||(n(".MenuView").hide(),i.removeClass(f),n(".BottomAction").removeClass("absolutePosition"),o())})}return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(isMobileDevice=!0),n(window).bind("orienmenuDataationchange",function(){setTimeout(function(){t(!1)},200)}),n(window).bind("resize",function(){setTimeout(function(){t(!1)},200)}),n(document).ready(function(){n(".MenuView").hide();i();t(!1)}),{setMinMaxSize:function(){t(!1)}}}(jQuery);(function(){var n=function(){function r(){return i?!0:!1}function u(t){return r()?(i.getCurrentPosition(function(n){t({lat:n.coords.latitude,lng:n.coords.longitude},null)},function(i){var r=n.UNKNOWN_ERROR;if(i!=null)switch(i.code){case i.PERMISSION_DENIED:r=n.PERMISSION_DENIED;break;case i.POSITION_UNAVAILABLE:r=n.POSITION_UNAVAILABLE;break;case i.TIMEOUT:case i.PERMISSION_DENIED_TIMEOUT:r=n.TIMEOUT;break;case i.UNKNOWN_ERROR:r=n.UNKNOWN_ERROR}t(null,r)},{enableHighAccuracy:!1,timeout:15e3,maximumAge:6e4}),!0):!1}function f(n,i,r,u){var h,e,o,s,c,f;return h=6366.707019,e=t(r-n),o=t(u-i),s=Math.sin(e/2)*Math.sin(e/2)+Math.cos(t(n))*Math.cos(t(r))*Math.sin(o/2)*Math.sin(o/2),c=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)),f=h*c,f=f/1.609344,Math.ceil(f*10)/10}function t(n){return n*(Math.PI/180)}var i=navigator.geolocation;return{Location:function(n){return u(n)},Distance:function(n,t,i,r){return f(n,t,i,r)},PERMISSION_DENIED:"Your Location Services is off. Please turn it on.",POSITION_UNAVAILABLE:"Current location is currently unavailable.",TIMEOUT:"You took too long to grant/deny permission.",UNKNOWN_ERROR:"Cannot determine you current location."}}();SuperSolver.LocationManager=n})(jQuery),function(n){function i(){var n=this;n.Location=ko.observable("Current Location");n.BusinessName=ko.observable("");n.oldBusinessName="";n.Results=ko.observableArray();n.HasMore=ko.observable(!1);n.SelectedPlace=ko.observable(null);n.IsSelected=ko.observable(!1);n.HideBackInComplaint=ko.observable(!1);n.Latitude=null;n.Longitude=null;n.SelectedPage=ko.observable(null);n.SelectedLocatorPage=ko.observable(null);n.HideMenu=ko.observable(!1);n.HideBackButton=ko.observable(!1);n.SubmitButtonPlacement=ko.observable(0)}function r(){var n=this;n.PageId=0;n.PageName="";n.ThemeId=0;n.HeaderImage="";n.AutoLocHeadline1="";n.AutoLocHeadline2="";n.ManLocHeadline1="";n.ManLocHeadline2="";n.ResListHeadline1="";n.ResListHeadline2="";n.ManLocAddressEntryLabel="";n.ManLocSearchButtonLabel="";n.NoResultsMsg="";n.NoResultsButtonLabel="";n.ResListMaxResults=0;n.ResListMaxDistance=0;n.LocatorSearchPages=[];n.FilteredLocatorSearchPages=ko.observableArray();n.AutoLocateRecoveryPageId=0;n.AutoLocateRecoveryPageUrl="";n.PageMenuId=0;n.AutoLocateRecoveryPageName="";n.AutoSelectDistance=0;n.LoadLocatorSearchPage=function(n){SavePageEvent(GetCurrentChainId(),n.PageIdLocator,"RESULTS_CLICK",n.SearchPageName,n.PageIdSearch,0);location.href=n.PageIdSearchUrl}}function u(){var t=this;t.PageId=0;t.PageName="";t.ThemeId=0;t.HeaderImage="";t.UpperSectionLine1="";t.UpperSectionLine2="";t.UpperSectionLine3="";t.LowerSectionLine1="";t.LowerSectionLine2="";t.FooterLinkUrl="";t.FooterLinkLable="";t.LandingPageLinks=[];t.PageMenuId=0;t.HideNavButtons=!1;t.LandingPageLinkClick=function(t,i){n.ajax({type:"GET",url:"/api/Home/GetLandingPageLinkDetails?landingPageLinkId="+t.LandingPageLinkId,success:function(n){var t,r;n.success&&(n.landingPageLink.LandingPageLinkId==0||n.landingPageLink.IsHidden||n.landingPageLink.IsDisabled?ShowAlert("This button not currently available. Please press OK to refresh and try again.","","",function(){location.reload()}):(SavePageEvent(GetCurrentChainId(),i.PageId,"CLICK",n.landingPageLink.LinkLabel,n.landingPageLink.PageIdLink,0),t=RemoveURLParameter(location.search,"pageid").trim(),t=RemoveURLParameter(t,"view").trim(),r=SuperSolver.Search.RemoveAllBackPgParams(t),r=SuperSolver.Search.AppendQuerystring(n.landingPageLink.PageIdLinkUrl,r),location.href=AppendBackPageQuerystring(r,i.PageId)))}})}}function f(){var n=this;n.LocationID=ko.observable("");n.PageID=ko.observable("");n.CompanyID=ko.observable("");n.CategoryID=ko.observable("");n.UpperSectionLine3=ko.observable("");n.IsForceEmail=ko.observable(!1);n.IsShowEmail=ko.observable(!1);n.EmailPlaceholder=ko.observable("");n.LoggedInCustomerEmail=ko.observable("");n.LoggedInCustomerFirstName=ko.observable("");n.IsForceFirstName=ko.observable(!1);n.IsShowFirstName=ko.observable(!1);n.FirstNamePlaceholder=ko.observable("");n.LoggedInCustomerLastName=ko.observable("");n.IsForceLastName=ko.observable(!1);n.IsShowLastName=ko.observable(!1);n.LastNamePlaceholder=ko.observable("");n.LoggedInCustomerMobileNo=ko.observable("");n.IsForceMobileNo=ko.observable(!1);n.IsShowMobileNo=ko.observable(!1);n.MobileNoPlaceholder=ko.observable("");n.CustomFieldLabel=ko.observable("");n.IsForceCustomField=ko.observable(!1);n.IsShowCustomField=ko.observable(!1);n.CustomFieldPlaceholder=ko.observable("");n.CustomAdditionalCommentsLabel=ko.observable("");n.IsForceAdditionalCommentsField=ko.observable(!1);n.IsShowAdditionalCommentsField=ko.observable(!1);n.CustomAdditionalCommentsPlaceholder=ko.observable("");n.IsShowCustomerUploads=ko.observable(!1);n.IsForceEmailOrMobileNo=ko.observable(!1);n.name=ko.observable("");n.displayname2=ko.observable("");n.first_cat=ko.observable("");n.miles=ko.observable("");n.photo=ko.observable("");n.categories=ko.observableArray();n.complaint_types=ko.observableArray();n.selected_complaints=ko.observableArray();n.HideSelectedPlace=ko.observable(!1);n.MapFileName=ko.observable("");n.companyAreaList=ko.observable([]);n.selectedSection=ko.observable();n.EnableHeaderImage=ko.observable(!1);n.HeaderImage=ko.observable("");n.DisableChat=ko.observable(!1);n.ContinueButtonLabel=ko.observable("Next");n.SubmitButtonLabel=ko.observable("Submit");n.FooterImage=ko.observable("");n.ShowMapWhen=ko.observable(0);n.HeaderImage2=ko.observable("");n.CustomerEmailName=ko.observable("");n.ShowMapPageWhenCaptureAreaNameOfAnyItemIsTrue=ko.observable(!1)}function e(n){this.model=n;this.id=ko.observable("");this.name=ko.observable("");this.sub_complaint_types=ko.observableArray();this.enableMultipleSelection=ko.observable(!1);this.requireSelection=ko.observable(!1);this.sectionType=ko.observable("")}function o(i){var r=this;r.main=i;r.id=ko.observable("");r.main_id=ko.observable("");r.name=ko.observable("");r.selected=ko.observable(!1);r.isMultiLineTextEntry=ko.observable(!1);r.isRequiredTextEntry=ko.observable(!1);r.enableTextEntry=ko.observable(!1);r.isEnabledTextEntry=ko.observable(!1);r.CustomTextEntryPlaceHolder=ko.observable("");r.DefaultValue=ko.observable("");r.UrlParamName=ko.observable("");r.CaptureAreaName=ko.observable(!1);r.ItemValue=ko.computed(function(){var t,n;return r.UrlParamName()&&r.UrlParamName().length>0&&(t=GetParameterByName(r.UrlParamName()),t)?(n=t.split("|"),n.length>0)?(r.main.sectionType()==1&&r.selected(Number(n[0])===1),n.length===2?n[1]:r.main.sectionType()==1?r.DefaultValue():n[0]):(r.selected(r.DefaultValue().length>0),t.trim()):r.DefaultValue()});r.textEntryKeyUp=function(i,u){var e=n(u.target),f=!1;r.main.model.ShowMapWhen()===2&&(e.val().length>0&&r.CaptureAreaName()?r.main.model.ShowMapPageWhenCaptureAreaNameOfAnyItemIsTrue(!0):(f=t(r),r.main.model.ShowMapPageWhenCaptureAreaNameOfAnyItemIsTrue(f)),SuperSolver.Search.ConfigureNextButtonTexts())};r.onSelected=function(i,u){var o=r.id()+"_"+r.main_id(),f,s=!1,e,h;if(f=r.main.model.selected_complaints(),!r.main.enableMultipleSelection()&&r.main.sectionType()==1)for(e=0,h=r.main.sub_complaint_types().length;e<h;++e)r.main.sub_complaint_types()[e].id()!=r.id()&&(r.main.sub_complaint_types()[e].selected(!1),r.main.sub_complaint_types()[e].isEnabledTextEntry(!1),n.each(f,function(n){if(f[n].id===r.main.sub_complaint_types()[e].id()+"_"+r.main_id())return f.splice(n,1),!1}));r.main.sectionType()==1&&(r.selected()?r.enableTextEntry()&&n(u.currentTarget).find("input").length!==0||(r.selected(!1),f=n.grep(f,function(n){return n.id!=o}),r.main.model.selected_complaints(f)):(r.selected(!0),f.push({id:o,MainComplaintTypeID:r.main_id(),SubComplaintTypeID:r.id(),main_name:r.main.name(),enableTextEntry:r.enableTextEntry(),sub_name:r.name()}),r.main.model.selected_complaints(f)));r.main.sectionType()!=2&&r.isEnabledTextEntry(r.selected()&&i.enableTextEntry());r.main.model.ShowMapWhen()===2&&(r.CaptureAreaName()&&r.selected()?r.main.model.ShowMapPageWhenCaptureAreaNameOfAnyItemIsTrue(!0):(s=t(r),r.main.model.ShowMapPageWhenCaptureAreaNameOfAnyItemIsTrue(s)),SuperSolver.Search.ConfigureNextButtonTexts())}}function t(t){var i=t.main.model.complaint_types().filter(function(i){var r=i.sub_complaint_types().filter(function(r){if(r.id()!==t.id())if(i.sectionType()===2){if(!r.isMultiLineTextEntry()&&r.CaptureAreaName()&&n("#singlText"+r.id()).val().length>0||r.isMultiLineTextEntry()&&r.CaptureAreaName()&&n("#multiText"+r.id()).val().length>0)return!0}else if(r.selected()&&r.CaptureAreaName())return!0});return r.length>0});return i.length>0}SuperSolver.Models=SuperSolver.Models||{};SuperSolver.Models.Search={};SuperSolver.Models.Search.SearchModel=i;SuperSolver.Models.Search.SelectPlaceModel=f;SuperSolver.Models.Search.MainComplaintType=e;SuperSolver.Models.Search.SubComplaintType=o;SuperSolver.Models.Search.LandingPageModel=u;SuperSolver.Models.Search.LocatorPageModel=r}(jQuery),function(n){n.ajaxSetup({beforeSend:function(t){t.setRequestHeader("EventGroupId",n("#hdnEventGroupId").val())}});var c=SuperSolver.LocationManager,h=SuperSolver.Loader,e=SuperSolver.Models.Search,r=new e.SearchModel,l=".Page",o=0,f=0,u=new e.LandingPageModel,t=new e.LocatorPageModel,s="",a=function(){function lt(n){console.log("Search init Started.");ko.applyBindings(r,document.getElementById("container1"));it(n)}function it(t,i){f=v("PageID");f!==""?(console.log("HandleLocationAndPageFunctionality called. Page id present."),vt(f,i),n(".startMenu li a").each(function(){n(this).attr("href",k(n(this).attr("href"),"?"+li()))}),StartSaveSession()):t>0&&(console.log("HandleLocationAndPageFunctionality called. Location id present."),et(t))}function at(){SuperSolver.Location!=""&&GetLookupValue(!1,"beacons",SuperSolver.Location,function(n){s=n.LookupValue})}function vt(t,i){var r=PageDetails;if(CustomerInfoFromCookie.created&&n("#hdnSatisfiCustID").val(CustomerInfoFromCookie.customerId),r.success){if(r.page!=null)if(companyDisplayName=r.page.CompanyDisplayName,placeHolderValue=r.page.TypingMessageLabel,n("#textAreaReply").attr("placeholder",r.page.TypingMessageLabel),n("#showAlertModal, #showConfirmModal, #divCustomerExistingPopUp, #feedbackDeleteConfirmationModal").find(".modal-title").html(companyDisplayName),r.page.PageId===0||r.page.RequireApiKey&&!pt(r.page.ApiKey))RedirectToPageNotFound();else if(r.page.PageTypeId!=null){var f=GetCookie("CompanyId"),e=f!=undefined&&f!=""&&Number(f)!=r.page.CompanyId,o=GetGuid(),u=0;(r.page.IsStartPage||e)&&(SetChainIdInCookieAndCreateSession(o,r.page.PageId),e&&SetCookie("CompanyId",r.page.CompanyId));r.page.IsStartPage&&SavePageEvent(o,t,"START","Start Page Loaded",0,0);(r.page.PageTypeId==1||r.page.PageTypeId==2)&&yt(r.IsCustomFaviconUsed,r.page.CompanyId);n("body").css("visibility","visible");n(".icon-menu").html(ThemeDetails.MenuCode);r.page.EnableHistory?n("#liHistoryLink").show():n("#liHistoryLink").hide();n("#IsUseThemes").val(!0);switch(r.page.PageTypeId){case 4:ri(r);break;case 2:n("#liNewRequestLink").hide();ii(r);u=parseInt(r.landingPage.PageMenuId)===NaN?0:parseInt(r.landingPage.PageMenuId);break;case 1:ti(r,i);u=parseInt(r.activityPage.PageMenuId)===NaN?0:parseInt(r.activityPage.PageMenuId);break;case 3:n("#liNewRequestLink").hide();wt(r);u=parseInt(r.locatorPage.PageMenuId)===NaN?0:parseInt(r.locatorPage.PageMenuId);break;default:RedirectToPageNotFound()}u!=1&&(CustomerInfoFromCookie.created&&BindMenuItems(CustomerInfoFromCookie),GetMenuItemValues());u===2&&ShowLegalOnly()}SavePageEvent(GetCurrentChainId(),t,"PAGEVIEW",r.page.PageName,0,0)}}function yt(n,t){var r=n?[{name:"favicon.ico",rel:"shortcut icon"},{size:"57x57",name:"apple-icon-57x57.png",rel:"apple-touch-icon"},{size:"60x60",name:"apple-icon-60x60.png",rel:"apple-touch-icon"},{size:"72x72",name:"apple-icon-72x72.png",rel:"apple-touch-icon"},{size:"76x76",name:"apple-icon-76x76.png",rel:"apple-touch-icon"},{size:"114x114",name:"apple-icon-114x114.png",rel:"apple-touch-icon"},{size:"120x120",name:"apple-icon-120x120.png",rel:"apple-touch-icon"},{size:"144x144",name:"apple-icon-144x144.png",rel:"apple-touch-icon"},{size:"152x152",name:"apple-icon-152x152.png",rel:"apple-touch-icon"},{size:"180x180",name:"apple-icon-180x180.png",rel:"apple-touch-icon"},{size:"192x192",name:"android-icon-192x192.png",rel:"icon",type:"image/png"},{size:"32x32",name:"favicon-32x32.png",rel:"icon",type:"image/png"},{size:"96x96",name:"favicon-96x96.png",rel:"icon",type:"image/png"},{size:"16x16",name:"favicon-16x16.png",rel:"icon",type:"image/png"},{name:"manifest.json",rel:"manifest"}]:[{name:"favicon.ico",rel:"shortcut icon",type:"image/x-icon"},{size:"180x180",name:"apple-touch-icon.png",rel:"apple-touch-icon",type:"image/png"},{size:"192x192",name:"android-chrome-192x192.png",rel:"icon",type:"image/png"},{size:"384x384",name:"android-chrome-384x384.png",rel:"icon",type:"image/png"},{size:"32x32",name:"favicon-32x32.png",rel:"icon",type:"image/png"},{size:"16x16",name:"favicon-16x16.png",rel:"icon",type:"image/png"}],i;i=[{name:"msapplication-TileColor",content:"#ffffff",isCustom:"false"},{name:"msapplication-TileImage",content:"/ms-icon-144x144.png",isCustom:"true"},{name:"theme-color",content:"#ffffff",isCustom:"false"}];r.forEach(function(i){var r=document.createElement("link"),u="";i.type!=undefined&&(r.type=i.type);i.rel!=undefined&&(r.rel=i.rel);i.size!=undefined&&(r.sizes=i.size);i.name!=undefined&&(u=u+(n==!0?t+"/":"")+"favicon/"+i.name);r.href=u;document.getElementsByTagName("head")[0].appendChild(r)});i.forEach(function(i){var r=document.createElement("meta"),u;u=i.content!=undefined&&i.isCustom=="true"?(n==!0?t:1)+"/favicon/"+i.content:i.content;i.name!=undefined&&(r.name=i.name);r.content=u;document.getElementsByTagName("head")[0].appendChild(r)})}function pt(n){var t=v("apikey");return t!=""&&t===n}function wt(i){var u,f,e;a("Locator");bt(i.googleApiKey);t.PageId=i.locatorPage.PageId;t.PageName=i.locatorPage.PageName;t.ThemeId=i.locatorPage.ThemeId;t.HeaderImage=i.locatorPage.HeaderImage;t.AutoLocHeadline1=i.locatorPage.AutoLocHeadline1;t.AutoLocHeadline2=i.locatorPage.AutoLocHeadline2;t.ManLocHeadline1=i.locatorPage.ManLocHeadline1;t.ManLocHeadline2=i.locatorPage.ManLocHeadline2;t.ManLocAddressEntryLabel=i.locatorPage.ManLocAddressEntryLabel;t.ManLocSearchButtonLabel=i.locatorPage.ManLocSearchButtonLabel;t.ResListMaxResults=i.locatorPage.ResListMaxResults;t.ResListMaxDistance=i.locatorPage.ResListMaxDistance;t.ResListHeadline1=i.locatorPage.ResListHeadline1;t.ResListHeadline2=i.locatorPage.ResListHeadline2;t.NoResultsMsg=i.locatorPage.NoResultsMsg;t.NoResultsButtonLabel=i.locatorPage.NoResultsButtonLabel;e=i.locatorPage.VersionNo;t.AutoLocateRecoveryPageId=i.locatorPage.AutoLocateRecoveryPageId;t.AutoLocateRecoveryPageUrl=i.locatorPage.AutoLocateRecoveryPageUrl;t.PageMenuId=i.locatorPage.PageMenuId;t.AutoLocateRecoveryPageName=i.locatorPage.AutoLocateRecoveryPageName;t.AutoSelectDistance=i.locatorPage.AutoSelectDistance;i.locatorSearchPages!=null&&(t.LocatorSearchPages=i.locatorSearchPages,n.each(t.LocatorSearchPages,function(n,i){var u=d(location.search,"PAGEID").trim(),r;u=d(u,"VIEW").trim();r=ot(u);r=k(i.PageIdSearchUrl,r);i.PageIdSearchUrl=AppendBackPageQuerystring(r,t.PageId)}));r.SelectedLocatorPage(t);u="pagetheme-"+t.ThemeId+".css";f=n("#hdnAWSServerURL").val()+n("#hdnAWSThemeFolder").val()+u+"?version="+e;n("#themeLink").attr("href",f);nt();r.HideMenu(t.PageMenuId==1);n(".PrevBtn",'.Page[data-page="LocatorResults"]').click(function(){n(this).hasClass("NoAct")||n(this).hasClass("addedButton")||RemoveLastBackpgAndRedirect()});setTimeout(function(){rt()},2e3)}function bt(t){var i=document.createElement("script");i.type="text/javascript";i.src="//maps.googleapis.com/maps/api/js?libraries=places&sensor=false&key="+t;n("head").append(i)}function rt(n){c.Location(function(i,r){n||SavePageEvent(GetCurrentChainId(),f,"AUTO-LOCATE",r!=null&&r!=""?"Unable to Locate":"User Located "+i.lat+" "+i.lng,0,0);i!=null&&ut(i);n&&t.FilteredLocatorSearchPages().length==0?(SavePageEvent(GetCurrentChainId(),f,"NO_RESULTS","User Shown 0 result(s)",0,0),ShowAlert(t.NoResultsMsg,"",t.NoResultsButtonLabel)):(i==null||t.FilteredLocatorSearchPages().length==0)&&(t.AutoLocateRecoveryPageId==0?ft():(SavePageEvent(GetCurrentChainId(),f,"REDIRECT",t.AutoLocateRecoveryPageName,t.AutoLocateRecoveryPageId,0),location.href=t.AutoLocateRecoveryPageUrl))})}function ut(i){var u=kt(t.LocatorSearchPages,t.ResListMaxResults,t.ResListMaxDistance,i),r;(t.FilteredLocatorSearchPages.removeAll(),n.each(u,function(n){t.FilteredLocatorSearchPages.push(u[n])}),t.FilteredLocatorSearchPages().length!=0)&&(t.FilteredLocatorSearchPages().length==1?(SavePageEvent(GetCurrentChainId(),f,"REDIRECT",t.FilteredLocatorSearchPages()[0].SearchPageName,t.FilteredLocatorSearchPages()[0].PageIdSearch,0),location.href=t.FilteredLocatorSearchPages()[0].PageIdSearchUrl):(SavePageEvent(GetCurrentChainId(),f,"LIST_RESULTS","User Shown "+t.FilteredLocatorSearchPages().length+" result(s)",0,0),t.AutoSelectDistance>0&&(r=n.grep(t.FilteredLocatorSearchPages(),function(n){return n.Distance<=t.AutoSelectDistance})),typeof r!="undefined"&&r!=null&&r.length>0?location.href=r[0].PageIdSearchUrl:a("LocatorResults")))}function kt(t,i,r,u){return n.each(t,function(n,t){var i=dt(u.lat,u.lng,t.SearchPageLatitude,t.SearchPageLongitude),r=i*.621371;t.Distance=r}),t.sort(function(n,t){var i=n.SearchPageTitle==""?n.SearchPageName:n.SearchPageTitle,r=t.SearchPageTitle==""?t.SearchPageName:t.SearchPageTitle;return n.Distance-t.Distance==0?i.localeCompare(r):n.Distance-t.Distance}),jQuery.grep(t,function(n,t){return n.Distance<=r&&t<i})}function ft(){a("ManualSearch");gt()}function dt(n,t,i,r){var f=b(i-n),e=b(r-t),u,o,s;return u=Math.sin(f/2)*Math.sin(f/2)+Math.cos(b(n))*Math.cos(b(i))*Math.sin(e/2)*Math.sin(e/2),o=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),s=6371*o,Math.round(s)}function b(n){return n*(Math.PI/180)}function gt(){n("#btnManualSearch").unbind("click").bind("click",function(){var n=new window.google.maps.Geocoder;ni(n)})}function ni(i){var r=n("#txtManualAddress").val().trim();if(SavePageEvent(GetCurrentChainId(),f,"MANUAL-LOCATE",r,0,0),r==""){SuperSolver.Search.LoadSearchPagesForCurrentLocation(!0);return}i.geocode({address:r},function(n,i){if(i===window.google.maps.GeocoderStatus.OK){var r={lat:n[0].geometry.location.lat(),lng:n[0].geometry.location.lng()};ut(r);t.FilteredLocatorSearchPages().length==0&&(SavePageEvent(GetCurrentChainId(),f,"NO_RESULTS","User Shown 0 result(s)",0,0),ShowAlert(t.NoResultsMsg,"",t.NoResultsButtonLabel))}else ShowAlert(t.NoResultsMsg,"",t.NoResultsButtonLabel)})}function ti(n,t){et(n.activityPage.LocationId,n.activityPage.UseThemesForActivityPages,n.activityPage.ThemeId,n.activityPage.VersionNo,n.activityPage.UpperSectionLine3,t)}function et(n,t,i,r,u,f){oi();n!=0&&fi(n,t,i,r,u,f)}function ii(t){var i,f,e;a("PagesLanding");u.PageId=t.landingPage.PageId;u.PageName=t.landingPage.PageName;u.ThemeId=t.landingPage.ThemeId;u.HeaderImage=t.landingPage.HeaderImage;u.UpperSectionLine1=t.landingPage.UpperSectionLine1;u.UpperSectionLine2=t.landingPage.UpperSectionLine2;u.UpperSectionLine3=t.landingPage.UpperSectionLine3;u.LowerSectionLine1=t.landingPage.LowerSectionLine1;u.LowerSectionLine2=t.landingPage.LowerSectionLine2;u.FooterLinkUrl=AppendBackPageQuerystring(t.landingPage.FooterLinkUrl,u.PageId);u.FooterLinkLable=t.landingPage.FooterLinkLable;u.PageMenuId=t.landingPage.PageMenuId;u.HideNavButtons=t.landingPage.HideNavButtons;t.landingPageLinks!=null&&(u.LandingPageLinks=t.landingPageLinks,n.each(u.LandingPageLinks,function(n,t){t.PageIdLinkUrl=AppendBackPageQuerystring(t.PageIdLinkUrl,u.PageId)}));r.SelectedPage(u);i="pagetheme-"+u.ThemeId+".css";f=n("#hdnAWSServerURL").val()+n("#hdnAWSThemeFolder").val()+i+"?version="+e;n("#themeLink").attr("href",f);r.HideMenu(u.PageMenuId==1);r.HideBackInComplaint(u.HideNavButtons);nt();n(".PrevBtn",'.Page[data-page="PagesLanding"]').click(function(){n(this).hasClass("NoAct")||n(this).hasClass("addedButton")||RemoveLastBackpgAndRedirect()})}function nt(){r.HideBackInComplaint()||(location.href.indexOf("backpg")==-1?r.HideBackInComplaint(!0):r.HideBackInComplaint(!1))}function ri(n){var t="";n.externalPage!=null&&n.externalPage.ExternalUrl!=""&&(t=d(location.search,"PAGEID").trim(),window.location.href=k(n.externalPage.ExternalUrl,t))}function ot(t){var i=t.match(/backpg\[(.*?)\]/g);return i==null?t:(n.each(i,function(n,i){t=d(t,i.toUpperCase(),!1)}),t)}function k(n,t){return t==="?"?n:(n!=""&&typeof n!="undefined"&&(n=n.indexOf("?")>-1?n+t.replace("?","&"):n+t),n)}function d(n,t,i){var f=n.split("?"),e,r,u;if(f.length>=2){for(e=typeof i=="undefined"||i?encodeURIComponent(t)+"=":t+"=",r=f[1].split(/[&;]/g),u=r.length;u-->0;)r[u].toUpperCase().lastIndexOf(e,0)!==-1&&r.splice(u,1);return f[0]+"?"+r.join("&")}return n}function ui(){var f=n(".pinchZoomContainer");o=o>0?o:f.outerHeight();var t=n(this).scrollTop(),e=t+n(this).height(),i=f.offset().top,s=i+o,r=i<t?t:i,u=s>e?e:s;return console.log(u-r),n(window).width()<640?u-r-(n("#divCompanyAreaListcontainer").height()+5)+n("#hrLocation").outerHeight(!0)+"px":u-r-(n("#divCompanyAreaListcontainer").height()+10)+"px"}function a(t,i){var r="";i&&(r=":not(.history)");n(".loader").addClass("noDisplay");n("#divMainContainer").removeClass("noDisplay");n(l+r).hide();n('.Page[data-page="'+t+'"]').show();n('.Page[data-page="'+t+'"]').removeClass("noDisplay");t!=="Feedbacks"&&t!=="LocationSelection"&&t!=="ConfirmComplaint"&&SetCookie("MaintainStatePageView"+GetParameterByName("pageId"),t,24);t==="FeedbackMessagesWithChat"&&SuperSolver.MessageMain.MessagingAreaSize();ShowNotification()}function y(n,t){var u={},f=!1,i=!1,r=!1;switch(n){case additionalInfoEnum.OptionalAlwaysShow:i=!0;break;case additionalInfoEnum.RequiredAlwaysShow:f=!0;i=!0;break;case additionalInfoEnum.OptionalShowifMissing:t.length===0&&(i=!0);break;case additionalInfoEnum.RequiredShowifMissing:t.length===0&&(i=!0);f=!0;break;case additionalInfoEnum.RequireifMobileBlankAlwaysShow:i=!0;r=!0;break;case additionalInfoEnum.RequireifEmailBlankAlwaysShow:i=!0;r=!0;break;case additionalInfoEnum.RequireifMobileBlankShowifMissing:t.length===0&&(i=!0);r=!0;break;case additionalInfoEnum.RequireifEmailBlankShowifMissing:t.length===0&&(i=!0);r=!0}return u.IsRequired=f,u.IsShow=i,u.IsEmailOrMobileRequired=r,u}function fi(t,u,f,o,s,h){console.log("ShowVirtualLocation start execute.");var w,b,p,c,l;n.getJSON("api/Home/GetLocation",{ID:t},function(t){var tt=t.location,k=t.company,ft=t.categoryName,rt=t.areaList,et=[],ut,it=!1;if(k.LoggedInCustomerFirstName=k.LoggedInCustomerFirstName?k.LoggedInCustomerFirstName:v("fn"),k.LoggedInCustomerLastName=k.LoggedInCustomerLastName?k.LoggedInCustomerLastName:v("ln"),k.LoggedInCustomerMobileNo=k.LoggedInCustomerMobileNo?k.LoggedInCustomerMobileNo:v("mnum"),k.LoggedInCustomerEmail=k.LoggedInCustomerEmail?k.LoggedInCustomerEmail:v("em",!1),SuperSolver.MessageMain.SetCompanySettings(tt.HideNavButtons,tt.PageMenuId==1,tt.HideMarkAllReadButton,tt.HideChatDeleteButton,k!==null?k.EnableCustomerUploads:!1,k.CompanyName,k.CompanyEmailName,t.disableChat,k.LoggedInCustomerEmail,k.LoggedInCustomerMobileNo,k.EnableExitPopNotify,k.EnableChatScreenNotify,t.suppressSubmitDetails,t.responsePageId,k.LoggedInCustomerFirstName+""+k.LoggedInCustomerLastName,k.CustomerEmailName.length>0?k.CustomerEmailName:"Customer",k.IsMuted),n("#hdnCompanyApiKey").val(k.ApiKey),n("#hdnCompanyId").val(k.CompanyID),n("#hdnLocationID").val(tt.LocationID),k.CompanyName!=""){p=GetParameterByName("view");p!=""&&GetCookie("NewButtonClicked")!="true"&&LoadChatOrHistoryIfRequired();r.IsSelected(!0);var d=new e.SelectPlaceModel,ot=k.CustomFieldLabel==""?"Custom Field":k.CustomFieldLabel,ht=k.CustomAdditionalComments==""?"Additional Comments":k.CustomAdditionalComments,ct=GetCookie("CompanyId");if(r.SelectedPlace(d),rt)for(i=0;i<rt.length;i++)ut={},ut.AreaID=rt[i].AreaID,ut.AreaName=rt[i].AreaName,et.push(ut);if(d.UpperSectionLine3(s),d.CustomerEmailName(k.CustomerEmailName.length>0?k.CustomerEmailName:"Customer"),d.companyAreaList(et),d.LocationID(tt.LocationID),d.PageID(tt.PageID),d.CompanyID(k.CompanyID),d.CategoryID(tt.CategoryID),c=y(k.AddInfoEmailId,k.LoggedInCustomerEmail),d.LoggedInCustomerEmail(k.LoggedInCustomerEmail),l=c.IsEmailOrMobileRequired,d.IsForceEmail(c.IsRequired),d.IsShowEmail(c.IsShow),d.EmailPlaceholder(c.IsRequired?"E-Mail Address (Required)":"E-Mail Address"),c=y(k.AddInfoFirstNameId,k.LoggedInCustomerFirstName),d.LoggedInCustomerFirstName(k.LoggedInCustomerFirstName),d.IsForceFirstName(c.IsRequired),d.IsShowFirstName(c.IsShow),d.FirstNamePlaceholder(c.IsRequired?"First Name (Required)":"First Name"),c=y(k.AddInfoLastNameId,k.LoggedInCustomerLastName),d.LoggedInCustomerLastName(k.LoggedInCustomerLastName),d.IsForceLastName(c.IsRequired),d.IsShowLastName(c.IsShow),d.LastNamePlaceholder(c.IsRequired?"Last Name (Required)":"Last Name"),c=y(k.AddInfoMobileId,k.LoggedInCustomerMobileNo),l=l?l:c.IsEmailOrMobileRequired,d.LoggedInCustomerMobileNo(k.LoggedInCustomerMobileNo),d.IsForceMobileNo(c.IsRequired),d.IsShowMobileNo(c.IsShow),d.MobileNoPlaceholder(c.IsRequired?"Mobile Number (Required)":"Mobile Number"),c=y(k.AddInfoCustomFieldId,GetCookie("CustomFieldValue")),d.CustomFieldLabel(k.CustomFieldLabel),d.IsForceCustomField(c.IsRequired),d.IsShowCustomField(c.IsShow),c=y(k.AddInfoCommentId,k.CustomAdditionalComments),d.CustomAdditionalCommentsLabel(k.CustomAdditionalComments),d.IsForceAdditionalCommentsField(c.IsRequired),d.IsShowAdditionalCommentsField(c.IsShow),d.IsShowCustomerUploads(k.IsShowCustomerUploads),d.IsForceEmailOrMobileNo(l),d.HideSelectedPlace(k.HideSelectedPlace),d.MapFileName(tt.MapFileName),d.EnableHeaderImage(tt.EnableHeaderImage),d.HeaderImage(tt.HeaderImage),d.DisableChat(t.disableChat),d.ContinueButtonLabel(k.ContinueButtonLabel),d.SubmitButtonLabel(k.SubmitButtonLabel),d.HeaderImage2(tt.HeaderImage2),SuperSolver.NewMessageLabel=k.NewMessageLabel,d.ShowMapWhen(t.showMapWhen),r.HideMenu(tt.PageMenuId==1),r.HideBackInComplaint(tt.HideNavButtons),r.HideBackButton(tt.HideNavButtons),nt(),d.CustomFieldPlaceholder(k.IsForceCustomField===!0?ot+" (Required)":ot),d.CustomAdditionalCommentsPlaceholder(k.IsForceAdditionalComments===!0?ht+" (Required)":ht),d.FooterImage(tt.FooterImage),r.SubmitButtonPlacement(tt.SubmitButtonPlacement),ct!=""&&ct==d.CompanyID()?(n("#txtCustomFieldLabel").val(GetCookie("CustomFieldValue")),n("#ddlCompanyAreaList").val(GetCookie("NearSectionValue"))):(SetCookie("CustomFieldValue",""),SetCookie("CompanyId",d.CompanyID()),SetCookie("NearSectionValue","")),d.name(k.CompanyName),d.displayname2(k.CompanyName),k.CompanyLogo.length>0&&d.photo(k.CompanyLogo),u){w="pagetheme-"+f+".css";b=n("#hdnAWSServerURL").val()+n("#hdnAWSThemeFolder").val()+w+"?version="+o;n("#activityLink").attr("href",b);n("body").on("keyup",".singleEntryTextBox,.multiLineTextEntryBox",function(){n(this).val()==""?(n(this).removeClass("GeneralUI-EntryBoxEntryState"),n(this).addClass("GeneralUI-EntryBoxLabelState")):(n(this).removeClass("GeneralUI-EntryBoxLabelState"),n(this).addClass("GeneralUI-EntryBoxEntryState"))})}d.first_cat(ft);d.categories(ft);tt.LocationName.length>0&&d.first_cat(tt.LocationName);ei(d,t.types,function(n,t){var f,i,u;d.complaint_types(n);n.forEach(function(n){n.sub_complaint_types().forEach(function(n){n.selected()&&(d.selected_complaints().push({id:n.id()+"_"+n.main_id(),MainComplaintTypeID:n.main_id(),SubComplaintTypeID:n.id(),main_name:n.main.name(),enableTextEntry:n.enableTextEntry(),sub_name:n.name()}),d.ShowMapWhen()===2&&n.CaptureAreaName()&&r.SelectedPlace().ShowMapPageWhenCaptureAreaNameOfAnyItemIsTrue(!0))})});st(r.SelectedPlace());(p===""||GetCookie("NewButtonClicked")==="true")&&(f=GetCookie("MaintainStatePageView"+tt.PageID).split(","),i=f[0],!tt.MaintainState||h||i==="Feedbacks"?(console.log("inside Feedbacks"),g(k.SubmitAutomatically,t,it)):i!=""?(u=f[1],i==="Feedbacks"||i==="ResponsePage"||i==="FeedbackMessagesWithChat"?(u!=="undefined"&&Number(u)>0&&SetCookie("CurrentSubmissionIdForLoadChat",u,24),SuperSolver.MessageMain.LoadFeedbacks(!1,it,{validateMaintainState:!0,callback:function(){console.log("inside callback");g(k.SubmitAutomatically,t,it)}})):i==="Legal"?AppendCustomLegalEntries():i==="ProflePage"&&(SuperSolver.CustomerProfile.LoadCustomerProfile(),setContainerMinMaxSize.setMinMaxSize()),i==="SelectComplaint"?(console.log("inside selectcomplaint"),g(k.SubmitAutomatically,t,it)):a(i,it)):(console.log("inside else"),g(k.SubmitAutomatically,t)))});tt.PageMenuId===2&&ShowLegalOnly()}})}function g(n,t,i){n&&t?(console.log("SubmitAutomaticallyOrLoadComplaintPage: autosubmit on"),w(!0)):(DeleteCookie("NewButtonClicked"),a("SelectComplaint",i))}function st(t){tt(t)?(n(".NextBtn .headerNextbtnTxt",'.Page[data-page="SelectComplaint"]').html(t.ContinueButtonLabel()),n(".NextBtn .headerNextbtnTxt",'.Page[data-page="LocationSelection"]').html(t.ContinueButtonLabel()),n(".NextBtn .headerNextbtnTxt",'.Page[data-page="ConfirmComplaint"]').html(t.SubmitButtonLabel()),n(".submissionSubmitBtn .headerNextbtnTxt",'.Page[data-page="SelectComplaint"]').html(t.ContinueButtonLabel()),n(".submissionSubmitBtn .headerNextbtnTxt",'.Page[data-page="LocationSelection"]').html(t.ContinueButtonLabel()),n(".submissionSubmitBtn .headerNextbtnTxt",'.Page[data-page="ConfirmComplaint"]').html(t.SubmitButtonLabel())):p(t.ShowMapWhen())?(n(".NextBtn .headerNextbtnTxt",'.Page[data-page="SelectComplaint"]').html(t.ContinueButtonLabel()),n(".NextBtn .headerNextbtnTxt",'.Page[data-page="LocationSelection"]').html(t.SubmitButtonLabel()),n(".submissionSubmitBtn .headerNextbtnTxt",'.Page[data-page="SelectComplaint"]').html(t.ContinueButtonLabel()),n(".submissionSubmitBtn .headerNextbtnTxt",'.Page[data-page="LocationSelection"]').html(t.SubmitButtonLabel())):(n(".NextBtn .headerNextbtnTxt",'.Page[data-page="SelectComplaint"]').html(t.SubmitButtonLabel()),n(".submissionSubmitBtn .headerNextbtnTxt",'.Page[data-page="SelectComplaint"]').html(t.SubmitButtonLabel()))}function p(n){var t=!1;switch(n){case 0:t=!1;break;case 1:t=!0;break;case 2:t=r.SelectedPlace().ShowMapPageWhenCaptureAreaNameOfAnyItemIsTrue()}return t}function ht(t){var i="",u=!1,r;return at(),s!=""&&(i=s.trim()),i!==undefined&&i.length!==0&&n("#ddlCompanyAreaList option").each(function(){n(this).html().toLowerCase()===i.toLowerCase()&&(u=!0)}),!u&&t&&(n("#ddlCompanyAreaList").val()>0?i=n("#ddlCompanyAreaList option:selected").text():(r=GetCookie("NearSectionValue"),r.length!==0&&(i=n('#ddlCompanyAreaList option[value="'+r+'"]').text()))),i}function tt(n){return n.IsShowCustomField()||n.IsShowEmail()||n.IsShowFirstName()||n.IsShowLastName()||n.IsShowMobileNo()||n.IsForceAdditionalCommentsField()||n.IsForceCustomField()||n.IsShowAdditionalCommentsField()||n.IsForceEmail()&&n.LoggedInCustomerEmail()==""||n.IsForceEmailOrMobileNo()&&n.LoggedInCustomerEmail()==""&&n.LoggedInCustomerMobileNo()==""||n.IsForceMobileNo()&&n.LoggedInCustomerMobileNo()==""}function ei(n,t,i){var v,y,o,f,u,r,c,l,a,s,p;for(h.Show(),v=[],a=!1,c=0;c<t.length;c++){for(o=t[c],u=new e.MainComplaintType(n),y=[],u.id(o.MainComplaintTypeID),u.name(o.TypeName),u.enableMultipleSelection(o.EnableMultipleSelection),u.requireSelection(o.RequireSelection),u.sectionType(o.SectionType),l=0;l<o.SubComplaintTypes.length;l++)f=o.SubComplaintTypes[l],r=new e.SubComplaintType(u),r.id(f.SubComplaintTypeID),r.main_id(o.MainComplaintTypeID),r.name(f.ComplaintText),r.isMultiLineTextEntry(f.IsMultiLineTextEntry),r.isRequiredTextEntry(f.IsRequiredTextEntry),r.enableTextEntry(f.EnableTextEntry),r.isEnabledTextEntry(!1),r.DefaultValue(f.DefaultValue),o.SectionType==1&&r.selected(f.DefaultValue.length>0),r.UrlParamName(f.UrlParamName),r.CaptureAreaName(f.CaptureAreaName),(f.DefaultValue.length>0||r.selected()||r.ItemValue().length>0)&&!a&&(a=!0),f.IsRequiredTextEntry?r.CustomTextEntryPlaceHolder(f.ComplaintText+" *"):r.CustomTextEntryPlaceHolder(f.ComplaintText),y.push(r);if(u.sub_complaint_types(y),v.push(u),u.sectionType()===1&&!u.enableMultipleSelection())for(s=0,p=u.sub_complaint_types().length;s<p;++s)if(u.sub_complaint_types()[s].selected()){u.sub_complaint_types().map(function(n){n.id()!==u.sub_complaint_types()[s].id()&&n.selected(!1)});break}}i(v,a);h.Hide()}function oi(){function g(t){n.ajax({type:"GET",traditional:!0,url:"api/Home/GetCustomerProfile",async:!0,context:document.body,success:function(i){i.success&&(i.customerEmail!=""?n("#txtEmailAddress").val(i.customerEmail):n("#txtEmailAddress").val(v("em",!1)),i.customerMobileNumber!=""?(n("#txtMobileNo").val(i.customerMobileNumber),n("#txtFormattedPhoneNumber").val(i.customerMobileNumber)):(n("#txtMobileNo").val(v("mnum")),n("#txtFormattedPhoneNumber").val(v("mnum"))),i.customerFirstName!=""?n("#txtFirstName").val(i.customerFirstName):n("#txtFirstName").val(v("fn")),i.customerLastName!=""?n("#txtLastName").val(i.customerLastName):n("#txtLastName").val(v("ln")));t&&t()},error:function(){t&&t();n(".NextBtn").removeAttr("disabled").removeClass("disabled")}})}var c,t,u,i,f,e,s,l=!1,h=[],d="Please review section <b>[SectionLabel]<\/b>. Required entries are indicated by a *.",y="Please review <b>[ItemLabel]<\/b> in section <b>[SectionLabel]<\/b>. Required entries are indicated by a *.",b,k=!0;n(document).off("click",'.Page[data-page="SelectComplaint"] .NextBtn');n(document).off("click",'.Page[data-page="SelectComplaint"] .PrevBtn');n(document).off("click",'.Page[data-page="ConfirmComplaint"] .PrevBtn');n(document).off("click",'.Page[data-page="ConfirmComplaint"] .NextBtn');n(document).off("click",'.Page[data-page="LocationSelection"] .PrevBtn');n(document).off("click",'.Page[data-page="LocationSelection"] .NextBtn');n(".PrevBtn",'.Page[data-page="SelectComplaint"]').click(function(){n(this).hasClass("NoAct")||n(this).hasClass("addedButton")||(location.href.indexOf("backpg")>-1?RemoveLastBackpgAndRedirect():a("Result"))});n(document).on("click",'.Page[data-page="SelectComplaint"] .NextBtn',function(){var ut,nt,it,rt;if(k=!0,n("li.CSel input:visible").each(function(){if(n(this).val().trim().length===0){k=!1;return}}),!k){ShowAlert("Unable to proceed. You selected an item that also requires text entry. Please enter text and try again.");return}if(h=[],n(".NextBtn").attr("disabled","disabled").addClass("disabled"),n("input[subComplaintId]").each(function(){n(this).parent().css("display")=="inline-block"&&n(this).val().length!=0&&h.push(n(this).attr("subComplaintId"))}),n("textarea[subComplaintId]").each(function(){n(this).parent().css("display")=="inline-block"&&n(this).val().length!=0&&h.push(n(this).attr("subComplaintId"))}),r.SelectedPlace().selected_complaints().length>0||h.length>0){for(c=0;c<r.SelectedPlace().complaint_types().length;c++){if(t=r.SelectedPlace().complaint_types()[c],t.requireSelection()&&t.sectionType()==1&&(ut=n.grep(r.SelectedPlace().selected_complaints(),function(n){return n.MainComplaintTypeID==t.id()}),ut.length==0)){n(".NextBtn").removeAttr("disabled").removeClass("disabled");ShowAlert(d.replace("[SectionLabel]",t.name()),"Required Entry Missing");return}if(t.requireSelection()&&t.sectionType()==2){for(l=!1,i=0;i<t.sub_complaint_types().length;i++){if(u=t.sub_complaint_types()[i].id(),f=t.sub_complaint_types()[i].isMultiLineTextEntry(),s=t.sub_complaint_types()[i].isRequiredTextEntry(),e=t.sub_complaint_types()[i].name(),f?n("textarea.multiLineTextEntryBox[subComplaintId="+u+"]").val().length!=0&&(l=!0):n("input.singleEntryTextBox[subComplaintId="+u+"]").val().length!=0&&(l=!0),s&&!f&&n("input.singleEntryTextBox[subComplaintId="+u+"]").val().length==0){n(".NextBtn").removeAttr("disabled").removeClass("disabled");ShowAlert(y.replace("[ItemLabel]",e).replace("[SectionLabel]",t.name()),"Required Entry Missing");return}if(s&&f&&n("textarea.multiLineTextEntryBox[subComplaintId="+u+"]").val().length==0){ShowAlert(y.replace("[ItemLabel]",e).replace("[SectionLabel]",t.name()),"Required Entry Missing");n(".NextBtn").removeAttr("disabled").removeClass("disabled");return}}if(!l){ShowAlert(d.replace("[SectionLabel]",t.name()),"Required Entry Missing");n(".NextBtn").removeAttr("disabled").removeClass("disabled");return}}if(!t.requireSelection()&&t.sectionType()==2)for(i=0;i<t.sub_complaint_types().length;i++){if(u=t.sub_complaint_types()[i].id(),f=t.sub_complaint_types()[i].isMultiLineTextEntry(),s=t.sub_complaint_types()[i].isRequiredTextEntry(),e=t.sub_complaint_types()[i].name(),s&&!f&&n("input.singleEntryTextBox[subComplaintId="+u+"]").val().length==0){ShowAlert(y.replace("[ItemLabel]",e).replace("[SectionLabel]",t.name()),"Required Entry Missing");n(".NextBtn").removeAttr("disabled").removeClass("disabled");return}if(s&&f&&n("textarea.multiLineTextEntryBox[subComplaintId="+u+"]").val().length==0){ShowAlert(y.replace("[ItemLabel]",e).replace("[SectionLabel]",t.name()),"Required Entry Missing");n(".NextBtn").removeAttr("disabled").removeClass("disabled");return}}}nt=v("cf");typeof nt!="undefined"&&nt!=""&&n("#txtCustomFieldLabel").val(nt);g(function(){n(".divConfirmContainer .singleEntryTextBox").each(function(){n(this).val()!=""&&(n(this).addClass("textEntryBackgroundColor"),n(this).removeClass("GeneralUI-EntryBoxLabelState"),n(this).addClass("GeneralUI-EntryBoxEntryState"))});n(".NextBtn").removeAttr("disabled").removeClass("disabled");it=tt(r.SelectedPlace());it||p(r.SelectedPlace().ShowMapWhen())?(b=ht(p(r.SelectedPlace().ShowMapWhen())),b!==undefined&&b.length!==0&&(n("#ddlCompanyAreaList option").each(function(){n(this).html().toLowerCase()===b.toLowerCase()&&(rt=n(this).attr("value"))}),n("#ddlCompanyAreaList").val(rt),r.SelectedPlace().selectedSection(rt)),p(r.SelectedPlace().ShowMapWhen())?(a("LocationSelection"),o==0&&(r.SelectedPlace().MapFileName().length!==0&&n("#hrLocation").each(function(){this.style.setProperty("margin-bottom","20px","important")}),n("#imgMap").attr("src",r.SelectedPlace().MapFileName()),n("#imgMap").pinchzoomer(),setTimeout(function(){var t=n(".pinchZoomContainer"),r,u,i,f,e;t.find("div:first").css("margin","0 auto");r=t.outerHeight();u=t.outerWidth();i=parseFloat(ui().replace("px",""));e=i/r;f=u*e;n("<style>.dynamicHeight{ height : "+i+"px !important;}<\/style>").appendTo("head");n("<style>.dynamicWidth{ width : "+f+"px !important;}<\/style>").appendTo("head");n(".zoomInOn").prev().find("img").addClass("dynamicHeight").addClass("dynamicWidth");n(".zoomInOn").prev().parent().addClass("dynamicHeight").addClass("dynamicWidth")},100))):it?a("ConfirmComplaint"):w()):w();n("#txtFormattedPhoneNumber").inputmask("(999) 999-9999");n("#txtMobileNo").forceNumeric();n("#txtMobileNo").hide();n("#txtFormattedPhoneNumber").on("focus",function(){n("#txtFormattedPhoneNumber").hide();n("#txtMobileNo").show();var t=n("#txtMobileNo").val();n("#txtMobileNo").val("");n("#txtMobileNo").val(t);setTimeout(function(){n("#txtMobileNo").focus()},100)});n("#txtMobileNo").on("blur",function(){n("#txtMobileNo").hide();n("#txtFormattedPhoneNumber").show();var t=n("#txtMobileNo").val();n("#txtFormattedPhoneNumber").val(t)});n("#txtMobileNo").keyup(function(){n(this).val().charAt(0)==1&&n(this).val(n(this).val().substr(1))});yi();n("html,body").animate({scrollTop:0},"fast")})}else n(".NextBtn").removeAttr("disabled").removeClass("disabled"),ShowAlert("At least one entry is required to proceed.","Entry Required")});n(".PrevBtn",'.Page[data-page="ConfirmComplaint"]').click(function(){p(r.SelectedPlace().ShowMapWhen())?a("LocationSelection"):(a("SelectComplaint"),h=[])});n(document).on("click",'.Page[data-page="ConfirmComplaint"] .NextBtn',function(){w()});n(document).on("click",'.Page[data-page="LocationSelection"] .PrevBtn',function(){a("SelectComplaint");h=[]});n(document).on("click",'.Page[data-page="LocationSelection"] .NextBtn',function(){var n=si();if(n!=""){ShowAlert(n);return}tt(r.SelectedPlace())?a("ConfirmComplaint"):w()})}function si(){var u="",t=n("#Section").val(),i=n("#Row").val(),r=n("#Seat").val();return t==""||t==parseInt(t,10)&&t<=538&&t>0?i==""||i==parseInt(i,10)&&i<=99&&i>0?r==""||r==parseInt(r,10)&&r<=99&&r>0||(u="Please enter valid seat number."):u="Please enter valid row number.":u="Please enter valid section number.",u}function v(n,t){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r=new RegExp("[\\?&]"+n+"=([^&#]*)","i"),i=r.exec(location.search);return typeof t!="undefined"&&!t?i===null?"":decodeURIComponent(i[1].replace("%20","+")):i==null?SuperSolver.HeaderInfo[n.toLowerCase()]?SuperSolver.HeaderInfo[n.toLowerCase()]:"":decodeURIComponent(i[1].replace(/\+/g," "))}function hi(t,i,r){var u={firstName:t,lastName:i,email:r};n.ajax({type:"POST",traditional:!0,url:"/api/Home/UpdateCustomerDetails",context:document.body,data:u,success:function(n){n.success&&console.log(n.success)},error:function(){console.log("Unable to update the customer details")},complete:function(){window.SuperSolver.Loader.Hide()}})}function w(t){var f,e;n(".NextBtn").attr("disabled","disabled").addClass("disabled");e=p(r.SelectedPlace().ShowMapWhen());f=ht(e);errorMessage="";var i=r.SelectedPlace(),o=e?f.length!==0?f:n("#ddlCompanyAreaList").val()!=""?n("#ddlCompanyAreaList option:selected").text():"":f,u={Action:submissionRequestTypes.Submit,UserEmail:n("#txtEmailAddress").val(),LocationID:i.LocationID(),PageID:i.PageID(),CategoryID:i.CategoryID(),CompanyID:i.CompanyID(),SelectedComplaints:i.selected_complaints(),SelectedTextEntryComplaintsIds:ai(),SelectedTextEntryComplaintsValues:vi(),UserAgent:navigator.userAgent,UserLat:r.Latitude,UserLng:r.Longitude,ResolutionX:window.screen.width,ResolutionY:window.screen.height,AdditionalFeedback:n.trim(n("#txtAdditionalComments").val()),FirstName:n.trim(n("#txtFirstName").val()),LastName:n.trim(n("#txtLastName").val()),MobileNumber:n.trim(n("#txtMobileNo").val()),CustomFieldLabel:i.IsShowCustomField()?i.CustomFieldLabel():"",CustomFieldValue:n.trim(n("#txtCustomFieldLabel").val()),UserSeatLocation:"",UserNearSection:o,NearLocation:""},s=i.CustomFieldLabel()==""?"Custom Field":i.CustomFieldLabel(),h=i.CustomAdditionalCommentsLabel()==""?"Additional Comments":i.CustomAdditionalCommentsLabel(),c=/(?:\+?1[-. ]?)?\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})/;u.SenderDisplayName=i.CustomerEmailName();u.CustomFieldValue||(u.CustomFieldValue=v("cf"));t?(console.log("Skip Validation on search page"),ct(u)):n.get("api/Home/GetLocationCategory?locationId="+u.LocationID,function(t){if(t.success)if(t.categoryId===u.CategoryID){if(SuperSolver.Company=i.name().replace(/[\W_]+/g,""),i.IsShowFirstName()&&i.IsForceFirstName()&&n.trim(n("#txtFirstName").val()).length==0&&(errorMessage+="First Name is required.<br>"),i.IsShowLastName()&&i.IsForceLastName()&&n.trim(n("#txtLastName").val()).length==0&&(errorMessage+="Last Name is required.<br>"),i.IsShowEmail()&&i.IsForceEmail()&&n.trim(n("#txtEmailAddress").val()).length==0&&(errorMessage+="An e-mail address is required.<br>"),i.IsShowEmail()&&n.trim(n("#txtEmailAddress").val()).length!=0&&SuperSolver.IsValidEmail(n.trim(n("#txtEmailAddress").val()))==!1&&(errorMessage+="Please enter a valid e-mail address.<br>"),i.IsShowMobileNo()&&i.IsForceMobileNo()&&n.trim(n("#txtMobileNo").val()).length==0&&(errorMessage+="Mobile Number is required.<br>"),i.IsShowMobileNo()&&n.trim(n("#txtMobileNo").val()).length!=0&&n("#txtMobileNo").val().trim().match(c)==null&&(errorMessage+="Please enter 10 digit Mobile Number.<br>"),i.IsForceAdditionalCommentsField()&&i.IsShowAdditionalCommentsField()&&n.trim(n("#txtAdditionalComments").val()).length==0&&(errorMessage+=h+" is required.<br>"),i.IsShowCustomField()&&i.IsForceCustomField()&&n.trim(n("#txtCustomFieldLabel").val()).length==0&&(errorMessage+=s+" is required.<br>"),(i.IsShowEmail()||i.IsShowMobileNo())&&(!i.IsForceEmailOrMobileNo()||i.IsForceMobileNo()||i.IsForceEmail()||n.trim(n("#txtEmailAddress").val()).length!=0||n.trim(n("#txtMobileNo").val()).length!=0||(errorMessage+="Email address or mobile number is required.<br>")),errorMessage.length!==0){ShowAlert(errorMessage);n(".NextBtn").removeAttr("disabled").removeClass("disabled");return}hi(n.trim(n("#txtFirstName").val()),n.trim(n("#txtLastName").val()),n.trim(n("#txtEmailAddress").val()));SetCookie("CustomFieldValue",n.trim(n("#txtCustomFieldLabel").val()));SetCookie("CompanyId",i.CompanyID());SetCookie("NearSectionValue",n.trim(n("#ddlCompanyAreaList").val()));ct(u)}else ShowAlert("The form you are trying to submit has expired.Please press OK to refresh and try again.","","",function(){location.reload()})})}function ct(t){SetCookie("SubmitInProcess","true",1);n("#hdnIsSafariSubmitInProcess").val("true");n("#submittedFeedbackModal").modal("show");n(".NextBtn").removeAttr("disabled").removeClass("disabled");console.log("Started loading submission payload");var i=setInterval(function(){if(n("#hdnConnectionIdSignalR").val()!==""){clearInterval(i);var r=new InputPayload(t),u=n("#hdnSatisfiWebApiUrl").val()+"api/submission?apiKey="+n("#hdnCompanyApiKey").val()+"&companyId="+t.CompanyID;console.log("Payload before send: "+JSON.stringify(r));r.payload.items.length!=0?n.ajax({type:"POST",url:u,contentType:"application/json",data:JSON.stringify(r),crossDomain:!0,success:function(t){console.log("ajax completed: "+JSON.stringify(t));n(".buttonsSection").addClass("noDisplay");SetCookie("LoadPage","true");n("#chatEnabledFeedbackId").val(t.response_payload.keys.submittedfeedback_id);SetCookie("isSubmissionMade","true",24);ci();n(".feedbackLoader").removeClass("noDisplay");n("#submittedFeedbackModal").modal("hide");SuperSolver.MessageMain.LoadChatUi(t.response_payload)},error:function(){n("#submittedFeedbackModal").modal("hide");ShowAlert("Sorry unable to proceed, you may have a weak internet connection.")}}):t.SelectedComplaints.length>0&&(n(".feedbackLoader").removeClass("noDisplay"),n("#submittedFeedbackModal").modal("hide"),n(".NextBtn").removeAttr("disabled").removeClass("disabled"),ShowAlert("Unable to submit. No item is selected."),clearInterval(i))}},500)}function ci(){SetCookie("submitComplete","1",1)}function li(){return location.href.indexOf("backpg")>-1?location.href.substring(location.href.indexOf("backpg"),location.href.length):""}function ai(){var t=[];return n("input[subComplaintId], textarea[subComplaintId]").each(function(){n(this).css("display")=="inline-block"&&n(this).val().length!=0&&(n(this).parent().hasClass("CSel")||!n(this).hasClass("enableTextEntry"))&&t.indexOf(Number(n(this).attr("subComplaintId")))===-1&&t.push(Number(n(this).attr("subComplaintId")))}),t}function vi(){var t=[],i=[];return n("input[subComplaintId], textarea[subComplaintId]").each(function(){n(this).css("display")=="inline-block"&&n(this).val().length!=0&&(n(this).parent().hasClass("CSel")||!n(this).hasClass("enableTextEntry"))&&i.indexOf(n(this).attr("subComplaintId"))===-1&&(i.push(n(this).attr("subComplaintId")),t.push(n(this).val()))}),t}function yi(){n("#txtEmailAddress").on("focus",function(){n(".BottomAction",'.Page[data-page="ConfirmComplaint"]').addClass("KBDisplay");n(".Header",'.Page[data-page="ConfirmComplaint"]').addClass("KBDisplay")});n("#txtEmailAddress").on("blur",function(){n(".BottomAction",'.Page[data-page="ConfirmComplaint"]').removeClass("KBDisplay");n(".Header",'.Page[data-page="ConfirmComplaint"]').removeClass("KBDisplay")})}return jQuery.fn.forceNumeric=function(){return this.each(function(){n(this).keydown(function(n){var t=n.which||n.keyCode;return!n.shiftKey&&!n.altKey&&!n.ctrlKey&&t>=48&&t<=57||t>=96&&t<=105||t==190||t==188||t==109||t==110||t==8||t==9||t==13||t==35||t==36||t==37||t==39||t==46||t==45?!0:!1})})},{Init:function(n){lt(n)},HandleLocationAndPageFunctionality:function(n,t){it(n,t)},ShowPage:function(n){a(n)},LoadManualSearchAndClearLocatorResultsInterval:function(){ft()},LoadSearchPagesForCurrentLocation:function(n){rt(n)},AppendBackPageQuerystring:function(n,t){return AppendBackPageQuerystring(n,t)},AppendQuerystring:function(n,t){return k(n,t)},RemoveAllBackPgParams:function(n,t){return ot(n,t)},ConfigureNextButtonTexts:function(){return st(r.SelectedPlace())},GetLocationCategoryId:function(){return r.SelectedPlace()?r.SelectedPlace().CategoryID():0},IsMenuHidden:function(){return r.HideMenu()}}}();SuperSolver.Search=a}(jQuery);$(function(){function n(){var n=new Date,t=-n.getTimezoneOffset();document.cookie="ctzo="+t.toString()+"; path=/;SameSite=None; Secure;"}n()});$(function(){function n(){$(".loader").removeClass("noDisplay");SetCookie("FeedbacksCurrentPosition",0,24);$("#newMessageAvailable").hide();$("#hdnNewMessagesFeedbackIds").val().split(",").length>1?(SetCookie("SubmittedFeedBackId","0",1),DeleteCookie("CurrentSubmissionIdForLoadChat")):$("#hdnNewMessagesFeedbackIds").val("");History.showMenu();DeleteCookie("CurrentSubmissionIdForLoadChat");SuperSolver.MessageMain.LoadFeedbacks(!0)}$.ajaxSetup({beforeSend:function(n){n.setRequestHeader("EventGroupId",$("#hdnEventGroupId").val())}});$("#btnViewMessages, #newMessageAvailable").click(function(){n()});$("#btnCancelNewMsgModal").click(function(){$(".defaultHeader").css("opacity",1);$(":button.NextBtn").attr("disabled",!1)})}),function(n){function k(){n(".typing-indicator").addClass("noDisplayImp");t.TypingUsers([]);n(".messagesList").css("padding-bottom",n(".divTypingUsers").height())}function ti(){var i=this;i.TotalFeedbacks=ko.observable("");i.Feedbacks=ko.observableArray();i.SelectedFeedback=ko.observable();i.MessageCount=ko.observable("");i.FeedbackMessages=ko.observableArray();i.Message=ko.observable();i.MailToLink1=ko.observable("");i.MailToLink2=ko.observable("");i.CustomerFirstMessageFromName=ko.observable("");i.CustomerEmailName=ko.observable("");i.SelectedFeedbackIdForAction=ko.observable(0);i.PendingFeedbackMessages=ko.observableArray();i.ReplyText=ko.observable("");i.IsChatEnabled=ko.observable(!1);i.FeedbackCompanyName=ko.observable("");i.CustomerEmail=ko.observable("");i.CustomerMobileNumber=ko.observable("");i.EnableExitPopNotify=ko.observable(!1);i.EnableChatScreenNotify=ko.observable(!1);i.TypingUsers=ko.observableArray();i.IsCustomerUploadsEnabled=ko.observable(!1);i.HideMenu=ko.observable(!1);i.HideHeaderBoxShadow=ko.observable(!1);i.HideBackButton=ko.observable(!1);i.HideMarkAllReadButton=ko.observable(!1);i.HideChatDeleteButton=ko.observable(!1);i.BusinessEmailDisplayName=ko.observable("");i.SuppressSubmitDetails=ko.observable(!1);i.ResponsePageId=ko.observable(0);i.IsMuted=ko.observable(!1);i.PageId=ko.observable(0);i.PageName=ko.observable("");i.ThemeId=ko.observable(0);i.ChatQuickReplyButtons=ko.observableArray();i.ShowHideQuickReplyScroll=function(){n(".quickReplySection").addClass("noDisplay");var t=setInterval(function(){if(n("#divMainContainer").width()!==0){n(".quickReplySection").removeClass("noDisplay");clearInterval(t);var i=n("#divMainContainer").width();n("#quickReplycontent").width(i);n(".quickReplyDiv").width(i+2);n("#quickReplycontent").get(0).scrollWidth!==0&&n("html, body").animate({scrollTop:n(".quickReplySection").position().top});n(".quickReplyButtonsDiv").width()>=n("#quickReplycontent").get(0).scrollWidth?(n("#right-button").addClass("noDisplay"),n("#left-button").addClass("noDisplay")):(n("#right-button").removeClass("noDisplay"),n("#left-button").addClass("noDisplay"));/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(n("#quickReplycontent").css("overflow-x","auto"),n("#right-button").addClass("noDisplay"),n("#left-button").addClass("noDisplay"))}else n(".quickReplySection").addClass("noDisplay")},500)};i.ChatQuickReplyShow=ko.observable(!1);i.HeaderImage=ko.observable("");i.UpperSectionLine1=ko.observable("");i.UpperSectionLine2=ko.observable("");i.UpperSectionLine3=ko.observable("");i.LowerSectionLine1=ko.observable("");i.LowerSectionLine2=ko.observable("");i.Button1Label=ko.observable("");i.Button1PageIdLink=ko.observable("");i.Button1PageIdLinkUrl=ko.observable("");i.Button2Label=ko.observable("");i.Button2PageIdLink=ko.observable("");i.Button2PageIdLinkUrl=ko.observable("");i.ResponsePageButtonClick=function(n,i,r){return SavePageEvent(GetCurrentChainId(),n.PageId(),"CLICK",r.target.textContent.trim(),i,n.SelectedFeedback().SubmittedFeedbackID()),i==-2?(DeleteCookie("ResponsePageId"),ii(n.SelectedFeedback().SubmittedFeedbackID()),t.SelectedFeedback().ResponsePageId(0),t.SelectedFeedback().IsChatDisabled(!1),SuperSolver.MessageMain.LoadMessages(),!1):(DeleteCookie("MaintainStatePageView"+getParameterByName("pageId")),!0)}}function ii(t){n.ajax({url:"api/Messages/EnableChatForSubmittedFeedback",data:{submittedFeedbackId:t},type:"POST",dataType:"json",success:function(){console.log("enabled chat successfully")},error:function(){console.log("some error occured while updating disable chat status")},complete:function(){}})}function y(n){var i=/('|")?((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#!]*[\w\-\@?^=%&amp;\/~\+#!])('|")?)/g,t=n.replace(i,function(n,t){return t?n:"<a href="+n+" >"+n+"<\/a>"});return t.indexOf("-newtabm")!=-1&&(i=/((<a href=")|(<img src="))?(((http|ftp|https)-newtabm):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#!]*[\w\-\@?^=%&amp;\/~\+#!])('|")?)/g,t=t.replace(i,function(n,t){return n=n.replace("-newtabm",""),t?n+(u?" target='_blank'":""):"<a href="+n+(u?" target='_blank' >":" >")+n+"<\/a>"})),t.indexOf("-newtabd")!=-1&&(i=/((<a href=")|(<img src="))?(((http|ftp|https)-newtabd):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#!]*[\w\-\@?^=%&amp;\/~\+#!])('|")?)/g,t=t.replace(i,function(n,t){return n=n.replace("-newtabd",""),t?n+(u?"":" target='_blank'"):"<a href="+n+(u?" >":" target='_blank' >")+n+"<\/a>"})),t.indexOf("-newtab")!=-1&&(i=/((<a href=")|(<img src="))?(((http|ftp|https)-newtab):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:\/~\+#!]*[\w\-\@?^=%&amp;\/~\+#!])('|")?)/g,t=t.replace(i,function(n,t){return n=n.replace("-newtab",""),t?n+" target='_blank'":"<a href="+n+" target='_blank'>"+n+"<\/a>"})),t.indexOf("&#60;")!==-1||t.indexOf("&lt;")!==-1?st(t).replace(/<script/g,"&#60;script"):t}function st(t){return n("<div/>").html(t).text()}function ri(n){n.value.length>n.maxLength&&(n.value=n.value.slice(0,n.maxLength))}function ui(n){var t=this;t.Label=ko.observable(n.label);t.QuickReplyButtonNum=ko.observable(n.quick_reply_button_num);t.Response=ko.observable(n.response);t.Action=ko.observable(n.action);t.Contents=ko.observable(n.contents)}function fi(n){var t=[];if(n!=null)for(i=0;i<n.length;i++)t.push(new ui(n[i]));return t}function d(i){function c(){r.MessageDateTime(new Date(r.MessageDateTime().getFullYear(),r.MessageDateTime().getMonth(),r.MessageDateTime().getDate(),r.MessageDateTime().getHours(),r.MessageDateTime().getMinutes(),r.MessageDateTime().getSeconds()));setTimeout(function(){c()},864e5)}n("#submittedFeedbackId").val(i.SubmittedFeedbackID);var r=this,e=i.ButtonPayload===undefined||i.ButtonPayload===""?null:JSON.parse(i.ButtonPayload),f=i.SelectionPayload===undefined||i.SelectionPayload===""?null:JSON.parse(i.SelectionPayload),s,h,u,o=i.QuickReplyButtonPayload===undefined||i.QuickReplyButtonPayload===""?null:JSON.parse(i.QuickReplyButtonPayload);t.ChatQuickReplyButtons(o==null?[]:fi(o.quick_reply_buttons));t.ChatQuickReplyShow(o!==null&&o.quick_reply_buttons!==null&&o.quick_reply_buttons.length>0&&o.quick_reply_buttons[0].label.trim()!==""?!0:!1);r.HideAfterPressed=ko.observable(1);e!=null&&e.columns!=0&&(r.HideAfterPressed=ko.observable(e.hide_after_pressed));f!=null&&f.selection_type!=""&&f.items.length!=0&&(r.HideAfterPressed=ko.observable(f.hide_after_pressed));r.MessageID=ko.observable(i.MessageID);r.IsChatPageButtonsShow=ko.observable(i.IsChatPageButtonsShow==undefined?!0:i.IsChatPageButtonsShow);r.ContentText=ko.observable(i.ContentText.indexOf(l)>-1?"<p>ATTACHMENT<\/p>":i.ContentText.trim().replace(/\\n/g,"<br />"));r.SubmittedFeedbackID=ko.observable(i.SubmittedFeedbackID);r.ResponsePageId=ko.observable(i.ResponsePageId);r.Subject=ko.observable(i.Subject);r.CompanyName=ko.observable(i.CompanyName);r.MessageCount=ko.observable(i.MessageCount);r.SenderDisplayName=ko.observable(i.SenderDisplayName);r.MessageDate=ko.observable(i.MessageDate);r.MessageTime=ko.observable(i.MessageTime);r.HasAttachment=ko.observable(i.HasAttachment);r.PreviousMessageID=ko.observable(0);r.Updated=ko.observable(i.Updated==!1?!1:!0);r.MessageDateTime=ko.observable(SuperSolver.MessageMain.GetFormatedDateFromJson(i.MessageDateTime));r.Attachments=ko.observableArray(ct(i.Attachments));r.Email=ko.observable(i.Email);r.MobileNumber=ko.observable(i.MobileNumber);r.IsChatDisabled=ko.observable(i.IsChatDisabled);r.PageID=ko.observable(i.PageID);r.MsgTypeId=ko.observable(i.MsgTypeId);r.IsJustNowMessage=ko.observable(i.IsJustNowMessage==undefined?!1:i.IsJustNowMessage);r.SuppressSubmitDetails=ko.observable(i.SuppressSubmitDetails);r.Columns=ko.observable(e==null?0:e.columns);r.ChatButtons=ko.observableArray(e==null?[]:e.buttons);r.AraId=ko.observable(i.AraId);r.ButtonClickPayload=ko.observable("");r.PageName=ko.observable(i.PageName);r.LastMessage=ko.observable(i.LastMessage);r.HideLoader=ko.observable(i.HideLoader);r.MessageGuid=ko.observable(i.MessageGuid);r.CategoryId=ko.observable(i.CategoryId);r.SelectionType=ko.observable(f==null?"":f.selection_type);r.SelectionItems=ko.observableArray(f==null?[]:oi(f.items));r.ConfirmButton=ko.observable(f==null?"":f.confirm_button);r.SelectionConfirmPayload=ko.observable("");r.LastMessageComputed=ko.computed(function(){return s=/(<([^>]+)>)/ig,h=r.LastMessage()===undefined?"":r.LastMessage(),u=h.replace(s,"").replace(/(https-newtabm|https-newtabd|https-newtab)/g,"https").replace(/(http-newtabm|http-newtabd|http-newtab)/g,"http").replace(/(ftp-newtabm|ftp-newtabd|ftp-newtab)/g,"ftp"),u.indexOf(l)>-1?"ATTACHMENT":((u.indexOf("&#60;")!==-1||u.indexOf("&lt;")!==-1)&&(u=u.replace(/&#60;/g,"<").replace(/&lt;/g,"<"),u=st(u).replace(/<script/g,"&#60;script"),u=u.indexOf("<")!==-1?u.substring(0,u.indexOf("<")):u),u)});r.IdColumn=ko.observable(i.IdColumn);r.SenderBubbleName=ko.computed(function(){if(r.MsgTypeId()==undefined)return"";switch(r.MsgTypeId()){case 1:return"Submission";case 10:return"Me";case 12:return"Submission";default:return r.SenderDisplayName()!=undefined&&r.SenderDisplayName()!=null&&r.SenderDisplayName().length!==0?r.SenderDisplayName():t.BusinessEmailDisplayName()!=undefined&&t.BusinessEmailDisplayName()!=null&&t.BusinessEmailDisplayName().length!==0?t.BusinessEmailDisplayName():t.FeedbackCompanyName()}});r.MessageHeader=ko.computed(function(){return SuperSolver.MessageMain.GetFormatedChatTime(r.MessageDate(),r.MessageTime())});r.MsgTimeInClientTZ=ko.computed(function(){if(r.MessageTime()===p)return p;var n=SuperSolver.MessageMain.GetClientTimeFromUtcTime(r.MessageDateTime());return si(n)});r.MsgDateInClientTZ=ko.computed(function(){return r.MessageTime()===p?"":SuperSolver.MessageMain.GetMessageDatePartInClientTimeZone(r.MessageDateTime())});setTimeout(function(){c()},timeIntervalForDayChange);r.displayFeedbackAction=function(){SuperSolver.MessageMain.displayFeedbackAction(r.SubmittedFeedbackID(),r.Updated())};r.deleteFeedbackFromchat=function(){SuperSolver.MessageMain.DeleteFeedbackFromchat(r.SubmittedFeedbackID())}}function ei(t){var i=this;i.SelectionNumber=ko.observable(t.selection_num);i.Response=ko.observable(t.response);i.Label=ko.observable(t.label);i.ChatSelectedItem=ko.observable(!1);i.onChatSelectedItem=function(t,r){t==="option_button"?(n(r).each(function(){this.ChatSelectedItem(!1)}),i.ChatSelectedItem(!0)):i.ChatSelectedItem(i.ChatSelectedItem()?!1:!0)}}function oi(n){for(var i=[],t=0;t<n.length;t++)i.push(new ei(n[t]));return i}function si(n){var t=ht(n.getHours()>12?n.getHours()-12:n.getHours()),i=ht(n.getMinutes()),r=n.getHours()<12?"AM":"PM";return t+":"+i+" "+r}function ht(n){return n<10?"0"+n:n}function hi(t){var i=this;i.AttachmentID=ko.observable(t.AttachmentID);i.DownloadLink=ko.observable(t.DownloadLink);i.FileName=ko.observable(t.FileName);i.StoredFileName=ko.observable(t.StoredFileName);i.FileSize=ko.observable(t.FileSize);i.AttachmentIconUrl=ko.computed(function(){var t=this.FileName().split(".").pop();return t.toLowerCase()=="pdf"?n("#AWSImgFilePath").val()+"Icons/pdf.png":n.inArray(t.toLowerCase(),["jpeg","jpg","png","gif"])!=-1?n("#AWSImgFilePath").val()+"Icons/photo.png":n("#AWSImgFilePath").val()+"Icons/fileicon.png"},this);i.DownLoadLinkText=ko.computed(function(){var t=this.FileName().split(".").pop();return t.toLowerCase()=="pdf"?"View PDF":n.inArray(t.toLowerCase(),["jpeg","jpg","png","gif"])!=-1?"View Photo":"View File"},this);i.IsPhoto=ko.computed(function(){var t=this.FileName().split(".").pop();return n.inArray(t.toLowerCase(),["jpeg","jpg","png","gif"])!=-1?!0:!1},this);i.PreviewPhoto=function(t){n("#imgPhotoPreview").attr("src",t.DownloadLink());n("#hdnContainerScrollPos").val(n(window).scrollTop());n(".Container").hide();n("#tblPhotoPreviewWrapper").removeClass("noDisplay");n("body").append(n("#divViewPhotoModal").html());n("body > #divViewPhotoModal").remove()}}function ci(n){var t=this;t.FirstName=ko.observable(n.UserDisplayName);t.SourceAppId=ko.observable(n.SourceApp)}function ct(n){var i=[],t;if(n!="undefined"&&n!=null)for(t=0;t<n.length;t++)n[t].AttachmentID!=0&&i.push(new hi(n[t]));return i}function li(n){var t=[];return t.push(new ci(n)),t}n.ajaxSetup({beforeSend:function(t){t.setRequestHeader("EventGroupId",n("#hdnEventGroupId").val())}});SuperSolver&&SuperSolver.HeaderInfo||(SuperSolver.HeaderInfo={});var h=!1,lt="AM",g="PM",p="Pending...",w=!1,nt=0,tt=SuperSolver.Loader,t=new ti,at=".Page",it="FeedbackMessagesWithChat",rt="Today",vt="Just Now",yt="Yesterday",pt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],wt=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],l="[[[(:ATTACHMENT:)]]]",ut=!1,bt=this,kt=window.innerHeight,c="click",b,dt=1e4,f=n("#textAreaReply"),ft=4e3,a=[],o,r,e,s,u=!1,gt=3,v=0,et=0,ot,ni=1e4;/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(u=!0);o=window.attachEvent?function(n,t,i){n.attachEvent("on"+t,i)}:function(n,t,i){n.addEventListener(t,i,!1)};SuperSolver.CitiField="Citi Field";SuperSolver.NewyorkTimeZoneName="America/New_York";SuperSolver.IsUtcTime=!0;SuperSolver.TimeGap=1;bt.maxLengthCheck=function(n){return ri(n)};n(window).unload(function(){if(chatConnection.invoke("removeUnusedConnection",n("#hdnConnectionIdSignalR").val()),!isReloadModalOpen){var r=GetCookie("SessionCounts"),t=r.split(","),i;t.length>0&&(i=t.indexOf(n("#hdnSessionNumber").val()),i>-1&&t.splice(i,1),SetCookie("SessionCounts",t.join()))}});n(document).ready(function(){setTimeout(function(){var t=n(".MessageBottomAction").height()+10;u&&(t+=10);n(".typing-indicator").attr("style","bottom : "+(t<50?50:t)+"px")},7e3);n(document).on("click","#right-button",function(t){t.preventDefault();n("#left-button").removeClass("noDisplay");n("#quickReplycontent").css("margin-left","0px");n("#quickReplycontent").animate({scrollLeft:"+=300px"},"slow",function(){Math.ceil(n("#quickReplycontent").scrollLeft()+n(".quickReplyButtonsDiv").width())>=n("#quickReplycontent").get(0).scrollWidth&&n("#right-button").addClass("noDisplay")})});n(document).on("click","#left-button",function(t){t.preventDefault();n("#right-button").removeClass("noDisplay");n("#quickReplycontent").animate({scrollLeft:"-=300px"},"slow",function(){n("#quickReplycontent").scrollLeft()==0&&(n("#left-button").addClass("noDisplay"),n("#quickReplycontent").css("margin-left","5px"))})});SetQuickReplyArrowPosition()});f.keyup(function(i){var h=n(".MessageBottomAction").height()+10,c,o;u&&(h+=10);n(".typing-indicator").attr("style","bottom : "+(h<50?50:h)+"px !important");clearTimeout(b);c={SubmittedFeedbackID:t.SelectedFeedback().SubmittedFeedbackID(),UserDisplayName:t.CustomerEmailName(),SourceApp:sourceApp.Mobile,CustomerId:SuperSolver.MessageMain.GetSatisfiCustID(),CompanyId:n("#hdnCompanyId").val(),AraId:t.SelectedFeedback().AraId(),ConnectionId:n("#hdnConnectionIdSignalR").val()};try{chatConnection.invoke("UserTyping",c);b=setTimeout(function(){chatConnection.invoke("ClearServerTypingData",c)},dt)}catch(l){CreateConnection(!0)}if(!u&&i.which==13&&f.val().trim().length===0)return o=Math.ceil(r+e/2),r!==e&&r!==14&&r<e&&(r===10?o+=3:r<20?o+=2:r<22&&(o+=1)),n(".MessageTopLine").css("margin-bottom",Math.abs(s-(o+6)+10)+"px"),f.val("").css("height",o+"px").focus(),!1});f.on("keydown",function(t){n("#imgCamera").addClass("doNotShow");clearTimeout(b);u||((t.ctrlKey||t.altKey)&&t.which==13?f.val(f.val()+"\n"):t.which==13&&(t.preventDefault(),n("#imgBtnReply").click()),t.which==13&&n("#imgCamera").removeClass("doNotShow"))});f.on("blur",function(){n("#imgCamera").removeClass("doNotShow");n(this).attr("placeholder",placeHolderValue)});u&&(c="touchend");n("#imgBtnReply",'.Page[data-page="FeedbackMessagesWithChat"]').on(c,function(){SuperSolver.MessageMain.SendReply()});SuperSolver.MessageMain=function(){function oi(){function i(){r=parseInt(n("#textAreaReply.GeneralUI-TypeMessageEntry").css("font-size"));e=parseInt(n("#imgBtnReply.GeneralUI-SendButton").css("font-size"));s=parseInt(n("#imgBtnReply").css("height"));var u;console.log("textFontSize : "+r+",buttonFontSize : "+e+",buttonHeight:"+s);r&&e&&s||et<5&&setTimeout(function(){et++;i()},200);n("#textAreaReply").height()<=60?(t.style.height="auto",u=Math.ceil(r+e/2),r!==e&&r!==14&&r<e&&(r===10?u+=3:r<20?u+=2:r<22&&(u+=1)),t.value.length===0?(n(".MessageTopLine").css("margin-bottom",Math.abs(s-(u+6)+10)+"px"),t.style.height=u+"px"):t.style.height=(t.scrollHeight<u?u:t.scrollHeight)+"px",n("#textAreaReply").addClass("overflowHidden")):n("#textAreaReply").removeClass("overflowHidden")}function u(){window.setTimeout(i,0)}var t=document.getElementById("textAreaReply");o(t,"change",i);o(t,"cut",u);o(t,"paste",u);o(t,"drop",u);o(t,"keydown",u);i()}function bi(){var r=n("#txtNotifyFormattedMobileNumber"),i=n("#txtNotifyMobileNumber");ko.applyBindings(t,document.getElementById("container2"));di();ir();or();wr();br();r.inputmask("(999) 999-9999");i.forceNumeric();i.hide();r.on("focus",function(){r.hide();i.show();var n=i.val();i.val("");i.val(n);i.focus()});i.on("blur",function(){i.hide();r.show();var n=i.val();r.val(n)});i.keyup(function(){n(this).val().charAt(0)==1&&n(this).val(n(this).val().substr(1))})}function ti(n){return n=n.toString(),n>9?n:"0"+n}function ki(r){if(t.IsMuted())RedirectToPageNotFound();else{var c=[],u=ui(),o,s;if(v=0,u.setMonth(u.getMonth()+1),o=u.getFullYear()+":"+ti(u.getMonth())+":"+ti(u.getDate())+":"+ti(u.getHours())+":"+ti(u.getMinutes()),s=u.toLocaleString("en-US",{hour:"numeric",minute:"numeric",hour12:!0}),c.push({AraId:r.keys.ara_id,CompanyName:"",ContentText:"<p>ok<\/p>↵",Email:"",HasAttachment:!1,IsChatDisabled:!t.IsChatEnabled(),MessageCount:r.messages.length,MessageDate:"Today",MessageDateTime:o,MessageTime:s,MobileNumber:"",PageID:r.keys.page_id,ResponsePageId:t.ResponsePageId(),Subject:"Re: Request "+r.keys.submittedfeedback_id+" for API Message",SubmittedFeedbackID:r.keys.submittedfeedback_id,SuppressSubmitDetails:t.SuppressSubmitDetails(),Updated:!1}),t.Feedbacks(bt(c,!0)),t.SelectedFeedbackIdForAction(r.keys.submittedfeedback_id),t.SelectedFeedback(t.Feedbacks()[0]),SetCookie("CurrentSubmissionIdForLoadChat",r.keys.submittedfeedback_id,24),t.ResponsePageId()>0)t.FeedbackMessages(null),ht(t.ResponsePageId());else{SetCookie("SubmittedFeedBackId",r.keys.submittedfeedback_id);LoadThemeWithPageId(t.ResponsePageId(),"chatThemeLink");var e=[],h=n("#hdnNewMessagesFeedbackIds"),f=h.val().length!==0?h.val()+",":"";r.messages.forEach(function(n){(Number(n.msg_type_id)===1||Number(n.msg_type_id)===12)&&t.SuppressSubmitDetails()||e.push({ContentText:n.message_text,SenderDisplayName:n.SenderDisplayName,HasAttachment:!1,MessageDate:"Today",MessageDateTime:o,MessageID:n.message_id,MessageTime:s,MsgTypeId:n.msg_type_id,Subject:"CustID: "+r.keys.customer_id.toString()+"SubID:"+r.keys.submittedfeedback_id.toString(),SubmittedFeedbackID:r.keys.submittedfeedback_id,ButtonPayload:JSON.stringify(n.button_payload),Attachments:n.attachments,MessageGuid:n.message_guid})});a.length!==0&&(n.each(a,function(){this.SubmittedFeedbackID===r.keys.submittedfeedback_id?e.push(this):f.indexOf(this.SubmittedFeedbackID)===-1&&(f+=this.SubmittedFeedbackID+",")}),h.val(f.length!==0?f.substr(0,f.length-1):f),a=[]);i(it,!0,r.keys.submittedfeedback_id);t.FeedbackMessages(null);t.FeedbackMessages(bt(e));t.MessageCount(e.length);DeleteCookie("SubmitInProcess");n("#hdnIsSafariSubmitInProcess").val("false");r.keys.submittedfeedback_id&&MarkFeedbackReadByCustomer(r.keys.submittedfeedback_id);t.IsChatEnabled()&&!t.IsMuted()?n(".MessageBottomAction").show():n(".MessageBottomAction").hide();t.EnableChatScreenNotify()&&n.trim(n("#txtMobileNo").val())==""&&n.trim(n("#txtEmailAddress").val())==""?n("#divNotify").show():n("#divNotify").hide()}n("#chatEnabledFeedbackId").val(0);n(".feedbackLoader").addClass("noDisplay");n("#submittedFeedbackModal").modal("hide");n("#chatEnabledFeedbackId").val(0)}}function b(i,r,u){try{var s=n("#hdnLocationID").val(),h=n("#hdnCompanyId").val(),o=!1,e,c=u?u.validateMaintainState:!1,f=GetParameterByName("submittedfeedbackid").length!==0?Number(GetParameterByName("submittedfeedbackid")):0;f=!f&&c?Number(GetCookie("CurrentSubmissionIdForLoadChat")):f;n.get("api/Messages/MLBFeedbacks?CustID="+dt()+"&LocationId="+s+"&CompanyId="+h+"&SubmittedFeedbackID="+f,function(i){if(i.Success){var r=i.Results;t.TotalFeedbacks(r.length);t.Feedbacks(bt(r,!0));r.length==0?n("#divNoRequests").removeClass("noDisplay"):n("#divNoRequests").addClass("noDisplay");u&&u.validateMaintainState&&(e=jQuery.grep(t.Feedbacks(),function(n){return n.SubmittedFeedbackID()==GetCookie("CurrentSubmissionIdForLoadChat")}),e.length>0&&e[0].CategoryId()!==SuperSolver.Search.GetLocationCategoryId()&&(o=!0,DeleteCookie("CurrentSubmissionIdForLoadChat"),u.callback()))}else ShowAlert(i.Msg)}).complete(function(){var s,e,f,u;if(s=n("#chatEnabledFeedbackId").val(),e=GetCookie("SubmittedFeedBackId"),u=0,s>0){for(u=0;u<t.Feedbacks().length;u++)if(s==t.Feedbacks()[u].SubmittedFeedbackID()){t.SelectedFeedbackIdForAction(s);t.SelectedFeedback(t.Feedbacks()[u]);SetCookie("CurrentSubmissionIdForLoadChat",s,24);t.SelectedFeedback().ResponsePageId()>0?ht(t.SelectedFeedback().ResponsePageId(),r):p(r);n("#chatEnabledFeedbackId").val(0);return}n("#chatEnabledFeedbackId").val(0)}else if(parseInt(e)>0&&GetCookie("IsLatestMessageClicked")=="true"){for(u=0;u<t.Feedbacks().length;u++)if(e==t.Feedbacks()[u].SubmittedFeedbackID()){t.SelectedFeedbackIdForAction(e);t.SelectedFeedback(t.Feedbacks()[u]);t.SelectedFeedback().ResponsePageId()>0?ht(t.SelectedFeedback().ResponsePageId(),r):p(r);SetCookie("IsLatestMessageClicked","false");return}}else if(st("SubmittedFeedbackId")==""||i)if(GetCookie("CurrentSubmissionIdForLoadChat")!=""){if(f=jQuery.grep(t.Feedbacks(),function(n){return n.SubmittedFeedbackID()==GetCookie("CurrentSubmissionIdForLoadChat")}),f.length!=0){History.hideMenu();t.SelectedFeedbackIdForAction(f[0].SubmittedFeedbackID());t.SelectedFeedback(f[0]);t.SelectedFeedback().ResponsePageId()>0?ht(t.SelectedFeedback().ResponsePageId(),r):p(r);SetCookie("IsLatestMessageClicked","false");return}n("#submittedFeedbackModal").modal("hide");n('.Page[data-page="FeedbackMessagesWithChat"]').css("display")!="block"?(History.showMenu(),History.showMessages()):History.hideMenu()}else o?History.hideMenu():(n("#submittedFeedbackModal").modal("hide"),History.showMenu(),History.showMessages());else if(st("SubmittedFeedbackId")>0){if(f=jQuery.grep(t.Feedbacks(),function(n){return n.SubmittedFeedbackID()==parseInt(st("SubmittedFeedbackId"))}),f.length!=0){History.hideMenu();t.SelectedFeedbackIdForAction(e);t.SelectedFeedback(f[0]);t.SelectedFeedback().ResponsePageId()>0?ht(t.SelectedFeedback().ResponsePageId(),r):p(r);SetCookie("IsLatestMessageClicked","false");return}History.showMenu();History.showMessages()}else{if(GetCookie("InsideChat")=="true"){History.hideMenu();f=jQuery.grep(t.Feedbacks(),function(n){return n.SubmittedFeedbackID()==GetCookie("CurrentSubmissionIdForLoadChat")});t.SelectedFeedbackIdForAction(e);t.SelectedFeedback(f[0]);t.SelectedFeedback().ResponsePageId()>0?ht(t.SelectedFeedback().ResponsePageId(),r):p(r);SetCookie("IsLatestMessageClicked","false");return}n("#submittedFeedbackModal").modal("hide");DeleteCookie("CurrentSubmissionIdForLoadChat");n('.Page[data-page="FeedbackMessagesWithChat"]').css("display")!="block"&&(History.showMenu(),History.showMessages())}SetCookie("IsLatestMessageClicked","false");n(".loader").addClass("noDisplay")})}catch(l){n(".loader").addClass("noDisplay");console.log(l.message)}}function di(){n(".FeedbackList").on("click",".ResultRow",function(t){try{n(".loader").removeClass("noDisplay");var i=t.target,r=n(i).parents(".ResultRow")[0],u=n(".Idx",r).val();SetCookie("FeedbacksCurrentPosition",n(window).scrollTop(),24);gi(u)}catch(f){n(".loader").addClass("noDisplay");console.log(f.message)}})}function gi(i){var r=t.Feedbacks()[i],u;t.SelectedFeedbackIdForAction(r.SubmittedFeedbackID());t.SelectedFeedback(r);SetCookie("isSubmissionMade","false",24);SetCookie("CurrentSubmissionIdForLoadChat",r.SubmittedFeedbackID(),24);SetCookie("InsideChat","true");n("#hdnNewMessagesFeedbackIds").val().indexOf(r.SubmittedFeedbackID()+",")!==-1?n("#hdnNewMessagesFeedbackIds").val(n("#hdnNewMessagesFeedbackIds").val().replace(r.SubmittedFeedbackID()+",","")):n("#hdnNewMessagesFeedbackIds").val().indexOf(","+r.SubmittedFeedbackID())!==-1?n("#hdnNewMessagesFeedbackIds").val(n("#hdnNewMessagesFeedbackIds").val().replace(","+r.SubmittedFeedbackID(),"")):n("#hdnNewMessagesFeedbackIds").val().indexOf(r.SubmittedFeedbackID())!==-1&&n("#hdnNewMessagesFeedbackIds").val(n("#hdnNewMessagesFeedbackIds").val().replace(r.SubmittedFeedbackID(),""));u=t.SelectedFeedback().ResponsePageId();u>0?ht(u):p();History.hideMenu()}function st(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)","i"),t=i.exec(location.search);return t==null?SuperSolver.HeaderInfo[n.toLowerCase()]?SuperSolver.HeaderInfo[n.toLowerCase()]:"":decodeURIComponent(t[1].replace(/\+/g," "))}function nr(){try{var u=!1,i=0,r=t.FeedbackMessages().length-1;if(r>=0){do{try{i=isNaN(Number(t.FeedbackMessages()[r].MessageID()))?0:Number(t.FeedbackMessages()[r].MessageID())}catch(f){LogErrorClientSide("Messages.js , MethodName : GetMessages, Do while Error: "+ex.message);i=0}r--}while(i===0&&r>0)}else v<gt&&(u=!0,v++);(i>0||u)&&t.SelectedFeedback()!=null&&n.ajax({type:"GET",url:"api/Messages/RetrieveMessages?MessageId="+i+"&SubmittedFeedbackId="+t.SelectedFeedback().SubmittedFeedbackID(),success:function(i){if(i.Success){var f=t.SelectedFeedback(),r=i.Results;u&&(v=3,f.SuppressSubmitDetails()&&(r=n.grep(r,function(n){return n.MsgTypeId!=12&&n.MsgTypeId!=1})),f.IsChatDisabled()||t.IsMuted()?n(".MessageBottomAction").hide():n(".MessageBottomAction").show());t.FeedbackMessages()!=null&&t.FeedbackMessages().length>0?ko.utils.arrayPushAll(t.FeedbackMessages,bt(r)):t.FeedbackMessages(bt(r))}},error:function(n,t,i){LogErrorClientSide("Messages.js , MethodName : GetMessages,Ajax Error: "+n.responseText+", status: "+t+", error:"+i)}})}catch(ex){LogErrorClientSide("Messages.js , MethodName : GetMessages, Error: "+ex.message)}}function tr(){chatConnection.on("sayWhoIsTyping",function(i){if(n('.Page[data-page="FeedbackMessagesWithChat"]').is(":visible")&&i.SubmittedFeedbackID==t.SelectedFeedback().SubmittedFeedbackID()){clearTimeout(ot);t.TypingUsers(li(i));var r=n(".MessageBottomAction").height()+10,f=ni;u&&(r+=10);n(".typing-indicator").attr("style","bottom : "+(r<50?50:r)+"px");n(".typing-indicator").removeClass("noDisplayImp");i.DisplaySeconds!==undefined&&i.DisplaySeconds>0&&(f=i.DisplaySeconds*1e3);ot=setTimeout(function(){k()},f)}});chatConnection.on("signalRConnectionCheck",function(){signalRCurrentCounter++});chatConnection.on("saveCurrentConnectionId",function(t){console.log("Message js Connection Id: "+t);n("#hdnConnectionIdSignalR").val(t);pageLoaded||(console.log("Page Initate Method Name: saveCurrentConnectionId, File Name: Messages.js"),PageInitAfterConnection())});chatConnection.on("ClearClientTypingData",function(){k()});chatConnection.on("addMessage",function(i){var e,f=n("#hdnNewMessagesFeedbackIds"),o=!1,s,r,u;if(t.ChatQuickReplyShow(!1),k(),GetCookie("SubmitInProcess").toLowerCase()==="true"||n("#hdnIsSafariSubmitInProcess").val()=="true"){a.push({MessageID:i.MessageID,Subject:i.Subject,SubmittedFeedbackID:i.SubmittedFeedbackID,SenderDisplayName:i.SenderDisplayName,ContentText:y(i.ContentText),MessageDateTime:i.MessageDateTime,MessageDate:i.MessageDate,MessageTime:i.MessageTime,IsJustNowMessage:i.IsJustNowMessage,MsgTypeId:i.MsgTypeId,HasAttachment:i.HasAttachment,Attachments:i.Attachments,ButtonPayload:JSON.stringify(i.ButtonPayload),MessageGuid:i.MessageGuid,SelectionPayload:JSON.stringify(i.SelectionPayload),QuickReplyButtonPayload:JSON.stringify(i.QuickReplyButtonPayload)});return}(n('.Page[data-page="FeedbackMessagesWithChat"]').css("display")!="none"||n('.Page[data-page="ResponsePage"]').css("display")!="none")&&i.SubmittedFeedbackID==t.SelectedFeedback().SubmittedFeedbackID()?(e=[{MessageID:i.MessageID,Subject:i.Subject,SubmittedFeedbackID:i.SubmittedFeedbackID,SenderDisplayName:i.SenderDisplayName,ContentText:i.ContentText,MessageDateTime:i.MessageDateTime,MessageDate:i.MessageDate,MessageTime:i.MessageTime,IsJustNowMessage:i.IsJustNowMessage,MsgTypeId:i.MsgTypeId,HasAttachment:i.HasAttachment,Attachments:i.Attachments,ButtonPayload:JSON.stringify(i.ButtonPayload),MessageGuid:i.MessageGuid,SelectionPayload:JSON.stringify(i.SelectionPayload),QuickReplyButtonPayload:JSON.stringify(i.QuickReplyButtonPayload)}],MarkFeedbackReadByCustomer(i.SubmittedFeedbackID),t.FeedbackMessages()!=null&&t.FeedbackMessages().length>2&&n(window).scrollTop()+100>=n(document).height()-n(window).height()&&(o=!1),t.FeedbackMessages()!=null&&t.FeedbackMessages().length>0?ko.utils.arrayPushAll(t.FeedbackMessages,SuperSolver.MessageMain.GetFeedbackModelsFromJsonInReverse(e)):t.FeedbackMessages(SuperSolver.MessageMain.GetFeedbackModelsFromJsonInReverse(e)),o||i.ContentText.trim()==""||ii()):(f.val().length===0?(f.val(i.SubmittedFeedbackID),SetCookie("SubmittedFeedBackId",i.SubmittedFeedbackID,1)):f.val().indexOf(i.SubmittedFeedbackID)===-1&&f.val(f.val()+","+i.SubmittedFeedbackID),ShowNotification(),u=ko.utils.arrayFirst(t.Feedbacks(),function(n){return n.SubmittedFeedbackID()===i.SubmittedFeedbackID}),u!=null&&(u.Updated(!0),r=new Date(i.MessageDateTime),s=new Date(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds()),u.MessageDateTime(s),u.MessageDate(i.MessageDate),u.MessageTime(i.MessageTime),i.ContentText!=undefined&&i.ContentText!=null&&u.LastMessage(y(i.ContentText.trim()))))})}function ht(i,r){try{var u=t.SelectedFeedback(),f=i,s=st("pageId"),o,e;n.get("api/Messages/GetResponsePageDetails?ID="+Number(u.SubmittedFeedbackID())+"&ResponsePageId="+Number(f)+"&PageId="+Number(s)+"&CustID="+Number(dt())+"&LocationId="+Number(st("locationid")),function(i){if(i.Success){SavePageEvent(GetCurrentChainId(f),f,"PAGEVIEW",i.responsePage.PageName,0,u.SubmittedFeedbackID());i.responsePage.HeaderImage!=null&&i.responsePage.HeaderImage.length!=0?t.HeaderImage(i.responsePage.HeaderImage):n("#imgResponsePageHeaderImage").addClass("noDisplay");t.UpperSectionLine1(i.responsePage.UpperSectionLine1);t.UpperSectionLine2(i.responsePage.UpperSectionLine2);t.UpperSectionLine3(i.responsePage.UpperSectionLine3);t.LowerSectionLine1(i.responsePage.LowerSectionLine1);t.LowerSectionLine2(i.responsePage.LowerSectionLine2);t.PageId(i.responsePage.PageId);o=RemoveURLParameter(location.search,"pageid").trim();e=RemoveAllBackPgParams(o);var s;i.responsePage.Button1Label.length!=0&&(t.Button1Label(i.responsePage.Button1Label),t.Button1PageIdLink(i.responsePage.Button1PageIdLink),s=si(i.responsePage.Button1PageIdLinkUrl,e),t.Button1PageIdLinkUrl(AppendBackPageQuerystring(i.responsePage.Button1PageIdLinkUrl,st("pageId"),!0)));i.responsePage.Button2Label.length!=0&&(t.Button2Label(i.responsePage.Button2Label),t.Button2PageIdLink(i.responsePage.Button2PageIdLink),s=si(i.responsePage.Button2PageIdLinkUrl,e),t.Button2PageIdLinkUrl(AppendBackPageQuerystring(i.responsePage.Button2PageIdLinkUrl,st("pageId"),!0)));t.HideMenu(i.responsePage.ResponseMenuId==1||i.responsePage.PageMenuId==1);t.HideBackButton(i.responsePage.NavigationButtonId==1||i.responsePage.HideNavButtons);ShowAllDefaultMenus();i.responsePage.PageMenuId===2&&ShowLegalOnly();n("#UUID").val(ri());MarkFeedbackReadByCustomer(u.SubmittedFeedbackID());u.Updated(!1);h=!1;lr(u.SubmittedFeedbackID());t.IsChatEnabled(!0);r&&(History.showMenu(),History.showMessages());return}ShowAlert(i.Msg)}).complete(function(){n(".feedbackLoader,.loader").addClass("noDisplay");GetPageDetailsAndLoadCustomScripts(f)})}catch(c){n(".loader").addClass("noDisplay");console.log(c.message)}}function si(n,t){return t==="?"?n:(n!=""&&typeof n!="undefined"&&(n=n.indexOf("?")>-1?n+t.replace("?","&"):n+t),n)}function ii(){n(".messagesList div.ResultRow:last-child p:first-child").length!==0&&n("html, body").animate({scrollTop:n(".messagesList div.ResultRow:last-child p:first-child").offset().top-60},900)}function p(r){try{if(t.IsMuted())RedirectToPageNotFound();else{n(".ChatActionLink").removeClass("NoAct");t.IsMuted()||n('.Page[data-page="FeedbackMessagesWithChat"] .MessageBottomAction').removeClass("noDisplay");var u=t.SelectedFeedback();SetCookie("SubmittedFeedBackId",u.SubmittedFeedbackID());LoadThemeWithPageId(u.PageID(),"chatThemeLink");n("body").css("overflow","hidden");n.get("api/Messages/MLBFeedbackMessages?ID="+u.SubmittedFeedbackID()+"&PageID="+u.PageID()+"&CustID="+dt(),function(f){if(f.Success){n("#UUID").val(ri());var e=f.Results,o=String.format(SuperSolver.ReplyToEmailTmpl,u.SubmittedFeedbackID());MarkFeedbackReadByCustomer(u.SubmittedFeedbackID());u.Updated(!1);t.MailToLink1(String.format("mailto:{0}?Subject={1}",o,escape(e[0].Subject)));u.SuppressSubmitDetails()&&(e=n.grep(e,function(n){return n.MsgTypeId!=12&&n.MsgTypeId!=1}));h=!1;u.IsChatDisabled()||t.IsMuted()?n(".MessageBottomAction").hide():n(".MessageBottomAction").show();i(it,!0,u.SubmittedFeedbackID());t.IsChatEnabled(!0);t.FeedbackMessages(null);t.FeedbackMessages(bt(e));r&&(History.showMenu(),History.showMessages());t.EnableChatScreenNotify()&&u.MobileNumber()==""&&u.Email()==""?n("#divNotify").show():n("#divNotify").hide();try{n(window).scrollTop(n("#hdnScrollHeight").val()?parseInt(n("#hdnScrollHeight").val()):1e8);n("body").css("overflow","visible")}catch(s){console.log("LoadMessage: Scrolldown"+s.message)}ii();return}ShowAlert(f.Msg);n("#submittedFeedbackModal").modal("hide")}).complete(function(){n(".feedbackLoader,.loader").addClass("noDisplay");n("#submittedFeedbackModal").modal("hide")})}}catch(f){n(".loader").addClass("noDisplay");console.log(f.message)}}function i(t,i,r){i||n("html,body").animate({scrollTop:0},"fast");n(".loader").addClass("noDisplay");n("#divMainContainer").removeClass("noDisplay");t==="Feedbacks"&&GetCookie("FeedbacksCurrentPosition").length!==0&&(n("html,body").animate({scrollTop:GetCookie("FeedbacksCurrentPosition")},"fast"),SetCookie("FeedbacksCurrentPosition","",-1));n(at).hide();n('.Page[data-page="'+t+'"]').show();n('.Page[data-page="'+t+'"]').removeClass("noDisplay");t!=="Feedbacks"&&t!=="LocationSelection"&&t!=="ConfirmComplaint"&&SetCookie("MaintainStatePageView"+GetParameterByName("pageId"),t+","+(r===undefined?0:r),24);n("body").removeClass("ShowMenu");setContainerMinMaxSize.setMinMaxSize();t==="FeedbackMessagesWithChat"&&oi();ShowNotification()}function ir(){function e(t){t.stopPropagation();n("#fileImageUpload").click()}function f(t){n.post("api/Messages/UpdateMessageHideChatButtons?messageId="+t)}function r(t){t?(n('div[data-page="FeedbackMessagesWithChat"]').find(".Header").addClass("noDisplay"),n('div[data-page="FeedbackMessagesWithChat"]').find(".Content").addClass("paddingTop10"),n('div[data-page="FeedbackMessagesWithChat"]').addClass("zeroTopPadding"),n("#divFileIcons").addClass("noDisplay")):(n('div[data-page="FeedbackMessagesWithChat"]').find(".Header").removeClass("noDisplay"),n('div[data-page="FeedbackMessagesWithChat"]').find(".Content").removeClass("paddingTop10"),n('div[data-page="FeedbackMessagesWithChat"]').removeClass("zeroTopPadding"))}n(".PrevBtn",'.Page[data-page="FeedbackMessages"]').click(function(){i("Feedbacks",!0);b()});n(".PrevBtn",'.Page[data-page="FeedbackMessagesWithChat"],.Page[data-page="ResponsePage"]').click(function(){RemoveLastBackpgAndRedirect()});n(".plusButton",'.Page[data-page="FeedbackMessagesWithChat"],.Page[data-page="ResponsePage"]').click(function(){GetParameterByName("view").trim().toUpperCase()==="MESSAGES"?DeleteMaintainStateAndRedirectToPageId():(n("#chatThemeLink").removeAttr("href"),SetCookie("NewButtonClicked","true"),SuperSolver.Search.HandleLocationAndPageFunctionality(Number(GetParameterByName("locationid")),!0),setContainerMinMaxSize.setMinMaxSize())});n(".PrevBtn",'.Page[data-page="MessageView"]').click(function(){t.MessageCount()==1?(i("Feedbacks",!0),b()):i("FeedbackMessages")});u&&(c="touchend");n("#imgCamera").on(c,function(n){e(n)});n(document).on("click",'.Page[data-page="FeedbackMessagesWithChat"] .ChatPageButtons, .quickReplyButtons',function(){try{SavePageEvent(GetCurrentChainId(),GetParameterByName("PageID"),"CHAT-BUTTON-CLICK",n(this).val(),0,t.SelectedFeedback().SubmittedFeedbackID(),"");n(this).attr("data-response")&&n(this).attr("data-response").trim()!==""?t.SelectedFeedback().ButtonClickPayload({ButtonNum:n(this).attr("data-button-num"),Label:n(this).val(),Response:n(this).attr("data-response"),Action:n(this).attr("data-action"),Contents:n(this).attr("data-content")}):t.SelectedFeedback().ButtonClickPayload({ButtonNum:n(this).attr("data-button-num"),Label:n(this).val(),Response:n(this).attr("data-response"),Action:"donotcallARA",Contents:n(this).attr("data-content")});n("#textAreaReply").val(n(this).attr("value"));var i=n(this).attr("data-action").trim().toUpperCase().indexOf("OPEN_URL")>-1,r=n(this).attr("data-content");setTimeout(function(){ei(i,r)},100);n(this).hasClass("ChatPageButtons")&&n(this).parents(".ResultRow").attr("data-message-hide-button")==="true"&&(n(this).parent(".responseButtons").addClass("noDisplay"),f(n(this).parents(".ResultRow").attr("data-message-id")));n(this).hasClass("quickReplyButtons")&&t.ChatQuickReplyShow(!1)}catch(u){LogErrorClientSide("Error- MethodName: ChatPageButtons, Message:"+u.message)}});n(document).on(c,'.Page[data-page="FeedbackMessagesWithChat"] .ChatPageConfirmButtons',function(){try{var i=[];n(this).parents(".SelectionPayloadItem").find(".ComplaintText").each(function(){n(this).attr("data-selected")&&n(this).attr("data-selected")=="true"&&(i.push({SelectionNum:n(this).attr("data-selection-num"),Label:n(this).attr("data-label"),Response:n(this).attr("data-response")}),n("#textAreaReply").val(n("#textAreaReply").val()?n("#textAreaReply").val()+"\n"+n(this).attr("data-label"):n(this).attr("data-label")))});t.SelectedFeedback().SelectionConfirmPayload({SelectionType:n(this).attr("data-selection-type"),Selections:i});n(this).parents(".ResultRow").attr("data-message-hide-button")==="true"&&(n(this).parents(".SelectionPayloadItem").addClass("noDisplay"),f(n(this).parents(".ResultRow").attr("data-message-id")))}catch(r){console.log(r.message)}setTimeout(function(){ei()},100)});if(u){var o=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;window.addEventListener("resize",function(){if(n('.Page[data-page="FeedbackMessagesWithChat"]').css("display")=="block"){if(o)return;ut=window.innerHeight<kt;r(ut)}},!1);n("#textAreaReply").bind("focus",function(){n(".MessageBottomAction").css("position","absolute");r(!0);n("#newMessageAvailable").addClass("top0")});n("#textAreaReply").bind("blur",function(){t.IsChatEnabled()&&!t.IsMuted()&&n(".MessageBottomAction").removeAttr("style");r(!1);n("#newMessageAvailable").removeClass("top0")})}n(document).on("click",".ContentText a",function(){SavePageEvent(GetCurrentChainId(),GetParameterByName("PageID"),"CHAT-LINK-CLICK",n(this).parents("div.ContentText").html(),0,t.SelectedFeedback().SubmittedFeedbackID(),n(this).attr("href"))})}function hi(t){n("#"+t).modal("show")}function rr(){ci(".openFeedbackDeleteModalConfirmation")}function ci(t){var i;n("body").append("<div class='modal-overlay js-modal-close'><\/div>");n(".modal-overlay").fadeTo(500,.7);i=n(t).attr("data-modal-id");n("#"+i).fadeIn(n(t).data())}function ur(){ShowModal("feedbackDeleteConfirmationModal")}function ai(n){for(var i=-1,t=0;t<unsendMessages.length;t++)if(unsendMessages[t].payload.message_guid==n){i=t;break}return i}function vi(i,r,f){var s=n("#hdnSatisfiWebApiUrl").val()+"api/submission?apiKey="+n("#hdnCompanyApiKey").val()+"&companyId="+n("#hdnCompanyId").val(),e=jQuery.grep(t.FeedbackMessages(),function(n){return n.MessageID()==i.payload.message_guid}),o;console.log(e);e.length!==0&&e[0].HideLoader(!1);r&&f.indexOf("-newtab")>0&&(o=window.open("","_blank"));n.ajax({type:"POST",url:s,contentType:"application/json",data:JSON.stringify(i),crossDomain:!0,success:function(n){var t=ai(i.payload.message_guid);t>=0&&unsendMessages.splice(t,1);e.length!=0&&e[0].MessageID(n.response_payload.messages[0].message_id);r&&(typeof parent=="undefined"?window.location.href=f:f.indexOf("-newtabm")>0?u?o.location=f.replace("-newtabm",""):window.location.href=f.replace("-newtabm",""):f.indexOf("-newtabd")>0?u?window.location.href=f.replace("-newtabd",""):o.location=f.replace("-newtabd",""):f.indexOf("-newtab")>0?o.location=f.replace("-newtab",""):window.location.href=f)},error:function(){e.length!==0&&e[0].HideLoader(!0);var n=ai(i.payload.message_guid);n<0&&unsendMessages.push(i)}})}function ei(i,o){var c=f.val().trim(),a=ri(),v=[{MessageID:a,Subject:"Re: CustID: "+SuperSolver.MessageMain.GetSatisfiCustID()+" SubID: "+t.SelectedFeedback().SubmittedFeedbackID(),SubmittedFeedbackID:t.SelectedFeedback().SubmittedFeedbackID(),ContentText:markdown.toHTML(c),MessageDateTime:SuperSolver.MessageMain.GetClientUtcTime(),MessageDate:rt,MessageTime:vt,IsJustNowMessage:!0,MsgTypeId:10,HasAttachment:!1,AraId:t.SelectedFeedback().AraId(),SenderDisplayName:t.CustomerEmailName(),HideLoader:!1,MessageGuid:a}],y,p,h,l;if(t.ChatQuickReplyShow(!1),c.length!==0){if(c.length>=ft){f.val(f.val().substr(0,ft));ShowAlert("Unable to send. The message you are trying to send is too long.");return}t.FeedbackMessages()!=null&&t.FeedbackMessages().length>0?ko.utils.arrayPushAll(t.FeedbackMessages,SuperSolver.MessageMain.GetFeedbackModelsFromJsonInReverse(v)):t.FeedbackMessages(SuperSolver.MessageMain.GetFeedbackModelsFromJsonInReverse(v));y={Action:submissionRequestTypes.MsgToBusiness,CompanyID:n("#hdnCompanyId").val(),FeedbackId:t.SelectedFeedback().SubmittedFeedbackID(),AraId:t.SelectedFeedback().AraId(),Messages:new Array({MessageId:0,MsgTypeId:10,MessageText:c,MessageGuid:a,ButtonClickPayload:t.SelectedFeedback().ButtonClickPayload(),SelectionConfirmPayload:t.SelectedFeedback().SelectionConfirmPayload()}),SenderDisplayName:t.CustomerEmailName(),PageID:t.SelectedFeedback().PageID(),CategoryID:t.SelectedFeedback().CategoryId()};p=new InputPayload(y);vi(p,i,o);t.SelectedFeedback().ButtonClickPayload(null);h=Math.ceil(r+e/2);r!==e&&r!==14&&r<e&&(r===10?h+=3:r<20?h+=2:r<22&&(h+=1));f.val("").css("height",h+"px");n(".MessageTopLine").css("margin-bottom",Math.abs(s-(h+6)+10)+"px");l=n(".MessageBottomAction").height()+10;u&&(l+=10);n(".typing-indicator").attr("style","bottom : "+(l<50?50:l)+"px");u?f.blur():f.focus();ii()}}function fr(r){er();HideModal("feedbackDeleteConfirmationModal");tt.Show();n.get("api/Messages/MLBHideFeedbackToCustomer?FeedbackID="+r,function(r){if(r.Success){DeleteCookie("CurrentSubmissionIdForLoadChat");t.FeedbackMessages(null);t.MessageCount(0);var u=GetParameterByName("view");u!=""&u.trim().toUpperCase()==="MESSAGES"?(i("FeedbackMessagesWithChat"),n('.Page[data-page="FeedbackMessagesWithChat"] .MessageBottomAction').css("display","none"),n(".ChatActionLink").addClass("NoAct")):RedirectToSelectComplaintPage()}else ShowNetworkError(r)}).error(function(n){ShowNetworkError(n)})}function er(){n("#chatFeedbackDeleteConfirmationModal, .modal-overlay").fadeOut(500,function(){n(".modal-overlay").remove()});n("#feedbackDeleteConfirmationModal, .modal-overlay").fadeOut(500,function(){n(".modal-overlay").remove()})}function or(){var r=n("#txtNotifyMobileNumber"),u=n("#txtNotifyEmail");n("#divRowFbActiondelete").click(function(){SuperSolver.MessageMain.ConfirmDeleteFeedback(t.SelectedFeedbackIdForAction())});n("#divRowMarkAsRead").click(function(){SuperSolver.MessageMain.MarkFeedbackAsRead(t.SelectedFeedbackIdForAction())});n("#divRowMarkAsUnread").click(function(){SuperSolver.MessageMain.MarkFeedbackAsUnRead(t.SelectedFeedbackIdForAction())});n("#btnDeleteConfirmation").click(function(){SuperSolver.MessageMain.DeleteFeedback(t.SelectedFeedbackIdForAction())});n("#divRowChatFbActiondelete").click(function(){SuperSolver.MessageMain.ConfirmDeleteFeedback(t.SelectedFeedbackIdForAction())});n("#btnNotifyMe").click(function(){r.val("");u.val("");n("divNotifyMeModal").length||sr();hi("divNotifyMeModal");w=!0});n("#btnNotifyOk").click(function(){var e=t.SelectedFeedback().SubmittedFeedbackID(),i=r.val().trim(),f=u.val().trim(),o;if(i!=""&&i.length!=10)return ShowAlert("Please enter a ten digit mobile number."),!1;if(f!=""&&SuperSolver.IsValidEmail(f)==!1)return ShowAlert("Please enter a valid e-mail address."),!1;e>0&&(i!=""||f!="")&&(o={feedbackId:e,email:f,mobileNumber:i},n.ajax({type:"POST",traditional:!0,url:"/api/Messages/UpdateEmailAndMobileNumberForNotification",context:document.body,data:o,success:hr,error:function(){ShowAlert("Some error occurred.")}}))});n(".modal").on("show.bs.modal",pi);n(window).on("resize",function(){n(".modal:visible").each(pi)});n("#btnCancelChatAction").click(function(){n("#chatFeedbackDeleteConfirmationModal, .modal-overlay").fadeOut(500,function(){n(".modal-overlay").remove()})});n("#btnCancelChatActionConfirmation").click(function(){n("#feedbackDeleteConfirmationModal, .modal-overlay").fadeOut(500,function(){n(".modal-overlay").remove()})});n("#btnCancelMessageDeleteConfirmation").click(function(){n("#deleteMessageConfirmationModal, .modal-overlay").fadeOut(500,function(){n(".modal-overlay").remove()})});n("#btnYouAreAllSetOk").click(function(){(n("#divYouAreAllSetModal").modal("hide"),w)||(GetCookie("isSubmissionMade")!="true"?(i("Feedbacks",!0),b()):RedirectToSelectComplaintPage())});n("#btnNotifyTipOk").click(function(){(n("#divNotifyTipModal, .modal-overlay").fadeOut(500,function(){n(".modal-overlay").remove()}),w)||(GetCookie("isSubmissionMade")!="true"?(i("Feedbacks",!0),DeleteCookie("CurrentSubmissionIdForLoadChat"),b()):RedirectToSelectComplaintPage())})}function sr(){var t='<div class="modal fade notifyModals" id="divNotifyMeModal" role="dialog" data-backdrop="static" data-keyboard="false">';t+='<div class="modal-dialog modal-sm">';t+='<div class="modal-content">';t+='<div class="modal-header">';t+='<button type="button" class="close marginTop5" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;<\/span><\/button>';t+='<p class="modalHeaderText modal-title DialogBox-Caption" style="font-weight: 100!important">Notify Me<\/p>';t+="<\/div>";t+='<div class="modal-body fontWeightBold textAlignLeft">';t+='<div id="divNotifyModalText" class="fontWeightBold textAlignLeft DialogBox-Text">Never miss a response! Enter your mobile number and/or email address and we\'ll let you know when you receive a response.<\/div>';t+='<input id="txtNotifyMobileNumber" placeholder="Enter Mobile Number" class="fontWeightNormal" oninput="maxLengthCheck(this)" maxlength="10" type="number" min="0" max="9999999999" />';t+='<input type="text" id="txtNotifyFormattedMobileNumber" placeholder="Enter Mobile Number" class="fontWeightNormal" />';t+='<div class="textAlignCenter fontWeightNormal">and/or<\/div>';t+='<input type="text" id="txtNotifyEmail" placeholder="Enter Email Address" class="fontWeightNormal" />';t+="<\/div>";t+='<div class="modal-footer textAlignCenter">';t+='<input type="button" data-dismiss="modal" class="customerIntegrationBtn Btn GreenBtn notifyButtonLeft DialogBox-Buttons" id="btnNotifyNoThanks" value="No Thanks" />';t+='<input type="button" class="customerIntegrationBtn Btn GreenBtn notifyButtonRight DialogBox-Buttons" id="btnNotifyOk" value="Ok" />';t+="<\/div>";t+="<\/div>";t+="<\/div>";t+="<\/div>";n("body").append(t)}function hr(i){i.success&&(n("#divNotifyMeModal").modal("hide"),hi("divYouAreAllSetModal"),n("#divNotify").hide(),n.ajax({type:"GET",traditional:!0,url:"/api/Home/GetCustomerProfile",context:document.body,success:function(n){n.success&&(t.CustomerEmail(n.customerEmail),t.CustomerMobileNumber(n.customerMobileNumber))},error:function(){ShowAlert("Some error occurred.")}}))}function cr(i,r,u){var s="Re: CustID: "+dt()+" SubID: "+t.SelectedFeedback().SubmittedFeedbackID(),h=t.SelectedFeedback().SubmittedFeedbackID(),e=n("#"+r),f=new FormData,o;e!=null&&e.val()!=null&&(o=e.get(0).files,o.length>0&&(f.append("AttachedFile",o[0]),f.append("CompressedFile",u),f.append("FileName",e.val().split("\\").pop()),f.append("SubmittedFeedbackID",h),f.append("Subject",s),f.append("ContentText",l),f.append("CompanyId",n("#hdnCompanyId").val()),f.append("CompanyApiKey",n("#hdnCompanyApiKey").val()),f.append("AraId",t.SelectedFeedback().AraId()),vr(f,function(i,r){var e=[{AttachmentId:r[0].AttachmentID(),DownloadLink:r[0].DownloadLink(),FileName:r[0].FileName(),StoredFileName:r[0].StoredFileName(),FileSize:r[0].FileSize()}],u={Attachments:e,MessageID:i.MessageAttachment.MessageID,Subject:s,SubmittedFeedbackID:h,SenderDisplayName:n.trim(t.CustomerFirstMessageFromName()),ContentText:l,MessageDateTime:SuperSolver.MessageMain.GetClientUtcTime(),MessageDate:"Today",MessageTime:"Just Now",IsJustNowMessage:!0,MsgTypeId:10,HasAttachment:!0,ConnectionId:n("#hdnConnectionIdSignalR").val(),MessageGuid:ri()},f=[u];t.FeedbackMessages()!=null&&t.FeedbackMessages().length>0?ko.utils.arrayPushAll(t.FeedbackMessages,SuperSolver.MessageMain.GetFeedbackModelsFromJsonInReverse(f)):t.FeedbackMessages(SuperSolver.MessageMain.GetFeedbackModelsFromJsonInReverse(f));try{chatConnection.invoke("getNewChatMessage",u)}catch(o){LogErrorClientSide("Error- MethodName: ImageUploadRequest, Message:"+o.message);n("#divLoaderForFileUpload").modal("hide")}})),n("#"+r).val(""))}function lr(i){try{var r=t.SelectedFeedback();n.get("api/Messages/MLBFeedbackMessages?ID="+r.SubmittedFeedbackID()+"&CustID="+dt()+"&lastMessageID=0&allowCustomerMessages=true&suppressSubmitDetails="+r.SuppressSubmitDetails(),function(n){ar(n,i)})}catch(u){LogErrorClientSide("Error- MethodName: GetAllMessages, Message:"+u.message);n("#divLoaderForFileUpload").modal("hide")}}function ar(r,u){if(r.Success){var f=r.Results;f.length>0&&(t.FeedbackMessages(bt(f)),t.MessageCount(f.length),n("#IsUseThemes").val()==="true"&&n(".ContentText a").addClass("GeneralUI-ChatLinks"),f.length>0&&t.SelectedFeedback().ResponsePageId()==0&&t.FeedbackMessages()!=null&&t.FeedbackMessages().length>2&&ii())}else ShowAlert(r.Msg);LoadThemeWithPageId(t.SelectedFeedback().ResponsePageId(),"chatThemeLink");i("ResponsePage",!1,u);n(".buttonsSection").removeClass("noDisplay");n("#submittedFeedbackModal").modal("hide")}function vr(i,r){try{LogErrorClientSide("MethodName: SaveFeedbackImage, Step: 1, Device: "+navigator.userAgent+", FeedbackId:"+t.SelectedFeedback().SubmittedFeedbackID());i!=null?n.ajax({url:"api/Messages/UploadFeedbackAttachment",contentType:!1,processData:!1,data:i,type:"POST",async:!0,success:function(n){if(n.Success&&n.MessageAttachment!=null){LogErrorClientSide("MethodName: SaveFeedbackImage, Step: 2, Device: "+navigator.userAgent+", FeedbackId:"+t.SelectedFeedback().SubmittedFeedbackID());var i=jQuery.grep(t.FeedbackMessages(),function(t){return t.MessageID()==n.MessageAttachment.MessageID}),u=ct(new Array(n.MessageAttachment));return LogErrorClientSide("MethodName: SaveFeedbackImage, Step: 3, Device: "+navigator.userAgent+", FeedbackId:"+t.SelectedFeedback().SubmittedFeedbackID()),i!=null&&i.length>0&&(i[0].Attachments()!=null&&i[0].Attachments().length>0?ko.utils.arrayPushAll(i[0].Attachments,u):i[0].Attachments(u),i[0].IsJustNowMessage(!0)),r(n,u)}},complete:function(){LogErrorClientSide("MethodName: SaveFeedbackImage, Step: 4, Device: "+navigator.userAgent+", FeedbackId:"+t.SelectedFeedback().SubmittedFeedbackID());n("#divLoaderForFileUpload").modal("hide");pr()},timeout:3e4,error:function(t,i){console.log(i);n("#divLoaderForFileUpload").modal("hide");ShowAlert("Sorry but we are unable to upload your photo, you may have a weak internet connection.")}}):n("#divLoaderForFileUpload").modal("hide")}catch(u){n("#divLoaderForFileUpload").modal("hide");LogErrorClientSide("Error- MethodName: SaveFeedbackImage, Message:"+u.message);console.log(u.message)}}function yr(i){var f;try{LogErrorClientSide("MethodName: ImagefileUploadChange, Step: 1, Device: "+navigator.userAgent+", FeedbackId:"+t.SelectedFeedback().SubmittedFeedbackID());var e=n(i.target),u=!0,r;n.inArray(e.val().split(".").pop().toLowerCase(),["jpeg","jpg","png","gif"])==-1?(ShowAlert("Only '.jpeg','.jpg','.png','.gif' formats are allowed."),n("#fileImageUpload").val(""),u=!1):(f=n("#fileAttachSizeLimit").val(),f<i.target.files[0].size&&(ShowAlert("Sorry, the photo you are trying to attach is too large. Max file size is:"+BytesToSize(f)),n("#fileImageUpload").val(""),u=!1));LogErrorClientSide("MethodName: ImagefileUploadChange, Step: 2, Device: "+navigator.userAgent+", FeedbackId:"+t.SelectedFeedback().SubmittedFeedbackID());u&&i.target.files&&i.target.files[0]&&(e.val().split(".").pop().toLowerCase()==="gif"?(n("#divLoaderForFileUpload").modal("show"),SuperSolver.MessageMain.ImageUploadRequest(!0,"fileImageUpload","")):(r=new Image,r.src=window.URL.createObjectURL(i.target.files[0]),r.onload=function(){var u=Number(r.naturalWidth),f=Number(r.naturalHeight);f=u>1e3?1e3/u*f:u/1e3*f;window.URL.revokeObjectURL(r.src);LogErrorClientSide("MethodName: ImagefileUploadChange, Step: 3, Device: "+navigator.userAgent+", FeedbackId:"+t.SelectedFeedback().SubmittedFeedbackID());canvasResize(i.target.files[0],{width:u>1e3?1e3:u,height:f,crop:!1,quality:100,rotate:0,callback:function(i){n("#divLoaderForFileUpload").modal("show");LogErrorClientSide("MethodName: ImagefileUploadChange, Step: 4, Device: "+navigator.userAgent+", FeedbackId:"+t.SelectedFeedback().SubmittedFeedbackID());SuperSolver.MessageMain.ImageUploadRequest(!0,"fileImageUpload",i.replace(/^data:image\/[a-z]+;base64,/,""));LogErrorClientSide("MethodName: ImagefileUploadChange, Step: 5, Device: "+navigator.userAgent+", FeedbackId:"+t.SelectedFeedback().SubmittedFeedbackID())}})}))}catch(o){LogErrorClientSide("Error- MethodName: ImagefileUploadChange, Message:"+o.message);n("#divLoaderForFileUpload").modal("hide");console.log(o.message)}}function pr(){if(!h){var t=n(document).innerHeight(),i=t/1;jQuery("html, body").animate({scrollTop:i+300},900)}}function yi(){var t=n(window).scrollTop();t>=nt?n(window).scrollTop()+n(window).height()>n(document).height()-100&&(h=!1):h=!0;nt=t;n(window).unbind("scroll");setTimeout(function(){n(window).bind("scroll",yi)},500)}function pi(){n(this).css("display","block");var t=n(this).find(".modal-dialog"),i=(n(window).height()-t.height())/2;t.css("margin-top",i)}function ri(){function n(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}function wr(){n(".RefreshBtn",'.Page[data-page="Feedbacks"]').click(function(){b()});n(".RefreshBtn",'.Page[data-page="FeedbackMessages"]').click(function(){p()})}function br(){n(".DeleteBtn",'.Page[data-page="MessageView"]').click(function(){ci(".deleteMessageConfirmation")});n(".DeleteBtnConfirm").click(function(){var r=t.Message();n.post(SuperSolver.API+"/DeleteMessage",{ID:r.MessageID},function(n){n.Success?setTimeout(function(){b();i("Feedbacks",!0)},300):ShowAlert(n.Msg)}).complete(function(){tt.Hide();n("#btnCancelMessageDeleteConfirmation").trigger("click")})})}function bt(n,i){for(var u=[],f,r=0;r<n.length;r++)n[r].ContentText=y(n[r].ContentText),i||t.FeedbackMessages()==null?u.push(new d(n[r])):(f=jQuery.grep(t.FeedbackMessages(),function(t){return t.MessageGuid().toLowerCase()==n[r].MessageGuid.toLowerCase()}),f.length===0&&u.push(new d(n[r])));return u}function kr(n){for(var r=[],u,i=n.length-1;i>=0;i--)n[i].ContentText=y(n[i].ContentText),u=jQuery.grep(t.FeedbackMessages(),function(t){return t.MessageGuid().toLowerCase()==n[i].MessageGuid.toLowerCase()}),u.length===0&&r.push(new d(n[i]));return r}function dr(n,t){var r,i;if(t=="Pending..."||n!="Today")return t;r=ui();try{if(i=tu(t),r.getHours()===i.getHours()&&r.getMinutes()-i.getMinutes()<=SuperSolver.TimeGap||r.getHours()-1===i.getHours()&&r.getMinutes()<=SuperSolver.TimeGap&&i.getMinutes()===59)return"Just Now"}catch(u){LogErrorClientSide("Error- MethodName: GetFormatedChatTime, Message:"+u.message)}return SuperSolver.IsUtcTime?wi(i):t}function gr(n){try{var t=new Date,i=fi(n);return t.getFullYear()!=i.getFullYear()||t.getMonth()!=i.getMonth()||t.getDate()!=i.getDate()?"":wi(n)}catch(r){LogErrorClientSide("Error- MethodName: GetMessageTimeInClientTimeZone, Message:"+r.message)}return""}function nu(n){try{var t=fi(n),i=new Date,u,r;return i.getFullYear()==t.getFullYear()&&i.getMonth()==t.getMonth()&&i.getDate()==t.getDate()?rt:i.getFullYear()==t.getFullYear()&&i.getMonth()==t.getMonth()&&i.getDate()==t.getDate()+1?yt:i.getFullYear()==t.getFullYear()&&i.getMonth()==t.getMonth()&&i.getDate()==t.getDate()+2?pt[t.getDay()]:(u=wt[t.getMonth()],r=t.getDate(),r<10&&(r="0"+r),u+" "+r)}catch(f){LogErrorClientSide("Error- MethodName: GetMessageDatePartInClientTimeZone, Message:"+f.message)}return""}function wi(n){msgLocalTime=fi(n);var t=msgLocalTime.getHours(),i=msgLocalTime.getMinutes(),r=lt;return t>=12&&(r=g),t>12&&(t-=12),t===0&&(t=12),t=t>9?t:"0"+t,i=i>9?i:"0"+i,t+":"+i+" "+r}function tu(n){var i=parseInt(n.substring(0,2)),u=parseInt(n.substring(3,5)),f=n.substring(6,8),t,r;return f===g&&i!=12&&(i=i+12),t=new Date,t.setMinutes(u),t.setHours(i),r=t,SuperSolver.IsUtcTime||(r=iu(t)),r}function iu(n){var t=ru()*6e4;return new Date(n.getTime()+t)}function ru(){var n=new timezoneJS.Date;return n.setTimezone(SuperSolver.NewyorkTimeZoneName),n.getTimezoneOffset()}function ui(){var n=new Date,t=n.getTimezoneOffset(),i=t*6e4;return new Date(n.getTime()+i)}function fi(n){var t=n.getTimezoneOffset(),i=t*6e4;return new Date(n.getTime()-i)}function uu(n){var t=ui();try{typeof n=="string"?n!==undefined&&n!==null&&n.length!==0&&(t.setFullYear(n.substring(0,4)),t.setMonth(n.substring(5,7)-1),t.setDate(n.substring(8,10)),t.setHours(n.substring(11,13)),t.setMinutes(n.substring(14,16))):(t.setFullYear(n.getFullYear()),t.setMonth(n.getMonth()),t.setDate(n.getDate()),t.setHours(n.getHours()),t.setMinutes(n.getMinutes()))}catch(i){LogErrorClientSide("Error- MethodName: GetFormatedDateFromJson, Message:"+i.message)}return t}function fu(t,i){n("#hdnSatisfiCustID").val(t);n("#hdnSatisfiExtID").val(i)}function dt(){return n("#hdnSatisfiCustID").val()}function eu(){if(t.Feedbacks()!==null){var i="";for(index=0;index<t.Feedbacks().length;index++)t.Feedbacks()[index].Updated()&&(i+=t.Feedbacks()[index].SubmittedFeedbackID()+",",t.Feedbacks()[index].Updated(!1));i=i.substr(0,i.length-1);n("#hdnNewMessagesFeedbackIds").val("");MarkFeedbackReadByCustomer(i)}}function ou(n,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w,b){t.HideBackButton(n);t.HideMenu(i);t.HideMarkAllReadButton(r);t.HideChatDeleteButton(u);t.IsCustomerUploadsEnabled(f);t.FeedbackCompanyName(e);t.BusinessEmailDisplayName(o);t.IsChatEnabled(!s);t.CustomerEmail(h);t.CustomerMobileNumber(c);t.EnableExitPopNotify(l);t.EnableChatScreenNotify(a);t.SuppressSubmitDetails(v);t.ResponsePageId(y);t.CustomerFirstMessageFromName(p);t.CustomerEmailName(w);t.IsMuted(b)}return jQuery.fn.forceNumeric=function(){return this.each(function(){n(this).keydown(function(n){var t=n.which||n.keyCode;return!n.shiftKey&&!n.altKey&&!n.ctrlKey&&t>=48&&t<=57||t>=96&&t<=105||t==190||t==188||t==109||t==110||t==8||t==9||t==13||t==35||t==36||t==37||t==39||t==46||t==45?!0:!1})})},n(window).scroll(yi),{Init:function(){bi()},ShowNetworkError:function(){return ShowNetworkError()},GetFormatedChatTime:function(n,t){return dr(n,t)},GetFormatedDateFromJson:function(n){return uu(n)},GetMessageTimeInClientTimeZone:function(n){return gr(n)},GetMessageDatePartInClientTimeZone:function(n){return nu(n)},GetClientTimeFromUtcTime:function(n){return fi(n)},GetClientUtcTime:function(){return ui()},displayFeedbackAction:function(n,t){return displayFeedbackAction(n,t)},MarkFeedbackAsRead:function(n){return MarkFeedbackAsRead(n)},MarkFeedbackAsUnRead:function(n){return MarkFeedbackAsUnRead(n)},DeleteFeedback:function(n){return fr(n)},ConfirmDeleteFeedback:function(n){return rr(n)},DeleteFeedbackFromchat:function(n){return ur(n)},SetCustId:function(n,t){fu(n,t)},GetSatisfiCustID:function(){return dt()},LoadFeedbacks:function(n,t,i){return b(n,t,i)},SendFeedbackReply:function(n,t,i){return SendFeedbackReply(n,t,i)},ImagefileUpload:function(n){return yr(n)},MarkAllMessageRead:function(){eu()},ImageUploadRequest:function(n,t,i){return cr(n,t,i)},GetFeedbackModelsFromJsonInReverse:function(n){return kr(n)},LoadChatUi:function(n,t){return ki(n,t)},SetCompanySettings:function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w){return ou(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y,p,w)},SendReply:function(){return ei()},SendMessageToServer:function(n){return vi(n)},LoadMessages:function(){return p()},GetMessages:function(){return nr()},SignalRConnected:function(){return tr()},ShowPage:function(n,t,r){return i(n,t,r)},GetSelectedFeebackId:function(){return t.SelectedFeedback()!==undefined?t.SelectedFeedback().SubmittedFeedbackID():0},IsMessagesArrayEmpty:function(){return t.FeedbackMessages()?t.FeedbackMessages().length===0:!0},MessagingAreaSize:function(){return oi()}}}()}(jQuery);$(window).resize(function(){$(".icon-blank").each(function(){$(this).css("line-height",$(this).parent().parent().css("height"))})});isCustomLegalLoaded=!1;$(document).ready(function(){$("#ulLegalLinks li").click(function(){var n=$(this).find("a").attr("id");switch(n){case"liEula":ShowPage("EULA");break;case"liPrivacyPolicy":ShowPage("PrivacyPolicy");break;case"liTermsAndCondtns":ShowPage("TermsAndConditions")}});$(".PrevBtn",'.Page[data-page="Legal"]').click(function(){SuperSolver.Search.HandleLocationAndPageFunctionality(0,!0);setContainerMinMaxSize.setMinMaxSize()});$(".PrevBtn",'.Page[data-page="EULA"],.Page[data-page="PrivacyPolicy"],.Page[data-page="TermsAndConditions"]').click(function(){ShowPage("Legal")});$(".ancTermsAndUse").click(function(){ShowPage("TermsAndConditions")});$(".ancPrivacyPolicy").click(function(){ShowPage("PrivacyPolicy")})})