function GetChatAvailability(n){if($("#chatAvailable").hide(),$("#chatUnavailable").hide(),n!="Please select a category"){$("#searching").show();var i=$("#ddlCategory").data("request-url"),t=n,r=$("#ddlCategory").data("list"),u={Category:t,CategoriesList:r},f=$("#selectCategory");$.ajax({cache:!1,async:!0,type:"POST",url:i,data:{vm:u}}).always(function(){$("#searching").hide();$("#ChatButton").prop("disabled",!1)}).done(function(result){if($("#searching").hide(),result.Success){$("#chatAvailable").show();$("#chatSubject").val(t);var a=eval("document.getElementById('comm100-button-"+result.Comm100SubjectID+"').getElementsByTagName('a')[0]");if(a&&(a.click(),Comm100API))Comm100API.on("livechat.chat.display",function(){$("#communicationsChatReveal").foundation("reveal","close")})}else $("#chatUnavailable").show()}).fail(function(n,t,i){processModalError(n,t,i,f,"Chat Availability")})}else $("#searching").hide()}function CreateCommunicationsCategoryList(){var t=$("#ddlCategory"),i=t.data("model"),n;typeof i!="undefined"&&(n="<ul id='SelectCategory'>",$.each(i.CategoriesList,function(t,i){var r='<li class="row"><div class="resizeDDL large-12 columns"><span>'+i.SubjectDescription+"<\/span><\/div><\/li>";n+=r}),n+="<\/ul>",t.append(n))}function showCategories(){$("#communicationsSpinner").hide();$("#chatUnavailable").hide();$("#chatAvailable").hide();$("#ddlCategory").toggle()}function loadPage(){var t=$("#isEmailConfirmed").val(),i=$("#noEmailAddress").val(),n=$("#chatType").val();i==="True"?($("#noEmailMsg").show(),$("#BcpVerify").show(),$("#communicationsSpinner").hide(),n=="claims"||n==="refs"?($("#selectCommunication").hide(),$("#communicationsSpinner").hide()):n==="gen"&&($("#selectCategory").hide(),$("#communicationsSpinner").hide())):t=="True"?($("#emailNotConfirmedMsg").show(),$("#BcpVerify").show(),$("#communicationsSpinner").hide(),n=="claims"||n==="refs"?($("#selectCommunication").hide(),$("#communicationsSpinner").hide()):n==="gen"&&($("#selectCategory").hide(),$("#communicationsSpinner").hide())):n==="claims"||n==="refs"?($("#selectCommunication").show(),$("#communicationsSpinner").hide()):n==="gen"&&($("#selectCategory").show(),$("#communicationsSpinner").hide())}$(document).ready(function(){$("#communicationsSpinner").show();loadPage();CreateCommunicationsCategoryList();$("#ddlCategory").on("onload",function(){var n=$(this).data("data-bind")});$("#SelectCategory li").click(function(n){var t=$(this);$("#chatH4").text(t.text());$("SelectCategory").children().removeClass("selected");t.addClass("selected");$("#ddlCategory").slideToggle("medium");n.preventDefault();GetChatAvailability(t.text())});$("#ChatButton").on("click",function(n){var t,i;n.preventDefault();$("#chatUnavailable").hide();$("#chatAvailable").hide();$("#ChatButton").prop("disabled",!0);t=$("#preselectedCategory").val();t!=null?($("#selectCategory").show(),i=$("#SelectCategory li").children().removeClass("selected"),i.addClass("selected"),GetChatAvailability(t)):$("#selectCategory").show()});$("#chatUnavailable").click(function(n){n.preventDefault();var t=$(this).data("request-url"),o=$("#selectCategory").val(),i=$("#chatH4").text(),r=$("#preselectedMessage").val(),u=$("#Src").val(),f=$(this).data("claimid"),e=$(this).data("referralid");t&&(window.location=t+"?PreselectedCategory="+i+"&PreselectedMessage="+r+"&Src="+u+"&ClaimId="+f+"&ReferralId="+e)});$("#startSendSecureMessage").click(function(){var n=$(this).data("request-url"),t=$("#preselectedCategory").val(),i=$(this).data("selected-message"),r=$("#Src").val(),u=$(this).data("claimid"),f=$(this).data("referralid");n&&(window.location=n+"?PreselectedCategory="+t+"&PreselectedMessage="+i+"&Src="+r+"&ClaimId="+u+"&ReferralId="+f)});$("#MessageButton").click(function(){var n=$(this).data("request-url"),t=$("#preselectedCategory").val(),i=$(this).data("selected-message"),r=$("#Src").val(),u=$(this).data("claimid"),f=$(this).data("referralid");n&&(window.location=n+"?PreselectedCategory="+t+"&PreselectedMessage="+i+"&Src="+r+"&ClaimId="+u+"&ReferralId="+f)});$("#GoToBCPBtn").click(function(){var n=$(this).data("request-url");n&&(window.location=n)});$("#ContinueChatBtn").click(function(){$("#noEmailMsg").hide();$("#emailNotConfirmedMsg").hide();$("#BcpVerify").hide();var n=$(this).data("source");n==="claims"||n==="refs"?$("#selectCommunication").show():n==="gen"?$("#selectCategory").show():alert("Missing Chat Type")})});$("#communicationsChatReveal").on("closed.zf.reveal",function(){$("#communicationsPartial").html("")})