--- a/src/ztfy/myams/resources/js/myams.min.js Thu Nov 26 12:07:43 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams.min.js Mon Dec 07 14:31:56 2015 +0100
@@ -1,1 +1,1 @@
-(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(0,f)===g)};String.prototype.endsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(e-f)===g)};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(f,g){var e=this.length;g=Number(g)||0;g=(g<0)?Math.ceil(g):Math.floor(g);if(g<0){g+=e}for(;g<e;g++){if(g in this&&this[g]===f){return g}}return -1}}c.expr[":"].econtains=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"").toLowerCase()===f[3].toLowerCase()};c.expr[":"].withtext=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"")===f[3]};c.expr[":"].parents=function(g,e,f){return c(g).parents(f[3]).length>0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l<i){g-=l}return g}return this.each(function(){c("a",c(f.menuSelector)).each(function(){c(this).data("ams-context-menu",true)});c(this).on("contextmenu",function(g){if(g.ctrlKey){return}c(f.menuSelector).data("invokedOn",c(g.target)).show().css({position:"fixed",left:e(g.clientX,"width","scrollLeft")-10,top:e(g.clientY,"height","scrollTop")-10}).off("click").on("click",function(i){c(this).hide();var h=c(this).data("invokedOn");var j=c(i.target);f.menuSelected.call(this,h,j);a.event.stop(i)});return false});c(document).click(function(){c(f.menuSelector).hide()})})},myams_menu:function(e){var g={accordion:true,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append("<b class='collapse-sign'>"+f.closedSign+"</b>");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var l=c(this);var i=l.parent().find("UL");if(f.accordion){var k=l.parent().parents("UL");var m=h.find("UL:visible");m.each(function(n){var o=true;k.each(function(p){if(k[p]===m[n]){o=false;return false}});if(o){if(i!==m[n]){c(m[n]).slideUp(f.speed,function(){l.parent("LI").find("b:first").html(f.closedSign);l.parent("LI").removeClass("open")})}}})}var j=l.parent().find("UL:first");if(!l.attr("href").replace(/^#/,"")&&j.is(":visible")&&!j.hasClass("active")){j.slideUp(f.speed,function(){l.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{j.slideDown(f.speed,function(){l.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h<f.length;h++){var g=f.charCodeAt(h);if(g<128){e+=String.fromCharCode(g)}else{if((g>127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j<e.length){k=e.charCodeAt(j);if(k<128){g+=String.fromCharCode(k);j++}else{if((k>191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f<j.length;f++){try{g=g[j[f]]}catch(l){return undefined}}try{return g[h]}catch(l){return undefined}};d.executeFunctionByName=function(h,f){var g=a.getFunctionByName(h,window);if(typeof(g)==="function"){var e=Array.prototype.slice.call(arguments,2);return g.apply(f,e)}};d.getSource=function(e){return e.replace(/{[^{}]*}/g,function(f){return a.getFunctionByName(f.substr(1,f.length-2))})};d.getScript=function(f,i,e){var h={dataType:"script",url:a.getSource(f),success:i,error:a.error.show,cache:!a.devmode,async:typeof(i)==="function"};var g=c.extend({},h,e);return c.ajax(g)};d.getCSS=function(e,i){var g=c("HEAD");var f=c('link[data-ams-id="'+i+'"]',g);if(f.length===0){var h=a.getSource(e);if(a.devmode){h+="?_="+new Date().getTime()}c("<link />").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(h,g){if(g.statusText==="OK"){return}var e=a.ajax.getResponse(g);if(e.content_type==="json"){a.ajax.handleJSON(e.data)}else{var i=h.statusText||h.type;var f=g.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+i+"</h4><p>"+f+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(h);b.console.debug(g)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.content_type==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"<h4>"+e+"</h4><p>"+g+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result},error:a.error.show};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var g=h.getResponseHeader("content-type"),j,f;if(g){if(g.startsWith("application/javascript")){j="script";f=h.responseText}else{if(g.startsWith("text/html")){j="html";f=h.responseText}else{if(g.startsWith("text/xml")){j="xml";f=h.responseText}else{f=h.responseJSON;if(f){j="json"}else{try{f=JSON.parse(h.responseText);j="json"}catch(i){f=h.responseText;j="text"}}}}}}else{j="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:j,data:f}},handleJSON:function(p,g,l){var j=p.status;var e;switch(j){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||l||"#content");break;case"redirect":if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+j)}}var k;var m;var f;if(p.content){m=p.content;f=c(m.target||l||g||"#content");if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}if(p.contents){var i=p.contents;for(k=0;k<i.length;k++){m=i[k];f=c(m.target);if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}}var o;if(p.message){o=p.message;if(typeof(o)==="string"){if((j==="info")||(j==="success")){a.skin.smallBox(j,{title:o,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(c(g||"#content"),j,o)}}else{a.skin.alert(c(o.target||l||g||"#content"),o.status||"success",o.header,o.body,o.subtitle)}}if(p.smallbox){a.skin.smallBox(p.smallbox_status||j,{title:p.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(p.messagebox){o=p.messagebox;if(typeof(o)==="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:o,timeout:10000})}else{var h=o.status||"info";if(h==="error"&&g&&l){a.executeFunctionByName(g.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",g,l)}a.skin.messageBox(h,{title:o.title||a.i18n.ERROR_OCCURED,content:o.content,icon:o.icon,number:o.number,timeout:o.timeout===null?undefined:(o.timeout||10000)})}}if(p.event){g.trigger(p.event,p.event_options)}if(p.callback){a.executeFunctionByName(p.callback,g,p.options)}if(p.callbacks){var n;for(k=0;k<p.callbacks.length;k++){n=p.callbacks[k];a.executeFunctionByName(n,g,n.options)}}}};d.jsonrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},query:function(f,h,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(g==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var k={};if(typeof(f)==="string"){k.query=f}else{if(typeof(f)==="object"){c.extend(k,f)}}c.extend(k,e);var i;var j={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:k,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};c.jsonRpc(j);return i})},post:function(h,f,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(typeof(g)==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var i;var k={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:f,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};var j=c.extend({},k,e);c.jsonRpc(j);return i})}};d.xmlrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},post:function(f,i,g,e,h){a.ajax.check(c.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+a.devext+".js",function(){if(typeof(e)==="function"){h=e;e={}}else{if(!e){e={}}}if(typeof(h)==="undefined"){h=e.callback}if(typeof(h)==="string"){h=a.getFunctionByName(h)}delete e.callback;var j;var l={url:a.xmlrpc.getAddr(f),methodName:i,params:g,success:h||function(m){j=m},error:a.error.show};var k=c.extend({},l,e);c.xmlrpc(k);return j})}};d.form={init:function(f){var e;if(a.warn_on_form_change){e=c('FORM[data-ams-warn-on-change!="false"]',f)}else{e=c('FORM[data-ams-warn-on-change="true"]',f)}e.each(function(){var g=c(this);c('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',g).each(function(){var i=c(this);if(i.data("ams-ignore-change")!==true){var h=i.data("ams-changed-event")||"change";i.on(h,function(){c(this).parents("FORM").attr("data-ams-form-changed",true)})}});g.on("reset",function(){c(this).removeAttr("data-ams-form-changed")})})},setFocus:function(e){var f=c("[data-ams-focus-target]",e).first();if(!f.exists()){f=c("input, select",e).first()}if(f.exists()){if(f.hasClass("select2")){setTimeout(function(){f.select2("focus");f.select2("open")},100)}else{f.focus()}}},checkBeforeUnload:function(){var e=c('FORM[data-ams-form-changed="true"]');if(e.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(f,g){if(typeof(f)==="function"){g=f;f=undefined}var e=c('FORM[data-ams-form-changed="true"]',f);if(e.exists()){a.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(h){if(h===a.i18n.BTN_OK){g.call(f)}})}else{g.call(f)}},submit:function(g,f,h){g=c(g);if(!g.exists()){return false}if(typeof(f)==="object"){h=f;f=undefined}if(g.data("submitted")){if(!g.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:g.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(g)){return false}c(".alert-danger, SPAN.state-error",g).remove();c(".state-error",g).removeClassPrefix("state-");var e=c(g.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(m,o){var l;var E=m.data();var v=E.amsFormOptions;var n;var q;if(h){q=h.formDataInitCallback}if(q){delete h.formDataInitCallback}else{q=E.amsFormDataInitCallback}if(q){var w={};if(typeof(q)==="function"){n=q.call(m,w)}else{n=a.executeFunctionByName(q,m,w)}if(w.veto){l=m.data("ams-submit-button");if(l){l.button("reset")}a.form.finalizeSubmitFooter.call(m);return false}}else{n=E.amsFormData||{}}l=c(m.data("ams-submit-button"));var x,A;if(l){x=l.data("ams-form-handler");A=l.data("ams-form-submit-target")}var p;var t=f||x||E.amsFormHandler||"";if(t.startsWith(window.location.protocol)){p=t}else{var z=m.attr("action").replace(/#/,"");if(z.startsWith(window.location.protocol)){p=z}else{p=a.ajax.getAddr()+z}p+=t}var D=null;if(h&&h.initSubmitTarget){a.executeFunctionByName(h.initSubmitTarget)}else{if(E.amsFormInitSubmitTarget){D=c(A||E.amsFormSubmitTarget||"#content");a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmit",m,D)}else{if(!E.amsFormHideSubmitFooter){a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",m)}}}var r=typeof(o.uuid)!=="undefined";if(r){if(p.indexOf("X-Progress-ID")<0){p+="?X-Progress-ID="+o.uuid}delete o.uuid}if(h){n=c.extend({},n,h.form_data)}var u={url:p,type:"post",cache:false,data:n,dataType:E.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(G,F){F.data("submitted",true)},error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},iframe:r};var y=(h&&h.downloadTarget)||E.amsFormDownloadTarget;if(y){var s=c('iframe[name="'+y+'"]');if(!s.exists()){s=c("<iframe></iframe>").hide().attr("name",y).appendTo(m)}u=c.extend({},u,{iframe:true,iframeTarget:s,success:function(F,G,K,J){var I=c(J).parents(".modal-dialog");if(I.exists()){a.dialog.close(J)}else{var L;var H=J.data("ams-submit-button");if(H){L=H.data("ams-form-submit-callback")}if(!L){L=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}L.call(J,F,G,K,J);if(J.is(":visible")&&H){H.button("reset")}J.data("submitted",false);J.removeData("ams-submit-button");J.removeAttr("data-ams-form-changed")}}})}else{u=c.extend({},u,{error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},success:function(F,G,J,I){var K;var H=I.data("ams-submit-button");if(H){K=H.data("ams-form-submit-callback")}if(!K){K=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}K.call(I,F,G,J,I);if(I.is(":visible")&&H){H.button("reset")}I.data("submitted",false);I.removeData("ams-submit-button");I.removeAttr("data-ams-form-changed")},iframe:r})}var C=c.extend({},u,o,v,h);c(m).ajaxSubmit(C);if(y){var B=c(m).parents(".modal-dialog");if(B.exists()){a.dialog.close(m)}else{a.form.finalizeSubmitFooter.call(m);if(l){l.button("reset")}m.data("submitted",false);m.removeData("ams-submit-button");m.removeAttr("data-ams-form-changed")}}}var j=c('INPUT[type="file"]',g).length>0;if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(g)});k(g,i)}else{k(g,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=e.data("ams-form-submit-message")}if(f){h+="<strong>"+f+"</strong>"}c(g).html('<div class="row margin-20"><div class="text-center">'+h+"</div></div>");c(g).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+f+"</strong>"}var g=c("footer",e);c("button",g).hide();g.append('<div class="row"><div class="text-center">'+h+"</div></div>")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,g,f,e){var i;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);i=e.data("ams-submit-button");if(i){i.button("reset")}}var h=e.data();var l;if(h.amsFormDatatype){l=h.amsFormDatatype}else{var j=a.ajax.getResponse(f);l=j.content_type;o=j.data}var k;if(i){k=c(i.amsFormSubmitTarget||h.amsFormSubmitTarget||"#content")}else{k=c(h.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:if(i&&(i.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=f.getResponseHeader("X-AMS-Callback");if(m){var n=f.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),f)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k<i.length;k++){var f=i[k];var e=f[0];var l=f[1];var m=a.executeFunctionByName(l,g,e);if(m===false){n=false}else{if(typeof(m)==="string"){h.push(m)}else{if(n.length&&(n.length>0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,m){var i;if(typeof(m)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,m)}else{if(m instanceof Array){i=m.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,m)}else{c(".state-error",e).removeClass("state-error");i=m.error_header||(m.widgets&&(m.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var l;for(l=0;l<m.messages.length;l++){var f=m.messages[l];if(f.header){n.push("<strong>"+f.header+"</strong><br />"+f.message)}else{n.push(f.message||f)}}if(m.widgets){for(l=0;l<m.widgets.length;l++){var g=m.widgets[l];var j=c('[name="'+g.name+'"]',e);j.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+g.message+"</span>");if(g.label){n.push(g.label+" : "+g.message)}var k=j.parents(".tab-pane").index()+1;if(k>0){var h=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+k+")",h).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(e,m.error_level||"error",i,n,m.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>'}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(n,m,l){c("body").modalmanager("removeLoading");var o=a.ajax.getResponse(l);var t=o.content_type;var u=o.data;switch(t){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var p=c(u);var r=c(".modal-dialog",p.wrap("<div></div>").parent());var q=r.data();var s={overflow:q.amsModalOverflow||".modal-viewport",maxHeight:q.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",p).outerHeight(true)-c("footer",p).outerHeight(true)-85}:a.getFunctionByName(q.amsModalMaxHeight)};var k=c.extend({},s,q.amsModalOptions);k=a.executeFunctionByName(q.amsModalInitCallback,r,k)||k;c("<div>").addClass("modal fade").append(p).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(p)}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if(f.height()===j){c("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g<i.length;g++){i[g].call(k)}}i=a.dialog._shown_callbacks;if(i){for(g=0;g<i.length;g++){i[g].call(k)}}a.form.setFocus(k)},close:function(f){var g=f.parents(".modal").data("modal");if(g){var e=c("body").data("modalmanager");if(e&&(e.getOpenModals().indexOf(g)>=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f<g.length;f++){g[f].call(h)}}g=a.dialog._hide_callbacks;if(g){for(f=0;f<g.length;f++){g[f].call(h)}}}};d.helpers={select2ClearSelection:function(){var f=c(this);var e=f.parents("label");var g=f.data("ams-select2-target");c('[name="'+g+'"]',e).data("select2").val("")},select2FormatSelection:function(f,e){if(f instanceof Array){c(f).each(function(){if(typeof(this)==="object"){e.append(this.text)}else{e.append(this)}})}else{if(typeof(f)==="object"){e.append(f.text)}else{e.append(f)}}},select2QueryUrlResultsCallback:function(g,f,e){switch(g.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+g.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+f.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var e=i.data();if(e.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||e.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var g=a.getFunctionByName(f);if(typeof(g)==="function"){f=g.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(f){a.plugins.initData(f);var g=[];c("[data-ams-plugins-disabled]",f).each(function(){var i=c(this).data("ams-plugins-disabled").split(/\s+/);for(var j=0;j<i.length;j++){g.push(i[j])}});var h;c("[data-ams-plugins]",f).each(function(){var l=c(this);var i={};var k;if(typeof(l.data("ams-plugins"))==="string"){var n=l.data("ams-plugins").split(/\s+/);for(var j=0;j<n.length;j++){k=n[j];i[k]={src:l.data("ams-plugin-"+k+"-src"),css:l.data("ams-plugin-"+k+"-css"),callback:l.data("ams-plugin-"+k+"-callback"),register:l.data("ams-plugin-"+k+"-register"),async:l.data("ams-plugin-"+k+"-async")}}}else{i=l.data("ams-plugins")}function m(){var q=h.callback;if(q){var p=a.getFunctionByName(q);if(h.register!==false){a.plugins.enabled[k]=p}}else{if(h.register!==false){a.plugins.enabled[k]=null}}var o=h.css;if(o){a.getCSS(o,k+"_css")}}for(k in i){if(a.plugins.enabled[k]===undefined){h=i[k];a.getScript(h.src,m,{async:h.async===undefined?true:h.async})}}});for(var e in a.plugins.enabled){if(!a.plugins.enabled.hasOwnProperty(e)){continue}if(g.indexOf(e)>=0){continue}h=a.plugins.enabled[e];if(typeof(h)==="function"){h(f)}}},initData:function(e){c("[data-ams-data]",e).each(function(){var g=c(this);var h=g.data("ams-data");if(h){for(var f in h){if(h.hasOwnProperty(f)){g.attr("data-"+f,h[f])}}}})},register:function(f,e,h){if(typeof(e)==="function"){h=e;e=null}e=e||f.name;if(a.plugins.enabled.indexOf(e)>=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var k=c(this);var j=k.data();var h={html:j.amsHintHtml,title:a.getFunctionByName(j.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(j.amsHintTitleAttr||"title")||(j.amsHintHtml?l.html():l.text())},opacity:j.amsHintOpacity||0.95,gravity:j.amsHintGravity||"sw",offset:j.amsHintOffset||0};var g=c.extend({},h,j.amsHintOptions);g=a.executeFunctionByName(j.amsHintInitCallback,k,g)||g;var i=k.tipsy(g);a.executeFunctionByName(j.amsHintAfterInitCallback,k,i,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={menuSelector:j.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},h,j.amsContextmenuOptions);g=a.executeFunctionByName(j.amsContextmenuInitCallback,k,g)||g;var i=k.contextMenu(g);a.executeFunctionByName(j.amsContextmenuAfterInitCallback,k,i,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('<i class="fa fa-fw"></i>').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var q=c(this);var r=q.parent("fieldset");var h=q.data();if(!h.amsChecker){var f=c('<label class="checkbox"></label>');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var o=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('<input type="hidden">').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(q)}else{if(g){c('<input type="hidden">').attr("name",g).attr("value",1).prependTo(q)}}var p=c('<input type="checkbox">').attr("name",k).attr("id",o).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){p.attr("disabled","disabled")}else{p.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");q.trigger("ams.checker.before-switch",[q,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,q,v);if(!h.amsCheckerCancelDefault){var t=p.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");q.trigger("ams.checker.opened",[q])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");q.trigger("ams.checker.closed",[q])}}})}p.appendTo(f);c(">label",q).attr("for",p.attr("id"));f.append("<i></i>").prependTo(q);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){p.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}q.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider.min.js",function(){f.each(function(){var j=c(this);var k=j.data();var h={};var g=c.extend({},h,j.data.amsSliderOptions);g=a.executeFunctionByName(k.amsSliderInitCallback,j,g)||g;var i=j.slider(g);a.executeFunctionByName(k.amsSliderAfterInitCallback,j,i,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={containment:k.amsDraggableContainment,helper:a.getFunctionByName(k.amsDraggableHelper)||k.amsDraggableHelper,start:a.getFunctionByName(k.amsDraggableStart),stop:a.getFunctionByName(k.amsDraggableStop)};var h=c.extend({},i,k.amsDraggableOptions);h=a.executeFunctionByName(k.amsDraggableInitCallback,g,h)||h;var j=g.draggable(h);g.disableSelection();a.executeFunctionByName(k.amsDraggableAfterInitCallback,g,j,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={items:j.amsSortableItems,handle:j.amsSortableHandle,connectWith:j.amsSortableConnectwith,start:a.getFunctionByName(j.amsSortableStart),over:a.getFunctionByName(j.amsSortableOver),containment:j.amsSortableContainment,placeholder:j.amsSortablePlaceholder,stop:a.getFunctionByName(j.amsSortableStop)};var g=c.extend({},h,j.amsSortableOptions);g=a.executeFunctionByName(j.amsSortableInitCallback,k,g)||g;var i=k.sortable(g);k.disableSelection();a.executeFunctionByName(j.amsSortableAfterInitCallback,k,i,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={autoHide:k.amsResizableAutohide===false?true:k.amsResizableAutohide,containment:k.amsResizableContainment,grid:k.amsResizableGrid,handles:k.amsResizableHandles,start:a.getFunctionByName(k.amsResizableStart),stop:a.getFunctionByName(k.amsResizableStop)};var h=c.extend({},i,k.amsResizableOptions);h=a.executeFunctionByName(k.amsResizableInitCallback,g,h)||h;var j=g.resizable(h);g.disableSelection();a.executeFunctionByName(k.amsResizableAfterInitCallback,g,j,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={};var h=c.extend({},i,k.amsTypeaheadOptions);h=a.executeFunctionByName(k.amsTypeaheadInitCallback,g,h)||h;var j=g.typeahead(h);a.executeFunctionByName(k.amsTypeaheadAfterInitCallback,g,j,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var l=g.data();var j={placeholder:l.amsSelect2Placeholder,multiple:l.amsSelect2Multiple,minimumInputLength:l.amsSelect2MinimumInputLength||0,maximumSelectionSize:l.amsSelect2MaximumSelectionSize,openOnEnter:l.amsSelect2EnterOpen===undefined?true:l.amsSelect2EnterOpen,allowClear:l.amsSelect2AllowClear===undefined?true:l.amsSelect2AllowClear,width:l.amsSelect2Width||"100%",initSelection:a.getFunctionByName(l.amsSelect2InitSelection),formatSelection:l.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(l.amsSelect2FormatSelection),formatResult:a.getFunctionByName(l.amsSelect2FormatResult),formatMatches:l.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(l.amsSelect2FormatMatches),formatNoMatches:l.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(l.amsSelect2FormatResult),formatInputTooShort:l.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooShort),formatInputTooLong:l.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooLong),formatSelectionTooBig:l.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatSelectionTooBig),formatLoadMore:l.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(l.amsSelect2FormatLoadMore),formatSearching:l.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(l.amsSelect2FormatSearching),separator:l.amsSelect2Separator||",",tokenSeparators:l.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(l.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!j.initSelection){var h=g.data("ams-select2-values");if(h){j.initSelection=function(m,o){var n=[];c(m.val().split(j.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){j.query=function(){return[]}}}else{if(l.amsSelect2Query){j.query=a.getFunctionByName(l.amsSelect2Query);j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryUrl){j.ajax={url:l.amsSelect2QueryUrl,quietMillis:l.amsSelect2QuietMillis||200,type:l.amsSelect2QueryType||"POST",dataType:l.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[l.amsSelect2QueryParamName||"query"]=o;m[l.amsSelect2PageParamName||"page"]=p;m[l.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,l.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryMethod){j.query=function(m){var n={url:l.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:l.amsSelect2MethodType||"POST",cache:false,method:l.amsSelect2QueryMethod,params:l.amsSelect2QueryParams||{},success:function(p,o){return a.helpers.select2QueryMethodSuccessCallback.call(g,p,o,m)},error:a.error.show};n.params[l.amsSelect2QueryParamName||"query"]=m.term;n.params[l.amsSelect2PageParamName||"page"]=m.page;n.params[l.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,l.amsSelect2QueryOptions);n=a.executeFunctionByName(l.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){c.jsonRpc(n)})};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2Tags){j.tags=l.amsSelect2Tags}else{if(l.amsSelect2Data){j.data=l.amsSelect2Data}}}}}}if(l.amsSelect2EnableFreeTags){j.createSearchChoice=function(m){return{id:m,text:(l.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},j,l.amsSelect2Options);i=a.executeFunctionByName(l.amsSelect2InitCallback,g,i)||i;var k=g.select2(i);a.executeFunctionByName(l.amsSelect2AfterInitCallback,g,k,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.3.1.min.js",function(){e.each(function(){var g=c(this);var k=g.data();var i={placeholder:k.amsMaskeditPlaceholder||"X"};var h=c.extend({},i,k.amsMaskeditOptions);h=a.executeFunctionByName(k.amsMaskeditInitCallback,g,h)||h;var j=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(k.amsMaskeditAfterInitCallback,g,j,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var l=h.data();var j={position:l.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},j,l.amsColorpickerOptions);i=a.executeFunctionByName(l.amsColorpickerInitCallback,h,i)||i;var k=h.minicolors(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var m=c(this);var n=m.data();var k={ignore:null,submitHandler:m.attr("data-async")!==undefined?n.amsFormSubmitHandler===undefined?function(){c(".state-error",m).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(m)}:a.getFunctionByName(n.amsFormSubmitHandler):undefined,invalidHandler:m.attr("data-async")!==undefined?n.amsFormInvalidHandler===undefined?function(s,r){c(".state-error",m).removeClass("state-error");for(var p=0;p<r.errorList.length;p++){var o=r.errorList[p];var q=c(o.element).parents(".tab-pane").index()+1;if(q>0){var t=c(".nav-tabs",c(o.element).parents(".tabforms"));c("li:nth-child("+q+")",t).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",t).click()}}}:a.getFunctionByName(n.amsFormInvalidHandler):undefined};var j=c.extend({},k,n.amsValidateOptions);j=a.executeFunctionByName(n.amsValidateInitCallback,m,j)||j;var l=m.validate(j);a.executeFunctionByName(n.amsValidateAfterInitCallback,m,l,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var H=D.data();var F=(H.amsDatatableExtensions||"").split(/\s+/);var m=H.amsDatatableSdom||"W"+((F.indexOf("colreorder")>=0||F.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(F.indexOf("colvis")>=0?"C":"")+((H.amsDatatablePagination===false||H.amsDatatablePaginationSize===false)?"":"L")+(H.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(F.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(H.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var p;var i=H.amsDatatableSorting;if(typeof(i)==="string"){var G=i.split(";");i=[];for(p=0;p<G.length;p++){var x=G[p].split(",");x[0]=parseInt(x[0]);i.push(x)}}var h=[];var t=c("th",D).listattr("data-ams-datatable-stype");for(p=0;p<t.length;p++){var s=t[p];if(s){var j=h[p]||{};j.sType=s;h[p]=j}}var z={bJQueryUI:false,bFilter:H.amsDatatableGlobalFilter!==false,bPaginate:H.amsDatatablePagination!==false,bInfo:H.amsDatatableInfo!==false,bSort:H.amsDatatableSort!==false,aaSorting:i,aoColumns:h.length>0?h:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:H.amsDatatableDisplayLength||25,sPaginationType:H.amsDatatablePaginationType||"bootstrap_full",sDom:m,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(K,J){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}};var E=c.extend({},z,H.amsDatatableOptions);if(F.length>0){for(p=0;p<F.length;p++){switch(F[p]){case"autofill":a.ajax.check(c.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+a.devext+".js");break;case"columnfilter":a.ajax.check(c.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+a.devext+".js");break;case"colreorder":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+a.devext+".js");break;case"colreorderwithresize":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+a.devext+".js");break;case"colvis":a.ajax.check(c.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+a.devext+".js");var u={activate:"click",sAlign:"right"};E.oColVis=c.extend({},u,H.amsDatatableColvisOptions);break;case"editable":a.ajax.check(c.fn.editable,a.baseURL+"ext/jquery-jeditable"+a.devext+".js");a.ajax.check(c.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+a.devext+".js");break;case"fixedcolumns":a.ajax.check(c.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+a.devext+".js");break;case"fixedheader":a.ajax.check(c.fn.dataTable.FixedHeader,a.baseURL+"ext/jquery-dataTables-fixedHeader"+a.devext+".js");break;case"keytable":a.ajax.check(window.KeyTable,a.baseURL+"ext/jquery-dataTables-keyTable"+a.devext+".js");break;case"rowgrouping":a.ajax.check(c.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+a.devext+".js");break;case"rowreordering":a.ajax.check(c.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+a.devext+".js");break;case"scroller":a.ajax.check(c.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+a.devext+".js");break;default:break}}}E=a.executeFunctionByName(H.amsDatatableInitCallback,D,E)||E;try{var l=D.dataTable(E);a.executeFunctionByName(H.amsDatatableAfterInitCallback,D,l,E);if(F.length>0){for(p=0;p<F.length;p++){switch(F[p]){case"autofill":var I=c.extend({},H.amsDatatableAutofillOptions,E.autofill);I=a.executeFunctionByName(H.amsDatatableAutofillInitCallback,D,I)||I;D.data("ams-autofill",H.amsDatatableAutofillConstructor===undefined?new c.fn.dataTable.AutoFill(D,I):a.executeFunctionByName(H.amsDatatableAutofillConstructor,D,l,I));break;case"columnfilter":var o={sPlaceHolder:"head:after"};var q=c.extend({},o,H.amsDatatableColumnfilterOptions,E.columnfilter);q=a.executeFunctionByName(H.amsDatatableColumnfilterInitCallback,D,q)||q;D.data("ams-columnfilter",H.amsDatatableColumnfilterConstructor===undefined?l.columnFilter(q):a.executeFunctionByName(H.amsDatatableColumnfilterConstructor,D,l,q));break;case"editable":var r=c.extend({},H.amsDatatableEditableOptions,E.editable);r=a.executeFunctionByName(H.amsDatatableEditableInitCallback,D,r)||r;D.data("ams-editable",H.amsDatatableEditableConstructor===undefined?D.makeEditable(r):a.executeFunctionByName(H.amsDatatableEditableConstructor,D,l,r));break;case"fixedcolumns":var k=c.extend({},H.amsDatatableFixedcolumnsOptions,E.fixedcolumns);k=a.executeFunctionByName(H.amsDatatableFixedcolumnsInitCallback,D,k)||k;D.data("ams-fixedcolumns",H.amsDatatableFixedcolumnsConstructor===undefined?new c.fn.dataTable.FixedColumns(D,k):a.executeFunctionByName(H.amsDatatableFixedcolumnsConstructor,D,l,k));break;case"fixedheader":var A=c.extend({},H.amsDatatableFixedheaderOptions,E.fixedheader);A=a.executeFunctionByName(H.amsDatatableFixedheadeInitCallback,D,A)||A;D.data("ams-fixedheader",H.amsDatatableFixedheaderConstructor===undefined?new c.fn.dataTable.FixedHeader(D,A):a.executeFunctionByName(H.amsDatatableFixedheaderConstructor,D,l,A));break;case"keytable":var n={table:D.get(0),datatable:l};var y=c.extend({},n,H.amsDatatableKeytableOptions,E.keytable);y=a.executeFunctionByName(H.amsDatatableKeytableInitCallback,D,y)||y;D.data("ams-keytable",H.amsDatatableKeytableConstructor===undefined?new KeyTable(y):a.executeFunctionByName(H.amsDatatableKeytableConstructor,D,l,y));break;case"rowgrouping":var w=c.extend({},H.amsDatatableRowgroupingOptions,E.rowgrouping);w=a.executeFunctionByName(H.amsDatatableRowgroupingInitCallback,D,w)||w;D.data("ams-rowgrouping",H.amsDatatableRowgroupingConstructor===undefined?D.rowGrouping(w):a.executeFunctionByName(H.amsDatatableRowgroupingConstructor,D,l,w));break;case"rowreordering":var v=c.extend({},H.amsDatatableRowreorderingOptions,E.rowreordering);v=a.executeFunctionByName(H.amsDatatableRowreorderingInitCallback,D,v)||v;D.data("ams-rowreordering",H.amsDatatableRowreorderingConstructor===undefined?D.rowReordering(v):a.executeFunctionByName(H.amsDatatableRowreorderingConstructor,D,l,v));break;default:break}}}var B=(H.amsDatatableFinalizeCallback||"").split(/\s+/);if(B.length>0){for(p=0;p<B.length;p++){a.executeFunctionByName(B[p],D,l,E)}}}catch(C){}})})}},tablednd:function(f){var e=c(".table-dnd",f);if(e.length>0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var k=c(this);c(k).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")});var l=k.data();var i={onDragClass:l.amsTabledndDragClass||"dragging-row",onDragStart:l.amsTabledndDragStart,dragHandle:l.amsTabledndDragHandle,scrollAmount:l.amsTabledndScrollAmount,onAllowDrop:l.amsTabledndAllowDrop,onDrop:l.amsTabledndDrop||function(o,q){var n=l.amsTabledndDropTarget;if(n){var m=[];c(o.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var p=a.getFunctionByName(n);if(typeof(p)==="function"){p.call(k,o,m)}else{a.ajax.post(n,{names:JSON.stringify(m)})}}return false}};var h=c.extend({},i,l.amsTabledndOptions);h=a.executeFunctionByName(l.amsTabledndInitCallback,k,h)||h;var j=k.tableDnD(h);a.executeFunctionByName(l.amsTabledndAfterInitCallback,k,j,h)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.10"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var m=c(this);var l=m.data();var j=l.amsImgareaselectParent?m.parents(l.amsImgareaselectParent):"body";var i={instance:true,handles:true,parent:j,x1:l.amsImgareaselectX1||0,y1:l.amsImgareaselectY1||0,x2:l.amsImgareaselectX2||l.amsImgareaselectImageWidth,y2:l.amsImgareaselectY2||l.amsImgareaselectImageHeight,imageWidth:l.amsImgareaselectImageWidth,imageHeight:l.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:l.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(l.amsImgareaselectSelectEnd)||function(n,o){var p=l.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',j).val(o.x1);c('input[name="'+p+'y1"]',j).val(o.y1);c('input[name="'+p+'x2"]',j).val(o.x2);c('input[name="'+p+'y2"]',j).val(o.y2)}};var h=c.extend({},i,l.amsImgareaselectOptions);h=a.executeFunctionByName(l.amsImgareaselectInitCallback,m,h)||h;var k=m.imgAreaSelect(h);a.executeFunctionByName(l.amsImgareaselectAfterInitCallback,m,k,h);setTimeout(function(){k.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var o=h.data();var n=(o.amsFancyboxHelpers||"").split(/\s+/);if(n.length>0){for(var i=0;i<n.length;i++){var m=n[i];switch(m){case"buttons":a.ajax.check(c.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons"+a.devext+".js");break;case"thumbs":a.ajax.check(c.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+a.devext+".js");break;case"media":a.ajax.check(c.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media"+a.devext+".js");break;default:break}}}var k={type:o.amsFancyboxType,padding:o.amsFancyboxPadding||10,margin:o.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(o.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(o.amsFancyboxTitleGetter,this)||c(this.element).attr("original-title")||c(this.element).attr("title")},helpers:{title:{type:"inside"}}};var j=c.extend({},k,o.amsFancyboxOptions);j=a.executeFunctionByName(o.amsFancyboxInitCallback,h,j)||j;var l=h.fancybox(j);a.executeFunctionByName(o.amsFancyboxAfterInitCallback,h,l,j)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var k=l.data();var i={theme:k.amsScrollbarTheme||"light"};var h=c.extend({},i,k.amsScrollbarOptions);h=a.executeFunctionByName(k.amsScrollbarInitCallback,l,h)||h;var j=l.mCustomScrollbar(h);a.executeFunctionByName(k.amsScrollbarAfterInitCallback,l,j,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsMessageboxOptions);var g=c.extend({},h,{title:i.amsMessageboxTitle||h.title||"",content:i.amsMessageboxContent||h.content||"",icon:i.amsMessageboxIcon||h.icon,number:i.amsMessageboxNumber||h.number,timeout:i.amsMessageboxTimeout||h.timeout});var e=i.amsMessageboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsMessageboxCallback||h.callback);a.skin.messageBox(e,g,j)},smallBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsSmallboxOptions);var g=c.extend({},h,{title:i.amsSmallboxTitle||h.title||"",content:i.amsSmallboxContent||h.content||"",icon:i.amsSmallboxIcon||h.icon,iconSmall:i.amsSmallboxIconSmall||h.iconSmall,timeout:i.amsSmallboxTimeout||h.timeout});var e=i.amsSmallboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsSmallboxCallback||h.callback);a.skin.smallBox(e,g,j)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var k=f.parents("table");var h=k.data("ams-location")||"";var l=f.parents("tr");var j=l.data("ams-delete-target")||k.data("ams-delete-target")||"delete-element.json";var g=l.data("ams-element-name");d.ajax.post(h+"/"+j,{object_name:g},function(m,n){if(m.status==="success"){if(k.hasClass("datatable")){k.dataTable().fnDeleteRow(l[0])}else{l.remove()}}})}})}}};d.skin={_setPageHeight:function(){var g=c("#main").height();var e=a.left_panel.height();var f=c(window).height()-a.navbar_height;if(g>f){a.left_panel.css("min-height",g);a.root.css("min-height",g+a.navbar_height)}else{a.left_panel.css("min-height",f);a.root.css("min-height",f)}},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c("#activity > .badge");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(e){if(a.enable_widgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var j=c(this);var i=j.data();var h={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},h,i.amsWidgetOptions);g=a.executeFunctionByName(i.amsWidgetInitcallback,j,g)||g;j.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){c(".alert",l).remove();if(f==="error"){f="danger"}var i='<div class="'+(e?"margin-10":"")+" alert alert-block alert-"+f+' fade in"><a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a><h4 class="alert-heading"><i class="fa fa-fw fa-warning"></i> '+g+"</h4>"+(k?("<p>"+k+"</p>"):"");if(typeof(m)==="string"){i+="<ul><li>"+m+"</li></ul>"}else{if(m){i+="<ul>";for(var h in m){if(!c.isNumeric(h)){continue}i+="<li>"+m[h]+"</li>"}i+="</ul>"}}i+="</div>";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("#ribbon OL.breadcrumb");e.empty().append(c("<li></li>").append(c("<a></a>").text(a.i18n.HOME).attr("href",c('nav a[href!="#"]:first').attr("href"))));c("nav LI.active >A").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("<li></li>").append(h.attr("href").replace(/^#/,"")?c("<a></a>").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(k){c("nav .active").removeClass("active");k.addClass("open").addClass("active");k.parents("li").addClass("open active").children("ul").addClass("active").show();k.parents("li:first").removeClass("open");k.parents("ul").addClass(k.attr("href").replace(/^#/,"")?"active":"").show()}var i;var h=location.hash;var g=h.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}i=c('nav A[href="'+h+'"]');if(i.exists()){e(i)}a.skin.loadURL(g,f);document.title=c("[data-ams-page-title]:first",f).data("ams-page-title")||i.attr("title")||document.title}else{var j=c("[data-ams-active-menu]").data("ams-active-menu");if(j){i=c('nav A[href="'+j+'"]')}else{i=c('nav >UL >LI >A[href!="#"]').first()}if(i.exists()){e(i);if(j){a.skin._drawBreadCrumb()}else{window.location.hash=i.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f<g.length;f++){g[f].call(e)}},loadURL:function(g,e,f,j){if(g.startsWith("#")){g=g.substr(1)}if(typeof(f)==="function"){j=f;f={}}e=c(e);var i={type:"GET",url:g,dataType:"html",cache:false,beforeSend:function(){a.skin.cleanContainer(e);e.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> Loading... </h1>');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();document.title=c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(o,l,n){if(j){a.executeFunctionByName(j,this,o,l,n,f)}else{var m=a.ajax.getResponse(n);var p=m.content_type;var k=m.data;c(".loading",e).remove();switch(p){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(o).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}}},error:function(m,l,k){e.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+a.i18n.ERROR+k+"</h3>"+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.left_panel=c("#left-panel");a.shortcuts=c("#shortcut");a.plugins.initData(e);var f=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var h=f();if(h&&(typeof(h.addEventListener)==="function")){var g=this;h.addEventListener("progress",function(i){g.progress(i)},false)}return h}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("#hide-menu A").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(g){e.toggleClass("hidden-menu");g.preventDefault()});c("#show-shortcut").click(function(g){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}g.preventDefault()});a.shortcuts.click(function(g){a.skin._hideShortcutButtons()});c(document).mouseup(function(g){if(!a.shortcuts.is(g.target)&&a.shortcuts.has(g.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c("#activity").click(function(h){var g=c(this);var i=g.next(".ajax-dropdown");if(!i.is(":visible")){i.css("left",g.position().left-i.innerWidth()/2+g.innerWidth()/2).fadeIn(150);g.addClass("active")}else{i.fadeOut(150);g.removeClass("active")}h.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(g){var h=c(".ajax-dropdown");if(!h.is(g.target)&&h.has(g.target).length===0){h.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(){var h=c(this).data("ams-url");var g=c(".ajax-notifications");a.skin.loadURL(h,g)});c("#logout a").click(function(g){g.preventDefault();g.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+a.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+c("#show-shortcut").text()+"</strong></span> ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(h){if(h===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});c("NAV UL").myams_menu({accordion:true,speed:a.menu_speed});c(".minifyme").click(function(g){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);g.preventDefault()});c("#refresh").click(function(g){a.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(h){if(h===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});g.preventDefault()});e.on("click",function(h){var g=c(this);if(!g.is(h.target)&&g.has(h.target).length===0&&c(".popover").has(h.target).length===0){g.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});c("nav").resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){c(document).on("click",'a[href="#"]',function(g){g.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(k){var i=c(k.currentTarget);var g=i.attr("href")||i.data("ams-url");if(!g||g.startsWith("javascript")||i.attr("target")||(i.data("ams-context-menu")===true)){return}k.preventDefault();k.stopPropagation();var h=a.getFunctionByName(g);if(typeof(h)==="function"){g=h.call(i)}if(typeof(g)==="function"){g.call(i)}else{g=g.replace(/\%23/,"#");var j=i.data("ams-target");if(j){a.form.confirmChangedForm(j,function(){a.skin.loadURL(g,j,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(g.startsWith("#")){if(g!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=g},50)}else{window.location.hash=g}}}else{window.location=g}})}}});c(document).on("click",'a[target="_blank"]',function(g){g.preventDefault();window.open(c(g.currentTarget).attr("href"))});c(document).on("click",'a[target="_top"]',function(g){g.preventDefault();a.form.confirmChangedForm(function(){window.location=c(g.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(h){var g=c(this);if(g.data("ams-context-menu")===true){return}if(g.data("ams-stop-propagation")===true){h.stopPropagation()}h.preventDefault();a.dialog.open(g);if(g.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var g=c(this);c(g.get(0).form).data("ams-submit-button",g)});c(document).on("click","[data-ams-click-handler]",function(i){var h=c(this);var g=h.data();if(g.amsClickHandler){if((g.amsStopPropagation===true)||(g.amsClickStopPropagation===true)){i.stopPropagation()}if(g.amsClickKeepDefault!==true){i.preventDefault()}var j=a.getFunctionByName(g.amsClickHandler);if(j!==undefined){j.call(h,g.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(i){var h=c(this);var g=h.data();if(g.amsChangeHandler){if(g.amsChangeKeepDefault!==true){i.preventDefault()}var j=a.getFunctionByName(g.amsChangeHandler);if(j!==undefined){j.call(h,g.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(h){var g=c(this);setTimeout(function(){g.find(".select2").trigger("change")},10);a.form.setFocus(g)});c(document).on("reset","[data-ams-reset-handler]",function(i){var g=c(this);var h=g.data();if(h.amsResetHandler){if(h.amsResetKeepDefault!==true){i.preventDefault()}var j=a.getFunctionByName(h.amsResetHandler);if(j!==undefined){j.call(g,h.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(i){i.preventDefault();var g=c(this);var h=g.parent(".button");if(h.exists()&&h.parent().hasClass("input-file")){h.next('input[type="text"]').val(g.val())}});c(document).on("focusin",function(g){if(c(g.target).closest(".mce-window").length){g.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(g){if(c(this).parent("li").hasClass("disabled")){g.preventDefault();return false}});c(document).on("show.bs.tab",function(i){var g=c(i.target);var h=g.data();if(h.amsUrl){if(h.amsTabLoaded){return}try{g.append('<i class="fa fa-spin fa-cog margin-left-5"></i>');a.skin.loadURL(h.amsUrl,g.attr("href"));if(h.amsTabLoadOnce){g.data("ams-tab-loaded",true)}}finally{c("i",g).remove()}}});a.initContent(document);if(a.ajax_nav&&c("nav").exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this);
\ No newline at end of file
+(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(0,f)===g)};String.prototype.endsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(e-f)===g)};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(f,g){var e=this.length;g=Number(g)||0;g=(g<0)?Math.ceil(g):Math.floor(g);if(g<0){g+=e}for(;g<e;g++){if(g in this&&this[g]===f){return g}}return -1}}c.expr[":"].econtains=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"").toLowerCase()===f[3].toLowerCase()};c.expr[":"].withtext=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"")===f[3]};c.expr[":"].parents=function(g,e,f){return c(g).parents(f[3]).length>0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l<i){g-=l}return g}return this.each(function(){c("a",c(f.menuSelector)).each(function(){c(this).data("ams-context-menu",true)});c(this).on("contextmenu",function(g){if(g.ctrlKey){return}c(f.menuSelector).data("invokedOn",c(g.target)).show().css({position:"fixed",left:e(g.clientX,"width","scrollLeft")-10,top:e(g.clientY,"height","scrollTop")-10}).off("click").on("click",function(i){c(this).hide();var h=c(this).data("invokedOn");var j=c(i.target);f.menuSelected.call(this,h,j);a.event.stop(i)});return false});c(document).click(function(){c(f.menuSelector).hide()})})},myams_menu:function(e){var g={accordion:true,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append("<b class='collapse-sign'>"+f.closedSign+"</b>");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var l=c(this);var i=l.parent().find("UL");if(f.accordion){var k=l.parent().parents("UL");var m=h.find("UL:visible");m.each(function(n){var o=true;k.each(function(p){if(k[p]===m[n]){o=false;return false}});if(o){if(i!==m[n]){c(m[n]).slideUp(f.speed,function(){l.parent("LI").find("b:first").html(f.closedSign);l.parent("LI").removeClass("open")})}}})}var j=l.parent().find("UL:first");if(!l.attr("href").replace(/^#/,"")&&j.is(":visible")&&!j.hasClass("active")){j.slideUp(f.speed,function(){l.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{j.slideDown(f.speed,function(){l.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h<f.length;h++){var g=f.charCodeAt(h);if(g<128){e+=String.fromCharCode(g)}else{if((g>127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j<e.length){k=e.charCodeAt(j);if(k<128){g+=String.fromCharCode(k);j++}else{if((k>191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f<j.length;f++){try{g=g[j[f]]}catch(l){return undefined}}try{return g[h]}catch(l){return undefined}};d.executeFunctionByName=function(h,f){var g=a.getFunctionByName(h,window);if(typeof(g)==="function"){var e=Array.prototype.slice.call(arguments,2);return g.apply(f,e)}};d.getSource=function(e){return e.replace(/{[^{}]*}/g,function(f){return a.getFunctionByName(f.substr(1,f.length-2))})};d.getScript=function(f,i,e){var h={dataType:"script",url:a.getSource(f),success:i,error:a.error.show,cache:!a.devmode,async:typeof(i)==="function"};var g=c.extend({},h,e);return c.ajax(g)};d.getCSS=function(e,i){var g=c("HEAD");var f=c('link[data-ams-id="'+i+'"]',g);if(f.length===0){var h=a.getSource(e);if(a.devmode){h+="?_="+new Date().getTime()}c("<link />").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(h,g){if(g.statusText==="OK"){return}var e=a.ajax.getResponse(g);if(e.content_type==="json"){a.ajax.handleJSON(e.data)}else{var i=h.statusText||h.type;var f=g.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+i+"</h4><p>"+f+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(h);b.console.debug(g)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.content_type==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"<h4>"+e+"</h4><p>"+g+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result},error:a.error.show};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var g=h.getResponseHeader("content-type"),j,f;if(g){if(g.startsWith("application/javascript")){j="script";f=h.responseText}else{if(g.startsWith("text/html")){j="html";f=h.responseText}else{if(g.startsWith("text/xml")){j="xml";f=h.responseText}else{f=h.responseJSON;if(f){j="json"}else{try{f=JSON.parse(h.responseText);j="json"}catch(i){f=h.responseText;j="text"}}}}}}else{j="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:j,data:f}},handleJSON:function(p,g,l){var j=p.status;var e;switch(j){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||l||"#content");break;case"redirect":if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+j)}}var k;var m;var f;if(p.content){m=p.content;f=c(m.target||l||g||"#content");if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}if(p.contents){var i=p.contents;for(k=0;k<i.length;k++){m=i[k];f=c(m.target);if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}}var o;if(p.message){o=p.message;if(typeof(o)==="string"){if((j==="info")||(j==="success")){a.skin.smallBox(j,{title:o,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(c(g||"#content"),j,o)}}else{a.skin.alert(c(o.target||l||g||"#content"),o.status||"success",o.header,o.body,o.subtitle)}}if(p.smallbox){a.skin.smallBox(p.smallbox_status||j,{title:p.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(p.messagebox){o=p.messagebox;if(typeof(o)==="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:o,timeout:10000})}else{var h=o.status||"info";if(h==="error"&&g&&l){a.executeFunctionByName(g.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",g,l)}a.skin.messageBox(h,{title:o.title||a.i18n.ERROR_OCCURED,content:o.content,icon:o.icon,number:o.number,timeout:o.timeout===null?undefined:(o.timeout||10000)})}}if(p.event){g.trigger(p.event,p.event_options)}if(p.callback){a.executeFunctionByName(p.callback,g,p.options)}if(p.callbacks){var n;for(k=0;k<p.callbacks.length;k++){n=p.callbacks[k];a.executeFunctionByName(n,g,n.options)}}}};d.jsonrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},query:function(f,h,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(g==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var k={};if(typeof(f)==="string"){k.query=f}else{if(typeof(f)==="object"){c.extend(k,f)}}c.extend(k,e);var i;var j={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:k,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};c.jsonRpc(j);return i})},post:function(h,f,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(typeof(g)==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var i;var k={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:f,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};var j=c.extend({},k,e);c.jsonRpc(j);return i})}};d.xmlrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},post:function(f,i,g,e,h){a.ajax.check(c.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+a.devext+".js",function(){if(typeof(e)==="function"){h=e;e={}}else{if(!e){e={}}}if(typeof(h)==="undefined"){h=e.callback}if(typeof(h)==="string"){h=a.getFunctionByName(h)}delete e.callback;var j;var l={url:a.xmlrpc.getAddr(f),methodName:i,params:g,success:h||function(m){j=m},error:a.error.show};var k=c.extend({},l,e);c.xmlrpc(k);return j})}};d.form={init:function(f){var e;if(a.warn_on_form_change){e=c('FORM[data-ams-warn-on-change!="false"]',f)}else{e=c('FORM[data-ams-warn-on-change="true"]',f)}e.each(function(){var g=c(this);c('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',g).each(function(){var i=c(this);if(i.data("ams-ignore-change")!==true){var h=i.data("ams-changed-event")||"change";i.on(h,function(){c(this).parents("FORM").attr("data-ams-form-changed",true)})}});g.on("reset",function(){c(this).removeAttr("data-ams-form-changed")})})},setFocus:function(e){var f=c("[data-ams-focus-target]",e).first();if(!f.exists()){f=c("input, select",e).first()}if(f.exists()){if(f.hasClass("select2")){setTimeout(function(){f.select2("focus");f.select2("open")},100)}else{f.focus()}}},checkBeforeUnload:function(){var e=c('FORM[data-ams-form-changed="true"]');if(e.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(f,g){if(typeof(f)==="function"){g=f;f=undefined}var e=c('FORM[data-ams-form-changed="true"]',f);if(e.exists()){a.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(h){if(h===a.i18n.BTN_OK){g.call(f)}})}else{g.call(f)}},submit:function(g,f,h){g=c(g);if(!g.exists()){return false}if(typeof(f)==="object"){h=f;f=undefined}if(g.data("submitted")){if(!g.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:g.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(g)){return false}c(".alert-danger, SPAN.state-error",g).remove();c(".state-error",g).removeClassPrefix("state-");var e=c(g.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(m,o){var l;var E=m.data();var v=E.amsFormOptions;var n;var q;if(h){q=h.formDataInitCallback}if(q){delete h.formDataInitCallback}else{q=E.amsFormDataInitCallback}if(q){var w={};if(typeof(q)==="function"){n=q.call(m,w)}else{n=a.executeFunctionByName(q,m,w)}if(w.veto){l=m.data("ams-submit-button");if(l){l.button("reset")}a.form.finalizeSubmitFooter.call(m);return false}}else{n=E.amsFormData||{}}l=c(m.data("ams-submit-button"));var x,A;if(l){x=l.data("ams-form-handler");A=l.data("ams-form-submit-target")}var p;var t=f||x||E.amsFormHandler||"";if(t.startsWith(window.location.protocol)){p=t}else{var z=m.attr("action").replace(/#/,"");if(z.startsWith(window.location.protocol)){p=z}else{p=a.ajax.getAddr()+z}p+=t}var D=null;if(h&&h.initSubmitTarget){a.executeFunctionByName(h.initSubmitTarget)}else{if(E.amsFormInitSubmitTarget){D=c(A||E.amsFormSubmitTarget||"#content");a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmit",m,D)}else{if(!E.amsFormHideSubmitFooter){a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",m)}}}var r=typeof(o.uuid)!=="undefined";if(r){if(p.indexOf("X-Progress-ID")<0){p+="?X-Progress-ID="+o.uuid}delete o.uuid}if(h){n=c.extend({},n,h.form_data)}var u={url:p,type:"post",cache:false,data:n,dataType:E.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(G,F){F.data("submitted",true)},error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},iframe:r};var y=(h&&h.downloadTarget)||E.amsFormDownloadTarget;if(y){var s=c('iframe[name="'+y+'"]');if(!s.exists()){s=c("<iframe></iframe>").hide().attr("name",y).appendTo(m)}u=c.extend({},u,{iframe:true,iframeTarget:s,success:function(F,G,K,J){var I=c(J).parents(".modal-dialog");if(I.exists()){a.dialog.close(J)}else{var L;var H=J.data("ams-submit-button");if(H){L=H.data("ams-form-submit-callback")}if(!L){L=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}L.call(J,F,G,K,J);if(J.is(":visible")&&H){H.button("reset")}J.data("submitted",false);J.removeData("ams-submit-button");J.removeAttr("data-ams-form-changed")}}})}else{u=c.extend({},u,{error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},success:function(F,G,J,I){var K;var H=I.data("ams-submit-button");if(H){K=H.data("ams-form-submit-callback")}if(!K){K=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}K.call(I,F,G,J,I);if(I.is(":visible")&&H){H.button("reset")}I.data("submitted",false);I.removeData("ams-submit-button");I.removeAttr("data-ams-form-changed")},iframe:r})}var C=c.extend({},u,o,v,h);c(m).ajaxSubmit(C);if(y){var B=c(m).parents(".modal-dialog");if(B.exists()){a.dialog.close(m)}else{a.form.finalizeSubmitFooter.call(m);if(l){l.button("reset")}m.data("submitted",false);m.removeData("ams-submit-button");m.removeAttr("data-ams-form-changed")}}}var j=c('INPUT[type="file"]',g).length>0;if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(g)});k(g,i)}else{k(g,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=e.data("ams-form-submit-message")}if(f){h+="<strong>"+f+"</strong>"}c(g).html('<div class="row margin-20"><div class="text-center">'+h+"</div></div>");c(g).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+f+"</strong>"}var g=c("footer",e);c("button",g).hide();g.append('<div class="row"><div class="text-center">'+h+"</div></div>")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,g,f,e){var i;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);i=e.data("ams-submit-button");if(i){i.button("reset")}}var h=e.data();var l;if(h.amsFormDatatype){l=h.amsFormDatatype}else{var j=a.ajax.getResponse(f);l=j.content_type;o=j.data}var k;if(i){k=c(i.data("ams-form-submit-target")||h.amsFormSubmitTarget||"#content")}else{k=c(h.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:if(i&&(i.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=f.getResponseHeader("X-AMS-Callback");if(m){var n=f.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),f)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k<i.length;k++){var f=i[k];var e=f[0];var l=f[1];var m=a.executeFunctionByName(l,g,e);if(m===false){n=false}else{if(typeof(m)==="string"){h.push(m)}else{if(n.length&&(n.length>0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,m){var i;if(typeof(m)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,m)}else{if(m instanceof Array){i=m.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,m)}else{c(".state-error",e).removeClass("state-error");i=m.error_header||(m.widgets&&(m.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var l;if(m.messages){for(l=0;l<m.messages.length;l++){var f=m.messages[l];if(f.header){n.push("<strong>"+f.header+"</strong><br />"+f.message)}else{n.push(f.message||f)}}}if(m.widgets){for(l=0;l<m.widgets.length;l++){var g=m.widgets[l];var j=c('[name="'+g.name+'"]',e);j.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+g.message+"</span>");if(g.label){n.push(g.label+" : "+g.message)}var k=j.parents(".tab-pane").index()+1;if(k>0){var h=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+k+")",h).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(e,m.error_level||"error",i,n,m.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>'}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(n,m,l){c("body").modalmanager("removeLoading");var o=a.ajax.getResponse(l);var t=o.content_type;var u=o.data;switch(t){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var p=c(u);var r=c(".modal-dialog",p.wrap("<div></div>").parent());var q=r.data();var s={overflow:q.amsModalOverflow||".modal-viewport",maxHeight:q.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",p).outerHeight(true)-c("footer",p).outerHeight(true)-85}:a.getFunctionByName(q.amsModalMaxHeight)};var k=c.extend({},s,q.amsModalOptions);k=a.executeFunctionByName(q.amsModalInitCallback,r,k)||k;c("<div>").addClass("modal fade").append(p).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(p)}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if(f.height()===j){c("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g<i.length;g++){i[g].call(k)}}i=a.dialog._shown_callbacks;if(i){for(g=0;g<i.length;g++){i[g].call(k)}}a.form.setFocus(k)},close:function(f){var g=f.parents(".modal").data("modal");if(g){var e=c("body").data("modalmanager");if(e&&(e.getOpenModals().indexOf(g)>=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f<g.length;f++){g[f].call(h)}}g=a.dialog._hide_callbacks;if(g){for(f=0;f<g.length;f++){g[f].call(h)}}}};d.helpers={select2ClearSelection:function(){var f=c(this);var e=f.parents("label");var g=f.data("ams-select2-target");c('[name="'+g+'"]',e).data("select2").val("")},select2FormatSelection:function(f,e){if(f instanceof Array){c(f).each(function(){if(typeof(this)==="object"){e.append(this.text)}else{e.append(this)}})}else{if(typeof(f)==="object"){e.append(f.text)}else{e.append(f)}}},select2QueryUrlResultsCallback:function(g,f,e){switch(g.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+g.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+f.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var e=i.data();if(e.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||e.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var g=a.getFunctionByName(f);if(typeof(g)==="function"){f=g.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(f){a.plugins.initData(f);var g=[];c("[data-ams-plugins-disabled]",f).each(function(){var i=c(this).data("ams-plugins-disabled").split(/\s+/);for(var j=0;j<i.length;j++){g.push(i[j])}});c("[data-ams-plugins]",f).each(function(){var m=c(this);var i={};var k;if(typeof(m.data("ams-plugins"))==="string"){var n=m.data("ams-plugins").split(/\s+/);for(var j=0;j<n.length;j++){k=n[j];i[k]={src:m.data("ams-plugin-"+k+"-src"),css:m.data("ams-plugin-"+k+"-css"),callback:m.data("ams-plugin-"+k+"-callback"),register:m.data("ams-plugin-"+k+"-register"),async:m.data("ams-plugin-"+k+"-async")}}}else{i=m.data("ams-plugins")}for(k in i){if(a.plugins.enabled[k]===undefined){var l=i[k];a.getScript(l.src,function(){var q=l.callback;if(q){var p=a.getFunctionByName(q);if(l.register!==false){a.plugins.enabled[k]=p}}else{if(l.register!==false){a.plugins.enabled[k]=null}}var o=l.css;if(o){a.getCSS(o,k+"_css")}},{async:l.async===undefined?true:l.async})}}});for(var e in a.plugins.enabled){if(!a.plugins.enabled.hasOwnProperty(e)){continue}if(g.indexOf(e)>=0){continue}var h=a.plugins.enabled[e];if(typeof(h)==="function"){h(f)}}},initData:function(e){c("[data-ams-data]",e).each(function(){var g=c(this);var h=g.data("ams-data");if(h){for(var f in h){if(h.hasOwnProperty(f)){g.attr("data-"+f,h[f])}}}})},register:function(f,e,h){if(typeof(e)==="function"){h=e;e=null}e=e||f.name;if(a.plugins.enabled.indexOf(e)>=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var k=c(this);var j=k.data();var h={html:j.amsHintHtml,title:a.getFunctionByName(j.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(j.amsHintTitleAttr||"title")||(j.amsHintHtml?l.html():l.text())},opacity:j.amsHintOpacity||0.95,gravity:j.amsHintGravity||"sw",offset:j.amsHintOffset||0};var g=c.extend({},h,j.amsHintOptions);g=a.executeFunctionByName(j.amsHintInitCallback,k,g)||g;var i=k.tipsy(g);a.executeFunctionByName(j.amsHintAfterInitCallback,k,i,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={menuSelector:j.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},h,j.amsContextmenuOptions);g=a.executeFunctionByName(j.amsContextmenuInitCallback,k,g)||g;var i=k.contextMenu(g);a.executeFunctionByName(j.amsContextmenuAfterInitCallback,k,i,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('<i class="fa fa-fw"></i>').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var q=c(this);var r=q.parent("fieldset");var h=q.data();if(!h.amsChecker){var f=c('<label class="checkbox"></label>');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var o=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('<input type="hidden">').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(q)}else{if(g){c('<input type="hidden">').attr("name",g).attr("value",1).prependTo(q)}}var p=c('<input type="checkbox">').attr("name",k).attr("id",o).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){p.attr("disabled","disabled")}else{p.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");q.trigger("ams.checker.before-switch",[q,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,q,v);if(!h.amsCheckerCancelDefault){var t=p.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");q.trigger("ams.checker.opened",[q])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");q.trigger("ams.checker.closed",[q])}}})}p.appendTo(f);c(">label",q).attr("for",p.attr("id"));f.append("<i></i>").prependTo(q);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){p.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}q.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider.min.js",function(){f.each(function(){var j=c(this);var k=j.data();var h={};var g=c.extend({},h,j.data.amsSliderOptions);g=a.executeFunctionByName(k.amsSliderInitCallback,j,g)||g;var i=j.slider(g);a.executeFunctionByName(k.amsSliderAfterInitCallback,j,i,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={containment:k.amsDraggableContainment,helper:a.getFunctionByName(k.amsDraggableHelper)||k.amsDraggableHelper,start:a.getFunctionByName(k.amsDraggableStart),stop:a.getFunctionByName(k.amsDraggableStop)};var h=c.extend({},i,k.amsDraggableOptions);h=a.executeFunctionByName(k.amsDraggableInitCallback,g,h)||h;var j=g.draggable(h);g.disableSelection();a.executeFunctionByName(k.amsDraggableAfterInitCallback,g,j,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={items:j.amsSortableItems,handle:j.amsSortableHandle,connectWith:j.amsSortableConnectwith,start:a.getFunctionByName(j.amsSortableStart),over:a.getFunctionByName(j.amsSortableOver),containment:j.amsSortableContainment,placeholder:j.amsSortablePlaceholder,stop:a.getFunctionByName(j.amsSortableStop)};var g=c.extend({},h,j.amsSortableOptions);g=a.executeFunctionByName(j.amsSortableInitCallback,k,g)||g;var i=k.sortable(g);k.disableSelection();a.executeFunctionByName(j.amsSortableAfterInitCallback,k,i,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={autoHide:k.amsResizableAutohide===false?true:k.amsResizableAutohide,containment:k.amsResizableContainment,grid:k.amsResizableGrid,handles:k.amsResizableHandles,start:a.getFunctionByName(k.amsResizableStart),stop:a.getFunctionByName(k.amsResizableStop)};var h=c.extend({},i,k.amsResizableOptions);h=a.executeFunctionByName(k.amsResizableInitCallback,g,h)||h;var j=g.resizable(h);g.disableSelection();a.executeFunctionByName(k.amsResizableAfterInitCallback,g,j,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={};var h=c.extend({},i,k.amsTypeaheadOptions);h=a.executeFunctionByName(k.amsTypeaheadInitCallback,g,h)||h;var j=g.typeahead(h);a.executeFunctionByName(k.amsTypeaheadAfterInitCallback,g,j,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var l=g.data();var j={placeholder:l.amsSelect2Placeholder,multiple:l.amsSelect2Multiple,minimumInputLength:l.amsSelect2MinimumInputLength||0,maximumSelectionSize:l.amsSelect2MaximumSelectionSize,openOnEnter:l.amsSelect2EnterOpen===undefined?true:l.amsSelect2EnterOpen,allowClear:l.amsSelect2AllowClear===undefined?true:l.amsSelect2AllowClear,width:l.amsSelect2Width||"100%",initSelection:a.getFunctionByName(l.amsSelect2InitSelection),formatSelection:l.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(l.amsSelect2FormatSelection),formatResult:a.getFunctionByName(l.amsSelect2FormatResult),formatMatches:l.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(l.amsSelect2FormatMatches),formatNoMatches:l.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(l.amsSelect2FormatResult),formatInputTooShort:l.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooShort),formatInputTooLong:l.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooLong),formatSelectionTooBig:l.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatSelectionTooBig),formatLoadMore:l.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(l.amsSelect2FormatLoadMore),formatSearching:l.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(l.amsSelect2FormatSearching),separator:l.amsSelect2Separator||",",tokenSeparators:l.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(l.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!j.initSelection){var h=g.data("ams-select2-values");if(h){j.initSelection=function(m,o){var n=[];c(m.val().split(j.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){j.query=function(){return[]}}}else{if(l.amsSelect2Query){j.query=a.getFunctionByName(l.amsSelect2Query);j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryUrl){j.ajax={url:l.amsSelect2QueryUrl,quietMillis:l.amsSelect2QuietMillis||200,type:l.amsSelect2QueryType||"POST",dataType:l.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[l.amsSelect2QueryParamName||"query"]=o;m[l.amsSelect2PageParamName||"page"]=p;m[l.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,l.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryMethod){j.query=function(m){var n={url:l.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:l.amsSelect2MethodType||"POST",cache:false,method:l.amsSelect2QueryMethod,params:l.amsSelect2QueryParams||{},success:function(p,o){return a.helpers.select2QueryMethodSuccessCallback.call(g,p,o,m)},error:a.error.show};n.params[l.amsSelect2QueryParamName||"query"]=m.term;n.params[l.amsSelect2PageParamName||"page"]=m.page;n.params[l.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,l.amsSelect2QueryOptions);n=a.executeFunctionByName(l.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){c.jsonRpc(n)})};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2Tags){j.tags=l.amsSelect2Tags}else{if(l.amsSelect2Data){j.data=l.amsSelect2Data}}}}}}if(l.amsSelect2EnableFreeTags){j.createSearchChoice=function(m){return{id:m,text:(l.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},j,l.amsSelect2Options);i=a.executeFunctionByName(l.amsSelect2InitCallback,g,i)||i;var k=g.select2(i);a.executeFunctionByName(l.amsSelect2AfterInitCallback,g,k,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.3.1.min.js",function(){e.each(function(){var g=c(this);var k=g.data();var i={placeholder:k.amsMaskeditPlaceholder||"X"};var h=c.extend({},i,k.amsMaskeditOptions);h=a.executeFunctionByName(k.amsMaskeditInitCallback,g,h)||h;var j=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(k.amsMaskeditAfterInitCallback,g,j,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var l=h.data();var j={position:l.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},j,l.amsColorpickerOptions);i=a.executeFunctionByName(l.amsColorpickerInitCallback,h,i)||i;var k=h.minicolors(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var m=c(this);var n=m.data();var k={ignore:null,submitHandler:m.attr("data-async")!==undefined?n.amsFormSubmitHandler===undefined?function(){c(".state-error",m).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(m)}:a.getFunctionByName(n.amsFormSubmitHandler):undefined,invalidHandler:m.attr("data-async")!==undefined?n.amsFormInvalidHandler===undefined?function(s,r){c(".state-error",m).removeClass("state-error");for(var p=0;p<r.errorList.length;p++){var o=r.errorList[p];var q=c(o.element).parents(".tab-pane").index()+1;if(q>0){var t=c(".nav-tabs",c(o.element).parents(".tabforms"));c("li:nth-child("+q+")",t).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",t).click()}}}:a.getFunctionByName(n.amsFormInvalidHandler):undefined};var j=c.extend({},k,n.amsValidateOptions);j=a.executeFunctionByName(n.amsValidateInitCallback,m,j)||j;var l=m.validate(j);a.executeFunctionByName(n.amsValidateAfterInitCallback,m,l,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var H=D.data();var F=(H.amsDatatableExtensions||"").split(/\s+/);var m=H.amsDatatableSdom||"W"+((F.indexOf("colreorder")>=0||F.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(F.indexOf("colvis")>=0?"C":"")+((H.amsDatatablePagination===false||H.amsDatatablePaginationSize===false)?"":"L")+(H.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(F.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(H.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var p;var i=H.amsDatatableSorting;if(typeof(i)==="string"){var G=i.split(";");i=[];for(p=0;p<G.length;p++){var x=G[p].split(",");x[0]=parseInt(x[0]);i.push(x)}}var h=[];var t=c("th",D).listattr("data-ams-datatable-stype");for(p=0;p<t.length;p++){var s=t[p];if(s){var j=h[p]||{};j.sType=s;h[p]=j}}var z={bJQueryUI:false,bFilter:H.amsDatatableGlobalFilter!==false,bPaginate:H.amsDatatablePagination!==false,bInfo:H.amsDatatableInfo!==false,bSort:H.amsDatatableSort!==false,aaSorting:i,aoColumns:h.length>0?h:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:H.amsDatatableDisplayLength||25,sPaginationType:H.amsDatatablePaginationType||"bootstrap_full",sDom:m,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(K,J){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}};var E=c.extend({},z,H.amsDatatableOptions);if(F.length>0){for(p=0;p<F.length;p++){switch(F[p]){case"autofill":a.ajax.check(c.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+a.devext+".js");break;case"columnfilter":a.ajax.check(c.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+a.devext+".js");break;case"colreorder":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+a.devext+".js");break;case"colreorderwithresize":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+a.devext+".js");break;case"colvis":a.ajax.check(c.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+a.devext+".js");var u={activate:"click",sAlign:"right"};E.oColVis=c.extend({},u,H.amsDatatableColvisOptions);break;case"editable":a.ajax.check(c.fn.editable,a.baseURL+"ext/jquery-jeditable"+a.devext+".js");a.ajax.check(c.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+a.devext+".js");break;case"fixedcolumns":a.ajax.check(c.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+a.devext+".js");break;case"fixedheader":a.ajax.check(c.fn.dataTable.FixedHeader,a.baseURL+"ext/jquery-dataTables-fixedHeader"+a.devext+".js");break;case"keytable":a.ajax.check(window.KeyTable,a.baseURL+"ext/jquery-dataTables-keyTable"+a.devext+".js");break;case"rowgrouping":a.ajax.check(c.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+a.devext+".js");break;case"rowreordering":a.ajax.check(c.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+a.devext+".js");break;case"scroller":a.ajax.check(c.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+a.devext+".js");break;default:break}}}E=a.executeFunctionByName(H.amsDatatableInitCallback,D,E)||E;try{var l=D.dataTable(E);a.executeFunctionByName(H.amsDatatableAfterInitCallback,D,l,E);if(F.length>0){for(p=0;p<F.length;p++){switch(F[p]){case"autofill":var I=c.extend({},H.amsDatatableAutofillOptions,E.autofill);I=a.executeFunctionByName(H.amsDatatableAutofillInitCallback,D,I)||I;D.data("ams-autofill",H.amsDatatableAutofillConstructor===undefined?new c.fn.dataTable.AutoFill(D,I):a.executeFunctionByName(H.amsDatatableAutofillConstructor,D,l,I));break;case"columnfilter":var o={sPlaceHolder:"head:after"};var q=c.extend({},o,H.amsDatatableColumnfilterOptions,E.columnfilter);q=a.executeFunctionByName(H.amsDatatableColumnfilterInitCallback,D,q)||q;D.data("ams-columnfilter",H.amsDatatableColumnfilterConstructor===undefined?l.columnFilter(q):a.executeFunctionByName(H.amsDatatableColumnfilterConstructor,D,l,q));break;case"editable":var r=c.extend({},H.amsDatatableEditableOptions,E.editable);r=a.executeFunctionByName(H.amsDatatableEditableInitCallback,D,r)||r;D.data("ams-editable",H.amsDatatableEditableConstructor===undefined?D.makeEditable(r):a.executeFunctionByName(H.amsDatatableEditableConstructor,D,l,r));break;case"fixedcolumns":var k=c.extend({},H.amsDatatableFixedcolumnsOptions,E.fixedcolumns);k=a.executeFunctionByName(H.amsDatatableFixedcolumnsInitCallback,D,k)||k;D.data("ams-fixedcolumns",H.amsDatatableFixedcolumnsConstructor===undefined?new c.fn.dataTable.FixedColumns(D,k):a.executeFunctionByName(H.amsDatatableFixedcolumnsConstructor,D,l,k));break;case"fixedheader":var A=c.extend({},H.amsDatatableFixedheaderOptions,E.fixedheader);A=a.executeFunctionByName(H.amsDatatableFixedheadeInitCallback,D,A)||A;D.data("ams-fixedheader",H.amsDatatableFixedheaderConstructor===undefined?new c.fn.dataTable.FixedHeader(D,A):a.executeFunctionByName(H.amsDatatableFixedheaderConstructor,D,l,A));break;case"keytable":var n={table:D.get(0),datatable:l};var y=c.extend({},n,H.amsDatatableKeytableOptions,E.keytable);y=a.executeFunctionByName(H.amsDatatableKeytableInitCallback,D,y)||y;D.data("ams-keytable",H.amsDatatableKeytableConstructor===undefined?new KeyTable(y):a.executeFunctionByName(H.amsDatatableKeytableConstructor,D,l,y));break;case"rowgrouping":var w=c.extend({},H.amsDatatableRowgroupingOptions,E.rowgrouping);w=a.executeFunctionByName(H.amsDatatableRowgroupingInitCallback,D,w)||w;D.data("ams-rowgrouping",H.amsDatatableRowgroupingConstructor===undefined?D.rowGrouping(w):a.executeFunctionByName(H.amsDatatableRowgroupingConstructor,D,l,w));break;case"rowreordering":var v=c.extend({},H.amsDatatableRowreorderingOptions,E.rowreordering);v=a.executeFunctionByName(H.amsDatatableRowreorderingInitCallback,D,v)||v;D.data("ams-rowreordering",H.amsDatatableRowreorderingConstructor===undefined?D.rowReordering(v):a.executeFunctionByName(H.amsDatatableRowreorderingConstructor,D,l,v));break;default:break}}}var B=(H.amsDatatableFinalizeCallback||"").split(/\s+/);if(B.length>0){for(p=0;p<B.length;p++){a.executeFunctionByName(B[p],D,l,E)}}}catch(C){}})})}},tablednd:function(f){var e=c(".table-dnd",f);if(e.length>0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var k=c(this);c(k).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")});var l=k.data();var i={onDragClass:l.amsTabledndDragClass||"dragging-row",onDragStart:l.amsTabledndDragStart,dragHandle:l.amsTabledndDragHandle,scrollAmount:l.amsTabledndScrollAmount,onAllowDrop:l.amsTabledndAllowDrop,onDrop:l.amsTabledndDrop||function(o,q){var n=l.amsTabledndDropTarget;if(n){var m=[];c(o.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var p=a.getFunctionByName(n);if(typeof(p)==="function"){p.call(k,o,m)}else{a.ajax.post(n,{names:JSON.stringify(m)})}}return false}};var h=c.extend({},i,l.amsTabledndOptions);h=a.executeFunctionByName(l.amsTabledndInitCallback,k,h)||h;var j=k.tableDnD(h);a.executeFunctionByName(l.amsTabledndAfterInitCallback,k,j,h)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.10"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var m=c(this);var l=m.data();var j=l.amsImgareaselectParent?m.parents(l.amsImgareaselectParent):"body";var i={instance:true,handles:true,parent:j,x1:l.amsImgareaselectX1||0,y1:l.amsImgareaselectY1||0,x2:l.amsImgareaselectX2||l.amsImgareaselectImageWidth,y2:l.amsImgareaselectY2||l.amsImgareaselectImageHeight,imageWidth:l.amsImgareaselectImageWidth,imageHeight:l.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:l.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(l.amsImgareaselectSelectEnd)||function(n,o){var p=l.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',j).val(o.x1);c('input[name="'+p+'y1"]',j).val(o.y1);c('input[name="'+p+'x2"]',j).val(o.x2);c('input[name="'+p+'y2"]',j).val(o.y2)}};var h=c.extend({},i,l.amsImgareaselectOptions);h=a.executeFunctionByName(l.amsImgareaselectInitCallback,m,h)||h;var k=m.imgAreaSelect(h);a.executeFunctionByName(l.amsImgareaselectAfterInitCallback,m,k,h);setTimeout(function(){k.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var o=h.data();var n=(o.amsFancyboxHelpers||"").split(/\s+/);if(n.length>0){for(var i=0;i<n.length;i++){var m=n[i];switch(m){case"buttons":a.ajax.check(c.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons"+a.devext+".js");break;case"thumbs":a.ajax.check(c.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+a.devext+".js");break;case"media":a.ajax.check(c.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media"+a.devext+".js");break;default:break}}}var k={type:o.amsFancyboxType,padding:o.amsFancyboxPadding||10,margin:o.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(o.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(o.amsFancyboxTitleGetter,this)||c(this.element).attr("original-title")||c(this.element).attr("title")},helpers:{title:{type:"inside"}}};var j=c.extend({},k,o.amsFancyboxOptions);j=a.executeFunctionByName(o.amsFancyboxInitCallback,h,j)||j;var l=h.fancybox(j);a.executeFunctionByName(o.amsFancyboxAfterInitCallback,h,l,j)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var k=l.data();var i={theme:k.amsScrollbarTheme||"light"};var h=c.extend({},i,k.amsScrollbarOptions);h=a.executeFunctionByName(k.amsScrollbarInitCallback,l,h)||h;var j=l.mCustomScrollbar(h);a.executeFunctionByName(k.amsScrollbarAfterInitCallback,l,j,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsMessageboxOptions);var g=c.extend({},h,{title:i.amsMessageboxTitle||h.title||"",content:i.amsMessageboxContent||h.content||"",icon:i.amsMessageboxIcon||h.icon,number:i.amsMessageboxNumber||h.number,timeout:i.amsMessageboxTimeout||h.timeout});var e=i.amsMessageboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsMessageboxCallback||h.callback);a.skin.messageBox(e,g,j)},smallBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsSmallboxOptions);var g=c.extend({},h,{title:i.amsSmallboxTitle||h.title||"",content:i.amsSmallboxContent||h.content||"",icon:i.amsSmallboxIcon||h.icon,iconSmall:i.amsSmallboxIconSmall||h.iconSmall,timeout:i.amsSmallboxTimeout||h.timeout});var e=i.amsSmallboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsSmallboxCallback||h.callback);a.skin.smallBox(e,g,j)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var k=f.parents("table");var h=k.data("ams-location")||"";var l=f.parents("tr");var j=l.data("ams-delete-target")||k.data("ams-delete-target")||"delete-element.json";var g=l.data("ams-element-name");d.ajax.post(h+"/"+j,{object_name:g},function(m,n){if(m.status==="success"){if(k.hasClass("datatable")){k.dataTable().fnDeleteRow(l[0])}else{l.remove()}}})}})}}};d.skin={_setPageHeight:function(){var g=c("#main").height();var e=a.left_panel.height();var f=c(window).height()-a.navbar_height;if(g>f){a.left_panel.css("min-height",g);a.root.css("min-height",g+a.navbar_height)}else{a.left_panel.css("min-height",f);a.root.css("min-height",f)}},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c("#activity > .badge");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(e){if(a.enable_widgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var j=c(this);var i=j.data();var h={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},h,i.amsWidgetOptions);g=a.executeFunctionByName(i.amsWidgetInitcallback,j,g)||g;j.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){c(".alert",l).remove();if(f==="error"){f="danger"}var i='<div class="'+(e?"margin-10":"")+" alert alert-block alert-"+f+' fade in"><a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a><h4 class="alert-heading"><i class="fa fa-fw fa-warning"></i> '+g+"</h4>"+(k?("<p>"+k+"</p>"):"");if(typeof(m)==="string"){i+="<ul><li>"+m+"</li></ul>"}else{if(m){i+="<ul>";for(var h in m){if(!c.isNumeric(h)){continue}i+="<li>"+m[h]+"</li>"}i+="</ul>"}}i+="</div>";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("#ribbon OL.breadcrumb");e.empty().append(c("<li></li>").append(c("<a></a>").text(a.i18n.HOME).attr("href",c('nav a[href!="#"]:first').attr("href"))));c("nav LI.active >A").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("<li></li>").append(h.attr("href").replace(/^#/,"")?c("<a></a>").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(k){c("nav .active").removeClass("active");k.addClass("open").addClass("active");k.parents("li").addClass("open active").children("ul").addClass("active").show();k.parents("li:first").removeClass("open");k.parents("ul").addClass(k.attr("href").replace(/^#/,"")?"active":"").show()}var i;var h=location.hash;var g=h.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}i=c('nav A[href="'+h+'"]');if(i.exists()){e(i)}a.skin.loadURL(g,f);document.title=c("[data-ams-page-title]:first",f).data("ams-page-title")||i.attr("title")||document.title}else{var j=c("[data-ams-active-menu]").data("ams-active-menu");if(j){i=c('nav A[href="'+j+'"]')}else{i=c('nav >UL >LI >A[href!="#"]').first()}if(i.exists()){e(i);if(j){a.skin._drawBreadCrumb()}else{window.location.hash=i.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f<g.length;f++){g[f].call(e)}},loadURL:function(g,e,f,j){if(g.startsWith("#")){g=g.substr(1)}if(typeof(f)==="function"){j=f;f={}}e=c(e);var i={type:"GET",url:g,dataType:"html",cache:false,beforeSend:function(){a.skin.cleanContainer(e);e.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> Loading... </h1>');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();document.title=c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(o,l,n){if(j){a.executeFunctionByName(j,this,o,l,n,f)}else{var m=a.ajax.getResponse(n);var p=m.content_type;var k=m.data;c(".loading",e).remove();switch(p){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(o).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}}},error:function(m,l,k){e.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+a.i18n.ERROR+k+"</h3>"+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.left_panel=c("#left-panel");a.shortcuts=c("#shortcut");a.plugins.initData(e);var f=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var h=f();if(h&&(typeof(h.addEventListener)==="function")){var g=this;h.addEventListener("progress",function(i){g.progress(i)},false)}return h}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("#hide-menu A").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(g){e.toggleClass("hidden-menu");g.preventDefault()});c("#show-shortcut").click(function(g){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}g.preventDefault()});a.shortcuts.click(function(g){a.skin._hideShortcutButtons()});c(document).mouseup(function(g){if(!a.shortcuts.is(g.target)&&a.shortcuts.has(g.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c("#activity").click(function(h){var g=c(this);var i=g.next(".ajax-dropdown");if(!i.is(":visible")){i.css("left",g.position().left-i.innerWidth()/2+g.innerWidth()/2).fadeIn(150);g.addClass("active")}else{i.fadeOut(150);g.removeClass("active")}h.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(g){var h=c(".ajax-dropdown");if(!h.is(g.target)&&h.has(g.target).length===0){h.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(){var h=c(this).data("ams-url");var g=c(".ajax-notifications");a.skin.loadURL(h,g)});c("#logout a").click(function(g){g.preventDefault();g.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+a.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+c("#show-shortcut").text()+"</strong></span> ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(h){if(h===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});c("NAV UL").myams_menu({accordion:true,speed:a.menu_speed});c(".minifyme").click(function(g){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);g.preventDefault()});c("#refresh").click(function(g){a.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(h){if(h===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});g.preventDefault()});e.on("click",function(h){var g=c(this);if(!g.is(h.target)&&g.has(h.target).length===0&&c(".popover").has(h.target).length===0){g.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});c("nav").resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){c(document).on("click",'a[href="#"]',function(g){g.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(k){var i=c(k.currentTarget);var g=i.attr("href")||i.data("ams-url");if(!g||g.startsWith("javascript")||i.attr("target")||(i.data("ams-context-menu")===true)){return}k.preventDefault();k.stopPropagation();var h=a.getFunctionByName(g);if(typeof(h)==="function"){g=h.call(i)}if(typeof(g)==="function"){g.call(i)}else{g=g.replace(/\%23/,"#");var j=i.data("ams-target");if(j){a.form.confirmChangedForm(j,function(){a.skin.loadURL(g,j,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(g.startsWith("#")){if(g!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=g},50)}else{window.location.hash=g}}}else{window.location=g}})}}});c(document).on("click",'a[target="_blank"]',function(g){g.preventDefault();window.open(c(g.currentTarget).attr("href"))});c(document).on("click",'a[target="_top"]',function(g){g.preventDefault();a.form.confirmChangedForm(function(){window.location=c(g.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(h){var g=c(this);if(g.data("ams-context-menu")===true){return}if(g.data("ams-stop-propagation")===true){h.stopPropagation()}h.preventDefault();a.dialog.open(g);if(g.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var g=c(this);c(g.get(0).form).data("ams-submit-button",g)});c(document).on("click","[data-ams-click-handler]",function(i){var h=c(this);var g=h.data();if(g.amsClickHandler){if((g.amsStopPropagation===true)||(g.amsClickStopPropagation===true)){i.stopPropagation()}if(g.amsClickKeepDefault!==true){i.preventDefault()}var j=a.getFunctionByName(g.amsClickHandler);if(j!==undefined){j.call(h,g.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(i){var h=c(this);var g=h.data();if(g.amsChangeHandler){if(g.amsChangeKeepDefault!==true){i.preventDefault()}var j=a.getFunctionByName(g.amsChangeHandler);if(j!==undefined){j.call(h,g.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(h){var g=c(this);setTimeout(function(){g.find(".select2").trigger("change")},10);a.form.setFocus(g)});c(document).on("reset","[data-ams-reset-handler]",function(i){var g=c(this);var h=g.data();if(h.amsResetHandler){if(h.amsResetKeepDefault!==true){i.preventDefault()}var j=a.getFunctionByName(h.amsResetHandler);if(j!==undefined){j.call(g,h.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(i){i.preventDefault();var g=c(this);var h=g.parent(".button");if(h.exists()&&h.parent().hasClass("input-file")){h.next('input[type="text"]').val(g.val())}});c(document).on("focusin",function(g){if(c(g.target).closest(".mce-window").length){g.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(g){if(c(this).parent("li").hasClass("disabled")){g.preventDefault();return false}});c(document).on("show.bs.tab",function(i){var g=c(i.target);var h=g.data();if(h.amsUrl){if(h.amsTabLoaded){return}try{g.append('<i class="fa fa-spin fa-cog margin-left-5"></i>');a.skin.loadURL(h.amsUrl,g.attr("href"));if(h.amsTabLoadOnce){g.data("ams-tab-loaded",true)}}finally{c("i",g).remove()}}});a.initContent(document);if(a.ajax_nav&&c("nav").exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this);
\ No newline at end of file