function goToLoginURL(n){var i="",r=document.location.href,i="",t,u;appSettings.searchPage&&(t=getParams(),t!=null&&t!=""&&(n!=undefined&&(t+="/d/"+n),createCookie("sp",t),i=document.location.search.length?encodeURIComponent("&sp=1"):encodeURIComponent("?sp=1")),r=appSettings.absoluteUriPure);u=appSettings.singleSignInURL+"?targetUrl="+r+i;document.location.href=u}function changeInterfaceBasedOnUserType(type,toCall){var oldType=appSettings.userType,utc,userTypeCallback;if($("[showType='all']").hide(),$("[showType='student']").hide(),$("[showType='staff']").hide(),$("[showType='public']").hide(),$("[showType='either']").hide(),$("[showType='admin']").hide(),$("[showType='all']").show(),$("[showType='"+type+"']").show(),appSettings.isUserITM||appSettings.isAdmin?$("[showType='ITM']").show():$("[showType='ITM']").hide(),appSettings.isAdmin?$("[showType='admin']").show():$("[showType='admin']").hide(),(type=="student"||type=="staff")&&$("[showType='either']").show(),toCall&&eval(toCall+"('"+type+"', '"+oldType+"')"),(appSettings.userType==null||appSettings.userType==undefined||appSettings.userType&&appSettings.userType!=type)&&(appSettings.userType=type,appSettings.userTypeCallback&&appSettings.userTypeCallback!=null&&appSettings.userTypeCallback!=undefined))for(utc in appSettings.userTypeCallback)userTypeCallback=appSettings.userTypeCallback[utc],userTypeCallback.type=="all"&&eval(userTypeCallback.todo),userTypeCallback.type.indexOf(type)>-1&&eval(userTypeCallback.todo);appSettings.userType=type}function getUserType(n){$.ajax({url:appSettings.applicationFullAddress+"/People/UserType",type:"POST"}).done(function(t){appSettings.isUserITM=t.IsUserITM;appSettings.isAdmin=t.IsAdmin;changeInterfaceBasedOnUserType(t.UserType,n)})}function handleUserChange(n,t){(!appSettings.ssoTried&&n=="public"||appSettings.userType&&appSettings.userType!=n)&&(singleSignOn(t),appSettings.ssoTried=!0)}function singleSignOn(n){try{appSettings.singleSignOnTried||(appSettings.singleSignOnTried=!0,url=appSettings.ajaxSingleSignInURL.replace(/&/g,"&"),$.ajax({type:"GET",url:url,dataType:"html",xhrFields:{withCredentials:!0},success:function(n){n.replace(/ /g,"").indexOf('type="password"')>=0||goToLoginURL()}}))}catch(t){console.error("Error determining if user already have a SSO session")}getUserType(n)}function trim(n){return n.replace(/^\s+|\s+$/gm,"")}function endsWith(n,t){return n.indexOf(t,n.length-t.length)!==-1}function formatPhoneNumber(n){return n.length==10&&n.substring(0,2)=="04"?n.substring(0,4)+" "+n.substring(4,7)+" "+n.substring(7,10):n}function readCookie(n){for(var t,r=n+"=",u=document.cookie.split(";"),i=0;i=n[t].length)n[t].counter=0,t++;else return!1;return!0},f=function(){for(var r=[],t=0;t