function isEmpty(n){var t,i;if(typeof n=="number"||typeof n=="boolean")return!1;if(typeof n=="undefined"||n===null)return!0;if(typeof n.length!="undefined")return n.length==0;t=0;for(i in n)n.hasOwnProperty(i)&&t++;return t==0}function isDef(n){return typeof n!="undefined"}function init(n,t){return isEmpty(n)?t||"":n}function isFunc(n){return typeof n==typeof Function}function async(n,t){n&&(t||(t=function(){}),setTimeout(function(){n();t()},0))}function findPos(n){var t=0;if(n.offsetParent){do t+=n.offsetTop;while(n=n.offsetParent);return[t]}}function isMobile(){return/iphone|ipod|android|ie|blackberry|fennec/.test(navigator.userAgent.toLowerCase())}function arrayContains(n,t){for(var i=n.length;i--;)if(n[i]===t)return!0;return!1}function arrayRemove(n,t){var r=[],i;for(i in n)n[i]!=t&&r.push(n[i]);return r}function wrmReplace(n,t){for(var i=0;i<t.length;i+=2)n=n.replaceAll(t[i],t[i+1]);return n}function wrmGo(n,t){if(isEmpty(n)){location.reload();return}n=wrmUrl(n);t?window.open(n,t):window.location.href=n}function wrmUrl(n){var t="/"+wrm_section,i="/"+wrm_page,r="/PostBack";return wrmReplace(n,["/s*",t,"/s/",t+"/","/p*",i,"/p/",i+"/","/pb*",r,"/pb/",r+"/","~/",init(wrm_rooturl,"/")])}function wrmParam(n,t){if(n==="#"&&init(window.location.hash)!=="")return window.location.hash.substring(1);var r,u,i,f=n>>>0===parseFloat(n)?parseInt(n):-1;if(f>=0)return isDef(wrm_params)&&f<wrm_params.length?wrm_params[f]:t;for(r=window.location.search.substr(1).split("&"),i=0;i<r.length;i++)if(u=r[i].split("="),u[0]==n)return decodeURIComponent(u[1]);return t}String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.left=function(n){var t=this.length;return n===0?"":n<0?n*-1>t?"":this.substring(0,t+n):n>t?this:this.substring(0,n)};String.prototype.right=function(n){var t=this.length;return n===0?"":n<0?n*-1>t?"":this.substring(Math.abs(n),t):n>t?this:this.substring(t-n,t)};String.prototype.startsWith=function(n,t){var i=this.left(n.length);return t?i===n:i.toLowerCase()===n.toLowerCase()};String.prototype.endsWith=function(n,t){var i=this.right(n.length);return t?i===n:i.toLowerCase()===n.toLowerCase()};String.prototype.replaceAll=function(n,t){var i=this;return i.replace(new RegExp(n.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),t)};String.prototype.contains=function(n,t){return n==null?!1:(t?this.indexOf(n):this.toLowerCase().indexOf(n.toLowerCase()))>=0};Object.size=function(n){var t=0,i;for(i in n)n.hasOwnProperty(i)&&t++;return t};var WRM$={parseDate:function(n,t,i){function a(n){var t=n.split(" ");return t[0]}var r,f,e;if(isEmpty(n))return null;if(i=init(i,!0),n.startsWith("/Date("))return new Date(parseInt(n.replace("/Date(","").replace(")/",""),10));t=init(t,i?"M/d/yyyy":wrm_dateformat);r="";t.indexOf("/")>=0?r="/":t.indexOf("-")?r="-":t.indexOf(".")?r=".":t.indexOf(" ")&&(r=" ");var u=t.split(r),o=n.split(r),s=u.indexOf("MM");s<0&&(s=u.indexOf("M"));f=u.indexOf("dd");f<0&&(f=u.indexOf("d"));e=u.indexOf("yyyy");e<0&&(e=u.indexOf("yy"));var h=parseInt(o[s]),c=parseInt(a(o[e])),l=parseInt(o[f]);return h>12||h<1||l<1||l>31||c<1900||c>2100?null:new Date(c,h-1,l)},formatTime:function(n,t){function f(n){return("00"+n.toString()).right(2)}var i=n,u,r;if(!(n instanceof Date))try{i=this.parseDate(n)}catch(e){return n}return i==null?n:(t=init(t,wrm_timeformat),r=i.getHours(),u=wrm_time_am,r===0?r=12:r>12&&(r=r%12,u=wrm_time_pm),t.replace("hh",i.getHours()).replace("h",r).replace("mm",f(i.getMinutes())).replace("m",i.getMinutes()).replace("ss",i.getSeconds()).replace("s",f(i.getSeconds())).replace("tt",u))},formatDateShort:function(n,t){function u(n){return("00"+n.toString()).right(2)}var r=n;if(!(n instanceof Date))try{r=this.parseDate(n)}catch(s){return n}if(r==null)return n;var i=init(t,wrm_dateformat),f=r.getMonth()+1,e=r.getDate(),o=r.getFullYear().toString();return i=i.replace("MM",u(f)),i=i.replace("M",f),i=i.replace("mm",u(f)),i=i.replace("m",u(f)),i=i.replace("dd",u(e)),i=i.replace("d",e),i=i.replace("yyyy",o),i.replace("yy",o.right(2))},formatDateMY:function(n){var t=wrm_dateformat.replace(/dd?[-\./]?/gi,"");return this.formatDateShort(n,t.toLowerCase())},parseDateMY:function(n){var i,t,u=wrm_dateformat.replace(/dd?[-\./]?/gi,""),r=n.split(/[-\.\/\s]/);return r.length<2?null:(u.startsWith("m")||startsWith.endsWith("y")?(i=parseInt(r[0]),t=parseInt(r[1])):(i=parseInt(r[1]),t=parseInt(r[0])),i>12||i<0)?null:(t<20&&(t+="2000"),t<100&&(t+="1900"),new Date(t,i-1,1))},formatPercent:function(n,t,i,r,u){return(init(i,!0)?n*100:n).toFixed(init(t,0)).toString().replace(".",init(u,wrm_percent_dec))+init(r,wrm_percent)},formatNumber:function(n,t,i,r){return this.formatMoney(n,t,"X",i,r)},formatMoney:function(n,t,i,r,u){n=n||0;i=i!==undefined?i:wrm_currency;t=isEmpty(t)?i==="X"?2:wrm_cur_digits:t;r=r||wrm_thousands;u=u||wrm_decimal;var o=n<0?wrm_negative:"",e=parseInt(n=Math.abs(+n||0).toFixed(t),10)+"",f=(f=e.length)>wrm_groupsize[0]?f%wrm_groupsize[0]:0;return(i=="X"?"":i)+o+(f?e.substr(0,f)+r:"")+e.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+r)+(t?u+Math.abs(n-e).toFixed(t).slice(2):"")},externalUrl:function(n){wrmGo("~/external/check/"+base64url(n))},setCulture:function(n){$.get(wrmUrl("~/pb/Culture/SetLanguage/"+n),function(){wrmGo()})},msgCount:function(n){$.get(wrmUrl("~/pb/_/MessageCount/_"),n);wrmResetSessionTimer},msgMarkRead:function(n,t,i){$.get(wrmUrl("~/pb/"+n+"/MessageMarkRead/"+t),i);wrmResetSessionTimer},getNotes:function(n,t,i){$.get(wrmUrl("~/pb/"+init(t,wrm_page)+"/Notes/"+init(i,encodeURIComponent(wrm_pagetitle))),init(n,function(n){WRM$.notes=n}));wrmResetSessionTimer()},userHistoricalTasks:function(n){$.get(wrmUrl("~/pb/_/HistoricalTaskList/_"),init(n,function(n){WRM$.historicalTaskList=n}))},userFutureTasks:function(n){$.get(wrmUrl("~/pb/_/FutureTaskList/_"),init(n,function(n){WRM$.futureTaskList=n}))},userTaskList:function(n){$.get(wrmUrl("~/pb/_/TaskList/_"),{_:Date.now()},init(n,function(n){WRM$.taskList=n}))},userToDoList:function(n){$.get(wrmUrl("~/pb/_/ToDoList/_"),{_:Date.now()},init(n,function(n){WRM$.toDoList=n}))},missingInformation:function(n){$.get(wrmUrl("~/pb/_/MissingInformationList/_"),{_:Date.now()},init(n,function(n){WRM$.missingInformationList=n}))},newGuid:function(){var n="";return $.ajax({url:wrmUrl("~/Ajax/KWAPI/GetGUID"),type:"GET",async:!1,success:function(t){n=t}}),n},userLastPage:function(n){$.get(wrmUrl("~/pb/_/GetLastPage/_"),init(n,function(n){WRM$.lastPage=n.LastPage}))},base64url:function(n){function f(n,t){return n.charCodeAt(t)}function o(n){return n.endsWith("==")?n.left(-2):n.endsWith("=")?n.left(-1):n}n=String(n);var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",r,t,u=[],e=n.length-n.length%3;if(n.length===0)return n;for(r=0;r<e;r+=3)t=f(n,r)<<16|f(n,r+1)<<8|f(n,r+2),u.push(i.charAt(t>>18)),u.push(i.charAt(t>>12&63)),u.push(i.charAt(t>>6&63)),u.push(i.charAt(t&63));switch(n.length-e){case 1:t=f(n,r)<<16;u.push(i.charAt(t>>18)+i.charAt(t>>12&63)+"==");break;case 2:t=f(n,r)<<16|f(n,r+1)<<8;u.push(i.charAt(t>>18)+i.charAt(t>>12&63)+i.charAt(t>>6&63)+"=")}return"K64~"+o(u.join(""))},makeSignature:function(n,t,i,r,u){if(isEmpty(n))return"makeSignature:name_is_required";var f=this.base64url(n+"|"+(t?t.match(/^all_?\s?portals$/ig)?"_":t:"_")+"|"+init(i,"0")+"|"+init(r,wrm_userlang));return isEmpty(u)||(f+=(u.startsWith(".")?"":".")+u),f},ajaxDefaults:{proxy:"~/ServiceProxy",url:"[endPoint]",type:"POST",dataType:"json",async:!1,cache:!1,contentType:"application/json; charset=utf-8"},getEndPoint:function(n,t,i,r,u){function e(n,t){new RegExp("[&/?]"+o[n]+"=","i").test(f)||isEmpty(t)||(f+=(f.indexOf("?")>0?"&":"?")+o[n]+"="+encodeURIComponent(t))}var f=this.ajaxDefaults.proxy,o=["_forwardTo","_action","_language","_uid"];return n.startsWith("http")||n.startsWith("~/")?f="":n="[defServHost]"+n,isEmpty(f)?f=n:e(0,n),e(1,t),e(2,init(r,init(wrm_userlang,"en"))),e(3,wrm_uid),isEmpty(u)||(f+=f.indexOf("?")>0?"&":"?"+u),wrmUrl(f).replace("[kKey]",init(i))},getList:function(n,t){return this.ajaxAction("","","_get_list:"+n,t)},getOccInfo:function(n,t,i,r){return this.ajaxAction({state:init(i,"IA"),onetid:t},r,"occs:"+n)},getData:function(n,t,i,r,u){return this.ajaxAction(t,i,n,r,u)},postData:function(n,t,i,r){if(t)return this.ajaxAction(t,"NA",n,i,r)},getDataLocal:function(n,t,i,r){return this.ajaxAction(t,i,n,r)},ajaxAction:function(prms,format,action_key,complete,success,error){var P,S,D;wrmResetSessionTimer();this.error="";var Y=!1,A="",url=wrmUrl("~/Ajax/KWAPI/GetData"),K="[kKey]";if(isEmpty(action_key)||(action_key.endsWith(".async")&&(action_key=action_key.left(-6),Y=!0),K=action_key),S=jQuery.extend({},this.ajaxDefaults),D={kKey:K,dataFormat:init(format,"ARRAY"),language:wrm_userlang},delete S.proxy,S.type="POST",typeof complete=="function"&&(Y=!0,S.complete=complete),S.success=init(success,function(n){WRM$.action_result=n;isEmpty(n.redirect)||wrmGo(n.redirect)}),S.error=init(error,function(n){var t=WRM$.defErrMsg(wrm_userlang);WRM$.action_result={errors:t};WRM$.error=isEmpty(n)?t:n.responseText}),init(prms)!==""){typeof prms=="string"?eval("D.parameters="+prms):D.parameters=prms;for(P in D.parameters)url=url.replace("["+P+"]",D.parameters[P])}return S.data=JSON.stringify(D),S.url=url,S.async=Y,$.ajax(S),Y?null:this.action_result},ajaxFavAction:function(prms,format,action_key,complete,success,error){var Y,A,K,url,P,S,D;if(wrmResetSessionTimer(),this.error="",Y=!1,url=wrmUrl("~/Ajax/KWAPI/Favorites"),isEmpty(action_key)||(action_key.endsWith(".async")&&(action_key=action_key.left(-6),Y=!0),action_key.startsWith("K03~")?K=action_key:A=action_key),S=jQuery.extend({},this.ajaxDefaults),D={kKey:"[kKey]",dataFormat:init(format,"ARRAY"),language:wrm_userlang},delete S.proxy,S.type="POST",typeof complete=="function"&&(Y=!0,S.complete=complete),S.success=init(success,function(n){WRM$.action_result=n;isEmpty(n.redirect)||wrmGo(n.redirect)}),S.error=init(error,function(n){var t=WRM$.defErrMsg(wrm_userlang);WRM$.action_result={errors:t};WRM$.error=isEmpty(n)?t:n.responseText}),init(prms)!==""){typeof prms=="string"?eval("D.parameters="+prms):D.parameters=prms;for(P in D.parameters)url=url.replace("["+P+"]",D.parameters[P])}return S.data=JSON.stringify(D),S.url=url,S.async=Y,$.ajax(S),Y?null:this.action_result},ajaxMsg:function(n,t,i){i=init(i,!0);t=init(t,"form:last");$(t).find("div.alert").remove();$(t).find(".has-error").removeClass("has-error");isEmpty(n)&&(n=init(this.action_result,{}));isEmpty(this.error)?(isEmpty(n.errors)?isEmpty(n.messages)&&(n.messages=this.defSuccessMsg()):this.makeMsg(t,n.errors,"alert alert-danger",!1),isEmpty(n.messages)||this.makeMsg(t,n.messages,"alert alert-success",!1)):this.makeMsg(t,this.error,"alert alert-danger",!1);isEmpty(n.field_errors)||$(t).find("input, textarea, select").each(function(t,i){for(var r in n.field_errors)if(r=="dob"&&(r="BirthDate"),i.name.toUpperCase()===r.toUpperCase()){$(i).parent().addClass("has-error");break}});i&&this.scrollTo("div.alert:first")},makeMsg:function(n,t,i,r){var u,f;i=init(i,"alert alert-danger");n=init(n,"form:last");init(r,!0)&&$(n).find("div.alert").remove();u=$("<div>",{"class":i,role:"alert"}).prependTo(n);Object.prototype.toString.call(t)==="[object Array]"?$(t).length===1?u.html(t[0]):(f=$("<ul>").appendTo(u),$(t).each(function(n,t){f.append($(document.createElement("li")).text(t))})):t!==""&&u.html(t)},isReqMsg:function(n,t){switch(init(t,init(wrm_userlang)).left(2)){case"es":return"Se requiere "+n;case"ar":return n+" مطلوب"}return n+" is required"},defSuccessMsg:function(n){switch(init(n,init(wrm_userlang)).left(2)){case"es":return"Su información se ha actualizado correctamente.";case"ar":return"تم تحديث المعلومات الخاصة بك بنجاح"}return"Your information has been updated successfully."},defErrMsg:function(n){switch(init(n,init(wrm_userlang)).left(2)){case"es":return"Se produjo un error al acceder a nuestros archivos.";case"ar":return"حدث خطأ أثناء الوصول سجلاتنا"}return"An error occurred while accessing our records."},favFunc:function(n,t,i,r,u,f,e){this.ajaxFavAction({action:u,link:n,description:t,type:i,rank:r},"",".async",e,null,null,wrmUrl("~/Ajax/KWAPI/Favorites"))},favAdd:function(n,t,i,r){this.favFunc(n,t,i,0,"a",r)},favRem:function(n,t,i){this.favFunc(n,"",t,0,"rl",i)},favRemRk:function(n,t,i){this.favFunc(0,"",t,n,"rr",i)},favUp:function(n,t,i){this.favFunc(0,"",t,n,"u",i)},favDn:function(n,t,i){this.favFunc(0,"",t,n,"d",i)},favStatus:function(n,t,i,r){this.favFunc(n,"",t,0,"s",r,i)},scrollTo:function(n,t,i,r){var u=init(r,n===null)?0:null;try{u=Math.min($(n).offset().top,$(document).height()-$(window).height())+init(i,-75)}catch(f){}u!==null&&$("html,body").animate({scrollTop:u},init(t,250),"swing")},bindSelect:function(n,t,i,r,u,f){var e,s=isEmpty(u),o=$(t)[0],h;if(init(f,!0)&&(o.innerHTML=""),(s||!isEmpty(i))&&typeof i=="boolean"&&(s=i,i=""),s){isEmpty(i)&&(i="[Select]");switch(init(wrm_userlang).left(2)){case"es":i="[Seleccionar]";break;case"ar":i="[اختار]"}e=document.createElement("option");e.value=init(r,"-1");e.innerHTML=i;o.appendChild(e)}for(h in n)e=document.createElement("option"),e.value=h,e.innerHTML=n[h],o.appendChild(e);isEmpty(u)||$(o).val(u)},form2json:function(n,t,i){return form2js($(n)[0],init(t,"."),!1,null,init(i,!0))},Login:function(n,t,i,r,u,f,e){function h(n,t){t||(t=window.location.href);n=n.replace(/[\[\]]/g,"\\$&");var r=new RegExp("[?&]"+n+"(=([^&#]*)|&|#|$)"),i=r.exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null}var o={err_code:0,err_txt:""},s;return(isEmpty(e)&&(e=!1),isEmpty(n))?(o.err_code=2,o.err_txt=this.isReqMsg(init(r,"Username")),o):isEmpty(t)?(o.err_code=3,o.err_txt=this.isReqMsg(init(u,"Password")),o):(isEmpty(i)&&(i=h("ReturnURL")),o.err_code===0&&(WRM$.auth_err_code=0,WRM$.auth_err_txt="",s=jQuery.extend({},this.ajaxDefaults),s.url=wrmUrl("~/pb/Account/Login"),s.async=!1,s.data=JSON.stringify({Username:n,Password:t,ReturnUrl:i}),s.success=function(n){n.ErrorCode==0||init(n.Reset,!1)?wrmGo(n.Redirect):(WRM$.auth_err_code=n.ErrorCode,WRM$.auth_err_txt=n.Status)},s.error=function(n){WRM$.auth_err_txt=n.statusText;WRM$.auth_err_code=n.status},$.ajax(s),o.err_code=WRM$.auth_err_code,o.err_txt=WRM$.auth_err_txt),o.err_code>0&&init(f,!0)&&alert(o.err_txt),o)},LoginPasswordChange:function(n,t,i,r,u,f,e){var o={err_code:0,err_txt:"",redirect:""},s;return isEmpty(t)?(o.err_code=3,o.err_txt=this.isReqMsg(init(t,"Password")),o):isEmpty(i)?(o.err_code=2,o.err_txt=this.isReqMsg(init(u,"Confirm Password")),o):t!==i?(o.err_code=9,o.err_txt=this.isReqMsg(init(f,"Your Password and Confirmation do not match")),o):(o.err_code===0&&(WRM$.auth_err_code=0,WRM$.auth_err_txt="",s=jQuery.extend({},this.ajaxDefaults),s.url=wrmUrl("~/pb/Account/ChangePasswordLogin"),s.async=!1,s.data=JSON.stringify({Password:t,Confirmation:i,SecurityHash:n}),s.success=function(n){n.ErrorCode===0?WRM$.auth_redirect=n.Redirect:(WRM$.auth_err_code=n.ErrorCode,WRM$.auth_err_txt=n.Status)},s.error=function(n){WRM$.auth_err_txt=n.statusText;WRM$.auth_err_code=n.status},$.ajax(s),o.err_code=WRM$.auth_err_code,o.err_txt=WRM$.auth_err_txt,o.redirect=WRM$.auth_redirect),o.err_code>0&&init(e,!0)&&alert(o.err_txt),o)},Logout:function(){wrmGo("~/Account/Logout")},CustomAuthenticate:function(n,t,i,r,u,f,e,o,s,h,c,l,a,v,y){var p={err_code:0,err_txt:""},w;return(isEmpty(y)&&(y=!1),isEmpty(n))?(p.err_code=2,p.err_txt=this.isReqMsg(init(o,"First Name")),p):isEmpty(t)?(p.err_code=3,p.err_txt=this.isReqMsg(init(s,"Last Name")),p):isEmpty(i)?(p.err_code=4,p.err_txt=this.isReqMsg(init(h,"Org ID")),p):isEmpty(r)?(p.err_code=5,p.err_txt=this.isReqMsg(init(c,"Grade Level")),p):isEmpty(u)?(p.err_code=6,p.err_txt=this.isReqMsg(init(l,"Birth Date")),p):isEmpty(f)?(p.err_code=7,p.err_txt=this.isReqMsg(init(a,"Birth Date")),p):(p.err_code===0&&(WRM$.auth_err_code=0,WRM$.auth_err_txt="",w=jQuery.extend({},this.ajaxDefaults),w.url=wrmUrl("~/pb/Account/CustomAuthentication"),w.async=!1,w.data=JSON.stringify({FirstName:n,LastName:t,OrgID:i,GradeLevel:r,DateOfBirth:u,Username:f}),w.success=function(n){n.ErrorCode==0||init(n.Reset,!1)?wrmGo(n.Redirect):(WRM$.auth_err_code=n.ErrorCode,WRM$.auth_err_txt=n.Status)},w.error=function(n){WRM$.auth_err_txt=n.statusText;WRM$.auth_err_code=n.status},$.ajax(w),p.err_code=WRM$.auth_err_code,p.err_txt=WRM$.auth_err_txt),p.err_code>0&&init(v,!0)&&alert(p.err_txt),p)}}