function SetStarFilled(){starFilled?($("#starId").addClass("star-active"),$("#staredText").text("Unfollow "+$("#productName").val()),starSelected=!0):($("#starId").removeClass("star-active"),$("#staredText").text("Follow "+$("#productName").val()),starSelected=!1)}function starClicked(){userHasAttribute("#UserId")?showmodal("alert","Login","You are not authenticated, so redirecting to login page.",!0,"OK",callbackloginRedirect):userHasAttribute("#UserPersonalizationRole")?showmodal("confirm","Role",'You need to pick a role, click "OK" to be redirected.',null,"",callbackCustomizeUserRedirect):$("#starId").hasClass("star-active")?OpenUnfollowPopup==!0?showmodal("confirm","Confirm","Are you sure you want to stop following the topic - "+$("#productName").val()+"?",null,"",function(){redirectToCustomizeExperience(!1);starSelected=!1}):OpenUnfollowPopup=!0:showmodal("confirm","Confirm","Are you sure you want to follow the topic - "+$("#productName").val()+"?",null,"",function(){redirectToCustomizeExperience(!0);starSelected=!0})}function redirectToCustomizeExperience(n){isSaveCustomizeClicked||SaveCustomizePrefrenceRecords(n)}function userHasAttribute(n){var t=$(n).val();return t===undefined||t===null||t==="00000000-0000-0000-0000-000000000000"?!0:!1}function SaveCustomizePrefrenceRecords(n){isSaveCustomizeClicked=!0;var t={model:null,categoryId:$("#productId").val(),setFlag:n};$(".ajax-loader").show();$.ajax({type:"POST",url:"/RestApi/NemaServices/CustomizeUserExperience/SaveStarCategoryData",data:JSON.stringify(t),contentType:"application/json; charset=utf-8",dataType:"json",beforeSend:function(){$(".ajax-loader").show()},success:function(){$(".ajax-loader").hide();$("#isdirectsave").val("");starSelected?($("#starId").addClass("star-active"),$("#staredText").text("Unfollow "+$("#productName").val())):($("#starId").removeClass("star-active"),$("#staredText").text("Follow "+$("#productName").val()));isSaveCustomizeClicked=!0;showmodal("alert","Data saved successfully.","",!0,"Go To Customize Experience",callbackSuccess)},failure:function(){isSaveCustomizeClicked=!0;$(".ajax-loader").hide()},error:function(){isSaveCustomizeClicked=!0;$(".ajax-loader").hide()}})}var starFilled=!1,starSelected=!1,OpenUnfollowPopup=!0,callbackSuccess=function(){var n=$("#nemaurl").val()+"/my-nema/customize-experience?previousUrl="+encodeURI(window.location.href);location.href=n},callbackloginRedirect=function(){window.location.href=$("#AuthenticationUrl").val()+encodeURI(window.location.href)},callbackCustomizeUserRedirect=function(){var n=window.location.pathname;$.ajax({type:"GET",url:"/StarWidget/GetCustomizedURL?navigationurl="+n,contentType:"application/json; charset=utf-8",success:function(n){window.location.href=n.replace(/&amp;/g,"&")}})};$(document).ready(function(){if(typeof window.performance!="undefined"&&window.performance.navigation.type===2)window.location.reload();else{starFilled=$("#starFilled").val();SetStarFilled();var n=$("#isdirectsave").val();n.toLowerCase()=="true"&&(OpenUnfollowPopup=!1,starClicked())}})