function gestureStart(){for(i=0;i<metas.length;i++)metas[i].name=="viewport"&&(metas[i].content="width=device-width, minimum-scale=0.25, maximum-scale=1.6")}var Client,metas,i,OfflineIndicator;if(function(n){var t=function(){function n(){}return n.prototype.processAjaxError=function(n,t,i){console.log(i);console.log(t);console.log(n);var u=i,r=n.responseJSON;r&&r.Message&&r.Message!==""?u=r.Message:r&&r.ErrorMessage&&r.ErrorMessage!==""&&(u=r.ErrorMessage);r&&r.ExceptionMessage&&r.ExceptionMessage!==""&&(u=r.ExceptionMessage);r&&r.ModelStateErrors&&r.ModelStateErrors.length>0&&(u=r.ModelStateErrors[0]);toastr.error("<div>"+u+"<\/div>","Oops, something went wrong")},n.prototype.ajax=function(n,t,i){var r=this;return $.ajax(t,{data:i,type:n,contentType:"application/json; charset=utf-8'",error:function(n,t,i){r.processAjaxError(n,t,i)}})},n.prototype.get=function(n,t,i){return(t===void 0&&(t=!0),i===void 0&&(i="json"),!n)?$.Deferred().reject().promise():(i||(i="json"),t==undefined&&(t=!1),$.ajax(n,{type:"get",cache:t,dataType:i,contentType:"application/json; charset=utf-8'",error:this.processAjaxError}))},n.prototype.getWithData=function(n,t,i,r){return(i===void 0&&(i=!0),r===void 0&&(r="json"),!n)?$.Deferred().reject().promise():(r||(r="json"),i==undefined&&(i=!1),$.ajax(n,{type:"get",data:JSON.stringify(t),cache:i,dataType:r,contentType:"application/json; charset=utf-8'",error:this.processAjaxError}))},n.prototype.getHtml=function(n){return this.get(n,!1,"html")},n.prototype.post=function(n,t){return this.ajax("post",n,t)},n.prototype.put=function(n,t){return this.ajax("put",n,t)},n.prototype.delete=function(n,t){return this.ajax("delete",n,t)},n.prototype.upload=function(n,t,i){return $.ajax({url:n,type:"POST",data:t,cache:!1,contentType:!1,processData:!1,xhr:function(){var n=new XMLHttpRequest;return i&&n.upload.addEventListener("progress",i,!1),n}})},n}();n.AjaxService=t}(Client||(Client={})),function(n){var t=function(){function t(t,i,r){this.urls=t;this.ajax=null;this.oDataUrl="";this.apiUrl="";this.ajax=new n.AjaxService;this.oDataUrl=t[i];this.apiUrl=t[r]}return t.prototype.getSpecificItem=function(n,t){var i=this.oDataUrl;return i+="?&$filter=Id eq guid'"+n+"'",t&&(i+="&"+t),this.ajax.get(this.oDataUrl)},t.prototype.getData=function(n,t,i,r,u,f,e,o,s){var h=this.buildGetDataUrl(n,t,i,r,u,f,e,o,s);return this.ajax.get(h)},t.prototype.saveItem=function(n){var t=JSON.stringify(n);return this.ajax.post(this.apiUrl,t)},t.prototype.delete=function(n){var t=this.apiUrl+"?id="+n;return this.ajax.delete(t,{})},t.prototype.buildGetDataUrl=function(n,t,i,r,u,f,e,o,s){var h="";return h=this.appendQueryString(h,o),h=this.appendQueryString(h,this.buildFilterClause(u,f,e,s)),h=this.appendQueryString(h,this.buildOrderByClause(i,r)),h=this.appendQueryString(h,this.buildPagingClause(n,t)),this.oDataUrl+h},t.prototype.buildFilterClause=function(n,t,i,r){var u="";return u=this.appendFilterString(u,this.buildSubStringFilter(n,t)),u=this.appendFilterString(u,this.buildEnabledFilter(i)),this.appendFilterString(u,this.buildCustomFilter(r))},t.prototype.buildSubStringFilter=function(n,t){return n!=null&&t!=null?"substringof('"+t+"', "+n+") eq true":""},t.prototype.buildEnabledFilter=function(n){return n?"IsEnabled eq true":""},t.prototype.buildCustomFilter=function(n){return n!=null?n:""},t.prototype.buildOrderByClause=function(n,t){return n!=null?"$orderby="+n+" "+t:""},t.prototype.buildPagingClause=function(n,t){if(n!=null&&t!=null){var i=(n-1)*t;return"$top="+t+"&$inlinecount=allpages&$skip="+i}return""},t.prototype.appendQueryString=function(n,t){return(n===void 0&&(n=""),!t||t.length===0)?n:(n+=n&&n.length!==0?"&":"?",n+t)},t.prototype.appendFilterString=function(n,t){return(n===void 0&&(n=""),!t||t.length===0)?n:(n+=n&&n.length!==0?" and ":"$filter=",n+t)},t}();n.BaseService=t}(Client||(Client={})),function(n){var t=function(){function n(n,t,i,r,u){var f,e;t===void 0&&(t={});u===void 0&&(u=!0);f=this;this.service=n;this.messages=t;this.ItemConstructor=i;this.itemData=r;this.items=ko.observableArray([]);this.totalResults=ko.observable(0);this.pager=ko.pager(this.totalResults);this.orderByList=ko.observableArray([]);this.orderByValue=ko.observable("Name");this.orderByAsc=ko.observable(!0);this.awaitingData=ko.observable(!1);this.hasPopulatedData=ko.observable(!1);this.preFilter=ko.observable("");this.filterProperty=ko.observable("Name");this.filterValue=ko.observable(null);this.customFilter=ko.observable(null);this.displayEnabledOnly=ko.observable(!0);this.isEditing=ko.observable(!1);this.isEditingNewItem=ko.observable(!1);this.editingItem=null;this.stopEditingOnSave=ko.observable(!0);this.populateDataOnSaveNew=ko.observable(!0);this.populateDataOnSaveExisting=ko.observable(!0);this.populateDataOnDelete=ko.observable(!0);this.preItemSelectEvent=null;this.postSelectItemEvent=null;this.postDataItemEvent=null;this.postDataPopulationEvent=null;this.preItemAddEvent=null;this.preSaveItemEvent=null;this.preItemCancelEditEvent=null;this.preSaveUnmappedItemEvent=null;this.postSaveItemEvent=null;this.customPopulateDataFunction=null;this.stateClass=ko.computed(function(){return f.awaitingData()?"shallow":""});this.select=function(n){f.preItemSelectEvent&&f.preItemSelectEvent(n);n?(f.isEditingNewItem(!1),f.transplant(n,f.editingItem())):(f.isEditingNewItem(!0),console.log("itemData",f.itemData),f.transplant(new f.ItemConstructor(f.itemData),f.editingItem()));f.isEditing(!0);f.postSelectItemEvent&&f.postSelectItemEvent(n)};e=new i(r);this.editingItem=ko.validatedObservable(e);this.pager().CurrentPage.subscribe(function(){f.populateData()});this.pager().PageSize.subscribe(function(){f.populateData()});u&&this.populateData()}return n.prototype.clearFilter=function(){this.filterValue(null);this.populateData()},n.prototype.toggleDisplayEnabledOnly=function(){this.displayEnabledOnly(!this.displayEnabledOnly());this.populateData()},n.prototype.populateData=function(){var n=this,t;return this.customPopulateDataFunction?this.customPopulateDataFunction():(this.awaitingData(!0),t=this.service.getData(this.pager().CurrentPage(),this.pager().PageSize(),this.orderByValue(),this.orderByAsc()?"asc":"desc",this.filterProperty(),this.filterValue(),this.displayEnabledOnly(),this.preFilter(),this.customFilter()),t.then(function(t){n.hasPopulatedData(!0);n.handleGetResponse(t)},function(){n.awaitingData(!1)}),t)},n.prototype.handleGetResponse=function(n){this.setData(n.value);this.totalResults(n["odata.count"]);this.postDataPopulationEvent&&this.postDataPopulationEvent();this.awaitingData(!1)},n.prototype.setData=function(n){var t=this,i=[];$.each(n,function(n,r){var u=new t.ItemConstructor(r);t.postDataItemEvent&&t.postDataItemEvent(u);t.preItemAddEvent&&t.preItemAddEvent(u);i.push(u)});this.items(i)},n.prototype.addItem=function(n){this.preItemAddEvent&&this.preItemAddEvent(n);this.items.push(n)},n.prototype.setOrderByValue=function(n){this.orderByValue()===n?this.orderByAsc(!this.orderByAsc()):(this.orderByValue(n),this.orderByAsc(!1));this.populateData()},n.prototype.getDirectionalClass=function(n){return this.orderByValue()===n?"glyphicon glyphicon-chevron-"+(this.orderByAsc()?"down":"up"):""},n.prototype.isSelected=function(n){return this.isEditing()&&n.Id()===this.editingItem().Id()},n.prototype.transplant=function(n,t){n.toJs&&(n=n.toJs());t.fromJs(n)},n.prototype.create=function(){this.select(null)},n.prototype.saveNew=function(){var n=this,t=this.saveEditingItem();return t.then(function(){if(n.populateDataOnSaveNew())n.populateData();else{var t=new n.ItemConstructor(n.itemData);n.transplant(n.editingItem(),t);n.addItem(t)}}),t},n.prototype.saveExisting=function(){var n=this,t=this.saveEditingItem();t.then(function(){n.populateDataOnSaveExisting()?n.populateData():n.updateItemInList(n.editingItem)})},n.prototype.saveEditingItem=function(){var t=this,n;if(this.awaitingData(!0),this.editingItem.isValid())return this.preSaveItemEvent&&this.preSaveItemEvent(),n=this.saveItem(this.editingItem()),n.then(function(n){t.editingItem().id(n.CommittedId);t.awaitingData(!1)}),n},n.prototype.saveItem=function(n){var t=this,i=n.toJs(),r;return this.preSaveUnmappedItemEvent&&this.preSaveUnmappedItemEvent(i),r=this.service.saveItem(i),r.then(function(r){console.log(r);!r.HasError&&t.postSaveItemEvent&&t.postSaveItemEvent(i,n);!r.HasError&&t.stopEditingOnSave()&&t.isEditing(!1)}),r},n.prototype.cancelEdit=function(){this.preItemCancelEditEvent&&this.preItemCancelEditEvent();this.hasPopulatedData()||this.populateData();this.isEditing(!1)},n.prototype.updateItemInList=function(n){var t=ko.utils.arrayFirst(this.items(),function(t){return t.id()===n.id()});t!=null&&this.transplant(n,t)},n}();n.BaseIndexAndEdit=t}(Client||(Client={})),function(n){var t=function(){function n(){}return n.notifySuccess=function(n,t,i){t===void 0&&(t="");i===void 0&&(i=5e3);var r={};r.closeButton=!1;r.tapToDismiss=!0;r.timeOut=i;toastr.success(n,t,r)},n.notifyInfo=function(n,t,i){t===void 0&&(t="");i===void 0&&(i=5e3);var r={};r.closeButton=!1;r.tapToDismiss=!0;r.timeOut=i;toastr.success(n,t,r)},n.notifyError=function(n,t,i){t===void 0&&(t="");i===void 0&&(i=5e3);var r={};r.timeOut=i;toastr.error(n,t,r)},n.validateEmail=function(n){return n?n===""?!1:(n=n.trim(),n.indexOf(" ")>-1)?!1:n.indexOf(",")>-1?!1:n.indexOf(".")===-1?!1:n.indexOf(".")===-1?!1:n.indexOf("@")===-1?!1:n.length<5?!1:!0:!1},n.heapEvent=function(n,t){window.heap&&window.heap.track(n,t)},n.facebookEvent=function(n,t){window.fbq&&window.fbq("track",n,t)},n.getQueryStringParameterByName=function(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=i.exec(location.search);return t?decodeURIComponent(t[1].replace(/\+/g," ")):null},n.fillZero=function(n){return n.length==1?"0"+n:n},n.colorToHex=function(t){var i=/(.*?)rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(t);if(i==null)return"";var r=parseInt(i[2]),u=parseInt(i[3]),f=parseInt(i[4]),e=n.fillZero(r.toString(16))+n.fillZero(u.toString(16))+n.fillZero(f.toString(16));return"#"+e.toUpperCase()},n.createCanvasLoader=function(t){var f=$("#"+t).attr("data-canvas-loader"),r,i,u;f||(r=window.CanvasLoader,r)&&(i=new r(t),u=n.colorToHex($("#divColour").css("background-color")),i.setColor(u),i.setDiameter(150),i.setSpeed(1),i.setFPS(30),i.show(),$("#"+t).attr("data-canvas-loader","true"))},n.blankGuid="00000000-0000-0000-0000-000000000000",n}();n.Common=t}(Client||(Client={})),function(n){var t=function(){function n(n,t){this.onChange=null;this.getHash=null;this.onChange=n;this.getHash=t;this.hashChange()}return n.prototype.updateHash=function(){if(this.getHash){var n=this.getHash();n?window.common.StringStartsWith(n,"#")||(n="#"+n):n="#";history.pushState?history.pushState(null,null,n):location.hash=n}},n.prototype.locationHash=function(){return location.hash},n.prototype.hashChange=function(){var n=this.locationHash();n=n.replace(/^#/,"")||null;this.onChange(n)},n}();n.HashManager=t}(Client||(Client={})),window.CallbackException=function(n,t){this.isCallbackError=!0;typeof n=="object"?n.message?this.message=n.message:n.Message&&(this.message=n.Message):this.message=n;this.detail=t?t:null},toastr.options={closeButton:!0,positionClass:"toast-top-center",hideDuration:"300",timeOut:"0",extendedTimeOut:"0",preventDuplicates:!0},window.common=function(){function r(n){$("html, body").animate({scrollTop:Math.min($(n).offset().top,$("body")[0].scrollHeight-$("body").height())},300)}function u(t){var i=null;t&&t.Message&&t.Message!=""?i=t.Message+"<br/>":t&&t.ErrorMessage&&t.ErrorMessage!=""&&(i=t.ErrorMessage+"<br/>");t&&t.ExceptionMessage&&t.ExceptionMessage!=""&&(i+=t.ExceptionMessage);t&&t.ModelStateErrors&&t.ModelStateErrors.length>0&&(i+=t.ModelStateErrors[0]);i&&n("<div><b>"+i+"<\/b><\/div>")}function n(n){toastr.error(n)}function t(n,t){this.isCallbackError=!0;typeof n=="object"?n.message?this.message=n.message:n.Message&&(this.message=n.Message):this.message=n;this.detail=t?t:null}function i(n,t){var i='<div class="validation-summary-errors">',r;if(i+='<div style="float: left">',i+="<span>"+n+"<\/span>",i+="<\/div>",i+='<div style="padding-top:0px; clear: both">',t!=null){if(i+="<ul>",t[0]!=undefined)for(r=0;r<t.length;r++)i+="<li>"+t[r].Value+"<\/li>";else i+="<li>Page Not Found<\/li>";i+="<\/ul>"}return i+="<\/div>",i+"<\/div>"}function f(n){function i(){for(var i=0;i<t;i++)this[n[i]]=arguments[i]}n=n.split(",");var t=n.length;return i}return{ScrollTo:r,dateToString:function(n,t){var i,r=n.getMonth()+1,u=(n.getDate()<10?"0":"")+n.getDate(),f=(r<10?"0":"")+r;return i=t===!0?f+"-"+u:u+"-"+f,i+("-"+n.getFullYear())},getTodayString:function(n){return common.dateToString(new Date,n)},ReplaceAll:function(n,t,i){return i.replace(new RegExp(n.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),t)},dateDataToString:function(n,t){var i=moment.utc(n,"YYYY-MM-DD");return common.dateToString(i.toDate(),t)},dateToUTC:function(n){return new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCSeconds())},newGuid:function(){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)})},blankGuid:"00000000-0000-0000-0000-000000000000",GetHashValueSetter:function(){return":"},GetHashDelimiter:function(){return","},AddNameValueToHash:function(n,t,i){return n==null||n==""||t==null||t==""?i==null||i==""?"":i:(i==null?i="":i+=common.GetHashDelimiter(),i+(n+common.GetHashValueSetter()+t))},Transplant:function(n,t){var i,r;for(i in t)if(t.hasOwnProperty(i)&&n.hasOwnProperty(i)){if(typeof t[i]=="function"&&ko.isComputed(t[i]))continue;if(typeof t[i]=="function"&&t[i].toString().substring(9,28)=="dependentObservable")continue;if(i=="__ko_mapping__")continue;r=typeof n[i]=="function"?n[i].call(n):n[i];typeof t[i]=="function"?t[i].call(t,r):t[i]=r}},StringStartsWith:function(n,t){return typeof String.prototype.startsWith!="function"&&(String.prototype.startsWith=function(n){return this.slice(0,n.length)==n}),n.startsWith(t)},GetHashParameterByName:function(n,t){var r,u,i,f,e;if(n==null||n==""||t==null||t=="")return null;for(common.StringStartsWith(t,"#")&&(t=t.substring(1)),r=n+common.GetHashValueSetter(),u=t.split(common.GetHashDelimiter()),i=0;i<u.length;i++)if(f=u[i],e=f.indexOf(r),e>=0)return f.substring(r.length);return null},MergeHashes:function(n,t){return n==null||n==""?t:t==null||t==""?n:n+common.GetHashDelimiter()+t},ProcessAjaxErrors:function(t){var i="",r;if(t.responseJSON!=null)if(t.responseJSON.ModelStateErrors!=null&&t.responseJSON.ModelStateErrors.length>0)for(r=0;r<t.responseJSON.ModelStateErrors.length;r++)i+="<div>"+t.responseJSON.ModelStateErrors[r]+"<\/div>";else t.responseJSON.Error!=null&&(i+="<div><b>Error<\/b><\/div>",i+="<div>"+t.responseJSON.Error.Message+"<\/div>",console.log(t.responseJSON.Error));common.StringIsNullOrEmpty(i)&&(i="Unknown error");n(i)},ProcessGenericError:function(t){var i="<div><b>Well this is embarrassing. An unexpected problem occurred:<\/b><\/div>";i+="<div>"+t+"<\/div>";n(i)},ProcessCustomError:function(t){var i="<div>"+t+"<\/div>";n(i)},ProcessAjaxError:function(n,t,i){var r,f;console.log(n);console.log(t);console.log(i);r=null;n.readyState==4&&(f=n.responseText,f&&f.charAt(0)=="{"&&(r=JSON.parse(f)),r||(r=n.status&&n.status!=200?new CallbackException(n.status+" "+n.statusText):new CallbackException("Callback Error: "+t),r.detail=f));r||(r=i);u(r,self,n)},ProcessError:function(n,r,u){var e=f("Key,Value"),o=new e("AJAX",u);t(r,i(r,[o]))},ProcessModelErrors:function(n,r,u){t(r,i(r,u))},ProcessSuccessMessage:function(n,t){var i='<fieldset class="Message">'+t+"<\/fieldset>";$("#"+n).html(i).show()},ProcessTimedMessage:function(n,t){$("#"+n).html(t);$("#"+n).oneTime(1e4,n+"Timer",function(){$("#"+n).html("")})},StringIsNullOrEmpty:function(n){return n==null?!0:n.trim()==""?!0:!1},CombineDateAndTime:function(n,t){var i={years:n.year(),months:n.month(),days:n.date(),hours:t.hours(),minutes:t.minutes(),seconds:0,milliseconds:0};return moment.utc(i)},ResolvedPromise:function(n){return n||(n=!0),$.Deferred().resolve(n).promise()},RejectedPromise:function(){return $.Deferred().reject().promise()},GetQueryStringParameterByName:function(n){n=n.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var i=new RegExp("[\\?&]"+n+"=([^&#]*)"),t=i.exec(location.search);return t==null||t==""?null:decodeURIComponent(t[1].replace(/\+/g," "))},FillZero:function(n){return n.length==1?"0"+n:n},ColorToHex:function(n){var t=/(.*?)rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(n);if(t==null)return"";var i=parseInt(t[2]),r=parseInt(t[3]),u=parseInt(t[4]),f=common.FillZero(i.toString(16))+common.FillZero(r.toString(16))+common.FillZero(u.toString(16));return"#"+f.toUpperCase()},Notify:function(n){toastr.info(n)},NotifySuccess:function(n,t){toastr.success(n);t&&t>0&&setInterval(toastr.clear,t)},NotifyWithDuration:function(n,t){toastr.info(n);setInterval(toastr.clear,t)},NotifyError:function(n,t){toastr.error(n);t&&t>0&&setInterval(toastr.clear,t)},queryStringCategoryIdVariable:function(){return"cat"},queryStringCategoryId:function(){return getQueryStringParameterByName(common.queryStringCategoryIdVariable)},queryStringAuthorIdVariable:function(){return"aut"},queryStringAuthorId:function(){return common.GetQueryStringParameterByName(common.queryStringAuthorIdVariable)},queryStringOrderByIdVariable:function(){return"orderBy"},queryStringOrderById:function(){return common.getQueryStringParameterByName(common.queryStringOrderByIdVariable)},queryStringSearchKeywordsVariable:function(){return"keywords"},queryStringSearchKeywords:function(){return common.getQueryStringParameterByName(common.queryStringSearchKeywordsVariable)},CreateCanvasLoader:function(n){var r=$("#"+n).attr("data-canvas-loader"),t,i;r||(t=new CanvasLoader(n),i=common.ColorToHex($("#divColour").css("background-color")),t.setColor(i),t.setDiameter(150),t.setSpeed(1),t.setFPS(30),t.show(),$("#"+n).attr("data-canvas-loader",!0))},IsFunction:function(n){return n&&{}.toString.call(n)==="[object Function]"},HeapEvent:function(n,t){window.heap&&window.heap.track(n,t)},FacebookEvent:function(n,t){window.fbq&&window.fbq("track",n,t)},GoogleAnalyticsTransaction:function(n,t){var i,r;if(window.ga){for(window.ga("require","ecommerce"),window.ga("ecommerce:addTransaction",n),i=0;i<t.length;i++)r=t[i],window.ga("ecommerce:addItem",r);window.ga("ecommerce:send")}}}}(),metas=document.getElementsByTagName("meta"),navigator.userAgent.match(/iPhone/i)){for(i=0;i<metas.length;i++)metas[i].name=="viewport"&&(metas[i].content="width=device-width, minimum-scale=1.0, maximum-scale=1.0");document.addEventListener("gesturestart",gestureStart,!1)}OfflineIndicator=function(){var n=this;n.IsOffline=ko.observable(!1);n.IntervalObject=null;n.CheckInterval=1e4;n.CheckUrl="/favicon.ico";n.ShowOfflineMessage=function(){toastr.error("<strong>Unable to connect!<\/strong><br/>Please check your internet connection.  Your changes are not being saved.")};n.ShowOnlineMessage=function(){toastr.clear();toastr.success("<strong>Connected!<\/strong><br/>Your changes will now be saved.",{timeOut:3e3,extendedTimeOut:1e3});setTimeout(toastr.clear,3e3)};n.HandleGoneOffline=function(){n.IsOffline(!0);n.ShowOfflineMessage();n.StartPeriodicOnlineChecking()};n.HandleStillOffline=function(){n.ShowOfflineMessage()};n.HandleGoneOnline=function(){n.IsOffline()&&(console.log("BACK ONLINE!"),n.IsOffline(!1),n.StopPeriodicOnlineChecking(),n.ShowOnlineMessage())};n.CheckIfOnline=function(){if(console.log("Checking online status ..."),!n.IsOffline()){n.StopPeriodicOnlineChecking();return}$.ajax({type:"HEAD",url:n.CheckUrl,success:n.HandleGoneOnline,failure:n.HandleStillOffline})};n.StartPeriodicOnlineChecking=function(){n.IntervalObject||(n.IntervalObject=setInterval(n.CheckIfOnline,n.CheckInterval))};n.StopPeriodicOnlineChecking=function(){clearInterval(n.IntervalObject);n.IntervalObject=null};n.Init=function(){window.addEventListener("offline",n.HandleGoneOffline);window.addEventListener("online",n.HandleGoneOnline)}};$(document).ready(function(){var n=new OfflineIndicator;n.Init()});window.AjaxService=function(){var n=this,t=function(n,t,i){return $.ajax(t,{data:i,type:n,contentType:"application/json; charset=utf-8'",error:common.ProcessAjaxError})};n.Get=function(n,t,i){return n?(i||(i="json"),t==undefined&&(t=!1),$.ajax(n,{type:"get",cache:t,dataType:i,contentType:"application/json; charset=utf-8'",error:common.ProcessAjaxError})):$.Deferred().reject().promise()};n.GetHtml=function(t){return n.Get(t,!1,"html")};n.Post=function(n,i){return t("post",n,i)};n.Put=function(n,i){return t("put",n,i)};n.Delete=function(n,i){return t("delete",n,i)};n.Upload=function(n,t,i){return $.ajax({url:n,type:"POST",data:t,cache:!1,contentType:!1,processData:!1,xhr:function(){var n=new window.XMLHttpRequest;return i&&n.upload.addEventListener("progress",i,!1),n}})};n.get=n.Get;n.put=n.Put;n.post=n.Post;n.delete=n.Delete},function(n){var o=function(n,t){typeof t=="undefined"&&(t={});this.init(n,t)},t=o.prototype,f,e=["canvas","vml"],i=["oval","spiral","square","rect","roundRect"],a=/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,c=navigator.appVersion.indexOf("MSIE")!==-1&&parseFloat(navigator.appVersion.split("MSIE")[1])===8?!0:!1,v=!!document.createElement("canvas").getContext,l=!0,u=function(n,t,i){var n=document.createElement(n);for(var r in i)n[r]=i[r];return typeof t!="undefined"&&t.appendChild(n),n},r=function(n,t){for(var i in t)n.style[i]=t[i];return n},s=function(n,t){for(var i in t)n.setAttribute(i,t[i]);return n},h=function(n,t,i,r){n.save();n.translate(t,i);n.rotate(r);n.translate(-t,-i);n.beginPath()};t.init=function(n,t){typeof t.safeVML=="boolean"&&(l=t.safeVML);try{this.mum=document.getElementById(n)!==void 0?document.getElementById(n):document.body}catch(h){this.mum=document.body}if(t.id=typeof t.id!="undefined"?t.id:"canvasLoader",this.cont=u("div",this.mum,{id:t.id}),v)f=e[0],this.can=u("canvas",this.cont),this.con=this.can.getContext("2d"),this.cCan=r(u("canvas",this.cont),{display:"none"}),this.cCon=this.cCan.getContext("2d");else{if(f=e[1],typeof o.vmlSheet=="undefined"){document.getElementsByTagName("head")[0].appendChild(u("style"));o.vmlSheet=document.styleSheets[document.styleSheets.length-1];var i=["group","oval","roundrect","fill"];for(var s in i)o.vmlSheet.addRule(i[s],"behavior:url(#default#VML); position:absolute;")}this.vml=u("group",this.cont)}this.setColor(this.color);this.draw();r(this.cont,{display:"none"})};t.cont={};t.can={};t.con={};t.cCan={};t.cCon={};t.timer={};t.activeId=0;t.diameter=40;t.setDiameter=function(n){this.diameter=Math.round(Math.abs(n));this.redraw()};t.getDiameter=function(){return this.diameter};t.cRGB={};t.color="#000000";t.setColor=function(n){this.color=a.test(n)?n:"#000000";this.cRGB=this.getRGB(this.color);this.redraw()};t.getColor=function(){return this.color};t.shape=i[0];t.setShape=function(n){for(var t in i)if(n===i[t]){this.shape=n;this.redraw();break}};t.getShape=function(){return this.shape};t.density=40;t.setDensity=function(n){this.density=l&&f===e[1]?Math.round(Math.abs(n))<=40?Math.round(Math.abs(n)):40:Math.round(Math.abs(n));this.density>360&&(this.density=360);this.activeId=0;this.redraw()};t.getDensity=function(){return this.density};t.range=1.3;t.setRange=function(n){this.range=Math.abs(n);this.redraw()};t.getRange=function(){return this.range};t.speed=2;t.setSpeed=function(n){this.speed=Math.round(Math.abs(n))};t.getSpeed=function(){return this.speed};t.fps=24;t.setFPS=function(n){this.fps=Math.round(Math.abs(n));this.reset()};t.getFPS=function(){return this.fps};t.getRGB=function(n){return n=n.charAt(0)==="#"?n.substring(1,7):n,{r:parseInt(n.substring(0,2),16),g:parseInt(n.substring(2,4),16),b:parseInt(n.substring(4,6),16)}};t.draw=function(){var w=0,t,y,n,l,a,d,p,k=this.density,g=Math.round(k*this.range),b,v,nt=0,o;if(v=this.cCon,o=this.diameter,f===e[0])for(v.clearRect(0,0,1e3,1e3),s(this.can,{width:o,height:o}),s(this.cCan,{width:o,height:o});w<k;){b=w<=g?1-1/g*w:b=0;d=270-360/k*w;p=d/180*Math.PI;v.fillStyle="rgba("+this.cRGB.r+","+this.cRGB.g+","+this.cRGB.b+","+b.toString()+")";switch(this.shape){case i[0]:case i[1]:t=o*.07;l=o*.47+Math.cos(p)*(o*.47-t)-o*.47;a=o*.47+Math.sin(p)*(o*.47-t)-o*.47;v.beginPath();this.shape===i[1]?v.arc(o*.5+l,o*.5+a,t*b,0,Math.PI*2,!1):v.arc(o*.5+l,o*.5+a,t,0,Math.PI*2,!1);break;case i[2]:t=o*.12;l=Math.cos(p)*(o*.47-t)+o*.5;a=Math.sin(p)*(o*.47-t)+o*.5;h(v,l,a,p);v.fillRect(l,a-t*.5,t,t);break;case i[3]:case i[4]:y=o*.3;n=y*.27;l=Math.cos(p)*(n+(o-n)*.13)+o*.5;a=Math.sin(p)*(n+(o-n)*.13)+o*.5;h(v,l,a,p);this.shape===i[3]?v.fillRect(l,a-n*.5,y,n):(t=n*.55,v.moveTo(l+t,a-n*.5),v.lineTo(l+y-t,a-n*.5),v.quadraticCurveTo(l+y,a-n*.5,l+y,a-n*.5+t),v.lineTo(l+y,a-n*.5+n-t),v.quadraticCurveTo(l+y,a-n*.5+n,l+y-t,a-n*.5+n),v.lineTo(l+t,a-n*.5+n),v.quadraticCurveTo(l,a-n*.5+n,l,a-n*.5+n-t),v.lineTo(l,a-n*.5+t),v.quadraticCurveTo(l,a-n*.5,l+t,a-n*.5))}v.closePath();v.fill();v.restore();++w}else{r(this.cont,{width:o,height:o});r(this.vml,{width:o,height:o});switch(this.shape){case i[0]:case i[1]:p="oval";t=140;break;case i[2]:p="roundrect";t=120;break;case i[3]:case i[4]:p="roundrect";t=300}for(y=n=t,l=500-n,a=-n*.5;w<k;){b=w<=g?1-1/g*w:b=0;d=270-360/k*w;switch(this.shape){case i[1]:y=n=t*b;l=500-t*.5-t*b*.5;a=(t-t*b)*.5;break;case i[0]:case i[2]:c&&(a=0,this.shape===i[2]&&(l=500-n*.5));break;case i[3]:case i[4]:y=t*.95;n=y*.28;c?(l=0,a=500-n*.5):(l=500-y,a=-n*.5);nt=this.shape===i[4]?.6:0}v=s(r(u("group",this.vml),{width:1e3,height:1e3,rotation:d}),{coordsize:"1000,1000",coordorigin:"-500,-500"});v=r(u(p,v,{stroked:!1,arcSize:nt}),{width:y,height:n,top:a,left:l});u("fill",v,{color:this.color,opacity:b});++w}}this.tick(!0)};t.clean=function(){if(f===e[0])this.con.clearRect(0,0,1e3,1e3);else{var n=this.vml;if(n.hasChildNodes())for(;n.childNodes.length>=1;)n.removeChild(n.firstChild)}};t.redraw=function(){this.clean();this.draw()};t.reset=function(){typeof this.timer=="number"&&(this.hide(),this.show())};t.tick=function(n){var i=this.con,t=this.diameter;n||(this.activeId+=360/this.density*this.speed);f===e[0]?(i.clearRect(0,0,t,t),h(i,t*.5,t*.5,this.activeId/180*Math.PI),i.drawImage(this.cCan,0,0,t,t),i.restore()):(this.activeId>=360&&(this.activeId-=360),r(this.vml,{rotation:this.activeId}))};t.show=function(){if(typeof this.timer!="number"){var n=this;this.timer=self.setInterval(function(){n.tick()},Math.round(1e3/this.fps));r(this.cont,{display:"block"})}};t.hide=function(){typeof this.timer=="number"&&(clearInterval(this.timer),delete this.timer,r(this.cont,{display:"none"}))};t.kill=function(){var n=this.cont,t;typeof this.timer=="number"&&this.hide();f===e[0]?(n.removeChild(this.can),n.removeChild(this.cCan)):n.removeChild(this.vml);for(t in this)delete this[t]};n.CanvasLoader=o}(window);$(document).ready(function(){var n=$("#top");n.appear();$.force_appear();$(n).on("appear",function(){$("#backToTop").hide()});$(n).on("disappear",function(){$("#backToTop").show()});$(".SubMenuWrapper").length&&$("body").removeClass("no-subnav")})