function saveCookie(n,t,i,r){var u=new Date,f;u.setTime(u.getTime());i&&(i=i*864e5);f=new Date(u.getTime()+i);document.cookie=n+"="+escape(t)+(i?";expires="+f.toUTCString():"")+";path="+r}function getCookie(n){var i=document.cookie.indexOf(n+"="),r=i+n.length+1,t;return!i&&n!=document.cookie.substring(0,n.length)?null:i==-1?null:(t=document.cookie.indexOf(";",r),t==-1&&(t=document.cookie.length),unescape(document.cookie.substring(r,t)))}function queryString(n){if(hu=window.location.search.substring(1),r="",hu!=""){for(gy=hu.split("&"),i=0;i-1?!0:!1;n.errType?window.location=(isAdmin?"/admin":"")+"/error/?err="+n.errType:n.redirect&&(window.location=n.redirect)}function formObj(){this.onStart=function(){disableButton(this.button,this.disabledText)};this.reenableForm=function(){reenableButton(this.button)};this.clearFields=function(){$("#"+this.button).closest("form").find("input").each(function(){var n=$(this),t;n.val("");n.attr("type")=="password"&&(t=$("#"+n.attr("id")+"-temp"),t.length>0&&(n.hide(),t.show()))})};this.onSuccess=function(){var n=this.resp;return n.errType?window.location=(this.isAdmin?"/admin":"")+"/error/?err="+n.errType:n.redirect?window.location=n.redirect:this.callback(n),n.IsValid?(this.formRedirects||this.reenableForm(),unhideCode(this.button),(!n.Data||n.Data&&!n.Data.overrideReset==!0)&&resetAction(this.button)):this.reenableForm(),!1};this.initForm=function(n){var t=this;$("#"+t.button).click(function(){if(!$(this).is(":visible")||n&&!confirm(n))return!1;try{return removeFeedback(),t.onStart(),$.ajax({type:"POST",cache:!1,dataType:"json",url:t.service,data:t.data()+serializeSecToken(),timeout:t.timeout,success:function(n){t.resp=n;t.onSuccess()},error:function(){alert("An error occurred");t.reenableForm()}}),!1}catch(i){return t.reenableForm(),!1}})}}function showPopover(n,t,i,r){var u=$("#"+n),f,o,e;i&&!u.is(":visible")&&(u=$("#"+i));r&&!u.is(":visible")&&(u=$("#"+r));f=u.data("popover");f?(f.$tip.find(".content p").html(t),f.$tip.show()):(u.popover({content:t,trigger:"manual"}),u.popover("show"),window.pageYOffset>0&&(o=u.data("popover").$tip,e=parseInt(o.css("top").replace("px","")),e=e-window.pageYOffset,o.css("top",e+"px")))}function showAlert(n,t,i,r){i||(i="alert-error");t||(t="fa fa-times-circle fa-spacer");r||(r="alert");$("#"+r).after('
<\/i> '+n+"<\/div>");window.location="#"}function showValidationError(n,t){var i=$("#"+n+""),r;document.location.href.indexOf("/admin/")>-1?(i.closest(".control-group").addClass("error"),t&&(i.after(''+t+"<\/span>"),r=i.closest(".controls"),r.children(".code").hide())):(i.closest(".form-group").addClass("has-error"),i.is("input")&&(i.is("input[type=hidden],input[type=checkbox]")||i.closest(".form-group").length&&(i.closest(".form-group").addClass("has-feedback"),i.after('