Version 0.1.27 0.1.27
authorThierry Florac <thierry.florac@onf.fr>
Tue, 20 Nov 2018 09:09:31 +0100
changeset 466 c86acac9dff5
parent 465 0a21be6342aa
child 467 c571dce459a3
Version 0.1.27
.installed.cfg
buildout.cfg
setup.py
src/pyams_skin.egg-info/PKG-INFO
src/pyams_skin.egg-info/SOURCES.txt
src/pyams_skin/resources/js/myams-ajax.min.js
src/pyams_skin/resources/js/myams-dialog.min.js
src/pyams_skin/resources/js/myams-plugins-loader.min.js
src/pyams_skin/resources/js/myams-plugins.min.js
src/pyams_skin/resources/js/myams.js
src/pyams_skin/resources/js/myams.min.js
--- a/.installed.cfg	Mon Nov 19 15:20:20 2018 +0100
+++ b/.installed.cfg	Tue Nov 20 09:09:31 2018 +0100
@@ -122,3 +122,27 @@
 
 [buildout]
 parts = package i18n pyflakes test
+
+[buildout]
+installed_develop_eggs = /home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-file.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/lingua.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-template.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-skin.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-pagelet.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-viewlet.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-i18n.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-catalog.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-form.egg-link
+	/home/tflorac/Dropbox/src/PyAMS/pyams_skin/develop-eggs/pyams-utils.egg-link
+
+[buildout]
+parts = i18n pyflakes test package
+
+[buildout]
+parts = pyflakes test package i18n
+
+[buildout]
+parts = test package i18n pyflakes
+
+[buildout]
+parts = package i18n pyflakes test
--- a/buildout.cfg	Mon Nov 19 15:20:20 2018 +0100
+++ b/buildout.cfg	Tue Nov 20 09:09:31 2018 +0100
@@ -80,4 +80,4 @@
 eggs = pyams_skin [test]
 
 [versions]
-pyams_skin = 0.1.26
+pyams_skin = 0.1.27
--- a/setup.py	Mon Nov 19 15:20:20 2018 +0100
+++ b/setup.py	Tue Nov 20 09:09:31 2018 +0100
@@ -25,7 +25,7 @@
 README = os.path.join(DOCS, 'README.txt')
 HISTORY = os.path.join(DOCS, 'HISTORY.txt')
 
-version = '0.1.26'
+version = '0.1.27'
 long_description = open(README).read() + '\n\n' + open(HISTORY).read()
 
 tests_require = []
--- a/src/pyams_skin.egg-info/PKG-INFO	Mon Nov 19 15:20:20 2018 +0100
+++ b/src/pyams_skin.egg-info/PKG-INFO	Tue Nov 20 09:09:31 2018 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: pyams-skin
-Version: 0.1.26
+Version: 0.1.27
 Summary: PyAMS base skin interfaces and classes
 Home-page: http://hg.ztfy.org/pyams/pyams_skin
 Author: Thierry Florac
--- a/src/pyams_skin.egg-info/SOURCES.txt	Mon Nov 19 15:20:20 2018 +0100
+++ b/src/pyams_skin.egg-info/SOURCES.txt	Tue Nov 20 09:09:31 2018 +0100
@@ -468,6 +468,8 @@
 src/pyams_skin/resources/js/myams-menus.min.js
 src/pyams_skin/resources/js/myams-notify.js
 src/pyams_skin/resources/js/myams-notify.min.js
+src/pyams_skin/resources/js/myams-plugins-loader.js
+src/pyams_skin/resources/js/myams-plugins-loader.min.js
 src/pyams_skin/resources/js/myams-plugins.js
 src/pyams_skin/resources/js/myams-plugins.min.js
 src/pyams_skin/resources/js/myams-skin.js
--- a/src/pyams_skin/resources/js/myams-ajax.min.js	Mon Nov 19 15:20:20 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-ajax.min.js	Tue Nov 20 09:09:31 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,t){var o=t.MyAMS,n=o;o.ajax={check:function(t,o,a,s){function i(e,t){if(void 0!==a){a instanceof Array||(a=[a]);for(var o=0;o<a.length;o++){var s=n.getFunctionByName(a[o]);"function"==typeof s&&s(e,t)}}}a instanceof Array||"object"==typeof a&&(s=a,a=void 0);var r={async:"function"==typeof a},c=e.extend({},r,s);if(t instanceof Array){for(var l=[],f=0;f<t.length;f++)void 0===t[f]&&l.push(n.getScript(o[f],{async:!0}));l.length>0?e.when.apply(e,l).then(function(){i(!0,s)}):i(!1,s)}else void 0===t?"string"==typeof o&&n.getScript(o,function(){i(!0,s)},c):i(!1,s)},getAddr:function(t){var o=t||e("HTML HEAD BASE").attr("href")||window.location.href;return o.substr(0,o.lastIndexOf("/")+1)},start:function(){e("#ajax-gear").show()},stop:function(){e("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||console&&console.log&&console.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var t=e.url;delete e.url,n.ajax.post(t,e,function(e,t,o){n.ajax.handleJSON(e)})}},post:function(o,a,s,i){var r;r=o.startsWith(window.location.protocol)?o:this.getAddr()+o,"function"==typeof s?(i=s,s={}):s||(s={}),void 0===i&&(i=s.callback),"string"==typeof i&&(i=n.getFunctionByName(i)),delete s.callback;var c,l={url:r,type:"post",cache:!1,async:"function"==typeof i,data:e.param(a),dataType:"json",beforeSend:function(e,o){if(void 0!==t.Cookies){var a=Cookies.get(n.csrfCookieName);a&&e.setRequestHeader(n.csrfHeaderName,a)}},success:i||function(e){c=e.result}},f=e.extend({},l,s);return e.ajax(f),c},getResponse:function(e){var t,o,a=e.getResponseHeader("content-type");if(a)if(a.startsWith("application/javascript"))t="script",o=e.responseText;else if(a.startsWith("text/html"))t="html",o=e.responseText;else if(a.startsWith("text/xml"))t="xml",o=e.responseText;else if(o=e.responseJSON)t="json";else try{o=JSON.parse(e.responseText),t="json"}catch(n){o=e.responseText,t="text"}else t="json",o={status:"alert",alert:{title:n.i18n.ERROR_OCCURED,content:n.i18n.NO_SERVER_RESPONSE}};return{contentType:t,data:o}},handleJSON:function(o,a,s){var i,r=o.status;switch(r){case"alert":t.alert&&t.alert(o.alert.title+"\n\n"+o.alert.content);break;case"error":n.form.showErrors(a,o);break;case"info":case"success":void 0!==a&&(n.form.resetChanged(a),!1!==o.close_form&&n.dialog.close(a));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==a&&(n.form.resetChanged(a),!1!==o.close_form&&n.dialog.close(a));break;case"modal":n.dialog.open(o.location);break;case"reload":void 0!==a&&(n.form.resetChanged(a),!1!==o.close_form&&n.dialog.close(a)),(i=o.location||window.location.hash).startsWith("#")&&(i=i.substr(1));var c=e(o.target||s||"#content");n.skin.loadURL(i,c,{preLoadCallback:n.getFunctionByName(o.pre_reload)||function(){e("[data-ams-pre-reload]",c).each(function(){n.executeFunctionByName(e(this).data("ams-pre-reload"))})},preLoadCallbackOptions:o.pre_reload_options,afterLoadCallback:n.getFunctionByName(o.post_reload)||function(){e("[data-ams-post-reload]",c).each(function(){n.executeFunctionByName(e(this).data("ams-post-reload"))})},afterLoadCallbackOptions:o.post_reload_options});break;case"redirect":void 0!==a&&(n.form.resetChanged(a),!0===o.close_form&&n.dialog.close(a)),(i=o.location||window.location.href).endsWith("##")&&(i=i.replace(/##/,window.location.hash)),o.window?window.open(i,o.window,o.options):window.location.href===i?window.location.reload(!0):window.location.href=i;break;default:console&&console.log&&console.log("Unhandled status: "+r)}var l,f,d;if(o.content&&(f=o.content,d=e(f.target||s||a||"#content"),!0===f.raw?d.text(f.text):(d.html(f.html),n.initContent(d)),f.keep_hidden||d.removeClass("hidden")),o.contents){var u=o.contents;for(l=0;l<u.length;l++)f=u[l],d=e(f.target),!0===f.raw?d.text(f.text):(d.html(f.html),n.initContent(d)),f.keep_hidden||d.removeClass("hidden")}var m;if(o.message&&("string"==typeof(m=o.message)?"info"===r||"success"===r?n.skin.smallBox(r,{title:m,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):n.skin.alert(e(a||"#content"),r,m):n.skin.alert(e(m.target||s||a||"#content"),m.status||"success",m.header,m.body,m.subtitle)),o.smallbox&&("string"==typeof(m=o.smallbox)?n.skin.smallBox(o.smallbox_status||r,{title:o.smallbox,icon:o.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:o.smallbox_timeout||3e3}):n.skin.smallBox(m.status||r,{title:m.message,icon:m.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:m.timeout||3e3})),o.messagebox)if("string"==typeof(m=o.messagebox))n.skin.messageBox("info",{title:n.i18n.ERROR_OCCURED,content:m,timeout:1e4});else{var p=m.status||"info";"error"===p&&a&&s&&n.executeFunctionByName(a.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",a,s),n.skin.messageBox(p,{title:m.title||n.i18n.ERROR_OCCURED,content:m.content,icon:m.icon,number:m.number,timeout:null===m.timeout?void 0:m.timeout||1e4})}if(o.event&&a.trigger(o.event,o.event_options),o.events){var g;for(void 0===a&&(a=e(document)),l=0;l<o.events.length;l++)null!==(g=o.events[l])&&("string"==typeof g?a.trigger(g,o.events_options):a.trigger(g.event,g.options))}if(o.callback&&n.executeFunctionByName(o.callback,a,o.options),o.callbacks){var h;for(l=0;l<o.callbacks.length;l++)"function"==typeof(h=o.callbacks[l])?n.executeFunctionByName(h,a,h.options):n.executeFunctionByName(h.callback,a,h.options)}}}}(jQuery,this);
+!function(p,g){var e=g.MyAMS,h=e;e.ajax={check:function(e,t,a,o){function n(e,t){if(void 0!==a){a instanceof Array||(a=[a]);for(var o=0;o<a.length;o++){var n=h.getFunctionByName(a[o]);"function"==typeof n&&n(e,t)}}}a instanceof Array||"object"==typeof a&&(o=a,a=void 0);var s={async:"function"==typeof a},i=p.extend({},s,o);if(e instanceof Array){for(var r=[],c=0;c<e.length;c++)void 0===e[c]&&r.push(h.getScript(t[c],{async:!0}));0<r.length?p.when.apply(p,r).then(function(){n(!0,o)}):n(!1,o)}else void 0===e?"string"==typeof t&&h.getScript(t,function(){n(!0,o)},i):n(!1,o)},getAddr:function(e){var t=e||p("HTML HEAD BASE").attr("href")||window.location.href;return t.substr(0,t.lastIndexOf("/")+1)},start:function(){p("#ajax-gear").show()},stop:function(){p("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||console&&console.log&&console.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var t=e.url;delete e.url,h.ajax.post(t,e,function(e,t,o){h.ajax.handleJSON(e)})}},post:function(e,t,o,n){var a,s;a=e.startsWith(window.location.protocol)?e:this.getAddr()+e,"function"==typeof o?(n=o,o={}):o||(o={}),void 0===n&&(n=o.callback),"string"==typeof n&&(n=h.getFunctionByName(n)),delete o.callback;var i={url:a,type:"post",cache:!1,async:"function"==typeof n,data:p.param(t),dataType:"json",beforeSend:function(e,t){if(void 0!==g.Cookies){var o=Cookies.get(h.csrfCookieName);o&&e.setRequestHeader(h.csrfHeaderName,o)}},success:n||function(e){s=e.result}},r=p.extend({},i,o);return p.ajax(r),s},getResponse:function(t){var o,n,e=t.getResponseHeader("content-type");if(e)if(e.startsWith("application/javascript"))o="script",n=t.responseText;else if(e.startsWith("text/html"))o="html",n=t.responseText;else if(e.startsWith("text/xml"))o="xml",n=t.responseText;else if(n=t.responseJSON)o="json";else try{n=JSON.parse(t.responseText),o="json"}catch(e){n=t.responseText,o="text"}else o="json",n={status:"alert",alert:{title:h.i18n.ERROR_OCCURED,content:h.i18n.NO_SERVER_RESPONSE}};return{contentType:o,data:n}},handleJSON:function(e,t,o){var n,a,s,i,r,c,l,f=e.status;switch(f){case"alert":g.alert&&g.alert(e.alert.title+"\n\n"+e.alert.content);break;case"error":h.form.showErrors(t,e);break;case"info":case"success":void 0!==t&&(h.form.resetChanged(t),!1!==e.close_form&&h.dialog.close(t));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==t&&(h.form.resetChanged(t),!1!==e.close_form&&h.dialog.close(t));break;case"modal":h.dialog.open(e.location);break;case"reload":void 0!==t&&(h.form.resetChanged(t),!1!==e.close_form&&h.dialog.close(t)),(n=e.location||window.location.hash).startsWith("#")&&(n=n.substr(1));var d=p(e.target||o||"#content");h.skin.loadURL(n,d,{preLoadCallback:h.getFunctionByName(e.pre_reload)||function(){p("[data-ams-pre-reload]",d).each(function(){h.executeFunctionByName(p(this).data("ams-pre-reload"))})},preLoadCallbackOptions:e.pre_reload_options,afterLoadCallback:h.getFunctionByName(e.post_reload)||function(){p("[data-ams-post-reload]",d).each(function(){h.executeFunctionByName(p(this).data("ams-post-reload"))})},afterLoadCallbackOptions:e.post_reload_options});break;case"redirect":void 0!==t&&(h.form.resetChanged(t),!0===e.close_form&&h.dialog.close(t)),(n=e.location||window.location.href).endsWith("##")&&(n=n.replace(/##/,window.location.hash)),e.window?window.open(n,e.window,e.options):window.location.href===n?window.location.reload(!0):window.location.href=n;break;default:console&&console.log&&console.log("Unhandled status: "+f)}if(e.content&&(s=e.content,i=p(s.target||o||t||"#content"),!0===s.raw?i.text(s.text):(i.html(s.html),h.initContent(i)),s.keep_hidden||i.removeClass("hidden")),e.contents){var u=e.contents;for(a=0;a<u.length;a++)s=u[a],i=p(s.target),!0===s.raw?i.text(s.text):(i.html(s.html),h.initContent(i)),s.keep_hidden||i.removeClass("hidden")}if(e.message&&("string"==typeof(r=e.message)?"info"===f||"success"===f?h.skin.smallBox(f,{title:r,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):h.skin.alert(p(t||"#content"),f,r):h.skin.alert(p(r.target||o||t||"#content"),r.status||"success",r.header,r.body,r.subtitle)),e.smallbox&&("string"==typeof(r=e.smallbox)?h.skin.smallBox(e.smallbox_status||f,{title:e.smallbox,icon:e.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:e.smallbox_timeout||3e3}):h.skin.smallBox(r.status||f,{title:r.message,icon:r.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:r.timeout||3e3})),e.messagebox)if("string"==typeof(r=e.messagebox))h.skin.messageBox("info",{title:h.i18n.ERROR_OCCURED,content:r,timeout:1e4});else{var m=r.status||"info";"error"===m&&t&&o&&h.executeFunctionByName(t.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",t,o),h.skin.messageBox(m,{title:r.title||h.i18n.ERROR_OCCURED,content:r.content,icon:r.icon,number:r.number,timeout:null===r.timeout?void 0:r.timeout||1e4})}if(e.event&&t.trigger(e.event,e.event_options),e.events)for(void 0===t&&(t=p(document)),a=0;a<e.events.length;a++)null!==(c=e.events[a])&&("string"==typeof c?t.trigger(c,e.events_options):t.trigger(c.event,c.options));if(e.callback&&h.executeFunctionByName(e.callback,t,e.options),e.callbacks)for(a=0;a<e.callbacks.length;a++)"function"==typeof(l=e.callbacks[a])?h.executeFunctionByName(l,t,l.options):h.executeFunctionByName(l.callback,t,l.options)}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-dialog.min.js	Mon Nov 19 15:20:20 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-dialog.min.js	Tue Nov 20 09:09:31 2018 +0100
@@ -1,1 +1,1 @@
-!function(v,a){var e=a.MyAMS,p=e;e.dialog={_shown_callbacks:[],registerShownCallback:function(a,e){var o,l;e&&(o=e.objectOrParentWithClass("modal-dialog")),o&&o.exists()?void 0===(l=o.data("shown-callbacks"))&&(l=[],o.data("shown-callbacks",l)):l=p.dialog._shown_callbacks,l.indexOf(a)<0&&l.push(a)},_hide_callbacks:[],registerHideCallback:function(a,e){var o,l;e&&(o=e.objectOrParentWithClass("modal-dialog")),o&&o.exists()?void 0===(l=o.data("hide-callbacks"))&&(l=[],o.data("hide-callbacks",l)):l=p.dialog._hide_callbacks,l.indexOf(a)<0&&l.push(a)},open:function(g,o,f){p.ajax.check(v.fn.modalmanager,p.baseURL+"ext/bootstrap-modalmanager"+p.devext+".js",function(){p.ajax.check(v.fn.modal.defaults,p.baseURL+"ext/bootstrap-modal"+p.devext+".js",function(a){var h,m;if(a&&(v(document).off("click.modal"),v.fn.modal.defaults.spinner=v.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>'),"string"==typeof g)h={},m=g;else{h=g.data(),m=g.attr("href")||h.amsUrl;var e=p.getFunctionByName(m);"function"==typeof e&&(m=e.call(g))}m&&(v("body").modalmanager("loading"),0===m.indexOf("#")?v(m).modal("show"):v.ajax({url:m,type:"get",cache:void 0!==h.amsAllowCache&&h.amsAllowCache,data:o,success:function(a,e,o){v("body").modalmanager("removeLoading");var l=p.ajax.getResponse(o),t=l.contentType,s=l.data;switch(t){case"json":p.ajax.handleJSON(s,v(v(g).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var d=v(s),i=v(".modal-dialog",d.wrap("<div></div>").parent()),n=i.data(),c={backdrop:"static",overflow:n.amsModalOverflow||".modal-viewport",maxHeight:void 0===n.amsModalMaxHeight?function(){return v(window).height()-v(".modal-header",d).outerHeight(!0)-v("footer",d).outerHeight(!0)-85}:p.getFunctionByName(n.amsModalMaxHeight)},r=v.extend({},c,n.amsModalOptions);r=p.executeFunctionByName(n.amsModalInitCallback,i,r)||r,f&&(f.shown&&p.dialog.registerShownCallback(f.shown,d),f.hide&&p.dialog.registerHideCallback(f.hide,d)),v("<div>").addClass("modal fade").append(d).modal(r).on("shown",p.dialog.shown).on("hidden",p.dialog.hidden),p.initContent(d),!1!==h.amsLogEvent&&p.stats.logPageview(m)}}}))})})},shown:function(a){function e(a){var e=v(".scrollmarker.top",t),o=t.scrollTop();0<o?e.show():e.hide();var l=v(".scrollmarker.bottom",t);s+o>=t.get(0).scrollHeight?l.hide():l.show()}var o,l=a.target,t=v(".modal-viewport",l);if(t.exists()){var s=parseInt(t.css("max-height")),d=v.scrollbarWidth();"hidden"!==t.css("overflow")&&t.height()===s?(v("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",t.width()-d).hide().appendTo(t),v("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",s-20).css("width",t.width()-d).appendTo(t),t.scroll(e),t.off("resize").on("resize",e)):v(".scrollmarker",t).remove()}v("[data-ams-shown-callback]",l).each(function(){var a=p.getFunctionByName(v(this).data("ams-shown-callback"));a&&a.call(l,this)});var i=v(".modal-dialog",l).data("shown-callbacks");if(i)for(o=0;o<i.length;o++)i[o].call(l);if(i=p.dialog._shown_callbacks)for(o=0;o<i.length;o++)i[o].call(l);p.form.setFocus(l)},close:function(a){"string"==typeof a&&(a=v(a));var e=a.parents(".modal").data("modal");if(e){var o=v("body").data("modalmanager");o&&0<=o.getOpenModals().indexOf(e)&&e.hide()}},hidden:function(a){var e,o=a.target;p.skin.cleanContainer(o),v("[data-ams-hidden-callback]",o).each(function(){var a=p.getFunctionByName(v(this).data("ams-hidden-callback"));a&&a.call(o,this)});var l=v(".modal-dialog",o).data("hide-callbacks");if(l)for(e=0;e<l.length;e++)l[e].call(o);if(l=p.dialog._hide_callbacks)for(e=0;e<l.length;e++)l[e].call(o)}}}(jQuery,this);
+!function(a,e){var o=e.MyAMS,l=o;o.dialog={_shown_callbacks:[],registerShownCallback:function(a,e){var o;e&&(o=e.objectOrParentWithClass("modal-dialog"));var t;o&&o.exists()?void 0===(t=o.data("shown-callbacks"))&&(t=[],o.data("shown-callbacks",t)):t=l.dialog._shown_callbacks,t.indexOf(a)<0&&t.push(a)},_hide_callbacks:[],registerHideCallback:function(a,e){var o;e&&(o=e.objectOrParentWithClass("modal-dialog"));var t;o&&o.exists()?void 0===(t=o.data("hide-callbacks"))&&(t=[],o.data("hide-callbacks",t)):t=l.dialog._hide_callbacks,t.indexOf(a)<0&&t.push(a)},open:function(e,o,t){l.ajax.check(a.fn.modalmanager,l.baseURL+"ext/bootstrap-modalmanager"+l.devext+".js",function(){l.ajax.check(a.fn.modal.defaults,l.baseURL+"ext/bootstrap-modal"+l.devext+".js",function(s){s&&(a(document).off("click.modal"),a.fn.modal.defaults.spinner=a.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 d,i;if("string"==typeof e)d={},i=e;else{d=e.data(),i=e.attr("href")||d.amsUrl;var n=l.getFunctionByName(i);"function"==typeof n&&(i=n.call(e))}i&&(a("body").modalmanager("loading"),0===i.indexOf("#")?a(i).modal("show"):a.ajax({url:i,type:"get",cache:void 0!==d.amsAllowCache&&d.amsAllowCache,data:o,success:function(o,s,n){a("body").modalmanager("removeLoading");var c=l.ajax.getResponse(n),r=c.contentType,h=c.data;switch(r){case"json":l.ajax.handleJSON(h,a(a(e).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var m=a(h),g=a(".modal-dialog",m.wrap("<div></div>").parent()),f=g.data()||{},v={backdrop:"static",overflow:f.amsModalOverflow||".modal-viewport",maxHeight:void 0===f.amsModalMaxHeight?function(){return a(window).height()-a(".modal-header",m).outerHeight(!0)-a("footer",m).outerHeight(!0)-85}:l.getFunctionByName(f.amsModalMaxHeight)},p=a.extend({},v,f.amsModalOptions);p=l.executeFunctionByName(f.amsModalInitCallback,g,p)||p,t&&(t.shown&&l.dialog.registerShownCallback(t.shown,m),t.hide&&l.dialog.registerHideCallback(t.hide,m)),a("<div>").addClass("modal fade").append(m).modal(p).on("shown",l.dialog.shown).on("hidden",l.dialog.hidden),l.initContent(m),!1!==d.amsLogEvent&&l.stats.logPageview(i)}}}))})})},shown:function(e){function o(e){var o=a(".scrollmarker.top",s),l=s.scrollTop();l>0?o.show():o.hide();var t=a(".scrollmarker.bottom",s);d+l>=s.get(0).scrollHeight?t.hide():t.show()}var t=e.target,s=a(".modal-viewport",t);if(s.exists()){var d=parseInt(s.css("max-height")),i=a.scrollbarWidth();"hidden"!==s.css("overflow")&&s.height()===d?(a("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",s.width()-i).hide().appendTo(s),a("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",d-20).css("width",s.width()-i).appendTo(s),s.scroll(o),s.off("resize").on("resize",o)):a(".scrollmarker",s).remove()}a("[data-ams-shown-callback]",t).each(function(){var e=l.getFunctionByName(a(this).data("ams-shown-callback"));e&&e.call(t,this)});var n,c=a(".modal-dialog",t).data("shown-callbacks");if(c)for(n=0;n<c.length;n++)c[n].call(t);if(c=l.dialog._shown_callbacks)for(n=0;n<c.length;n++)c[n].call(t);l.form.setFocus(t)},close:function(e){"string"==typeof e&&(e=a(e));var o=e.parents(".modal").data("modal");if(o){var l=a("body").data("modalmanager");l&&l.getOpenModals().indexOf(o)>=0&&o.hide()}},hidden:function(e){var o=e.target;l.skin.cleanContainer(o),a("[data-ams-hidden-callback]",o).each(function(){var e=l.getFunctionByName(a(this).data("ams-hidden-callback"));e&&e.call(o,this)});var t,s=a(".modal-dialog",o).data("hide-callbacks");if(s)for(t=0;t<s.length;t++)s[t].call(o);if(s=l.dialog._hide_callbacks)for(t=0;t<s.length;t++)s[t].call(o)}}}(jQuery,this);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_skin/resources/js/myams-plugins-loader.min.js	Tue Nov 20 09:09:31 2018 +0100
@@ -0,0 +1,1 @@
+!function(f,a){var n=a.MyAMS,p=n;n.plugins={enabled:{},init:function(c){p.plugins.initData(c);var e=[];f("[data-ams-plugins-disabled]",c).each(function(){for(var a=f(this).data("ams-plugins-disabled").split(/\s+/),n=0;n<a.length;n++)e.push(a[n])});var l,i,s={};function r(a,n){if(s.hasOwnProperty(a)){var e=s[a];e.css=e.css||n.css,e.callbacks.push({callback:n.callback,context:n.context}),n.register&&(e.register=!0),!1===n.async&&(e.async=!1)}else s[a]={src:n.src,css:n.css,callbacks:[{callback:n.callback,context:n.context}],register:n.register,async:n.async};n.css&&p.getCSS(n.css,a+"_css")}function a(a){var n,e,s=i.callbacks;if(s&&s.length){for(n=0;n<s.length;n++)if((e=s[n]).callback=p.getFunctionByName(e.callback),!1!==i.register){var t=p.plugins.enabled;t.hasOwnProperty(l)?t[l].push(e):t[l]=[e]}}else!1!==i.register&&(p.plugins.enabled[l]=null);if(!0!==a&&s&&s.length&&!1!==i.async)for(n=0;n<s.length;n++)e=s[n],p.executeFunctionByName(e.callback,c,e.context)}function n(){var a=p.plugins.enabled[l];for(t=0;t<a.length;t++){var n=a[t];n&&n.context&&!p.isInDOM(n.context)&&(a[t]=null)}}for(l in f("[data-ams-plugins]",c).each(function(){var a=f(this),n=a.data("ams-plugins");if("string"==typeof n)for(var e=a.data("ams-plugins").split(/\s+/),s=0;s<e.length;s++){l=e[s];var t={src:a.data("ams-plugin-"+l+"-src"),css:a.data("ams-plugin-"+l+"-css"),callback:a.data("ams-plugin-"+l+"-callback"),context:a,register:a.data("ams-plugin-"+l+"-register"),async:a.data("ams-plugin-"+l+"-async")};r(l,t)}else for(l in n)n.hasOwnProperty(l)&&r(l,n[l])}),s)s.hasOwnProperty(l)&&(i=s[l],void 0===p.plugins.enabled[l]?p.getScript(i.src,a,{async:void 0===i.async||i.async}):(n(),a(!0)));for(var t in p.plugins.enabled)if(p.plugins.enabled.hasOwnProperty(t)&&!(0<=e.indexOf(t))){var o=p.plugins.enabled[t];if(o)switch(typeof o){case"function":o(c);break;default:for(var u=0;u<o.length;u++){var g=o[u];switch(typeof g){case"function":g(c);break;default:g&&g.callback&&g.callback(g.context)}}}}},initData:function(a){f("[data-ams-data]",a).each(function(){var a=f(this),n=a.data("ams-data");if(n)for(var e in n)if(n.hasOwnProperty(e)){var s=n[e];"string"!=typeof s&&(s=JSON.stringify(s)),a.attr("data-"+e,s)}})},register:function(n,e,s){if("function"==typeof e&&(s=e,e=null),e=e||n.name,0<=p.plugins.enabled.indexOf(e))console&&console.warn&&console.warn("Plugin "+e+" is already registered!");else if("object"==typeof n){var a=n.src;a?p.ajax.check(n.callback,a,function(a){a&&(p.plugins.enabled[e]=p.getFunctionByName(n.callback),n.css&&p.getCSS(n.css,e+"_css"),s&&p.executeFunctionByName(s))}):(p.plugins.enabled[e]=p.getFunctionByName(n.callback),n.css&&p.getCSS(n.css,e+"_css"),s&&p.executeFunctionByName(s))}else"function"==typeof n&&(p.plugins.enabled[e]=n,s&&p.executeFunctionByName(s))}}}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams-plugins.min.js	Mon Nov 19 15:20:20 2018 +0100
+++ b/src/pyams_skin/resources/js/myams-plugins.min.js	Tue Nov 20 09:09:31 2018 +0100
@@ -1,1 +1,1 @@
-!function(e,a){var t=a.MyAMS,n=t;t.plugins={init:function(a){function t(e,a){if(c.hasOwnProperty(e)){var t=c[e];t.css=t.css||a.css,t.callbacks.push({callback:a.callback,context:a.context}),a.register&&(t.register=!0),!1===a.async&&(t.async=!1)}else c[e]={src:a.src,css:a.css,callbacks:[{callback:a.callback,context:a.context}],register:a.register,async:a.async};a.css&&n.getCSS(a.css,e+"_css")}function s(e){var t,s,i=o.callbacks;if(i&&i.length){for(t=0;t<i.length;t++)if(s=i[t],s.callback=n.getFunctionByName(s.callback),!1!==o.register){var c=n.plugins.enabled;c.hasOwnProperty(r)?c[r].push(s):c[r]=[s]}}else!1!==o.register&&(n.plugins.enabled[r]=null);if(!0!==e&&i&&i.length&&!1!==o.async)for(t=0;t<i.length;t++)s=i[t],n.executeFunctionByName(s.callback,a,s.context)}n.plugins.initData(a);var i=[];e("[data-ams-plugins-disabled]",a).each(function(){for(var a=e(this).data("ams-plugins-disabled").split(/\s+/),t=0;t<a.length;t++)i.push(a[t])});var r,c={};e("[data-ams-plugins]",a).each(function(){var a=e(this),n=a.data("ams-plugins");if("string"==typeof n)for(var s=a.data("ams-plugins").split(/\s+/),i=0;i<s.length;i++){r=s[i];var c={src:a.data("ams-plugin-"+r+"-src"),css:a.data("ams-plugin-"+r+"-css"),callback:a.data("ams-plugin-"+r+"-callback"),context:a,register:a.data("ams-plugin-"+r+"-register"),async:a.data("ams-plugin-"+r+"-async")};t(r,c)}else for(r in n)n.hasOwnProperty(r)&&t(r,n[r])});var o;for(r in c)c.hasOwnProperty(r)&&(o=c[r],void 0===n.plugins.enabled[r]?n.getScript(o.src,s,{async:void 0===o.async||o.async}):(!function(){var e=n.plugins.enabled[r];for(l=0;l<e.length;l++){var a=e[l];a&&a.context&&!n.isInDOM(a.context)&&(e[l]=null)}}(),s(!0)));for(var l in n.plugins.enabled)if(n.plugins.enabled.hasOwnProperty(l)&&!(i.indexOf(l)>=0)){var m=n.plugins.enabled[l];if(m)switch(typeof m){case"function":m(a);break;default:for(var d=0;d<m.length;d++){var u=m[d];switch(typeof u){case"function":u(a);break;default:u&&u.callback&&u.callback(u.context)}}}}},initData:function(a){e("[data-ams-data]",a).each(function(){var a=e(this),t=a.data("ams-data");if(t)for(var n in t)if(t.hasOwnProperty(n)){var s=t[n];"string"!=typeof s&&(s=JSON.stringify(s)),a.attr("data-"+n,s)}})},register:function(e,a,t){if("function"==typeof a&&(t=a,a=null),a=a||e.name,n.plugins.enabled.indexOf(a)>=0)console&&console.warn&&console.warn("Plugin "+a+" is already registered!");else if("object"==typeof e){var s=e.src;s?n.ajax.check(e.callback,s,function(s){s&&(n.plugins.enabled[a]=n.getFunctionByName(e.callback),e.css&&n.getCSS(e.css,a+"_css"),t&&n.executeFunctionByName(t))}):(n.plugins.enabled[a]=n.getFunctionByName(e.callback),e.css&&n.getCSS(e.css,a+"_css"),t&&n.executeFunctionByName(t))}else"function"==typeof e&&(n.plugins.enabled[a]=e,t&&n.executeFunctionByName(t))},enabled:{svg:function(a){var t=e(".svg-container",a);t.length>0&&t.each(function(){var a=e(this),t=e("svg",a),n=t.attr("width"),s=t.attr("height");n&&s&&t.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(n))+" "+Math.round(parseFloat(s))),t.attr("width","100%").attr("height","auto")})},hint:function(a){var t=e(".hint:not(:parents(.nohints))",a);t.length>0&&n.ajax.check(e.fn.tipsy,n.baseURL+"ext/jquery-tipsy"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-tipsy"+n.devext+".css","jquery-tipsy",function(){t.each(function(){var a=e(this),t=a.data(),s={html:void 0===t.amsHintHtml?(a.attr("title")||"").startsWith("<"):t.amsHintHtml,title:n.getFunctionByName(t.amsHintTitleGetter)||function(){var a=e(this),n=a.attr("original-title")||a.attr(t.amsHintTitleAttr||"title")||(t.amsHintHtml?a.html():a.text());return n=n.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:t.amsHintOpacity||.95,gravity:t.amsHintGravity||"sw",offset:t.amsHintOffset||0},i=e.extend({},s,t.amsHintOptions);i=n.executeFunctionByName(t.amsHintInitCallback,a,i)||i;var r=a.tipsy(i);n.executeFunctionByName(t.amsHintAfterInitCallback,a,r,i)})})})},contextMenu:function(a){var t=e(".context-menu",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={menuSelector:t.amsContextmenuSelector,menuSelected:n.helpers.contextMenuHandler},i=e.extend({},s,t.amsContextmenuOptions);i=n.executeFunctionByName(t.amsContextmenuInitCallback,a,i)||i;var r=a.contextMenu(i);n.executeFunctionByName(t.amsContextmenuAfterInitCallback,a,r,i)})},switcher:function(a){e("LEGEND.switcher",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();n.amsSwitcher||(e('<i class="fa fa-fw"></i>').prependTo(e(this)).addClass("open"===n.amsSwitcherState?n.amsSwitcherMinusClass||"fa-minus":n.amsSwitcherPlusClass||"fa-plus"),a.on("click",function(s){s.preventDefault();var i={};if(a.trigger("ams.switcher.before-switch",[a,i]),!i.veto)if(t.hasClass("switched")){t.removeClass("switched"),e(".fa",a).removeClass(n.amsSwitcherPlusClass||"fa-plus").addClass(n.amsSwitcherMinusClass||"fa-minus"),a.trigger("ams.switcher.opened",[a]);var r=a.attr("id");r&&e('legend.switcher[data-ams-switcher-sync="'+r+'"]',t).each(function(){var a=e(this);a.parents("fieldset").hasClass("switched")&&a.click()})}else t.addClass("switched"),e(".fa",a).removeClass(n.amsSwitcherMinusClass||"fa-minus").addClass(n.amsSwitcherPlusClass||"fa-plus"),a.trigger("ams.switcher.closed",[a])}),"open"!==n.amsSwitcherState&&t.addClass("switched"),a.data("ams-switcher","on"))})},checker:function(a){e("LEGEND.checker",a).each(function(){var a=e(this),t=a.parent("fieldset"),s=a.data();if(!s.amsChecker){var i=e('<label class="checkbox"></label>'),r=s.amsCheckerFieldname||"checker_"+n.generateId(),c=r.replace(/\./,"_"),o=s.amsCheckerHiddenPrefix,l=null,m=s.amsCheckerHiddenValueOn||"true",d=s.amsCheckerHiddenValueOff||"false",u=s.amsCheckerMarker||!1;o?l=e('<input type="hidden">').attr("name",o+r).val("on"===s.amsCheckerState?m:d).prependTo(a):u&&e('<input type="hidden">').attr("name",u).attr("value",1).prependTo(a);var b=e('<input type="checkbox">').attr("name",r).attr("id",c).data("ams-checker-hidden-input",l).data("ams-checker-init",!0).val(s.amsCheckerValue||!0).attr("checked","on"===s.amsCheckerState?"checked":null);s.amsCheckerReadonly?b.attr("disabled","disabled"):b.on("change",function(i){i.preventDefault();var r={},c=e(this).is(":checked");if(a.trigger("ams.checker.before-switch",[a,r]),r.veto)e(this).prop("checked",!c);else if(n.executeFunctionByName(s.amsCheckerChangeHandler,a,c),!s.amsCheckerCancelDefault){var o=b.data("ams-checker-hidden-input");c?("disable"===s.amsCheckerMode?(t.removeAttr("disabled"),e(".select2",t).removeAttr("disabled")):t.removeClass("switched"),o&&o.val(m),e("[data-required]",t).attr("required","required"),a.trigger("ams.checker.opened",[a])):("disable"===s.amsCheckerMode?(t.prop("disabled","disabled"),e(".select2",t).attr("disabled","disabled")):t.addClass("switched"),o&&o.val(d),e("[data-required]",t).removeAttr("required"),a.trigger("ams.checker.closed",[a]))}}),b.appendTo(i),e(">label",a).attr("for",b.attr("id")),i.append("<i></i>").prependTo(a);var h=e("[required]",t);h.attr("data-required",!0),"on"===s.amsCheckerState?b.attr("checked",!0):("disable"===s.amsCheckerMode?(t.attr("disabled","disabled"),e(".select2",t).attr("disabled","disabled")):t.addClass("switched"),h.removeAttr("required")),a.data("ams-checker","on")}})},slider:function(a){var t=e(".slider",a);t.length>0&&n.ajax.check(e.fn.slider,n.baseURL+"ext/bootstrap-slider-2.0.0"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s=e.extend({},{},a.data.amsSliderOptions);s=n.executeFunctionByName(t.amsSliderInitCallback,a,s)||s;var i=a.slider(s);n.executeFunctionByName(t.amsSliderAfterInitCallback,a,i,s)})})},draggable:function(a){var t=e(".draggable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={cursor:t.amsDraggableCursor||"move",containment:t.amsDraggableContainment,handle:t.amsDraggableHandle,connectToSortable:t.amsDraggableConnectSortable,helper:n.getFunctionByName(t.amsDraggableHelper)||t.amsDraggableHelper,start:n.getFunctionByName(t.amsDraggableStart),stop:n.getFunctionByName(t.amsDraggableStop)},i=e.extend({},s,t.amsDraggableOptions);i=n.executeFunctionByName(t.amsDraggableInitCallback,a,i)||i;var r=a.draggable(i);a.disableSelection(),n.executeFunctionByName(t.amsDraggableAfterInitCallback,a,r,i)})},droppable:function(a){var t=e(".droppable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={accept:t.amsdroppableAccept,drop:n.getFunctionByName(t.amsDroppableDrop)},i=e.extend({},s,t.amsDroppableOptions);i=n.executeFunctionByName(t.amsDroppableInitCallback,a,i)||i;var r=a.droppable(i);n.executeFunctionByName(t.amsDroppableAfterInitCallback,a,r,i)})},sortable:function(a){var t=e(".sortable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={items:t.amsSortableItems,handle:t.amsSortableHandle,helper:t.amsSortableHelper,connectWith:t.amsSortableConnectwith,start:n.getFunctionByName(t.amsSortableStart),over:n.getFunctionByName(t.amsSortableOver),containment:t.amsSortableContainment,placeholder:t.amsSortablePlaceholder,stop:n.getFunctionByName(t.amsSortableStop)},i=e.extend({},s,t.amsSortableOptions);i=n.executeFunctionByName(t.amsSortableInitCallback,a,i)||i;var r=a.sortable(i);a.disableSelection(),n.executeFunctionByName(t.amsSortableAfterInitCallback,a,r,i)})},resizable:function(a){var t=e(".resizable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={autoHide:!1===t.amsResizableAutohide||t.amsResizableAutohide,containment:t.amsResizableContainment,grid:t.amsResizableGrid,handles:t.amsResizableHandles,start:n.getFunctionByName(t.amsResizableStart),stop:n.getFunctionByName(t.amsResizableStop)},i=e.extend({},s,t.amsResizableOptions);i=n.executeFunctionByName(t.amsResizableInitCallback,a,i)||i;var r=a.resizable(i);a.disableSelection(),n.executeFunctionByName(t.amsResizableAfterInitCallback,a,r,i)})},typeahead:function(a){var t=e(".typeahead",a);t.length>0&&n.ajax.check(e.fn.typeahead,n.baseURL+"ext/jquery-typeahead"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s=e.extend({},{},t.amsTypeaheadOptions);s=n.executeFunctionByName(t.amsTypeaheadInitCallback,a,s)||s;var i=a.typeahead(s);n.executeFunctionByName(t.amsTypeaheadAfterInitCallback,a,i,s)})})},treeview:function(a){var t=e(".treeview",a);t.length>0&&n.ajax.check(e.fn.treview,n.baseURL+"ext/bootstrap-treeview"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/bootstrap-treeview"+n.devext+".css","bootstrap-treeview",function(){t.each(function(){var a=e(this),t=a.data(),s={data:t.amsTreeviewData,levels:t.amsTreeviewLevels,injectStyle:t.amsTreeviewInjectStyle,expandIcon:t.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:t.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:t.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:t.amsTreeviewNodeIcon,selectedIcon:t.amsTreeviewSelectedIcon,checkedIcon:t.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:t.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:t.amsTreeviewColor,backColor:t.amsTreeviewBackColor,borderColor:t.amsTreeviewBorderColor,onHoverColor:t.amsTreeviewHoverColor,selectedColor:t.amsTreeviewSelectedColor,selectedBackColor:t.amsTreeviewSelectedBackColor,unselectableColor:t.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:t.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:t.amsTreeviewEnableLinks,highlightSelected:t.amsTreeviewHighlightSelected,highlightSearchResults:t.amsTreeviewhighlightSearchResults,showBorder:t.amsTreeviewShowBorder,showIcon:t.amsTreeviewShowIcon,showCheckbox:t.amsTreeviewShowCheckbox,showTags:t.amsTreeviewShowTags,toggleUnselectable:t.amsTreeviewToggleUnselectable,multiSelect:t.amsTreeviewMultiSelect,onNodeChecked:n.getFunctionByName(t.amsTreeviewNodeChecked),onNodeCollapsed:n.getFunctionByName(t.amsTreeviewNodeCollapsed),onNodeDisabled:n.getFunctionByName(t.amsTreeviewNodeDisabled),onNodeEnabled:n.getFunctionByName(t.amsTreeviewNodeEnabled),onNodeExpanded:n.getFunctionByName(t.amsTreeviewNodeExpanded),onNodeSelected:n.getFunctionByName(t.amsTreeviewNodeSelected),onNodeUnchecked:n.getFunctionByName(t.amsTreeviewNodeUnchecked),onNodeUnselected:n.getFunctionByName(t.amsTreeviewNodeUnselected),onSearchComplete:n.getFunctionByName(t.amsTreeviewSearchComplete),onSearchCleared:n.getFunctionByName(t.amsTreeviewSearchCleared)},i=e.extend({},s,t.amsTreeviewOptions);i=n.executeFunctionByName(t.amsTreeviewInitcallback,a,i)||i;var r=a.treeview(i);n.executeFunctionByName(t.amsTreeviewAfterInitCallback,a,r,i)})})})},select2:function(a){var t=e(".select2",a);t.length>0&&n.ajax.check(e.fn.select2,n.baseURL+"ext/jquery-select2-3.5.4"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data();if(!t.select2){var s={placeholder:t.amsSelect2Placeholder,multiple:t.amsSelect2Multiple,minimumInputLength:t.amsSelect2MinimumInputLength||0,maximumSelectionSize:t.amsSelect2MaximumSelectionSize,openOnEnter:void 0===t.amsSelect2EnterOpen||t.amsSelect2EnterOpen,allowClear:void 0===t.amsSelect2AllowClear||t.amsSelect2AllowClear,width:t.amsSelect2Width||"100%",initSelection:n.getFunctionByName(t.amsSelect2InitSelection),formatSelection:void 0===t.amsSelect2FormatSelection?n.helpers.select2FormatSelection:n.getFunctionByName(t.amsSelect2FormatSelection),formatResult:n.getFunctionByName(t.amsSelect2FormatResult),formatMatches:void 0===t.amsSelect2FormatMatches?function(e){return 1===e?n.i18n.SELECT2_MATCH:e+n.i18n.SELECT2_MATCHES}:n.getFunctionByName(t.amsSelect2FormatMatches),formatNoMatches:void 0===t.amsSelect2FormatResult?function(e){return n.i18n.SELECT2_NOMATCHES}:n.getFunctionByName(t.amsSelect2FormatResult),formatInputTooShort:void 0===t.amsSelect2FormatInputTooShort?function(e,a){var t=a-e.length;return n.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":n.i18n.SELECT2_PLURAL)}:n.getFunctionByName(t.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===t.amsSelect2FormatInputTooLong?function(e,a){var t=e.length-a;return n.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":n.i18n.SELECT2_PLURAL)}:n.getFunctionByName(t.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===t.amsSelect2FormatSelectionTooBig?function(e){return n.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":n.i18n.SELECT2_PLURAL)}:n.getFunctionByName(t.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===t.amsSelect2FormatLoadMore?function(e){return n.i18n.SELECT2_LOADMORE}:n.getFunctionByName(t.amsSelect2FormatLoadMore),formatSearching:void 0===t.amsSelect2FormatSearching?function(){return n.i18n.SELECT2_SEARCHING}:n.getFunctionByName(t.amsSelect2FormatSearching),separator:t.amsSelect2Separator||",",tokenSeparators:t.amsSelect2TokensSeparators||[","],tokenizer:n.getFunctionByName(t.amsSelect2Tokenizer)};switch(a.context.type){case"text":case"hidden":if(!s.initSelection){var i=a.data("ams-select2-values");i&&(s.initSelection=function(a,t){var n=[];e(a.val().split(s.separator)).each(function(){n.push({id:this,text:i[this]||this})}),t(n)})}}a.attr("readonly")?"hidden"===a.attr("type")&&(s.query=function(){return[]}):t.amsSelect2Query?(s.query=n.getFunctionByName(t.amsSelect2Query),s.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2QueryUrl?(s.ajax={url:t.amsSelect2QueryUrl,quietMillis:t.amsSelect2QuietMillis||200,type:t.amsSelect2QueryType||"POST",dataType:t.amsSelect2QueryDatatype||"json",data:function(a,n,s){var i={};return i[t.amsSelect2QueryParamName||"query"]=a,i[t.amsSelect2PageParamName||"page"]=n,i[t.amsSelect2ContextParamName||"context"]=s,e.extend({},i,t.amsSelect2QueryOptions)},results:n.helpers.select2QueryUrlResultsCallback},s.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2QueryMethod?(s.query=function(s){var i={id:(new Date).getTime(),params:t.amsSelect2QueryParams||{},success:function(e){return n.helpers.select2QueryMethodSuccessCallback.call(a,e,"success",s)},error:n.error.show};i.params[t.amsSelect2QueryParamName||"query"]=s.term,i.params[t.amsSelect2PageParamName||"page"]=s.page,i.params[t.amsSelect2ContextParamName||"context"]=s.context,i=e.extend({},i,t.amsSelect2QueryOptions),i=n.executeFunctionByName(t.amsSelect2QueryInitCallback,a,i)||i,n.ajax.check(e.jsonRPC,n.baseURL+"ext/jquery-jsonrpc"+n.devext+".js",function(){e.jsonRPC.withOptions({endPoint:t.amsSelect2MethodTarget||n.jsonrpc.getAddr(),namespace:t.amsSelect2MethodNamespace,cache:!1},function(){e.jsonRPC.request(t.amsSelect2QueryMethod,i)})})},s.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2Tags?s.tags=t.amsSelect2Tags:t.amsSelect2Data&&(s.data=t.amsSelect2Data),t.amsSelect2EnableFreeTags&&(s.createSearchChoice=function(e){return{id:e,text:(t.amsSelect2FreeTagsPrefix||n.i18n.SELECT2_FREETAG_PREFIX)+e}});var r=e.extend({},s,t.amsSelect2Options);r=n.executeFunctionByName(t.amsSelect2InitCallback,a,r)||r;var c=a.select2(r);n.executeFunctionByName(t.amsSelect2AfterInitCallback,a,c,r),a.hasClass("ordered")&&n.ajax.check(e.fn.select2Sortable,n.baseURL+"ext/jquery-select2-sortable"+n.devext+".js",function(){a.select2Sortable({bindOrder:"sortableStop"})}),a.on("change",function(){void 0!==e(a.get(0).form).data("validator")&&e(a).valid()})}})})},maskedit:function(a){var t=e("[data-mask]",a);t.length>0&&n.ajax.check(e.fn.mask,n.baseURL+"ext/jquery-maskedinput-1.4.1"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s={placeholder:void 0===t.amsMaskeditPlaceholder?"X":t.amsMaskeditPlaceholder,complete:n.getFunctionByName(t.amsMaskeditComplete)},i=e.extend({},s,t.amsMaskeditOptions);i=n.executeFunctionByName(t.amsMaskeditInitCallback,a,i)||i;var r=a.mask(a.attr("data-mask"),i);n.executeFunctionByName(t.amsMaskeditAfterInitCallback,a,r,i)})})},inputmask:function(a){var t=e("input[data-input-mask]",a);t.length>0&&n.ajax.check(e.fn.inputmask,n.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+n.devext+".js",function(){t.each(function(){var a,t=e(this),s=t.data();a="object"==typeof s.inputMask?s.inputMask:{mask:s.inputMask.toString()};var i=e.extend({},a,s.amsInputmaskOptions);i=n.executeFunctionByName(s.amsInputmaskInitCallback,t,i)||i;var r=t.inputmask(i);n.executeFunctionByName(s.amsInputmaskAfterInitCallback,t,r,i)})})},datepicker:function(a){var t=e(".datepicker",a);t.length>0&&n.ajax.check(e.fn.datetimepicker,n.baseURL+"ext/jquery-datetimepicker"+n.devext+".js",function(a){a&&n.dialog.registerHideCallback(n.helpers.datetimepickerDialogHiddenCallback),n.getCSS(n.baseURL+"../css/ext/jquery-datetimepicker"+n.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),s={lang:t.amsDatetimepickerLang||n.lang,format:t.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,weeks:t.amsDatetimepickerWeeks},i=e.extend({},s,t.amsDatetimepickerOptions);i=n.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);n.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},datetimepicker:function(a){var t=e(".datetimepicker",a);t.length>0&&n.ajax.check(e.fn.datetimepicker,n.baseURL+"ext/jquery-datetimepicker"+n.devext+".js",function(a){a&&n.dialog.registerHideCallback(n.helpers.datetimepickerDialogHiddenCallback),n.getCSS(n.baseURL+"../css/ext/jquery-datetimepicker"+n.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),s={lang:t.amsDatetimepickerLang||n.lang,format:t.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,weeks:t.amsDatetimepickerWeeks},i=e.extend({},s,t.amsDatetimepickerOptions);i=n.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);n.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},timepicker:function(a){var t=e(".timepicker",a);t.length>0&&n.ajax.check(e.fn.datetimepicker,n.baseURL+"ext/jquery-datetimepicker"+n.devext+".js",function(a){a&&n.dialog.registerHideCallback(n.helpers.datetimepickerDialogHiddenCallback),n.getCSS(n.baseURL+"../css/ext/jquery-datetimepicker"+n.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),s={lang:t.amsDatetimepickerLang||n.lang,format:t.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect},i=e.extend({},s,t.amsDatetimepickerOptions);i=n.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);n.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},colorpicker:function(a){var t=e(".colorpicker",a);t.length>0&&n.ajax.check(e.fn.minicolors,n.baseURL+"ext/jquery-minicolors"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-minicolors"+n.devext+".css","jquery-minicolors",function(){t.each(function(){var a=e(this),t=a.data(),s={position:t.amsColorpickerPosition||a.closest(".input").data("ams-colorpicker-position")||"bottom left"},i=e.extend({},s,t.amsColorpickerOptions);i=n.executeFunctionByName(t.amsColorpickerInitCallback,a,i)||i;var r=a.minicolors(i);n.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},dndupload:function(a){var t=e(".dndupload",a);t.length>0&&n.ajax.check(e.fn.dndupload,n.baseURL+"ext/jquery-dndupload"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-dndupload"+n.devext+".css","jquery-dndupload",function(){t.each(function(){var a=e(this),t=a.data(),s={action:t.amsDnduploadAction||a.attr("action")||"upload-files",fieldname:t.amsDnduploadFieldname||"files",autosubmit:t.amsDnduploadAutosubmit},i=e.extend({},s,t.amsDnduploadOptions);i=n.executeFunctionByName(t.amsDnduploadInitCallback,a,i)||i;var r=a.dndupload(i);n.executeFunctionByName(t.amsDnduploadAfterInitcallback,a,r,i)})})})},validate:function(a){var t=e("FORM:not([novalidate])",a);t.length>0&&n.ajax.check(e.fn.validate,n.baseURL+"ext/jquery-validate-1.17.0"+n.devext+".js",function(a){if(a&&(e.validator.setDefaults({highlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),n.plugins.i18n)){for(var s in n.plugins.i18n.validate)if(n.plugins.i18n.validate.hasOwnProperty(s)){var i=n.plugins.i18n.validate[s];"string"==typeof i&&i.indexOf("{0}")>-1&&(n.plugins.i18n.validate[s]=e.validator.format(i))}e.extend(e.validator.messages,n.plugins.i18n.validate)}t.each(function(){var a=e(this),t=a.data(),s={ignore:null,submitHandler:void 0!==a.attr("data-async")?void 0===t.amsFormSubmitHandler?function(){return e(".state-error",a).removeClass("state-error"),n.ajax.check(e.fn.ajaxSubmit,n.baseURL+"ext/jquery-form-3.49"+n.devext+".js"),n.form.submit(a)}:n.getFunctionByName(t.amsFormSubmitHandler):void 0,invalidHandler:void 0!==a.attr("data-async")?void 0===t.amsFormInvalidHandler?function(t,n){e(".state-error",a).removeClass("state-error");for(var s=0;s<n.errorList.length;s++){var i=n.errorList[s],r=e(i.element).parents(".tab-pane").index()+1;if(r>0){var c=e(".nav-tabs",e(i.element).parents(".tabforms"));e("li:nth-child("+r+")",c).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",c).click()}}}:n.getFunctionByName(t.amsFormInvalidHandler):void 0};e("[data-ams-validate-rules]",a).each(function(a){0===a&&(s.rules={}),s.rules[e(this).attr("name")]=e(this).data("ams-validate-rules")});var i=e.extend({},s,t.amsValidateOptions);i=n.executeFunctionByName(t.amsValidateInitCallback,a,i)||i;var r=a.validate(i);n.executeFunctionByName(t.amsValidateAfterInitCallback,a,r,i)})})},datatable:function(a){var t=e(".datatable",a);t.length>0&&n.ajax.check(e.fn.dataTable,n.baseURL+"ext/jquery-dataTables-1.9.4"+n.devext+".js",function(){n.ajax.check(e.fn.dataTableExt.oPagination.bootstrap_full,n.baseURL+"myams-dataTables"+n.devext+".js",function(){e(t).each(function(){var a,t=e(this),s=t.data(),i=(s.amsDatatableExtensions||"").split(/\s+/),r=s.amsDatatableSdom||"W"+(i.indexOf("colreorder")>=0||i.indexOf("colreorderwithresize")>=0?"R":"")+"<'dt-top-row'"+(i.indexOf("colvis")>=0?"C":"")+(!1===s.amsDatatablePagination||!1===s.amsDatatablePaginationSize?"":"L")+(!1===s.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(i.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===s.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",c=s.amsDatatableSorting;if("string"==typeof c){var o=c.split(";");for(c=[],a=0;a<o.length;a++){var l=o[a].split(",");l[0]=parseInt(l[0]),c.push(l)}}var m,d=[],u=e("th",t).listattr("data-ams-datatable-sortable");for(a=0;a<u.length;a++){var b=u[a];void 0!==b?((m=d[a]||{}).bSortable="string"==typeof b?JSON.parse(b):b,d[a]=m):d[a]=d[a]||{}}var h=e("th",t).listattr("data-ams-datatable-stype");for(a=0;a<h.length;a++){var p=h[a];p?((m=d[a]||{}).sType=p,d[a]=m):d[a]=d[a]||{}}var f={bJQueryUI:!1,bServerSide:s.amsDatatableServerSide||!1,sAjaxSource:!0===s.amsDatatableServerSide?s.amsDatatableAjaxSource:void 0,sServerMethod:!0===s.amsDatatableServerSide?"POST":void 0,bFilter:!1!==s.amsDatatableGlobalFilter||i.indexOf("columnfilter")>=0,bPaginate:!1!==s.amsDatatablePagination,bInfo:!1!==s.amsDatatableInfo,bSort:!1!==s.amsDatatableSort,aaSorting:c,aoColumns:d.length>0?d:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:s.amsDatatableDisplayLength||25,sPaginationType:s.amsDatatablePaginationType||"bootstrap_full",sDom:r,oLanguage:n.plugins.i18n.datatables,fnInitComplete:function(a,t){e(".ColVis_Button").addClass("btn btn-default btn-sm").html((n.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},g=e.extend({},f,s.amsDatatableOptions),v=[],y=[],x=[];if(i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":v.push(e.fn.dataTable.AutoFill),y.push(n.baseURL+"ext/jquery-dataTables-autoFill"+n.devext+".js");break;case"columnfilter":v.push(e.fn.columnFilter),y.push(n.baseURL+"ext/jquery-dataTables-columnFilter"+n.devext+".js");break;case"colreorder":v.push(e.fn.dataTable.ColReorder),y.push(n.baseURL+"ext/jquery-dataTables-colReorder"+n.devext+".js");break;case"colreorderwithresize":v.push(window.ColReorder),y.push(n.baseURL+"ext/jquery-dataTables-colReorderWithResize"+n.devext+".js");break;case"colvis":v.push(e.fn.dataTable.ColVis),y.push(n.baseURL+"ext/jquery-dataTables-colVis"+n.devext+".js"),x.push(function(){g.oColVis=e.extend({},{activate:"click",sAlign:"right"},s.amsDatatableColvisOptions)});break;case"editable":v.push(e.fn.editable),y.push(n.baseURL+"ext/jquery-jeditable"+n.devext+".js"),v.push(e.fn.makeEditable),y.push(n.baseURL+"ext/jquery-dataTables-editable"+n.devext+".js");break;case"fixedcolumns":v.push(e.fn.dataTable.FixedColumns),y.push(n.baseURL+"ext/jquery-dataTables-fixedColumns"+n.devext+".js");break;case"fixedheader":v.push(e.fn.dataTable.Fixedheader),y.push(n.baseURL+"ext/jquery-dataTables-fixedHeader"+n.devext+".js");break;case"keytable":v.push(window.keyTable),y.push(n.baseURL+"ext/jquery-dataTables-keyTable"+n.devext+".js");break;case"rowgrouping":v.push(e.fn.rowGrouping),y.push(n.baseURL+"ext/jquery-dataTables-rowGrouping"+n.devext+".js");break;case"rowreordering":v.push(e.fn.rowReordering),y.push(n.baseURL+"ext/jquery-dataTables-rowReordering"+n.devext+".js");break;case"scroller":v.push(e.fn.dataTable.Scroller),y.push(n.baseURL+"ext/jquery-dataTables-scroller"+n.devext+".js")}x.push(function(){g=n.executeFunctionByName(s.amsDatatableInitCallback,t,g)||g;try{var r=t.dataTable(g);if(n.executeFunctionByName(s.amsDatatableAfterInitCallback,t,r,g),i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":var c=e.extend({},s.amsDatatableAutofillOptions,g.autofill);c=n.executeFunctionByName(s.amsDatatableAutofillInitCallback,t,c)||c,t.data("ams-autofill",void 0===s.amsDatatableAutofillConstructor?new e.fn.dataTable.AutoFill(t,c):n.executeFunctionByName(s.amsDatatableAutofillConstructor,t,r,c));break;case"columnfilter":var o=e.extend({},{sPlaceHolder:"head:after"},s.amsDatatableColumnfilterOptions,g.columnfilter);o=n.executeFunctionByName(s.amsDatatableColumnfilterInitCallback,t,o)||o,t.data("ams-columnfilter",void 0===s.amsDatatableColumnfilterConstructor?r.columnFilter(o):n.executeFunctionByName(s.amsDatatableColumnfilterConstructor,t,r,o));break;case"editable":var l=e.extend({},s.amsDatatableEditableOptions,g.editable);l=n.executeFunctionByName(s.amsDatatableEditableInitCallback,t,l)||l,t.data("ams-editable",void 0===s.amsDatatableEditableConstructor?t.makeEditable(l):n.executeFunctionByName(s.amsDatatableEditableConstructor,t,r,l));break;case"fixedcolumns":var m=e.extend({},s.amsDatatableFixedcolumnsOptions,g.fixedcolumns);m=n.executeFunctionByName(s.amsDatatableFixedcolumnsInitCallback,t,m)||m,t.data("ams-fixedcolumns",void 0===s.amsDatatableFixedcolumnsConstructor?new e.fn.dataTable.FixedColumns(t,m):n.executeFunctionByName(s.amsDatatableFixedcolumnsConstructor,t,r,m));break;case"fixedheader":var d=e.extend({},s.amsDatatableFixedheaderOptions,g.fixedheader);d=n.executeFunctionByName(s.amsDatatableFixedheadeInitCallback,t,d)||d,t.data("ams-fixedheader",void 0===s.amsDatatableFixedheaderConstructor?new e.fn.dataTable.FixedHeader(t,d):n.executeFunctionByName(s.amsDatatableFixedheaderConstructor,t,r,d));break;case"keytable":var u={table:t.get(0),datatable:r},b=e.extend({},u,s.amsDatatableKeytableOptions,g.keytable);b=n.executeFunctionByName(s.amsDatatableKeytableInitCallback,t,b)||b,t.data("ams-keytable",void 0===s.amsDatatableKeytableConstructor?new KeyTable(b):n.executeFunctionByName(s.amsDatatableKeytableConstructor,t,r,b));break;case"rowgrouping":var h=e.extend({},s.amsDatatableRowgroupingOptions,g.rowgrouping);h=n.executeFunctionByName(s.amsDatatableRowgroupingInitCallback,t,h)||h,t.data("ams-rowgrouping",void 0===s.amsDatatableRowgroupingConstructor?t.rowGrouping(h):n.executeFunctionByName(s.amsDatatableRowgroupingConstructor,t,r,h));break;case"rowreordering":var p=e.extend({},s.amsDatatableRowreorderingOptions,g.rowreordering);p=n.executeFunctionByName(s.amsDatatableRowreorderingInitCallback,t,p)||p,t.data("ams-rowreordering",void 0===s.amsDatatableRowreorderingConstructor?t.rowReordering(p):n.executeFunctionByName(s.amsDatatableRowreorderingConstructor,t,r,p))}if(s.amsDatatableFinalizeCallback){var f=s.amsDatatableFinalizeCallback.split(/\s+/);if(f.length>0)for(a=0;a<f.length;a++)n.executeFunctionByName(f[a],t,r,g)}}catch(e){}}),n.ajax.check(v,y,x)})})})},tablednd:function(a){var t=e(".table-dnd",a);t.length>0&&n.ajax.check(e.fn.tableDnD,n.baseURL+"ext/jquery-tablednd"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data();t.amsTabledndDragHandle?e("tr",a).addClass("no-drag-handle"):e(a).on("mouseover","tr",function(){e(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){e(this.cells[0]).removeClass("drag-handle")});var s={onDragClass:t.amsTabledndDragClass||"dragging-row",onDragStart:n.getFunctionByName(t.amsTabledndDragStart),dragHandle:t.amsTabledndDragHandle,scrollAmount:t.amsTabledndScrollAmount,onAllowDrop:t.amsTabledndAllowDrop,onDrop:n.getFunctionByName(t.amsTabledndDrop)||function(s,i){var r=t.amsTabledndDropTarget;if(r){e(i).data("ams-disabled-handlers","click");try{var c=[];e(s.rows).each(function(){var a=e(this).data("ams-element-name");a&&c.push(a)});var o=n.getFunctionByName(r);if("function"==typeof o)o.call(a,s,c);else{if(!r.startsWith(window.location.protocol)){var l=t.amsLocation;l&&(r=l+"/"+r)}n.ajax.post(r,{names:JSON.stringify(c)})}}finally{setTimeout(function(){e(i).removeData("ams-disabled-handlers")},50)}}return!1}},i=e.extend({},s,t.amsTabledndOptions);i=n.executeFunctionByName(t.amsTabledndInitCallback,a,i)||i;var r=a.tableDnD(i);n.executeFunctionByName(t.amsTabledndAfterInitCallback,a,r,i)})})},wizard:function(a){var t=e(".wizard",a);t.length>0&&n.ajax.check(e.fn.bootstrapWizard,n.baseURL+"ext/bootstrap-wizard-1.4.2"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s={withVisible:void 0===t.amsWizardWithVisible||t.amsWizardWithVisible,tabClass:t.amsWizardTabClass,firstSelector:t.amsWizardFirstSelector,previousSelector:t.amsWizardPreviousSelector,nextSelector:t.amsWizardNextSelector,lastSelector:t.amsWizardLastSelector,finishSelector:t.amsWizardFinishSelector,backSelector:t.amsWizardBackSelector,onInit:n.getFunctionByName(t.amsWizardInit),onShow:n.getFunctionByName(t.amsWizardShow),onNext:n.getFunctionByName(t.amsWizardNext),onPrevious:n.getFunctionByName(t.amsWizardPrevious),onFirst:n.getFunctionByName(t.amsWizardFirst),onLast:n.getFunctionByName(t.amsWizardLast),onBack:n.getFunctionByName(t.amsWizardBack),onFinish:n.getFunctionByName(t.amsWizardFinish),onTabChange:n.getFunctionByName(t.amsWizardTabChange),onTabClick:n.getFunctionByName(t.amsWizardTabClick),onTabShow:n.getFunctionByName(t.amsWizardTabShow)},i=e.extend({},s,t.amsWizardOptions);i=n.executeFunctionByName(t.amsWizardInitCallback,a,i)||i;var r=a.bootstrapWizard(i);n.executeFunctionByName(t.amsWizardAfterInitCallback,a,r,i)})})},tinymce:function(a){function t(){e(".tinymce",e(this)).each(function(){var a=tinymce.get(e(this).attr("id"));a&&a.remove()})}var s=e(".tinymce",a);if(s.length>0){var i=n.baseURL+"ext/tinymce"+(n.devmode?"/dev":"");n.ajax.check(window.tinymce,i+"/tinymce"+n.devext+".js",function(a){function r(){s.each(function(){var a=e(this),t=a.data(),s={theme:t.amsTinymceTheme||"modern",language:n.lang,menubar:!1!==t.amsTinymceMenubar,statusbar:!1!==t.amsTinymceStatusbar,plugins:t.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:t.amsTinymceToolbar,toolbar1:!1!==t.amsTinymceToolbar1&&(t.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==t.amsTinymceToolbar2&&(t.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:t.amsTinymceContentCss,formats:t.amsTinymceFormats,style_formats:t.amsTinymceStyleFormats,block_formats:t.amsTinymceBlockFormats,valid_classes:t.amsTinymceValidClasses,image_advtab:!0,image_list:n.getFunctionByName(t.amsTinymceImageList)||t.amsTinymceImageList,image_class_list:t.amsTinymceImageClassList,link_list:n.getFunctionByName(t.amsTinymceLinkList)||t.amsTinymceLinkList,link_class_list:t.amsTinymceLinkClassList,paste_as_text:void 0===t.amsTinymcePasteAsText||t.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===t.amsTinymcePasteAutoCleanup||t.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:t.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===t.amsTinymcePaseRemoveSpans||t.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===t.amsTinymcePasteRemoveStyles||t.amsTinymcePasteRemoveStyles,height:t.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(t.amsTinymceExternalPlugins){var i=t.amsTinymceExternalPlugins.split(/\s+/);for(var r in i)if(i.hasOwnProperty(r)){var c=a.data("ams-tinymce-plugin-"+i[r]);tinymce.PluginManager.load(i[r],n.getSource(c))}}var o=e.extend({},s,t.amsTinymceOptions);o=n.executeFunctionByName(t.amsTinymceInitCallback,a,o)||o;var l=a.tinymce(o);n.executeFunctionByName(t.amsTinymceAfterInitCallback,a,l,o)})}a?n.getScript(i+"/jquery.tinymce"+n.devext+".js",function(){tinymce.baseURL=i,tinymce.suffix=n.devext,n.skin.registerCleanCallback(t),r()}):r()})}},imgareaselect:function(a){var t=e(".imgareaselect",a);t.length>0&&n.ajax.check(e.fn.imgAreaSelect,n.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-imgareaselect"+n.devext+".css","jquery-imgareaselect",function(){t.each(function(){var a=e(this),t=a.data(),s=t.amsImgareaselectParent?a.parents(t.amsImgareaselectParent):"body",i={instance:!0,handles:!0,parent:s,x1:t.amsImgareaselectX1||0,y1:t.amsImgareaselectY1||0,x2:t.amsImgareaselectX2||t.amsImgareaselectImageWidth,y2:t.amsImgareaselectY2||t.amsImgareaselectImageHeight,imageWidth:t.amsImgareaselectImageWidth,imageHeight:t.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:t.amsImgareaselectRatio,onSelectEnd:n.getFunctionByName(t.amsImgareaselectSelectEnd)||function(a,n){var i=t.amsImgareaselectTargetField||"image_";e('input[name="'+i+'x1"]',s).val(n.x1),e('input[name="'+i+'y1"]',s).val(n.y1),e('input[name="'+i+'x2"]',s).val(n.x2),e('input[name="'+i+'y2"]',s).val(n.y2)}},r=e.extend({},i,t.amsImgareaselectOptions);r=n.executeFunctionByName(t.amsImgareaselectInitCallback,a,r)||r;var c=a.imgAreaSelect(r);n.executeFunctionByName(t.amsImgareaselectAfterInitCallback,a,c,r),setTimeout(function(){c.update()},250)})})})},fancybox:function(a){var t=e(".fancybox",a);t.length>0&&n.ajax.check(e.fn.fancybox,n.baseURL+"ext/jquery-fancybox-2.1.5"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-fancybox-2.1.5"+n.devext+".css","jquery-fancybox",function(){t.each(function(){var a,t=e(this),s=t.data(),i=t;s.amsFancyboxElements&&(i=e(s.amsFancyboxElements,t));var r=(s.amsFancyboxHelpers||"").split(/\s+/);if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":n.ajax.check(e.fancybox.helpers.buttons,n.baseURL+"ext/fancybox-helpers/fancybox-buttons"+n.devext+".js");break;case"thumbs":n.ajax.check(e.fancybox.helpers.thumbs,n.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+n.devext+".js");break;case"media":n.ajax.check(e.fancybox.helpers.media,n.baseURL+"ext/fancybox-helpers/fancybox-media"+n.devext+".js")}var c={type:s.amsFancyboxType,padding:s.amsFancyboxPadding||10,margin:s.amsFancyboxMargin||10,loop:s.amsFancyboxLoop,beforeLoad:n.getFunctionByName(s.amsFancyboxBeforeLoad)||function(){var a;if(s.amsFancyboxTitleGetter&&(a=n.executeFunctionByName(s.amsFancyboxTitleGetter,this)),!a){var t=e("*:first",this.element);(a=t.attr("original-title")||t.attr("title"))||(a=e(this.element).attr("original-title")||e(this.element).attr("title"))}this.title=a},afterLoad:n.getFunctionByName(s.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":c.helpers.buttons={position:s.amsFancyboxButtonsPosition||"top"};break;case"thumbs":c.helpers.thumbs={width:s.amsFancyboxThumbsWidth||50,height:s.amsFancyboxThumbsHeight||50};break;case"media":c.helpers.media=!0}var o=e.extend({},c,s.amsFancyboxOptions);o=n.executeFunctionByName(s.amsFancyboxInitCallback,t,o)||o;var l=i.fancybox(o);n.executeFunctionByName(s.amsFancyboxAfterInitCallback,t,l,o)})})})},chart:function(a){var t=e(".chart",a);t.length>0&&n.ajax.check(e.fn.plot,n.baseURL+"flot/jquery.flot"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s=(t.amsChartPlugins||"").split(/\s+/);if(s.length>0)for(var i in s)if(s.hasOwnProperty(i)){var r=s[i];(function(a){for(var t in e.plot.plugins)if(e.plot.plugins.hasOwnProperty(t)){var n=e.plot.plugins[t];if(n.name===a)return n}return null})(r)||n.getScript(n.baseURL+"flot/jquery.flot."+r+n.devext+".js")}var c=e.extend({},{},t.amsChartOptions);c=n.executeFunctionByName(t.amsChartInitCallback,a,c)||c;var o=t.amsChartData;o=n.executeFunctionByName(t.amsChartInitData,a,o)||o;var l=a.plot(o,c);n.executeFunctionByName(t.amsChartAfterInitCallback,a,l,c)})})},graphs:function(a){var t=e(".sparkline",a);t.length>0&&n.ajax.check(n.graphs,n.baseURL+"myams-graphs"+n.devext+".js",function(){n.graphs.init(t)})},scrollbars:function(a){var t=e(".scrollbar",a);t.length>0&&n.ajax.check(e.event.special.mousewheel,n.baseURL+"ext/jquery-mousewheel.min.js",function(){n.ajax.check(e.fn.mCustomScrollbar,n.baseURL+"ext/jquery-mCustomScrollbar"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){t.each(function(){var a=e(this),t=a.data(),s={theme:t.amsScrollbarTheme||"light"},i=e.extend({},s,t.amsScrollbarOptions);i=n.executeFunctionByName(t.amsScrollbarInitCallback,a,i)||i;var r=a.mCustomScrollbar(i);n.executeFunctionByName(t.amsScrollbarAfterInitCallback,a,r,i)})})})})}}}}(jQuery,this);
+!function(y,e){var x=e.MyAMS;y.extend(x.plugins.enabled,{svg:function(e){var a=y(".svg-container",e);0<a.length&&a.each(function(){var e=y(this),a=y("svg",e),t=a.attr("width"),n=a.attr("height");t&&n&&a.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(t))+" "+Math.round(parseFloat(n))),a.attr("width","100%").attr("height","auto")})},hint:function(e){var a=y(".hint:not(:parents(.nohints))",e);0<a.length&&x.ajax.check(y.fn.tipsy,x.baseURL+"ext/jquery-tipsy"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-tipsy"+x.devext+".css","jquery-tipsy",function(){a.each(function(){var e=y(this),t=e.data(),a={html:void 0===t.amsHintHtml?(e.attr("title")||"").startsWith("<"):t.amsHintHtml,title:x.getFunctionByName(t.amsHintTitleGetter)||function(){var e=y(this),a=e.attr("original-title")||e.attr(t.amsHintTitleAttr||"title")||(t.amsHintHtml?e.html():e.text());return a=a.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:t.amsHintOpacity||.95,gravity:t.amsHintGravity||"sw",offset:t.amsHintOffset||0},n=y.extend({},a,t.amsHintOptions);n=x.executeFunctionByName(t.amsHintInitCallback,e,n)||n;var i=e.tipsy(n);x.executeFunctionByName(t.amsHintAfterInitCallback,e,i,n)})})})},contextMenu:function(e){var a=y(".context-menu",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={menuSelector:a.amsContextmenuSelector,menuSelected:x.helpers.contextMenuHandler},n=y.extend({},t,a.amsContextmenuOptions);n=x.executeFunctionByName(a.amsContextmenuInitCallback,e,n)||n;var i=e.contextMenu(n);x.executeFunctionByName(a.amsContextmenuAfterInitCallback,e,i,n)})},switcher:function(e){y("LEGEND.switcher",e).each(function(){var n=y(this),i=n.parent("fieldset"),s=n.data();s.amsSwitcher||(y('<i class="fa fa-fw"></i>').prependTo(y(this)).addClass("open"===s.amsSwitcherState?s.amsSwitcherMinusClass||"fa-minus":s.amsSwitcherPlusClass||"fa-plus"),n.on("click",function(e){e.preventDefault();var a={};if(n.trigger("ams.switcher.before-switch",[n,a]),!a.veto)if(i.hasClass("switched")){i.removeClass("switched"),y(".fa",n).removeClass(s.amsSwitcherPlusClass||"fa-plus").addClass(s.amsSwitcherMinusClass||"fa-minus"),n.trigger("ams.switcher.opened",[n]);var t=n.attr("id");t&&y('legend.switcher[data-ams-switcher-sync="'+t+'"]',i).each(function(){var e=y(this);e.parents("fieldset").hasClass("switched")&&e.click()})}else i.addClass("switched"),y(".fa",n).removeClass(s.amsSwitcherMinusClass||"fa-minus").addClass(s.amsSwitcherPlusClass||"fa-plus"),n.trigger("ams.switcher.closed",[n])}),"open"!==s.amsSwitcherState&&i.addClass("switched"),n.data("ams-switcher","on"))})},checker:function(e){y("LEGEND.checker",e).each(function(){var i=y(this),s=i.parent("fieldset"),r=i.data();if(!r.amsChecker){var e=y('<label class="checkbox"></label>'),a=r.amsCheckerFieldname||"checker_"+x.generateId(),t=a.replace(/\./,"_"),n=r.amsCheckerHiddenPrefix,o=null,c=r.amsCheckerHiddenValueOn||"true",l=r.amsCheckerHiddenValueOff||"false",m=r.amsCheckerMarker||!1;n?o=y('<input type="hidden">').attr("name",n+a).val("on"===r.amsCheckerState?c:l).prependTo(i):m&&y('<input type="hidden">').attr("name",m).attr("value",1).prependTo(i);var d=y('<input type="checkbox">').attr("name",a).attr("id",t).data("ams-checker-hidden-input",o).data("ams-checker-init",!0).val(r.amsCheckerValue||!0).attr("checked","on"===r.amsCheckerState?"checked":null);r.amsCheckerReadonly?d.attr("disabled","disabled"):d.on("change",function(e){e.preventDefault();var a={},t=y(this).is(":checked");if(i.trigger("ams.checker.before-switch",[i,a]),a.veto)y(this).prop("checked",!t);else if(x.executeFunctionByName(r.amsCheckerChangeHandler,i,t),!r.amsCheckerCancelDefault){var n=d.data("ams-checker-hidden-input");t?("disable"===r.amsCheckerMode?(s.removeAttr("disabled"),y(".select2",s).removeAttr("disabled")):s.removeClass("switched"),n&&n.val(c),y("[data-required]",s).attr("required","required"),i.trigger("ams.checker.opened",[i])):("disable"===r.amsCheckerMode?(s.prop("disabled","disabled"),y(".select2",s).attr("disabled","disabled")):s.addClass("switched"),n&&n.val(l),y("[data-required]",s).removeAttr("required"),i.trigger("ams.checker.closed",[i]))}}),d.appendTo(e),y(">label",i).attr("for",d.attr("id")),e.append("<i></i>").prependTo(i);var u=y("[required]",s);u.attr("data-required",!0),"on"===r.amsCheckerState?d.attr("checked",!0):("disable"===r.amsCheckerMode?(s.attr("disabled","disabled"),y(".select2",s).attr("disabled","disabled")):s.addClass("switched"),u.removeAttr("required")),i.data("ams-checker","on")}})},slider:function(e){var a=y(".slider",e);0<a.length&&x.ajax.check(y.fn.slider,x.baseURL+"ext/bootstrap-slider-2.0.0"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t=y.extend({},{},e.data.amsSliderOptions);t=x.executeFunctionByName(a.amsSliderInitCallback,e,t)||t;var n=e.slider(t);x.executeFunctionByName(a.amsSliderAfterInitCallback,e,n,t)})})},draggable:function(e){var a=y(".draggable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={cursor:a.amsDraggableCursor||"move",containment:a.amsDraggableContainment,handle:a.amsDraggableHandle,connectToSortable:a.amsDraggableConnectSortable,helper:x.getFunctionByName(a.amsDraggableHelper)||a.amsDraggableHelper,start:x.getFunctionByName(a.amsDraggableStart),stop:x.getFunctionByName(a.amsDraggableStop)},n=y.extend({},t,a.amsDraggableOptions);n=x.executeFunctionByName(a.amsDraggableInitCallback,e,n)||n;var i=e.draggable(n);e.disableSelection(),x.executeFunctionByName(a.amsDraggableAfterInitCallback,e,i,n)})},droppable:function(e){var a=y(".droppable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={accept:a.amsdroppableAccept,drop:x.getFunctionByName(a.amsDroppableDrop)},n=y.extend({},t,a.amsDroppableOptions);n=x.executeFunctionByName(a.amsDroppableInitCallback,e,n)||n;var i=e.droppable(n);x.executeFunctionByName(a.amsDroppableAfterInitCallback,e,i,n)})},sortable:function(e){var a=y(".sortable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={items:a.amsSortableItems,handle:a.amsSortableHandle,helper:a.amsSortableHelper,connectWith:a.amsSortableConnectwith,start:x.getFunctionByName(a.amsSortableStart),over:x.getFunctionByName(a.amsSortableOver),containment:a.amsSortableContainment,placeholder:a.amsSortablePlaceholder,stop:x.getFunctionByName(a.amsSortableStop)},n=y.extend({},t,a.amsSortableOptions);n=x.executeFunctionByName(a.amsSortableInitCallback,e,n)||n;var i=e.sortable(n);e.disableSelection(),x.executeFunctionByName(a.amsSortableAfterInitCallback,e,i,n)})},resizable:function(e){var a=y(".resizable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={autoHide:!1===a.amsResizableAutohide||a.amsResizableAutohide,containment:a.amsResizableContainment,grid:a.amsResizableGrid,handles:a.amsResizableHandles,start:x.getFunctionByName(a.amsResizableStart),stop:x.getFunctionByName(a.amsResizableStop)},n=y.extend({},t,a.amsResizableOptions);n=x.executeFunctionByName(a.amsResizableInitCallback,e,n)||n;var i=e.resizable(n);e.disableSelection(),x.executeFunctionByName(a.amsResizableAfterInitCallback,e,i,n)})},typeahead:function(e){var a=y(".typeahead",e);0<a.length&&x.ajax.check(y.fn.typeahead,x.baseURL+"ext/jquery-typeahead"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t=y.extend({},{},a.amsTypeaheadOptions);t=x.executeFunctionByName(a.amsTypeaheadInitCallback,e,t)||t;var n=e.typeahead(t);x.executeFunctionByName(a.amsTypeaheadAfterInitCallback,e,n,t)})})},treeview:function(e){var a=y(".treeview",e);0<a.length&&x.ajax.check(y.fn.treview,x.baseURL+"ext/bootstrap-treeview"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/bootstrap-treeview"+x.devext+".css","bootstrap-treeview",function(){a.each(function(){var e=y(this),a=e.data(),t={data:a.amsTreeviewData,levels:a.amsTreeviewLevels,injectStyle:a.amsTreeviewInjectStyle,expandIcon:a.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:a.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:a.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:a.amsTreeviewNodeIcon,selectedIcon:a.amsTreeviewSelectedIcon,checkedIcon:a.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:a.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:a.amsTreeviewColor,backColor:a.amsTreeviewBackColor,borderColor:a.amsTreeviewBorderColor,onHoverColor:a.amsTreeviewHoverColor,selectedColor:a.amsTreeviewSelectedColor,selectedBackColor:a.amsTreeviewSelectedBackColor,unselectableColor:a.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:a.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:a.amsTreeviewEnableLinks,highlightSelected:a.amsTreeviewHighlightSelected,highlightSearchResults:a.amsTreeviewhighlightSearchResults,showBorder:a.amsTreeviewShowBorder,showIcon:a.amsTreeviewShowIcon,showCheckbox:a.amsTreeviewShowCheckbox,showTags:a.amsTreeviewShowTags,toggleUnselectable:a.amsTreeviewToggleUnselectable,multiSelect:a.amsTreeviewMultiSelect,onNodeChecked:x.getFunctionByName(a.amsTreeviewNodeChecked),onNodeCollapsed:x.getFunctionByName(a.amsTreeviewNodeCollapsed),onNodeDisabled:x.getFunctionByName(a.amsTreeviewNodeDisabled),onNodeEnabled:x.getFunctionByName(a.amsTreeviewNodeEnabled),onNodeExpanded:x.getFunctionByName(a.amsTreeviewNodeExpanded),onNodeSelected:x.getFunctionByName(a.amsTreeviewNodeSelected),onNodeUnchecked:x.getFunctionByName(a.amsTreeviewNodeUnchecked),onNodeUnselected:x.getFunctionByName(a.amsTreeviewNodeUnselected),onSearchComplete:x.getFunctionByName(a.amsTreeviewSearchComplete),onSearchCleared:x.getFunctionByName(a.amsTreeviewSearchCleared)},n=y.extend({},t,a.amsTreeviewOptions);n=x.executeFunctionByName(a.amsTreeviewInitcallback,e,n)||n;var i=e.treeview(n);x.executeFunctionByName(a.amsTreeviewAfterInitCallback,e,i,n)})})})},select2:function(e){var a=y(".select2",e);0<a.length&&x.ajax.check(y.fn.select2,x.baseURL+"ext/jquery-select2-3.5.4"+x.devext+".js",function(){a.each(function(){var t=y(this),i=t.data();if(!i.select2){var n={placeholder:i.amsSelect2Placeholder,multiple:i.amsSelect2Multiple,minimumInputLength:i.amsSelect2MinimumInputLength||0,maximumSelectionSize:i.amsSelect2MaximumSelectionSize,openOnEnter:void 0===i.amsSelect2EnterOpen||i.amsSelect2EnterOpen,allowClear:void 0===i.amsSelect2AllowClear||i.amsSelect2AllowClear,width:i.amsSelect2Width||"100%",initSelection:x.getFunctionByName(i.amsSelect2InitSelection),formatSelection:void 0===i.amsSelect2FormatSelection?x.helpers.select2FormatSelection:x.getFunctionByName(i.amsSelect2FormatSelection),formatResult:x.getFunctionByName(i.amsSelect2FormatResult),formatMatches:void 0===i.amsSelect2FormatMatches?function(e){return 1===e?x.i18n.SELECT2_MATCH:e+x.i18n.SELECT2_MATCHES}:x.getFunctionByName(i.amsSelect2FormatMatches),formatNoMatches:void 0===i.amsSelect2FormatResult?function(e){return x.i18n.SELECT2_NOMATCHES}:x.getFunctionByName(i.amsSelect2FormatResult),formatInputTooShort:void 0===i.amsSelect2FormatInputTooShort?function(e,a){var t=a-e.length;return x.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":x.i18n.SELECT2_PLURAL)}:x.getFunctionByName(i.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===i.amsSelect2FormatInputTooLong?function(e,a){var t=e.length-a;return x.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":x.i18n.SELECT2_PLURAL)}:x.getFunctionByName(i.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===i.amsSelect2FormatSelectionTooBig?function(e){return x.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":x.i18n.SELECT2_PLURAL)}:x.getFunctionByName(i.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===i.amsSelect2FormatLoadMore?function(e){return x.i18n.SELECT2_LOADMORE}:x.getFunctionByName(i.amsSelect2FormatLoadMore),formatSearching:void 0===i.amsSelect2FormatSearching?function(){return x.i18n.SELECT2_SEARCHING}:x.getFunctionByName(i.amsSelect2FormatSearching),separator:i.amsSelect2Separator||",",tokenSeparators:i.amsSelect2TokensSeparators||[","],tokenizer:x.getFunctionByName(i.amsSelect2Tokenizer)};switch(t.context.type){case"text":case"hidden":if(!n.initSelection){var s=t.data("ams-select2-values");s&&(n.initSelection=function(e,a){var t=[];y(e.val().split(n.separator)).each(function(){t.push({id:this,text:s[this]||this})}),a(t)})}}t.attr("readonly")?"hidden"===t.attr("type")&&(n.query=function(){return[]}):i.amsSelect2Query?(n.query=x.getFunctionByName(i.amsSelect2Query),n.minimumInputLength=i.amsSelect2MinimumInputLength||1):i.amsSelect2QueryUrl?(n.ajax={url:i.amsSelect2QueryUrl,quietMillis:i.amsSelect2QuietMillis||200,type:i.amsSelect2QueryType||"POST",dataType:i.amsSelect2QueryDatatype||"json",data:function(e,a,t){var n={};return n[i.amsSelect2QueryParamName||"query"]=e,n[i.amsSelect2PageParamName||"page"]=a,n[i.amsSelect2ContextParamName||"context"]=t,y.extend({},n,i.amsSelect2QueryOptions)},results:x.helpers.select2QueryUrlResultsCallback},n.minimumInputLength=i.amsSelect2MinimumInputLength||1):i.amsSelect2QueryMethod?(n.query=function(a){var e={id:(new Date).getTime(),params:i.amsSelect2QueryParams||{},success:function(e){return x.helpers.select2QueryMethodSuccessCallback.call(t,e,"success",a)},error:x.error.show};e.params[i.amsSelect2QueryParamName||"query"]=a.term,e.params[i.amsSelect2PageParamName||"page"]=a.page,e.params[i.amsSelect2ContextParamName||"context"]=a.context,e=y.extend({},e,i.amsSelect2QueryOptions),e=x.executeFunctionByName(i.amsSelect2QueryInitCallback,t,e)||e,x.ajax.check(y.jsonRPC,x.baseURL+"ext/jquery-jsonrpc"+x.devext+".js",function(){y.jsonRPC.withOptions({endPoint:i.amsSelect2MethodTarget||x.jsonrpc.getAddr(),namespace:i.amsSelect2MethodNamespace,cache:!1},function(){y.jsonRPC.request(i.amsSelect2QueryMethod,e)})})},n.minimumInputLength=i.amsSelect2MinimumInputLength||1):i.amsSelect2Tags?n.tags=i.amsSelect2Tags:i.amsSelect2Data&&(n.data=i.amsSelect2Data),i.amsSelect2EnableFreeTags&&(n.createSearchChoice=function(e){return{id:e,text:(i.amsSelect2FreeTagsPrefix||x.i18n.SELECT2_FREETAG_PREFIX)+e}});var e=y.extend({},n,i.amsSelect2Options);e=x.executeFunctionByName(i.amsSelect2InitCallback,t,e)||e;var a=t.select2(e);x.executeFunctionByName(i.amsSelect2AfterInitCallback,t,a,e),t.hasClass("ordered")&&x.ajax.check(y.fn.select2Sortable,x.baseURL+"ext/jquery-select2-sortable"+x.devext+".js",function(){t.select2Sortable({bindOrder:"sortableStop"})}),t.on("change",function(){void 0!==y(t.get(0).form).data("validator")&&y(t).valid()})}})})},maskedit:function(e){var a=y("[data-mask]",e);0<a.length&&x.ajax.check(y.fn.mask,x.baseURL+"ext/jquery-maskedinput-1.4.1"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t={placeholder:void 0===a.amsMaskeditPlaceholder?"X":a.amsMaskeditPlaceholder,complete:x.getFunctionByName(a.amsMaskeditComplete)},n=y.extend({},t,a.amsMaskeditOptions);n=x.executeFunctionByName(a.amsMaskeditInitCallback,e,n)||n;var i=e.mask(e.attr("data-mask"),n);x.executeFunctionByName(a.amsMaskeditAfterInitCallback,e,i,n)})})},inputmask:function(e){var a=y("input[data-input-mask]",e);0<a.length&&x.ajax.check(y.fn.inputmask,x.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+x.devext+".js",function(){a.each(function(){var e,a=y(this),t=a.data();e="object"==typeof t.inputMask?t.inputMask:{mask:t.inputMask.toString()};var n=y.extend({},e,t.amsInputmaskOptions);n=x.executeFunctionByName(t.amsInputmaskInitCallback,a,n)||n;var i=a.inputmask(n);x.executeFunctionByName(t.amsInputmaskAfterInitCallback,a,i,n)})})},datepicker:function(e){var a=y(".datepicker",e);0<a.length&&x.ajax.check(y.fn.datetimepicker,x.baseURL+"ext/jquery-datetimepicker"+x.devext+".js",function(e){e&&x.dialog.registerHideCallback(x.helpers.datetimepickerDialogHiddenCallback),x.getCSS(x.baseURL+"../css/ext/jquery-datetimepicker"+x.devext+".css","jquery-datetimepicker",function(){a.each(function(){var e=y(this),a=e.data(),t={lang:a.amsDatetimepickerLang||x.lang,format:a.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect,weeks:a.amsDatetimepickerWeeks},n=y.extend({},t,a.amsDatetimepickerOptions);n=x.executeFunctionByName(a.amsDatetimepickerInitCallback,e,n)||n;var i=e.datetimepicker(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,i,n)})})})},datetimepicker:function(e){var a=y(".datetimepicker",e);0<a.length&&x.ajax.check(y.fn.datetimepicker,x.baseURL+"ext/jquery-datetimepicker"+x.devext+".js",function(e){e&&x.dialog.registerHideCallback(x.helpers.datetimepickerDialogHiddenCallback),x.getCSS(x.baseURL+"../css/ext/jquery-datetimepicker"+x.devext+".css","jquery-datetimepicker",function(){a.each(function(){var e=y(this),a=e.data(),t={lang:a.amsDatetimepickerLang||x.lang,format:a.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect,weeks:a.amsDatetimepickerWeeks},n=y.extend({},t,a.amsDatetimepickerOptions);n=x.executeFunctionByName(a.amsDatetimepickerInitCallback,e,n)||n;var i=e.datetimepicker(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,i,n)})})})},timepicker:function(e){var a=y(".timepicker",e);0<a.length&&x.ajax.check(y.fn.datetimepicker,x.baseURL+"ext/jquery-datetimepicker"+x.devext+".js",function(e){e&&x.dialog.registerHideCallback(x.helpers.datetimepickerDialogHiddenCallback),x.getCSS(x.baseURL+"../css/ext/jquery-datetimepicker"+x.devext+".css","jquery-datetimepicker",function(){a.each(function(){var e=y(this),a=e.data(),t={lang:a.amsDatetimepickerLang||x.lang,format:a.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect},n=y.extend({},t,a.amsDatetimepickerOptions);n=x.executeFunctionByName(a.amsDatetimepickerInitCallback,e,n)||n;var i=e.datetimepicker(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,i,n)})})})},colorpicker:function(e){var a=y(".colorpicker",e);0<a.length&&x.ajax.check(y.fn.minicolors,x.baseURL+"ext/jquery-minicolors"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-minicolors"+x.devext+".css","jquery-minicolors",function(){a.each(function(){var e=y(this),a=e.data(),t={position:a.amsColorpickerPosition||e.closest(".input").data("ams-colorpicker-position")||"bottom left"},n=y.extend({},t,a.amsColorpickerOptions);n=x.executeFunctionByName(a.amsColorpickerInitCallback,e,n)||n;var i=e.minicolors(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,i,n)})})})},dndupload:function(e){var a=y(".dndupload",e);0<a.length&&x.ajax.check(y.fn.dndupload,x.baseURL+"ext/jquery-dndupload"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-dndupload"+x.devext+".css","jquery-dndupload",function(){a.each(function(){var e=y(this),a=e.data(),t={action:a.amsDnduploadAction||e.attr("action")||"upload-files",fieldname:a.amsDnduploadFieldname||"files",autosubmit:a.amsDnduploadAutosubmit},n=y.extend({},t,a.amsDnduploadOptions);n=x.executeFunctionByName(a.amsDnduploadInitCallback,e,n)||n;var i=e.dndupload(n);x.executeFunctionByName(a.amsDnduploadAfterInitcallback,e,i,n)})})})},validate:function(e){var n=y("FORM:not([novalidate])",e);0<n.length&&x.ajax.check(y.fn.validate,x.baseURL+"ext/jquery-validate-1.17.0"+x.devext+".js",function(e){if(e&&(y.validator.setDefaults({highlight:function(e){y(e).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(e){y(e).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),x.plugins.i18n)){for(var a in x.plugins.i18n.validate)if(x.plugins.i18n.validate.hasOwnProperty(a)){var t=x.plugins.i18n.validate[a];"string"==typeof t&&-1<t.indexOf("{0}")&&(x.plugins.i18n.validate[a]=y.validator.format(t))}y.extend(y.validator.messages,x.plugins.i18n.validate)}n.each(function(){var r=y(this),e=r.data(),a={ignore:null,submitHandler:void 0!==r.attr("data-async")?void 0===e.amsFormSubmitHandler?function(){return y(".state-error",r).removeClass("state-error"),x.ajax.check(y.fn.ajaxSubmit,x.baseURL+"ext/jquery-form-3.49"+x.devext+".js"),x.form.submit(r)}:x.getFunctionByName(e.amsFormSubmitHandler):void 0,invalidHandler:void 0!==r.attr("data-async")?void 0===e.amsFormInvalidHandler?function(e,a){y(".state-error",r).removeClass("state-error");for(var t=0;t<a.errorList.length;t++){var n=a.errorList[t],i=y(n.element).parents(".tab-pane").index()+1;if(0<i){var s=y(".nav-tabs",y(n.element).parents(".tabforms"));y("li:nth-child("+i+")",s).removeClassPrefix("state-").addClass("state-error"),y("li.state-error:first a",s).click()}}}:x.getFunctionByName(e.amsFormInvalidHandler):void 0};y("[data-ams-validate-rules]",r).each(function(e){0===e&&(a.rules={}),a.rules[y(this).attr("name")]=y(this).data("ams-validate-rules")});var t=y.extend({},a,e.amsValidateOptions);t=x.executeFunctionByName(e.amsValidateInitCallback,r,t)||t;var n=r.validate(t);x.executeFunctionByName(e.amsValidateAfterInitCallback,r,n,t)})})},datatable:function(e){var a=y(".datatable",e);0<a.length&&x.ajax.check(y.fn.dataTable,x.baseURL+"ext/jquery-dataTables-1.9.4"+x.devext+".js",function(){x.ajax.check(y.fn.dataTableExt.oPagination.bootstrap_full,x.baseURL+"myams-dataTables"+x.devext+".js",function(){y(a).each(function(){var d,u=y(this),b=u.data(),h=(b.amsDatatableExtensions||"").split(/\s+/),e=b.amsDatatableSdom||"W"+(0<=h.indexOf("colreorder")||0<=h.indexOf("colreorderwithresize")?"R":"")+"<'dt-top-row'"+(0<=h.indexOf("colvis")?"C":"")+(!1===b.amsDatatablePagination||!1===b.amsDatatablePaginationSize?"":"L")+(!1===b.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(0<=h.indexOf("scroller")?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===b.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",a=b.amsDatatableSorting;if("string"==typeof a){var t=a.split(";");for(a=[],d=0;d<t.length;d++){var n=t[d].split(",");n[0]=parseInt(n[0]),a.push(n)}}var i,s=[],r=y("th",u).listattr("data-ams-datatable-sortable");for(d=0;d<r.length;d++){var o=r[d];void 0!==o?((i=s[d]||{}).bSortable="string"==typeof o?JSON.parse(o):o,s[d]=i):s[d]=s[d]||{}}var c=y("th",u).listattr("data-ams-datatable-stype");for(d=0;d<c.length;d++){var l=c[d];l?((i=s[d]||{}).sType=l,s[d]=i):s[d]=s[d]||{}}var m={bJQueryUI:!1,bServerSide:b.amsDatatableServerSide||!1,sAjaxSource:!0===b.amsDatatableServerSide?b.amsDatatableAjaxSource:void 0,sServerMethod:!0===b.amsDatatableServerSide?"POST":void 0,bFilter:!1!==b.amsDatatableGlobalFilter||0<=h.indexOf("columnfilter"),bPaginate:!1!==b.amsDatatablePagination,bInfo:!1!==b.amsDatatableInfo,bSort:!1!==b.amsDatatableSort,aaSorting:a,aoColumns:0<s.length?s:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:b.amsDatatableDisplayLength||25,sPaginationType:b.amsDatatablePaginationType||"bootstrap_full",sDom:e,oLanguage:x.plugins.i18n.datatables,fnInitComplete:function(e,a){y(".ColVis_Button").addClass("btn btn-default btn-sm").html((x.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},p=y.extend({},m,b.amsDatatableOptions),f=[],g=[],v=[];if(0<h.length)for(d=0;d<h.length;d++)switch(h[d]){case"autofill":f.push(y.fn.dataTable.AutoFill),g.push(x.baseURL+"ext/jquery-dataTables-autoFill"+x.devext+".js");break;case"columnfilter":f.push(y.fn.columnFilter),g.push(x.baseURL+"ext/jquery-dataTables-columnFilter"+x.devext+".js");break;case"colreorder":f.push(y.fn.dataTable.ColReorder),g.push(x.baseURL+"ext/jquery-dataTables-colReorder"+x.devext+".js");break;case"colreorderwithresize":f.push(window.ColReorder),g.push(x.baseURL+"ext/jquery-dataTables-colReorderWithResize"+x.devext+".js");break;case"colvis":f.push(y.fn.dataTable.ColVis),g.push(x.baseURL+"ext/jquery-dataTables-colVis"+x.devext+".js"),v.push(function(){p.oColVis=y.extend({},{activate:"click",sAlign:"right"},b.amsDatatableColvisOptions)});break;case"editable":f.push(y.fn.editable),g.push(x.baseURL+"ext/jquery-jeditable"+x.devext+".js"),f.push(y.fn.makeEditable),g.push(x.baseURL+"ext/jquery-dataTables-editable"+x.devext+".js");break;case"fixedcolumns":f.push(y.fn.dataTable.FixedColumns),g.push(x.baseURL+"ext/jquery-dataTables-fixedColumns"+x.devext+".js");break;case"fixedheader":f.push(y.fn.dataTable.Fixedheader),g.push(x.baseURL+"ext/jquery-dataTables-fixedHeader"+x.devext+".js");break;case"keytable":f.push(window.keyTable),g.push(x.baseURL+"ext/jquery-dataTables-keyTable"+x.devext+".js");break;case"rowgrouping":f.push(y.fn.rowGrouping),g.push(x.baseURL+"ext/jquery-dataTables-rowGrouping"+x.devext+".js");break;case"rowreordering":f.push(y.fn.rowReordering),g.push(x.baseURL+"ext/jquery-dataTables-rowReordering"+x.devext+".js");break;case"scroller":f.push(y.fn.dataTable.Scroller),g.push(x.baseURL+"ext/jquery-dataTables-scroller"+x.devext+".js")}v.push(function(){p=x.executeFunctionByName(b.amsDatatableInitCallback,u,p)||p;try{var e=u.dataTable(p);if(x.executeFunctionByName(b.amsDatatableAfterInitCallback,u,e,p),0<h.length)for(d=0;d<h.length;d++)switch(h[d]){case"autofill":var a=y.extend({},b.amsDatatableAutofillOptions,p.autofill);a=x.executeFunctionByName(b.amsDatatableAutofillInitCallback,u,a)||a,u.data("ams-autofill",void 0===b.amsDatatableAutofillConstructor?new y.fn.dataTable.AutoFill(u,a):x.executeFunctionByName(b.amsDatatableAutofillConstructor,u,e,a));break;case"columnfilter":var t=y.extend({},{sPlaceHolder:"head:after"},b.amsDatatableColumnfilterOptions,p.columnfilter);t=x.executeFunctionByName(b.amsDatatableColumnfilterInitCallback,u,t)||t,u.data("ams-columnfilter",void 0===b.amsDatatableColumnfilterConstructor?e.columnFilter(t):x.executeFunctionByName(b.amsDatatableColumnfilterConstructor,u,e,t));break;case"editable":var n=y.extend({},b.amsDatatableEditableOptions,p.editable);n=x.executeFunctionByName(b.amsDatatableEditableInitCallback,u,n)||n,u.data("ams-editable",void 0===b.amsDatatableEditableConstructor?u.makeEditable(n):x.executeFunctionByName(b.amsDatatableEditableConstructor,u,e,n));break;case"fixedcolumns":var i=y.extend({},b.amsDatatableFixedcolumnsOptions,p.fixedcolumns);i=x.executeFunctionByName(b.amsDatatableFixedcolumnsInitCallback,u,i)||i,u.data("ams-fixedcolumns",void 0===b.amsDatatableFixedcolumnsConstructor?new y.fn.dataTable.FixedColumns(u,i):x.executeFunctionByName(b.amsDatatableFixedcolumnsConstructor,u,e,i));break;case"fixedheader":var s=y.extend({},b.amsDatatableFixedheaderOptions,p.fixedheader);s=x.executeFunctionByName(b.amsDatatableFixedheadeInitCallback,u,s)||s,u.data("ams-fixedheader",void 0===b.amsDatatableFixedheaderConstructor?new y.fn.dataTable.FixedHeader(u,s):x.executeFunctionByName(b.amsDatatableFixedheaderConstructor,u,e,s));break;case"keytable":var r={table:u.get(0),datatable:e},o=y.extend({},r,b.amsDatatableKeytableOptions,p.keytable);o=x.executeFunctionByName(b.amsDatatableKeytableInitCallback,u,o)||o,u.data("ams-keytable",void 0===b.amsDatatableKeytableConstructor?new KeyTable(o):x.executeFunctionByName(b.amsDatatableKeytableConstructor,u,e,o));break;case"rowgrouping":var c=y.extend({},b.amsDatatableRowgroupingOptions,p.rowgrouping);c=x.executeFunctionByName(b.amsDatatableRowgroupingInitCallback,u,c)||c,u.data("ams-rowgrouping",void 0===b.amsDatatableRowgroupingConstructor?u.rowGrouping(c):x.executeFunctionByName(b.amsDatatableRowgroupingConstructor,u,e,c));break;case"rowreordering":var l=y.extend({},b.amsDatatableRowreorderingOptions,p.rowreordering);l=x.executeFunctionByName(b.amsDatatableRowreorderingInitCallback,u,l)||l,u.data("ams-rowreordering",void 0===b.amsDatatableRowreorderingConstructor?u.rowReordering(l):x.executeFunctionByName(b.amsDatatableRowreorderingConstructor,u,e,l))}if(b.amsDatatableFinalizeCallback){var m=b.amsDatatableFinalizeCallback.split(/\s+/);if(0<m.length)for(d=0;d<m.length;d++)x.executeFunctionByName(m[d],u,e,p)}}catch(e){}}),x.ajax.check(f,g,v)})})})},tablednd:function(e){var a=y(".table-dnd",e);0<a.length&&x.ajax.check(y.fn.tableDnD,x.baseURL+"ext/jquery-tablednd"+x.devext+".js",function(){a.each(function(){var r=y(this),o=r.data();o.amsTabledndDragHandle?y("tr",r).addClass("no-drag-handle"):y(r).on("mouseover","tr",function(){y(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){y(this.cells[0]).removeClass("drag-handle")});var e={onDragClass:o.amsTabledndDragClass||"dragging-row",onDragStart:x.getFunctionByName(o.amsTabledndDragStart),dragHandle:o.amsTabledndDragHandle,scrollAmount:o.amsTabledndScrollAmount,onAllowDrop:o.amsTabledndAllowDrop,onDrop:x.getFunctionByName(o.amsTabledndDrop)||function(e,a){var t=o.amsTabledndDropTarget;if(t){y(a).data("ams-disabled-handlers","click");try{var n=[];y(e.rows).each(function(){var e=y(this).data("ams-element-name");e&&n.push(e)});var i=x.getFunctionByName(t);if("function"==typeof i)i.call(r,e,n);else{if(!t.startsWith(window.location.protocol)){var s=o.amsLocation;s&&(t=s+"/"+t)}x.ajax.post(t,{names:JSON.stringify(n)})}}finally{setTimeout(function(){y(a).removeData("ams-disabled-handlers")},50)}}return!1}},a=y.extend({},e,o.amsTabledndOptions);a=x.executeFunctionByName(o.amsTabledndInitCallback,r,a)||a;var t=r.tableDnD(a);x.executeFunctionByName(o.amsTabledndAfterInitCallback,r,t,a)})})},wizard:function(e){var a=y(".wizard",e);0<a.length&&x.ajax.check(y.fn.bootstrapWizard,x.baseURL+"ext/bootstrap-wizard-1.4.2"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t={withVisible:void 0===a.amsWizardWithVisible||a.amsWizardWithVisible,tabClass:a.amsWizardTabClass,firstSelector:a.amsWizardFirstSelector,previousSelector:a.amsWizardPreviousSelector,nextSelector:a.amsWizardNextSelector,lastSelector:a.amsWizardLastSelector,finishSelector:a.amsWizardFinishSelector,backSelector:a.amsWizardBackSelector,onInit:x.getFunctionByName(a.amsWizardInit),onShow:x.getFunctionByName(a.amsWizardShow),onNext:x.getFunctionByName(a.amsWizardNext),onPrevious:x.getFunctionByName(a.amsWizardPrevious),onFirst:x.getFunctionByName(a.amsWizardFirst),onLast:x.getFunctionByName(a.amsWizardLast),onBack:x.getFunctionByName(a.amsWizardBack),onFinish:x.getFunctionByName(a.amsWizardFinish),onTabChange:x.getFunctionByName(a.amsWizardTabChange),onTabClick:x.getFunctionByName(a.amsWizardTabClick),onTabShow:x.getFunctionByName(a.amsWizardTabShow)},n=y.extend({},t,a.amsWizardOptions);n=x.executeFunctionByName(a.amsWizardInitCallback,e,n)||n;var i=e.bootstrapWizard(n);x.executeFunctionByName(a.amsWizardAfterInitCallback,e,i,n)})})},tinymce:function(e){function t(){y(".tinymce",y(this)).each(function(){var e=tinymce.get(y(this).attr("id"));e&&e.remove()})}var n=y(".tinymce",e);if(0<n.length){var i=x.baseURL+"ext/tinymce"+(x.devmode?"/dev":"");x.ajax.check(window.tinymce,i+"/tinymce"+x.devext+".js",function(e){function a(){n.each(function(){var e=y(this),a=e.data(),t={theme:a.amsTinymceTheme||"modern",language:x.lang,menubar:!1!==a.amsTinymceMenubar,statusbar:!1!==a.amsTinymceStatusbar,plugins:a.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:a.amsTinymceToolbar,toolbar1:!1!==a.amsTinymceToolbar1&&(a.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==a.amsTinymceToolbar2&&(a.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:a.amsTinymceContentCss,formats:a.amsTinymceFormats,style_formats:a.amsTinymceStyleFormats,block_formats:a.amsTinymceBlockFormats,valid_classes:a.amsTinymceValidClasses,image_advtab:!0,image_list:x.getFunctionByName(a.amsTinymceImageList)||a.amsTinymceImageList,image_class_list:a.amsTinymceImageClassList,link_list:x.getFunctionByName(a.amsTinymceLinkList)||a.amsTinymceLinkList,link_class_list:a.amsTinymceLinkClassList,paste_as_text:void 0===a.amsTinymcePasteAsText||a.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===a.amsTinymcePasteAutoCleanup||a.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:a.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===a.amsTinymcePaseRemoveSpans||a.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===a.amsTinymcePasteRemoveStyles||a.amsTinymcePasteRemoveStyles,height:a.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(a.amsTinymceExternalPlugins){var n=a.amsTinymceExternalPlugins.split(/\s+/);for(var i in n)if(n.hasOwnProperty(i)){var s=e.data("ams-tinymce-plugin-"+n[i]);tinymce.PluginManager.load(n[i],x.getSource(s))}}var r=y.extend({},t,a.amsTinymceOptions);r=x.executeFunctionByName(a.amsTinymceInitCallback,e,r)||r;var o=e.tinymce(r);x.executeFunctionByName(a.amsTinymceAfterInitCallback,e,o,r)})}e?x.getScript(i+"/jquery.tinymce"+x.devext+".js",function(){tinymce.baseURL=i,tinymce.suffix=x.devext,x.skin.registerCleanCallback(t),a()}):a()})}},imgareaselect:function(e){var a=y(".imgareaselect",e);0<a.length&&x.ajax.check(y.fn.imgAreaSelect,x.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-imgareaselect"+x.devext+".css","jquery-imgareaselect",function(){a.each(function(){var e=y(this),n=e.data(),i=n.amsImgareaselectParent?e.parents(n.amsImgareaselectParent):"body",a={instance:!0,handles:!0,parent:i,x1:n.amsImgareaselectX1||0,y1:n.amsImgareaselectY1||0,x2:n.amsImgareaselectX2||n.amsImgareaselectImageWidth,y2:n.amsImgareaselectY2||n.amsImgareaselectImageHeight,imageWidth:n.amsImgareaselectImageWidth,imageHeight:n.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:n.amsImgareaselectRatio,onSelectEnd:x.getFunctionByName(n.amsImgareaselectSelectEnd)||function(e,a){var t=n.amsImgareaselectTargetField||"image_";y('input[name="'+t+'x1"]',i).val(a.x1),y('input[name="'+t+'y1"]',i).val(a.y1),y('input[name="'+t+'x2"]',i).val(a.x2),y('input[name="'+t+'y2"]',i).val(a.y2)}},t=y.extend({},a,n.amsImgareaselectOptions);t=x.executeFunctionByName(n.amsImgareaselectInitCallback,e,t)||t;var s=e.imgAreaSelect(t);x.executeFunctionByName(n.amsImgareaselectAfterInitCallback,e,s,t),setTimeout(function(){s.update()},250)})})})},fancybox:function(e){var a=y(".fancybox",e);0<a.length&&x.ajax.check(y.fn.fancybox,x.baseURL+"ext/jquery-fancybox-2.1.5"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-fancybox-2.1.5"+x.devext+".css","jquery-fancybox",function(){a.each(function(){var e,a=y(this),t=a.data(),n=a;t.amsFancyboxElements&&(n=y(t.amsFancyboxElements,a));var i=(t.amsFancyboxHelpers||"").split(/\s+/);if(0<i.length)for(e=0;e<i.length;e++)switch(i[e]){case"buttons":x.ajax.check(y.fancybox.helpers.buttons,x.baseURL+"ext/fancybox-helpers/fancybox-buttons"+x.devext+".js");break;case"thumbs":x.ajax.check(y.fancybox.helpers.thumbs,x.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+x.devext+".js");break;case"media":x.ajax.check(y.fancybox.helpers.media,x.baseURL+"ext/fancybox-helpers/fancybox-media"+x.devext+".js")}var s={type:t.amsFancyboxType,padding:t.amsFancyboxPadding||10,margin:t.amsFancyboxMargin||10,loop:t.amsFancyboxLoop,beforeLoad:x.getFunctionByName(t.amsFancyboxBeforeLoad)||function(){var e;if(t.amsFancyboxTitleGetter&&(e=x.executeFunctionByName(t.amsFancyboxTitleGetter,this)),!e){var a=y("*:first",this.element);(e=a.attr("original-title")||a.attr("title"))||(e=y(this.element).attr("original-title")||y(this.element).attr("title"))}this.title=e},afterLoad:x.getFunctionByName(t.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(0<i.length)for(e=0;e<i.length;e++)switch(i[e]){case"buttons":s.helpers.buttons={position:t.amsFancyboxButtonsPosition||"top"};break;case"thumbs":s.helpers.thumbs={width:t.amsFancyboxThumbsWidth||50,height:t.amsFancyboxThumbsHeight||50};break;case"media":s.helpers.media=!0}var r=y.extend({},s,t.amsFancyboxOptions);r=x.executeFunctionByName(t.amsFancyboxInitCallback,a,r)||r;var o=n.fancybox(r);x.executeFunctionByName(t.amsFancyboxAfterInitCallback,a,o,r)})})})},chart:function(e){var a=y(".chart",e);0<a.length&&x.ajax.check(y.fn.plot,x.baseURL+"flot/jquery.flot"+x.devext+".js",function(){a.each(function(){function e(e){for(var a in y.plot.plugins)if(y.plot.plugins.hasOwnProperty(a)){var t=y.plot.plugins[a];if(t.name===e)return t}return null}var a=y(this),t=a.data(),n=(t.amsChartPlugins||"").split(/\s+/);if(0<n.length)for(var i in n)if(n.hasOwnProperty(i)){var s=n[i];e(s)||x.getScript(x.baseURL+"flot/jquery.flot."+s+x.devext+".js")}var r=y.extend({},{},t.amsChartOptions);r=x.executeFunctionByName(t.amsChartInitCallback,a,r)||r;var o=t.amsChartData;o=x.executeFunctionByName(t.amsChartInitData,a,o)||o;var c=a.plot(o,r);x.executeFunctionByName(t.amsChartAfterInitCallback,a,c,r)})})},graphs:function(e){var a=y(".sparkline",e);0<a.length&&x.ajax.check(x.graphs,x.baseURL+"myams-graphs"+x.devext+".js",function(){x.graphs.init(a)})},scrollbars:function(e){var a=y(".scrollbar",e);0<a.length&&x.ajax.check(y.event.special.mousewheel,x.baseURL+"ext/jquery-mousewheel.min.js",function(){x.ajax.check(y.fn.mCustomScrollbar,x.baseURL+"ext/jquery-mCustomScrollbar"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){a.each(function(){var e=y(this),a=e.data(),t={theme:a.amsScrollbarTheme||"light"},n=y.extend({},t,a.amsScrollbarOptions);n=x.executeFunctionByName(a.amsScrollbarInitCallback,e,n)||n;var i=e.mCustomScrollbar(n);x.executeFunctionByName(a.amsScrollbarAfterInitCallback,e,i,n)})})})})}})}(jQuery,this);
--- a/src/pyams_skin/resources/js/myams.js	Mon Nov 19 15:20:20 2018 +0100
+++ b/src/pyams_skin/resources/js/myams.js	Tue Nov 20 09:09:31 2018 +0100
@@ -1223,6 +1223,9 @@
 						}
 					}
 					url = result.location || window.location.href;
+					if (url.endsWith('##')) {
+						url = url.replace(/##/, window.location.hash);
+					}
 					if (result.window) {
 						window.open(url, result.window, result.options);
 					} else {
@@ -2446,7 +2449,7 @@
 													default:
 														var content = $(result);
 														var dialog = $('.modal-dialog', content.wrap('<div></div>').parent());
-														var dialogData = dialog.data();
+														var dialogData = dialog.data() || {};
 														var dataOptions = {
 															backdrop: 'static',
 															overflow: dialogData.amsModalOverflow || '.modal-viewport',
@@ -2858,7 +2861,7 @@
 })(jQuery, this);
 
 /**
- * MyAMS standard plug-ins
+ * MyAMS standard plug-ins loader
  *
  * Only basic JQuery, Bootstrap and MyAMS javascript extensions are typically loaded from main page.
  * Other JQuery plug-ins may be loaded dynamically.
@@ -2878,6 +2881,11 @@
 	MyAMS.plugins = {
 
 		/**
+		 * Container of enabled plug-ins
+		 */
+		enabled: {},
+
+		/**
 		 * Initialize list of content plug-ins
 		 */
 		init: function(element) {
@@ -3124,1699 +3132,1719 @@
 					ams.executeFunctionByName(callback);
 				}
 			}
+		}
+	};
+
+})(jQuery, this);
+
+/**
+ * MyAMS standard plug-ins
+ *
+ * Only basic JQuery, Bootstrap and MyAMS javascript extensions are typically loaded from main page.
+ * Other JQuery plug-ins may be loaded dynamically.
+ * Several JQuery extension plug-ins are already included and pre-configured by MyAMS. Other external
+ * plug-ins can be defined and loaded dynamically using simple "data" attributes.
+ *
+ * WARNING: any plug-in implicated into a form submit process (like JQuery-form or JQuery-progressbar)
+ * must be loaded in a synchronous way. Otherwise, if you use named buttons to submit your forms,
+ * dynamic hidden input fields created by JQuery-validate plug-in will be removed from the form
+ * before the form is submitted!
+ */
+(function($, globals) {
+
+	var MyAMS = globals.MyAMS,
+		ams = MyAMS;
+
+	/**
+	 * Map of enabled plug-ins
+	 * This map can be extended by external plug-ins.
+	 *
+	 * Standard MyAMS plug-ins management method generally includes:
+	 * - applying a class matching plug-in name on a set of HTML entities to apply the plug-in
+	 * - defining a set of data-attributes on each of these entities to customize the plug-in
+	 * For each standard plug-in, you can also provide an options object (to define plug-in options not handled
+	 * by default MyAMS initialization engine) and an initialization callback (to define these options dynamically).
+	 * Another callback can also be provided to be called after plug-in initialization.
+	 *
+	 * You can also register plug-ins using the 'register' function
+	 */
+	$.extend(ams.plugins.enabled, {
+
+		/**
+		 * SVG containers
+		 */
+		svg: function(element) {
+			var svgs = $('.svg-container', element);
+			if (svgs.length > 0) {
+				svgs.each(function() {
+					var container = $(this);
+					var svg = $('svg', container),
+						width = svg.attr('width'),
+						height = svg.attr('height');
+					if (width && height) {
+						svg.get(0).setAttribute('viewBox',
+												'0 0 ' + Math.round(parseFloat(width)) + ' ' +
+														 Math.round(parseFloat(height)));
+					}
+					svg.attr('width', '100%')
+					   .attr('height', 'auto');
+				})
+			}
+		},
+
+		/**
+		 * Label hints
+		 */
+		hint: function(element) {
+			var hints = $('.hint:not(:parents(.nohints))', element);
+			if (hints.length > 0) {
+				ams.ajax.check($.fn.tipsy,
+							   ams.baseURL + 'ext/jquery-tipsy' + ams.devext + '.js',
+							   function() {
+								   ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + ams.devext + '.css',
+											  'jquery-tipsy', function() {
+									   hints.each(function () {
+										   var hint = $(this);
+										   var data = hint.data();
+										   var dataOptions = {
+											   html: data.amsHintHtml === undefined ? (hint.attr('title') || '').startsWith('<') : data.amsHintHtml,
+											   title: ams.getFunctionByName(data.amsHintTitleGetter) || function () {
+												   var hint = $(this);
+												   var result = hint.attr('original-title') ||
+																hint.attr(data.amsHintTitleAttr || 'title') ||
+																(data.amsHintHtml ? hint.html() : hint.text());
+												   result = result.replace(/\?_="/, '?_=' + new Date().getTime() + '"');
+												   return result;
+											   },
+											   opacity: data.amsHintOpacity || 0.95,
+											   gravity: data.amsHintGravity || 'sw',
+											   offset: data.amsHintOffset || 0
+										   };
+										   var settings = $.extend({}, dataOptions, data.amsHintOptions);
+										   settings = ams.executeFunctionByName(data.amsHintInitCallback, hint, settings) || settings;
+										   var plugin = hint.tipsy(settings);
+										   ams.executeFunctionByName(data.amsHintAfterInitCallback, hint, plugin, settings);
+									   });
+								   });
+							   });
+			}
+		},
+
+		/**
+		 * Context menu plug-in
+		 */
+		contextMenu: function(element) {
+			var menus = $('.context-menu', element);
+			if (menus.length > 0) {
+				menus.each(function() {
+					var menu = $(this);
+					var data = menu.data();
+					var dataOptions = {
+						menuSelector: data.amsContextmenuSelector,
+						menuSelected: ams.helpers.contextMenuHandler
+					};
+					var settings = $.extend({}, dataOptions, data.amsContextmenuOptions);
+					settings = ams.executeFunctionByName(data.amsContextmenuInitCallback, menu, settings) || settings;
+					var plugin = menu.contextMenu(settings);
+					ams.executeFunctionByName(data.amsContextmenuAfterInitCallback, menu, plugin, settings);
+				});
+			}
+		},
+
+		/**
+		 * Fieldset legend switcher
+		 */
+		switcher: function(element) {
+			$('LEGEND.switcher', element).each(function() {
+				var legend = $(this);
+				var fieldset = legend.parent('fieldset');
+				var data = legend.data();
+				if (!data.amsSwitcher) {
+					$('<i class="fa fa-fw"></i>')
+						.prependTo($(this))
+						.addClass(data.amsSwitcherState === 'open' ?
+								  (data.amsSwitcherMinusClass || 'fa-minus') :
+								  (data.amsSwitcherPlusClass || 'fa-plus'));
+					legend.on('click', function(e) {
+						e.preventDefault();
+						var veto = {};
+						legend.trigger('ams.switcher.before-switch', [legend, veto]);
+						if (veto.veto) {
+							return;
+						}
+						if (fieldset.hasClass('switched')) {
+							fieldset.removeClass('switched');
+							$('.fa', legend).removeClass(data.amsSwitcherPlusClass || 'fa-plus')
+											.addClass(data.amsSwitcherMinusClass || 'fa-minus');
+							legend.trigger('ams.switcher.opened', [legend]);
+							var id = legend.attr('id');
+							if (id) {
+								$('legend.switcher[data-ams-switcher-sync="'+id+'"]', fieldset).each(function() {
+									var switcher = $(this);
+									if (switcher.parents('fieldset').hasClass('switched')) {
+										switcher.click();
+									}
+								});
+							}
+						} else {
+							fieldset.addClass('switched');
+							$('.fa', legend).removeClass(data.amsSwitcherMinusClass || 'fa-minus')
+											.addClass(data.amsSwitcherPlusClass || 'fa-plus');
+							legend.trigger('ams.switcher.closed', [legend]);
+						}
+					});
+					if (data.amsSwitcherState !== 'open') {
+						fieldset.addClass('switched');
+					}
+					legend.data('ams-switcher', 'on');
+				}
+			});
+		},
+
+		/**
+		 * Fieldset legend checker
+		 */
+		checker: function(element) {
+			$('LEGEND.checker', element).each(function() {
+				var legend = $(this);
+				var fieldset = legend.parent('fieldset');
+				var data = legend.data();
+				if (!data.amsChecker) {
+					var checker = $('<label class="checkbox"></label>');
+					var fieldname = data.amsCheckerFieldname || ('checker_'+ams.generateId());
+					var checkboxId = fieldname.replace(/\./, '_');
+					var prefix = data.amsCheckerHiddenPrefix;
+					var hidden = null;
+					var checkedValue = data.amsCheckerHiddenValueOn || 'true';
+					var uncheckedValue = data.amsCheckerHiddenValueOff || 'false';
+					var marker = data.amsCheckerMarker || false;
+					if (prefix) {
+						hidden = $('<input type="hidden">').attr('name', prefix + fieldname)
+														   .val(data.amsCheckerState === 'on' ? checkedValue : uncheckedValue)
+														   .prependTo(legend);
+					} else if (marker) {
+						$('<input type="hidden">').attr('name', marker)
+												  .attr('value', 1)
+												  .prependTo(legend);
+					}
+					var input = $('<input type="checkbox">').attr('name', fieldname)
+															.attr('id', checkboxId)
+															.data('ams-checker-hidden-input', hidden)
+															.data('ams-checker-init', true)
+															.val(data.amsCheckerValue || true)
+															.attr('checked', data.amsCheckerState === 'on' ? 'checked' : null);
+					if (data.amsCheckerReadonly) {
+						input.attr('disabled', 'disabled');
+					} else {
+						input.on('change', function(e) {
+							e.preventDefault();
+							var veto = {};
+							var isChecked = $(this).is(':checked');
+							legend.trigger('ams.checker.before-switch', [legend, veto]);
+							if (veto.veto) {
+								// reset checked status because event is fired after change...
+								$(this).prop('checked', !isChecked);
+								return;
+							}
+							ams.executeFunctionByName(data.amsCheckerChangeHandler, legend, isChecked);
+							if (!data.amsCheckerCancelDefault) {
+								var hidden = input.data('ams-checker-hidden-input');
+								if (isChecked) {
+									if (data.amsCheckerMode === 'disable') {
+										fieldset.removeAttr('disabled');
+										$('.select2', fieldset).removeAttr('disabled');
+									} else {
+										fieldset.removeClass('switched');
+									}
+									if (hidden) {
+										hidden.val(checkedValue);
+									}
+									$('[data-required]', fieldset).attr('required', 'required');
+									legend.trigger('ams.checker.opened', [legend]);
+								} else {
+									if (data.amsCheckerMode === 'disable') {
+										fieldset.prop('disabled', 'disabled');
+										$('.select2', fieldset).attr('disabled', 'disabled');
+									} else {
+										fieldset.addClass('switched');
+									}
+									if (hidden) {
+										hidden.val(uncheckedValue);
+									}
+									$('[data-required]', fieldset).removeAttr('required');
+									legend.trigger('ams.checker.closed', [legend]);
+								}
+							}
+						});
+					}
+					input.appendTo(checker);
+					$('>label', legend).attr('for', input.attr('id'));
+					checker.append('<i></i>')
+						   .prependTo(legend);
+					var required = $('[required]', fieldset);
+					required.attr('data-required', true);
+					if (data.amsCheckerState === 'on') {
+						input.attr('checked', true);
+					} else {
+						if (data.amsCheckerMode === 'disable') {
+							fieldset.attr('disabled', 'disabled');
+							$('.select2', fieldset).attr('disabled', 'disabled');
+						} else {
+							fieldset.addClass('switched');
+						}
+						required.removeAttr('required');
+					}
+					legend.data('ams-checker', 'on');
+				}
+			});
+		},
+
+		/**
+		 * Sliders
+		 */
+		slider: function(element) {
+			var sliders = $('.slider', element);
+			if (sliders.length > 0) {
+				ams.ajax.check($.fn.slider,
+							   ams.baseURL + 'ext/bootstrap-slider-2.0.0' + ams.devext + '.js',
+							   function() {
+									sliders.each(function() {
+										var slider = $(this);
+										var data = slider.data();
+										var dataOptions = {};
+										var settings = $.extend({}, dataOptions, slider.data.amsSliderOptions);
+										settings = ams.executeFunctionByName(data.amsSliderInitCallback, slider, settings) || settings;
+										var plugin = slider.slider(settings);
+										ams.executeFunctionByName(data.amsSliderAfterInitCallback, slider, plugin, settings);
+									});
+							   });
+			}
+		},
+
+		/**
+		 * Draggable plug-in
+		 */
+		draggable: function(element) {
+			var draggables = $('.draggable', element);
+			if (draggables.length > 0) {
+				draggables.each(function() {
+					var draggable = $(this);
+					var data = draggable.data();
+					var dataOptions = {
+						cursor: data.amsDraggableCursor || 'move',
+						containment: data.amsDraggableContainment,
+						handle: data.amsDraggableHandle,
+						connectToSortable: data.amsDraggableConnectSortable,
+						helper: ams.getFunctionByName(data.amsDraggableHelper) || data.amsDraggableHelper,
+						start: ams.getFunctionByName(data.amsDraggableStart),
+						stop: ams.getFunctionByName(data.amsDraggableStop)
+					};
+					var settings = $.extend({}, dataOptions, data.amsDraggableOptions);
+					settings = ams.executeFunctionByName(data.amsDraggableInitCallback, draggable, settings) || settings;
+					var plugin = draggable.draggable(settings);
+					draggable.disableSelection();
+					ams.executeFunctionByName(data.amsDraggableAfterInitCallback, draggable, plugin, settings);
+				});
+			}
+		},
+
+		/**
+		 * Droppable plug-in
+		 */
+		droppable: function(element) {
+			var droppables = $('.droppable', element);
+			if (droppables.length > 0) {
+				droppables.each(function() {
+					var droppable = $(this);
+					var data = droppable.data();
+					var dataOptions = {
+						accept: data.amsdroppableAccept,
+						drop: ams.getFunctionByName(data.amsDroppableDrop)
+					};
+					var settings = $.extend({}, dataOptions, data.amsDroppableOptions);
+					settings = ams.executeFunctionByName(data.amsDroppableInitCallback, droppable, settings) || settings;
+					var plugin = droppable.droppable(settings);
+					ams.executeFunctionByName(data.amsDroppableAfterInitCallback, droppable, plugin, settings);
+				});
+			}
+		},
+
+		/**
+		 * Sortable plug-in
+		 */
+		sortable: function(element) {
+			var sortables = $('.sortable', element);
+			if (sortables.length > 0) {
+				sortables.each(function() {
+					var sortable = $(this);
+					var data = sortable.data();
+					var dataOptions = {
+						items: data.amsSortableItems,
+						handle: data.amsSortableHandle,
+						helper: data.amsSortableHelper,
+						connectWith: data.amsSortableConnectwith,
+						start: ams.getFunctionByName(data.amsSortableStart),
+						over: ams.getFunctionByName(data.amsSortableOver),
+						containment: data.amsSortableContainment,
+						placeholder: data.amsSortablePlaceholder,
+						stop: ams.getFunctionByName(data.amsSortableStop)
+					};
+					var settings = $.extend({}, dataOptions, data.amsSortableOptions);
+					settings = ams.executeFunctionByName(data.amsSortableInitCallback, sortable, settings) || settings;
+					var plugin = sortable.sortable(settings);
+					sortable.disableSelection();
+					ams.executeFunctionByName(data.amsSortableAfterInitCallback, sortable, plugin, settings);
+				});
+			}
+		},
+
+		/**
+		 * Resizable plug-in
+		 */
+		resizable: function(element) {
+			var resizables = $('.resizable', element);
+			if (resizables.length > 0) {
+				resizables.each(function() {
+					var resizable = $(this);
+					var data = resizable.data();
+					var dataOptions = {
+						autoHide: data.amsResizableAutohide === false ? true : data.amsResizableAutohide,
+						containment: data.amsResizableContainment,
+						grid: data.amsResizableGrid,
+						handles: data.amsResizableHandles,
+						start: ams.getFunctionByName(data.amsResizableStart),
+						stop: ams.getFunctionByName(data.amsResizableStop)
+					};
+					var settings = $.extend({}, dataOptions, data.amsResizableOptions);
+					settings = ams.executeFunctionByName(data.amsResizableInitCallback, resizable, settings) || settings;
+					var plugin = resizable.resizable(settings);
+					resizable.disableSelection();
+					ams.executeFunctionByName(data.amsResizableAfterInitCallback, resizable, plugin, settings);
+				});
+			}
+		},
+
+		/**
+		 * JQuery typeahead plug-in
+		 */
+		typeahead: function(element) {
+			var typeaheads = $('.typeahead', element);
+			if (typeaheads.length > 0) {
+				ams.ajax.check($.fn.typeahead,
+							   ams.baseURL + 'ext/jquery-typeahead' + ams.devext + '.js',
+							   function() {
+									typeaheads.each(function() {
+										var input = $(this);
+										var data = input.data();
+										var dataOptions = {};
+										var settings = $.extend({}, dataOptions, data.amsTypeaheadOptions);
+										settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings;
+										var plugin = input.typeahead(settings);
+										ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings);
+									});
+							   });
+			}
+		},
+
+		/**
+		 * Treeview plug-in
+		 */
+		treeview: function(element) {
+			var treeviews = $('.treeview', element);
+			if (treeviews.length > 0) {
+				ams.ajax.check($.fn.treview,
+							   ams.baseURL + 'ext/bootstrap-treeview' + ams.devext + '.js',
+							   function() {
+									ams.getCSS(ams.baseURL + '../css/ext/bootstrap-treeview' + ams.devext + '.css',
+											   'bootstrap-treeview',
+											   function() {
+												   treeviews.each(function () {
+													   var treeview = $(this);
+													   var data = treeview.data();
+													   var dataOptions = {
+														   data: data.amsTreeviewData,
+														   levels: data.amsTreeviewLevels,
+														   injectStyle: data.amsTreeviewInjectStyle,
+														   expandIcon: data.amsTreeviewExpandIcon || 'fa fa-fw fa-plus-square-o',
+														   collapseIcon: data.amsTreeviewCollaspeIcon || 'fa fa-fw fa-minus-square-o',
+														   emptyIcon: data.amsTreeviewEmptyIcon || 'fa fa-fw',
+														   nodeIcon: data.amsTreeviewNodeIcon,
+														   selectedIcon: data.amsTreeviewSelectedIcon,
+														   checkedIcon: data.amsTreeviewCheckedIcon || 'fa fa-fw fa-check-square-o',
+														   uncheckedIcon: data.amsTreeviewUncheckedIcon || 'fa fa-fw fa-square-o',
+														   color: data.amsTreeviewColor,
+														   backColor: data.amsTreeviewBackColor,
+														   borderColor: data.amsTreeviewBorderColor,
+														   onHoverColor: data.amsTreeviewHoverColor,
+														   selectedColor: data.amsTreeviewSelectedColor,
+														   selectedBackColor: data.amsTreeviewSelectedBackColor,
+														   unselectableColor: data.amsTreeviewUnselectableColor || 'rgba(1,1,1,0.25)',
+														   unselectableBackColor: data.amsTreeviewUnselectableBackColor || 'rgba(1,1,1,0.25)',
+														   enableLinks: data.amsTreeviewEnableLinks,
+														   highlightSelected: data.amsTreeviewHighlightSelected,
+														   highlightSearchResults: data.amsTreeviewhighlightSearchResults,
+														   showBorder: data.amsTreeviewShowBorder,
+														   showIcon: data.amsTreeviewShowIcon,
+														   showCheckbox: data.amsTreeviewShowCheckbox,
+														   showTags: data.amsTreeviewShowTags,
+														   toggleUnselectable: data.amsTreeviewToggleUnselectable,
+														   multiSelect: data.amsTreeviewMultiSelect,
+														   onNodeChecked: ams.getFunctionByName(data.amsTreeviewNodeChecked),
+														   onNodeCollapsed: ams.getFunctionByName(data.amsTreeviewNodeCollapsed),
+														   onNodeDisabled: ams.getFunctionByName(data.amsTreeviewNodeDisabled),
+														   onNodeEnabled: ams.getFunctionByName(data.amsTreeviewNodeEnabled),
+														   onNodeExpanded: ams.getFunctionByName(data.amsTreeviewNodeExpanded),
+														   onNodeSelected: ams.getFunctionByName(data.amsTreeviewNodeSelected),
+														   onNodeUnchecked: ams.getFunctionByName(data.amsTreeviewNodeUnchecked),
+														   onNodeUnselected: ams.getFunctionByName(data.amsTreeviewNodeUnselected),
+														   onSearchComplete: ams.getFunctionByName(data.amsTreeviewSearchComplete),
+														   onSearchCleared: ams.getFunctionByName(data.amsTreeviewSearchCleared)
+													   };
+													   var settings = $.extend({}, dataOptions, data.amsTreeviewOptions);
+													   settings = ams.executeFunctionByName(data.amsTreeviewInitcallback, treeview, settings) || settings;
+													   var plugin = treeview.treeview(settings);
+													   ams.executeFunctionByName(data.amsTreeviewAfterInitCallback, treeview, plugin, settings);
+												   });
+											   });
+							   });
+			}
+		},
+
+		/**
+		 * Select2 plug-in
+		 */
+		select2: function(element) {
+			var selects = $('.select2', element);
+			if (selects.length > 0) {
+				ams.ajax.check($.fn.select2,
+							   ams.baseURL + 'ext/jquery-select2-3.5.4' + ams.devext + '.js',
+							   function() {
+									selects.each(function() {
+										var select = $(this);
+										var data = select.data();
+										if (data.select2) {
+											// Already initialized
+											return;
+										}
+										var dataOptions = {
+											placeholder: data.amsSelect2Placeholder,
+											multiple: data.amsSelect2Multiple,
+											minimumInputLength: data.amsSelect2MinimumInputLength || 0,
+											maximumSelectionSize: data.amsSelect2MaximumSelectionSize,
+											openOnEnter: data.amsSelect2EnterOpen === undefined ? true : data.amsSelect2EnterOpen,
+											allowClear: data.amsSelect2AllowClear === undefined ? true : data.amsSelect2AllowClear,
+											width: data.amsSelect2Width || '100%',
+											initSelection: ams.getFunctionByName(data.amsSelect2InitSelection),
+											formatSelection: data.amsSelect2FormatSelection === undefined ?
+																ams.helpers.select2FormatSelection
+																: ams.getFunctionByName(data.amsSelect2FormatSelection),
+											formatResult: ams.getFunctionByName(data.amsSelect2FormatResult),
+											formatMatches: data.amsSelect2FormatMatches === undefined ?
+																function(matches) {
+																	if (matches === 1) {
+																		return ams.i18n.SELECT2_MATCH;
+																	} else {
+																		return matches + ams.i18n.SELECT2_MATCHES;
+																	}
+																}
+																: ams.getFunctionByName(data.amsSelect2FormatMatches),
+											formatNoMatches: data.amsSelect2FormatResult === undefined ?
+																function(term) {
+																	return ams.i18n.SELECT2_NOMATCHES;
+																}
+																: ams.getFunctionByName(data.amsSelect2FormatResult),
+											formatInputTooShort: data.amsSelect2FormatInputTooShort === undefined ?
+																function(input, min) {
+																	var n = min - input.length;
+																	return ams.i18n.SELECT2_INPUT_TOOSHORT
+																					.replace(/\{0\}/, n)
+																					.replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
+																}
+																: ams.getFunctionByName(data.amsSelect2FormatInputTooShort),
+											formatInputTooLong: data.amsSelect2FormatInputTooLong === undefined ?
+																function(input, max) {
+																	var n = input.length - max;
+																	return ams.i18n.SELECT2_INPUT_TOOLONG
+																					.replace(/\{0\}/, n)
+																					.replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
+																}
+																: ams.getFunctionByName(data.amsSelect2FormatInputTooLong),
+											formatSelectionTooBig: data.amsSelect2FormatSelectionTooBig === undefined ?
+																function(limit) {
+																	return ams.i18n.SELECT2_SELECTION_TOOBIG
+																					.replace(/\{0\}/, limit)
+																					.replace(/\{1\}/, limit === 1 ? "" : ams.i18n.SELECT2_PLURAL);
+																}
+																: ams.getFunctionByName(data.amsSelect2FormatSelectionTooBig),
+											formatLoadMore: data.amsSelect2FormatLoadMore === undefined ?
+																function (pageNumber) {
+																	return ams.i18n.SELECT2_LOADMORE;
+																}
+																: ams.getFunctionByName(data.amsSelect2FormatLoadMore),
+											formatSearching: data.amsSelect2FormatSearching === undefined ?
+																function() {
+																	return ams.i18n.SELECT2_SEARCHING;
+																}
+																: ams.getFunctionByName(data.amsSelect2FormatSearching),
+											separator: data.amsSelect2Separator || ',',
+											tokenSeparators: data.amsSelect2TokensSeparators || [','],
+											tokenizer: ams.getFunctionByName(data.amsSelect2Tokenizer)
+										};
+
+										switch (select.context.type) {
+											case 'text':
+											case 'hidden':
+												if (!dataOptions.initSelection) {
+													var valuesData = select.data('ams-select2-values');
+													if (valuesData) {
+														dataOptions.initSelection = function(element, callback) {
+															var data = [];
+															$(element.val().split(dataOptions.separator)).each(function() {
+																data.push({id: this,
+																		   text: valuesData[this] || this});
+															});
+															callback(data);
+														};
+													}
+												}
+												break;
+											default:
+												break;
+										}
+
+										if (select.attr('readonly')) {
+											if (select.attr('type') === 'hidden') {
+												dataOptions.query = function () {
+													return [];
+												};
+											}
+										} else if (data.amsSelect2Query) {
+											// Custom query method
+											dataOptions.query = ams.getFunctionByName(data.amsSelect2Query);
+											dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+										} else if (data.amsSelect2QueryUrl) {
+											// AJAX query
+											dataOptions.ajax = {
+												url: data.amsSelect2QueryUrl,
+												quietMillis: data.amsSelect2QuietMillis || 200,
+												type: data.amsSelect2QueryType || 'POST',
+												dataType: data.amsSelect2QueryDatatype || 'json',
+												data: function(term, page, context) {
+													var options = {};
+													options[data.amsSelect2QueryParamName || 'query'] = term;
+													options[data.amsSelect2PageParamName || 'page'] = page;
+													options[data.amsSelect2ContextParamName || 'context'] = context;
+													return $.extend({}, options, data.amsSelect2QueryOptions);
+												},
+												results: ams.helpers.select2QueryUrlResultsCallback
+											};
+											dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+										} else if (data.amsSelect2QueryMethod) {
+											// JSON-RPC query
+											dataOptions.query = function(options) {
+												var settings = {
+													id: new Date().getTime(),
+													params: data.amsSelect2QueryParams || {},
+													success: function(result) {
+														return ams.helpers.select2QueryMethodSuccessCallback.call(select, result, 'success', options);
+													},
+													error: ams.error.show
+												};
+												settings.params[data.amsSelect2QueryParamName || 'query'] = options.term;
+												settings.params[data.amsSelect2PageParamName || 'page'] = options.page;
+												settings.params[data.amsSelect2ContextParamName || 'context'] = options.context;
+												settings = $.extend({}, settings, data.amsSelect2QueryOptions);
+												settings = ams.executeFunctionByName(data.amsSelect2QueryInitCallback, select, settings) || settings;
+												ams.ajax.check($.jsonRPC,
+															   ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
+															   function() {
+																	$.jsonRPC.withOptions({
+																		endPoint: data.amsSelect2MethodTarget || ams.jsonrpc.getAddr(),
+																		namespace: data.amsSelect2MethodNamespace,
+																		cache: false
+																	}, function() {
+																		$.jsonRPC.request(data.amsSelect2QueryMethod, settings);
+																	});
+															   });
+											};
+											dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+										} else if (data.amsSelect2Tags) {
+											// Tags mode
+											dataOptions.tags = data.amsSelect2Tags;
+										} else if (data.amsSelect2Data) {
+											// Provided data mode
+											dataOptions.data = data.amsSelect2Data;
+										}
+
+										if (data.amsSelect2EnableFreeTags) {
+											dataOptions.createSearchChoice = function(term) {
+												return {id: term,
+														text: (data.amsSelect2FreeTagsPrefix || ams.i18n.SELECT2_FREETAG_PREFIX) + term};
+											};
+										}
+
+										var settings = $.extend({}, dataOptions, data.amsSelect2Options);
+										settings = ams.executeFunctionByName(data.amsSelect2InitCallback, select, settings) || settings;
+										var plugin = select.select2(settings);
+										ams.executeFunctionByName(data.amsSelect2AfterInitCallback, select, plugin, settings);
+										if (select.hasClass('ordered')) {
+											ams.ajax.check($.fn.select2Sortable,
+														   ams.baseURL + 'ext/jquery-select2-sortable' + ams.devext + '.js',
+														   function() {
+																select.select2Sortable({
+																	bindOrder: 'sortableStop'
+																});
+														   });
+										}
+
+										select.on('change', function() {
+											var validator = $(select.get(0).form).data('validator');
+											if (validator !== undefined) {
+												$(select).valid();
+											}
+										});
+									});
+							   });
+			}
+		},
+
+		/**
+		 * Edit mask plug-in
+		 */
+		maskedit: function(element) {
+			var masks = $('[data-mask]', element);
+			if (masks.length > 0) {
+				ams.ajax.check($.fn.mask,
+							   ams.baseURL + 'ext/jquery-maskedinput-1.4.1' + ams.devext + '.js',
+							   function() {
+									masks.each(function() {
+										var mask = $(this);
+										var data = mask.data();
+										var dataOptions = {
+											placeholder: data.amsMaskeditPlaceholder === undefined ? 'X' : data.amsMaskeditPlaceholder,
+											complete: ams.getFunctionByName(data.amsMaskeditComplete)
+										};
+										var settings = $.extend({}, dataOptions, data.amsMaskeditOptions);
+										settings = ams.executeFunctionByName(data.amsMaskeditInitCallback, mask, settings) || settings;
+										var plugin = mask.mask(mask.attr('data-mask'), settings);
+										ams.executeFunctionByName(data.amsMaskeditAfterInitCallback, mask, plugin, settings);
+									});
+							   });
+			}
+		},
+
+		/**
+		 * JQuery input-mask plug-in
+		 *
+		 * Mask value can be set in a "data-input-mask" attribute defined:
+		 * - as a simple string containing mask
+		 * - as a JSON object defining all mask attributes, for example:
+		 *   data-input-mask='{"alias": "integer", "allowPlus": false, "allowMinus": false}'
+		 */
+		inputmask: function(element) {
+			var masks = $('input[data-input-mask]', element);
+			if (masks.length > 0) {
+				ams.ajax.check($.fn.inputmask,
+							   ams.baseURL + 'ext/jquery-inputmask-bundle-3.2.8' + ams.devext + '.js',
+							   function() {
+									masks.each(function() {
+										var input = $(this);
+										var data = input.data();
+										var dataOptions;
+										if (typeof(data.inputMask) === 'object') {
+											dataOptions = data.inputMask;
+										} else {
+											dataOptions = {
+												mask: data.inputMask.toString()
+											};
+										}
+										var settings = $.extend({}, dataOptions, data.amsInputmaskOptions);
+										settings = ams.executeFunctionByName(data.amsInputmaskInitCallback, input, settings) || settings;
+										var plugin = input.inputmask(settings);
+										ams.executeFunctionByName(data.amsInputmaskAfterInitCallback, input, plugin, settings);
+									});
+							   });
+			}
+		},
+
+		/**
+		 * JQuery date picker
+		 */
+		datepicker: function(element) {
+			var datepickers = $('.datepicker', element);
+			if (datepickers.length > 0) {
+				ams.ajax.check($.fn.datetimepicker,
+							   ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
+							   function(first_load) {
+									if (first_load) {
+										ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
+									}
+									ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
+											   'jquery-datetimepicker',
+											   function () {
+												   datepickers.each(function () {
+													   var input = $(this);
+													   var data = input.data();
+													   var dataOptions = {
+														   lang: data.amsDatetimepickerLang || ams.lang,
+														   format: data.amsDatetimepickerFormat || 'd/m/y',
+														   datepicker: true,
+														   dayOfWeekStart: 1,
+														   timepicker: false,
+														   closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
+														   weeks: data.amsDatetimepickerWeeks
+													   };
+													   var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
+													   settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
+													   var plugin = input.datetimepicker(settings);
+													   ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+												   });
+											   });
+							   });
+			}
+		},
+
+		/**
+		 * JQuery datetime picker
+		 */
+		datetimepicker: function(element) {
+			var datetimepickers = $('.datetimepicker', element);
+			if (datetimepickers.length > 0) {
+				ams.ajax.check($.fn.datetimepicker,
+							   ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
+							   function(first_load) {
+									if (first_load) {
+										ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
+									}
+									ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
+											   'jquery-datetimepicker',
+											   function () {
+												   datetimepickers.each(function () {
+													   var input = $(this);
+													   var data = input.data();
+													   var dataOptions = {
+														   lang: data.amsDatetimepickerLang || ams.lang,
+														   format: data.amsDatetimepickerFormat || 'd/m/y H:i',
+														   datepicker: true,
+														   dayOfWeekStart: 1,
+														   timepicker: true,
+														   closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
+														   closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
+														   weeks: data.amsDatetimepickerWeeks
+													   };
+													   var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
+													   settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
+													   var plugin = input.datetimepicker(settings);
+													   ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+												   });
+											   });
+							   });
+			}
+		},
+
+		/**
+		 * JQuery time picker
+		 */
+		timepicker: function(element) {
+			var timepickers = $('.timepicker', element);
+			if (timepickers.length > 0) {
+				ams.ajax.check($.fn.datetimepicker,
+							   ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
+							   function(first_load) {
+									if (first_load) {
+										ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
+									}
+									ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
+											   'jquery-datetimepicker',
+											   function() {
+												   timepickers.each(function () {
+													   var input = $(this);
+													   var data = input.data();
+													   var dataOptions = {
+														   lang: data.amsDatetimepickerLang || ams.lang,
+														   format: data.amsDatetimepickerFormat || 'H:i',
+														   datepicker: false,
+														   timepicker: true,
+														   closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect
+													   };
+													   var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
+													   settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
+													   var plugin = input.datetimepicker(settings);
+													   ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+												   });
+											   });
+							   });
+			}
 		},
 
 		/**
-		 * Map of enabled plug-ins
-		 * This map can be extended by external plug-ins.
-		 *
-		 * Standard MyAMS plug-ins management method generally includes:
-		 * - applying a class matching plug-in name on a set of HTML entities to apply the plug-in
-		 * - defining a set of data-attributes on each of these entities to customize the plug-in
-		 * For each standard plug-in, you can also provide an options object (to define plug-in options not handled
-		 * by default MyAMS initialization engine) and an initialization callback (to define these options dynamically).
-		 * Another callback can also be provided to be called after plug-in initialization.
-		 *
-		 * You can also register plug-ins using the 'register' function
+		 * JQuery color picker
+		 */
+		colorpicker: function(element) {
+			var colorpickers = $('.colorpicker', element);
+			if (colorpickers.length > 0) {
+				ams.ajax.check($.fn.minicolors,
+							   ams.baseURL + 'ext/jquery-minicolors' + ams.devext + '.js',
+							   function() {
+									ams.getCSS(ams.baseURL + '../css/ext/jquery-minicolors' + ams.devext + '.css',
+											   'jquery-minicolors',
+											   function () {
+												   colorpickers.each(function () {
+													   var input = $(this);
+													   var data = input.data();
+													   var dataOptions = {
+														   position: data.amsColorpickerPosition || input.closest('.input').data('ams-colorpicker-position') || 'bottom left'
+													   };
+													   var settings = $.extend({}, dataOptions, data.amsColorpickerOptions);
+													   settings = ams.executeFunctionByName(data.amsColorpickerInitCallback, input, settings) || settings;
+													   var plugin = input.minicolors(settings);
+													   ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
+												   });
+											   });
+							   });
+			}
+		},
+
+		/**
+		 * Drag & drop upload plug-in
 		 */
-		enabled: {
-
-			/**
-			 * SVG containers
-			 */
-			svg: function(element) {
-				var svgs = $('.svg-container', element);
-				if (svgs.length > 0) {
-					svgs.each(function() {
-						var container = $(this);
-						var svg = $('svg', container),
-							width = svg.attr('width'),
-							height = svg.attr('height');
-						if (width && height) {
-							svg.get(0).setAttribute('viewBox',
-													'0 0 ' + Math.round(parseFloat(width)) + ' ' +
-															 Math.round(parseFloat(height)));
-						}
-						svg.attr('width', '100%')
-						   .attr('height', 'auto');
-					})
-				}
-			},
-
-			/**
-			 * Label hints
-			 */
-			hint: function(element) {
-				var hints = $('.hint:not(:parents(.nohints))', element);
-				if (hints.length > 0) {
-					ams.ajax.check($.fn.tipsy,
-								   ams.baseURL + 'ext/jquery-tipsy' + ams.devext + '.js',
-								   function() {
-									   ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + ams.devext + '.css',
-												  'jquery-tipsy', function() {
-										   hints.each(function () {
-											   var hint = $(this);
-											   var data = hint.data();
-											   var dataOptions = {
-												   html: data.amsHintHtml === undefined ? (hint.attr('title') || '').startsWith('<') : data.amsHintHtml,
-												   title: ams.getFunctionByName(data.amsHintTitleGetter) || function () {
-													   var hint = $(this);
-													   var result = hint.attr('original-title') ||
-																	hint.attr(data.amsHintTitleAttr || 'title') ||
-																	(data.amsHintHtml ? hint.html() : hint.text());
-													   result = result.replace(/\?_="/, '?_=' + new Date().getTime() + '"');
-													   return result;
-												   },
-												   opacity: data.amsHintOpacity || 0.95,
-												   gravity: data.amsHintGravity || 'sw',
-												   offset: data.amsHintOffset || 0
-											   };
-											   var settings = $.extend({}, dataOptions, data.amsHintOptions);
-											   settings = ams.executeFunctionByName(data.amsHintInitCallback, hint, settings) || settings;
-											   var plugin = hint.tipsy(settings);
-											   ams.executeFunctionByName(data.amsHintAfterInitCallback, hint, plugin, settings);
-										   });
-									   });
-								   });
-				}
-			},
-
-			/**
-			 * Context menu plug-in
-			 */
-			contextMenu: function(element) {
-				var menus = $('.context-menu', element);
-				if (menus.length > 0) {
-					menus.each(function() {
-						var menu = $(this);
-						var data = menu.data();
-						var dataOptions = {
-							menuSelector: data.amsContextmenuSelector,
-							menuSelected: ams.helpers.contextMenuHandler
-						};
-						var settings = $.extend({}, dataOptions, data.amsContextmenuOptions);
-						settings = ams.executeFunctionByName(data.amsContextmenuInitCallback, menu, settings) || settings;
-						var plugin = menu.contextMenu(settings);
-						ams.executeFunctionByName(data.amsContextmenuAfterInitCallback, menu, plugin, settings);
-					});
-				}
-			},
-
-			/**
-			 * Fieldset legend switcher
-			 */
-			switcher: function(element) {
-				$('LEGEND.switcher', element).each(function() {
-					var legend = $(this);
-					var fieldset = legend.parent('fieldset');
-					var data = legend.data();
-					if (!data.amsSwitcher) {
-						$('<i class="fa fa-fw"></i>')
-							.prependTo($(this))
-							.addClass(data.amsSwitcherState === 'open' ?
-									  (data.amsSwitcherMinusClass || 'fa-minus') :
-									  (data.amsSwitcherPlusClass || 'fa-plus'));
-						legend.on('click', function(e) {
-							e.preventDefault();
-							var veto = {};
-							legend.trigger('ams.switcher.before-switch', [legend, veto]);
-							if (veto.veto) {
-								return;
-							}
-							if (fieldset.hasClass('switched')) {
-								fieldset.removeClass('switched');
-								$('.fa', legend).removeClass(data.amsSwitcherPlusClass || 'fa-plus')
-												.addClass(data.amsSwitcherMinusClass || 'fa-minus');
-								legend.trigger('ams.switcher.opened', [legend]);
-								var id = legend.attr('id');
-								if (id) {
-									$('legend.switcher[data-ams-switcher-sync="'+id+'"]', fieldset).each(function() {
-										var switcher = $(this);
-										if (switcher.parents('fieldset').hasClass('switched')) {
-											switcher.click();
+		dndupload: function(element) {
+			var uploads = $('.dndupload', element);
+			if (uploads.length > 0) {
+				ams.ajax.check($.fn.dndupload,
+							   ams.baseURL + 'ext/jquery-dndupload' + ams.devext + '.js',
+							   function() {
+									ams.getCSS(ams.baseURL + '../css/ext/jquery-dndupload' + ams.devext + '.css',
+											   'jquery-dndupload',
+											   function () {
+												   uploads.each(function () {
+													   var upload = $(this);
+													   var data = upload.data();
+													   var dataOptions = {
+														   action: data.amsDnduploadAction || upload.attr('action') || 'upload-files',
+														   fieldname: data.amsDnduploadFieldname || 'files',
+														   autosubmit: data.amsDnduploadAutosubmit
+													   };
+													   var settings = $.extend({}, dataOptions, data.amsDnduploadOptions);
+													   settings = ams.executeFunctionByName(data.amsDnduploadInitCallback, upload, settings) || settings;
+													   var plugin = upload.dndupload(settings);
+													   ams.executeFunctionByName(data.amsDnduploadAfterInitcallback, upload, plugin, settings);
+												   });
+											   });
+							   });
+			}
+		},
+
+		/**
+		 * JQuery validation plug-in
+		 */
+		validate: function(element) {
+			var forms = $('FORM:not([novalidate])', element);
+			if (forms.length > 0) {
+				ams.ajax.check($.fn.validate,
+							   ams.baseURL + 'ext/jquery-validate-1.17.0' + ams.devext + '.js',
+							   function(first_load) {
+									if (first_load) {
+										$.validator.setDefaults({
+											highlight: function(element) {
+												$(element).closest('.form-group, label:not(:parents(.form-group))').addClass('state-error');
+											},
+											unhighlight: function(element) {
+												$(element).closest('.form-group, label:not(:parents(.form-group))').removeClass('state-error');
+											},
+											errorElement: 'span',
+											errorClass: 'state-error',
+											errorPlacement: function(error, element) {
+												var label = element.parents('label:first');
+												if (label.length) {
+													error.insertAfter(label);
+												} else {
+													error.insertAfter(element);
+												}
+											}
+										});
+										if (ams.plugins.i18n) {
+											for (var key in ams.plugins.i18n.validate) {
+												if (!ams.plugins.i18n.validate.hasOwnProperty(key)) {
+													continue;
+												}
+												var message = ams.plugins.i18n.validate[key];
+												if ((typeof(message) === 'string') &&
+													(message.indexOf('{0}') > -1)) {
+													ams.plugins.i18n.validate[key] = $.validator.format(message);
+												}
+											}
+											$.extend($.validator.messages, ams.plugins.i18n.validate);
 										}
-									});
-								}
-							} else {
-								fieldset.addClass('switched');
-								$('.fa', legend).removeClass(data.amsSwitcherMinusClass || 'fa-minus')
-												.addClass(data.amsSwitcherPlusClass || 'fa-plus');
-								legend.trigger('ams.switcher.closed', [legend]);
-							}
-						});
-						if (data.amsSwitcherState !== 'open') {
-							fieldset.addClass('switched');
-						}
-						legend.data('ams-switcher', 'on');
-					}
-				});
-			},
-
-			/**
-			 * Fieldset legend checker
-			 */
-			checker: function(element) {
-				$('LEGEND.checker', element).each(function() {
-					var legend = $(this);
-					var fieldset = legend.parent('fieldset');
-					var data = legend.data();
-					if (!data.amsChecker) {
-						var checker = $('<label class="checkbox"></label>');
-						var fieldname = data.amsCheckerFieldname || ('checker_'+ams.generateId());
-						var checkboxId = fieldname.replace(/\./, '_');
-						var prefix = data.amsCheckerHiddenPrefix;
-						var hidden = null;
-						var checkedValue = data.amsCheckerHiddenValueOn || 'true';
-						var uncheckedValue = data.amsCheckerHiddenValueOff || 'false';
-						var marker = data.amsCheckerMarker || false;
-						if (prefix) {
-							hidden = $('<input type="hidden">').attr('name', prefix + fieldname)
-															   .val(data.amsCheckerState === 'on' ? checkedValue : uncheckedValue)
-															   .prependTo(legend);
-						} else if (marker) {
-							$('<input type="hidden">').attr('name', marker)
-													  .attr('value', 1)
-													  .prependTo(legend);
-						}
-						var input = $('<input type="checkbox">').attr('name', fieldname)
-																.attr('id', checkboxId)
-																.data('ams-checker-hidden-input', hidden)
-																.data('ams-checker-init', true)
-																.val(data.amsCheckerValue || true)
-																.attr('checked', data.amsCheckerState === 'on' ? 'checked' : null);
-						if (data.amsCheckerReadonly) {
-							input.attr('disabled', 'disabled');
-						} else {
-							input.on('change', function(e) {
-								e.preventDefault();
-								var veto = {};
-								var isChecked = $(this).is(':checked');
-								legend.trigger('ams.checker.before-switch', [legend, veto]);
-								if (veto.veto) {
-									// reset checked status because event is fired after change...
-									$(this).prop('checked', !isChecked);
-									return;
-								}
-								ams.executeFunctionByName(data.amsCheckerChangeHandler, legend, isChecked);
-								if (!data.amsCheckerCancelDefault) {
-									var hidden = input.data('ams-checker-hidden-input');
-									if (isChecked) {
-										if (data.amsCheckerMode === 'disable') {
-											fieldset.removeAttr('disabled');
-											$('.select2', fieldset).removeAttr('disabled');
-										} else {
-											fieldset.removeClass('switched');
-										}
-										if (hidden) {
-											hidden.val(checkedValue);
-										}
-										$('[data-required]', fieldset).attr('required', 'required');
-										legend.trigger('ams.checker.opened', [legend]);
-									} else {
-										if (data.amsCheckerMode === 'disable') {
-											fieldset.prop('disabled', 'disabled');
-											$('.select2', fieldset).attr('disabled', 'disabled');
-										} else {
-											fieldset.addClass('switched');
-										}
-										if (hidden) {
-											hidden.val(uncheckedValue);
-										}
-										$('[data-required]', fieldset).removeAttr('required');
-										legend.trigger('ams.checker.closed', [legend]);
 									}
-								}
-							});
-						}
-						input.appendTo(checker);
-						$('>label', legend).attr('for', input.attr('id'));
-						checker.append('<i></i>')
-							   .prependTo(legend);
-						var required = $('[required]', fieldset);
-						required.attr('data-required', true);
-						if (data.amsCheckerState === 'on') {
-							input.attr('checked', true);
-						} else {
-							if (data.amsCheckerMode === 'disable') {
-								fieldset.attr('disabled', 'disabled');
-								$('.select2', fieldset).attr('disabled', 'disabled');
-							} else {
-								fieldset.addClass('switched');
-							}
-							required.removeAttr('required');
-						}
-						legend.data('ams-checker', 'on');
-					}
-				});
-			},
-
-			/**
-			 * Sliders
-			 */
-			slider: function(element) {
-				var sliders = $('.slider', element);
-				if (sliders.length > 0) {
-					ams.ajax.check($.fn.slider,
-								   ams.baseURL + 'ext/bootstrap-slider-2.0.0' + ams.devext + '.js',
-								   function() {
-										sliders.each(function() {
-											var slider = $(this);
-											var data = slider.data();
-											var dataOptions = {};
-											var settings = $.extend({}, dataOptions, slider.data.amsSliderOptions);
-											settings = ams.executeFunctionByName(data.amsSliderInitCallback, slider, settings) || settings;
-											var plugin = slider.slider(settings);
-											ams.executeFunctionByName(data.amsSliderAfterInitCallback, slider, plugin, settings);
-										});
-								   });
-				}
-			},
-
-			/**
-			 * Draggable plug-in
-			 */
-			draggable: function(element) {
-				var draggables = $('.draggable', element);
-				if (draggables.length > 0) {
-					draggables.each(function() {
-						var draggable = $(this);
-						var data = draggable.data();
-						var dataOptions = {
-							cursor: data.amsDraggableCursor || 'move',
-							containment: data.amsDraggableContainment,
-							handle: data.amsDraggableHandle,
-							connectToSortable: data.amsDraggableConnectSortable,
-							helper: ams.getFunctionByName(data.amsDraggableHelper) || data.amsDraggableHelper,
-							start: ams.getFunctionByName(data.amsDraggableStart),
-							stop: ams.getFunctionByName(data.amsDraggableStop)
-						};
-						var settings = $.extend({}, dataOptions, data.amsDraggableOptions);
-						settings = ams.executeFunctionByName(data.amsDraggableInitCallback, draggable, settings) || settings;
-						var plugin = draggable.draggable(settings);
-						draggable.disableSelection();
-						ams.executeFunctionByName(data.amsDraggableAfterInitCallback, draggable, plugin, settings);
-					});
-				}
-			},
-
-			/**
-			 * Droppable plug-in
-			 */
-			droppable: function(element) {
-				var droppables = $('.droppable', element);
-				if (droppables.length > 0) {
-					droppables.each(function() {
-						var droppable = $(this);
-						var data = droppable.data();
-						var dataOptions = {
-							accept: data.amsdroppableAccept,
-							drop: ams.getFunctionByName(data.amsDroppableDrop)
-						};
-						var settings = $.extend({}, dataOptions, data.amsDroppableOptions);
-						settings = ams.executeFunctionByName(data.amsDroppableInitCallback, droppable, settings) || settings;
-						var plugin = droppable.droppable(settings);
-						ams.executeFunctionByName(data.amsDroppableAfterInitCallback, droppable, plugin, settings);
-					});
-				}
-			},
-
-			/**
-			 * Sortable plug-in
-			 */
-			sortable: function(element) {
-				var sortables = $('.sortable', element);
-				if (sortables.length > 0) {
-					sortables.each(function() {
-						var sortable = $(this);
-						var data = sortable.data();
-						var dataOptions = {
-							items: data.amsSortableItems,
-							handle: data.amsSortableHandle,
-							helper: data.amsSortableHelper,
-							connectWith: data.amsSortableConnectwith,
-							start: ams.getFunctionByName(data.amsSortableStart),
-							over: ams.getFunctionByName(data.amsSortableOver),
-							containment: data.amsSortableContainment,
-							placeholder: data.amsSortablePlaceholder,
-							stop: ams.getFunctionByName(data.amsSortableStop)
-						};
-						var settings = $.extend({}, dataOptions, data.amsSortableOptions);
-						settings = ams.executeFunctionByName(data.amsSortableInitCallback, sortable, settings) || settings;
-						var plugin = sortable.sortable(settings);
-						sortable.disableSelection();
-						ams.executeFunctionByName(data.amsSortableAfterInitCallback, sortable, plugin, settings);
-					});
-				}
-			},
-
-			/**
-			 * Resizable plug-in
-			 */
-			resizable: function(element) {
-				var resizables = $('.resizable', element);
-				if (resizables.length > 0) {
-					resizables.each(function() {
-						var resizable = $(this);
-						var data = resizable.data();
-						var dataOptions = {
-							autoHide: data.amsResizableAutohide === false ? true : data.amsResizableAutohide,
-							containment: data.amsResizableContainment,
-							grid: data.amsResizableGrid,
-							handles: data.amsResizableHandles,
-							start: ams.getFunctionByName(data.amsResizableStart),
-							stop: ams.getFunctionByName(data.amsResizableStop)
-						};
-						var settings = $.extend({}, dataOptions, data.amsResizableOptions);
-						settings = ams.executeFunctionByName(data.amsResizableInitCallback, resizable, settings) || settings;
-						var plugin = resizable.resizable(settings);
-						resizable.disableSelection();
-						ams.executeFunctionByName(data.amsResizableAfterInitCallback, resizable, plugin, settings);
-					});
-				}
-			},
-
-			/**
-			 * JQuery typeahead plug-in
-			 */
-			typeahead: function(element) {
-				var typeaheads = $('.typeahead', element);
-				if (typeaheads.length > 0) {
-					ams.ajax.check($.fn.typeahead,
-								   ams.baseURL + 'ext/jquery-typeahead' + ams.devext + '.js',
-								   function() {
-										typeaheads.each(function() {
-											var input = $(this);
-											var data = input.data();
-											var dataOptions = {};
-											var settings = $.extend({}, dataOptions, data.amsTypeaheadOptions);
-											settings = ams.executeFunctionByName(data.amsTypeaheadInitCallback, input, settings) || settings;
-											var plugin = input.typeahead(settings);
-											ams.executeFunctionByName(data.amsTypeaheadAfterInitCallback, input, plugin, settings);
-										});
-								   });
-				}
-			},
-
-			/**
-			 * Treeview plug-in
-			 */
-			treeview: function(element) {
-				var treeviews = $('.treeview', element);
-				if (treeviews.length > 0) {
-					ams.ajax.check($.fn.treview,
-								   ams.baseURL + 'ext/bootstrap-treeview' + ams.devext + '.js',
-								   function() {
-										ams.getCSS(ams.baseURL + '../css/ext/bootstrap-treeview' + ams.devext + '.css',
-												   'bootstrap-treeview',
-												   function() {
-													   treeviews.each(function () {
-														   var treeview = $(this);
-														   var data = treeview.data();
-														   var dataOptions = {
-															   data: data.amsTreeviewData,
-															   levels: data.amsTreeviewLevels,
-															   injectStyle: data.amsTreeviewInjectStyle,
-															   expandIcon: data.amsTreeviewExpandIcon || 'fa fa-fw fa-plus-square-o',
-															   collapseIcon: data.amsTreeviewCollaspeIcon || 'fa fa-fw fa-minus-square-o',
-															   emptyIcon: data.amsTreeviewEmptyIcon || 'fa fa-fw',
-															   nodeIcon: data.amsTreeviewNodeIcon,
-															   selectedIcon: data.amsTreeviewSelectedIcon,
-															   checkedIcon: data.amsTreeviewCheckedIcon || 'fa fa-fw fa-check-square-o',
-															   uncheckedIcon: data.amsTreeviewUncheckedIcon || 'fa fa-fw fa-square-o',
-															   color: data.amsTreeviewColor,
-															   backColor: data.amsTreeviewBackColor,
-															   borderColor: data.amsTreeviewBorderColor,
-															   onHoverColor: data.amsTreeviewHoverColor,
-															   selectedColor: data.amsTreeviewSelectedColor,
-															   selectedBackColor: data.amsTreeviewSelectedBackColor,
-															   unselectableColor: data.amsTreeviewUnselectableColor || 'rgba(1,1,1,0.25)',
-															   unselectableBackColor: data.amsTreeviewUnselectableBackColor || 'rgba(1,1,1,0.25)',
-															   enableLinks: data.amsTreeviewEnableLinks,
-															   highlightSelected: data.amsTreeviewHighlightSelected,
-															   highlightSearchResults: data.amsTreeviewhighlightSearchResults,
-															   showBorder: data.amsTreeviewShowBorder,
-															   showIcon: data.amsTreeviewShowIcon,
-															   showCheckbox: data.amsTreeviewShowCheckbox,
-															   showTags: data.amsTreeviewShowTags,
-															   toggleUnselectable: data.amsTreeviewToggleUnselectable,
-															   multiSelect: data.amsTreeviewMultiSelect,
-															   onNodeChecked: ams.getFunctionByName(data.amsTreeviewNodeChecked),
-															   onNodeCollapsed: ams.getFunctionByName(data.amsTreeviewNodeCollapsed),
-															   onNodeDisabled: ams.getFunctionByName(data.amsTreeviewNodeDisabled),
-															   onNodeEnabled: ams.getFunctionByName(data.amsTreeviewNodeEnabled),
-															   onNodeExpanded: ams.getFunctionByName(data.amsTreeviewNodeExpanded),
-															   onNodeSelected: ams.getFunctionByName(data.amsTreeviewNodeSelected),
-															   onNodeUnchecked: ams.getFunctionByName(data.amsTreeviewNodeUnchecked),
-															   onNodeUnselected: ams.getFunctionByName(data.amsTreeviewNodeUnselected),
-															   onSearchComplete: ams.getFunctionByName(data.amsTreeviewSearchComplete),
-															   onSearchCleared: ams.getFunctionByName(data.amsTreeviewSearchCleared)
-														   };
-														   var settings = $.extend({}, dataOptions, data.amsTreeviewOptions);
-														   settings = ams.executeFunctionByName(data.amsTreeviewInitcallback, treeview, settings) || settings;
-														   var plugin = treeview.treeview(settings);
-														   ams.executeFunctionByName(data.amsTreeviewAfterInitCallback, treeview, plugin, settings);
-													   });
-												   });
-								   });
-				}
-			},
-
-			/**
-			 * Select2 plug-in
-			 */
-			select2: function(element) {
-				var selects = $('.select2', element);
-				if (selects.length > 0) {
-					ams.ajax.check($.fn.select2,
-								   ams.baseURL + 'ext/jquery-select2-3.5.4' + ams.devext + '.js',
-								   function() {
-										selects.each(function() {
-											var select = $(this);
-											var data = select.data();
-											if (data.select2) {
-												// Already initialized
-												return;
-											}
-											var dataOptions = {
-												placeholder: data.amsSelect2Placeholder,
-												multiple: data.amsSelect2Multiple,
-												minimumInputLength: data.amsSelect2MinimumInputLength || 0,
-												maximumSelectionSize: data.amsSelect2MaximumSelectionSize,
-												openOnEnter: data.amsSelect2EnterOpen === undefined ? true : data.amsSelect2EnterOpen,
-												allowClear: data.amsSelect2AllowClear === undefined ? true : data.amsSelect2AllowClear,
-												width: data.amsSelect2Width || '100%',
-												initSelection: ams.getFunctionByName(data.amsSelect2InitSelection),
-												formatSelection: data.amsSelect2FormatSelection === undefined ?
-																	ams.helpers.select2FormatSelection
-																	: ams.getFunctionByName(data.amsSelect2FormatSelection),
-												formatResult: ams.getFunctionByName(data.amsSelect2FormatResult),
-												formatMatches: data.amsSelect2FormatMatches === undefined ?
-																	function(matches) {
-																		if (matches === 1) {
-																			return ams.i18n.SELECT2_MATCH;
-																		} else {
-																			return matches + ams.i18n.SELECT2_MATCHES;
+									forms.each(function() {
+										var form = $(this);
+										var data = form.data();
+										var dataOptions = {
+											ignore: null,
+											submitHandler: form.attr('data-async') !== undefined ?
+														   data.amsFormSubmitHandler === undefined ?
+																function() {
+																	// JQuery-form plug-in must be loaded synchronously!!
+																	// Otherwise, hidden input fields created by jquery-validate plug-in
+																	// and matching named buttons will be deleted (on first form submit)
+																	// before JQuery-form plug-in can get them when submitting the form...
+																	$('.state-error', form).removeClass('state-error');
+																	ams.ajax.check($.fn.ajaxSubmit,
+																				   ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js');
+																	return ams.form.submit(form);
+																}
+																: ams.getFunctionByName(data.amsFormSubmitHandler)
+														   : undefined,
+											invalidHandler: form.attr('data-async') !== undefined ?
+															data.amsFormInvalidHandler === undefined ?
+																function(event, validator) {
+																	$('.state-error', form).removeClass('state-error');
+																	for (var index=0; index < validator.errorList.length; index++) {
+																		var error = validator.errorList[index];
+																		var tabIndex = $(error.element).parents('.tab-pane').index() + 1;
+																		if (tabIndex > 0) {
+																			var navTabs = $('.nav-tabs', $(error.element).parents('.tabforms'));
+																			$('li:nth-child(' + tabIndex + ')', navTabs)
+																					.removeClassPrefix('state-')
+																					.addClass('state-error');
+																			$('li.state-error:first a', navTabs).click();
 																		}
 																	}
-																	: ams.getFunctionByName(data.amsSelect2FormatMatches),
-												formatNoMatches: data.amsSelect2FormatResult === undefined ?
-																	function(term) {
-																		return ams.i18n.SELECT2_NOMATCHES;
-																	}
-																	: ams.getFunctionByName(data.amsSelect2FormatResult),
-												formatInputTooShort: data.amsSelect2FormatInputTooShort === undefined ?
-																	function(input, min) {
-																		var n = min - input.length;
-																		return ams.i18n.SELECT2_INPUT_TOOSHORT
-																						.replace(/\{0\}/, n)
-																						.replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
-																	}
-																	: ams.getFunctionByName(data.amsSelect2FormatInputTooShort),
-												formatInputTooLong: data.amsSelect2FormatInputTooLong === undefined ?
-																	function(input, max) {
-																		var n = input.length - max;
-																		return ams.i18n.SELECT2_INPUT_TOOLONG
-																						.replace(/\{0\}/, n)
-																						.replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
-																	}
-																	: ams.getFunctionByName(data.amsSelect2FormatInputTooLong),
-												formatSelectionTooBig: data.amsSelect2FormatSelectionTooBig === undefined ?
-																	function(limit) {
-																		return ams.i18n.SELECT2_SELECTION_TOOBIG
-																						.replace(/\{0\}/, limit)
-																						.replace(/\{1\}/, limit === 1 ? "" : ams.i18n.SELECT2_PLURAL);
-																	}
-																	: ams.getFunctionByName(data.amsSelect2FormatSelectionTooBig),
-												formatLoadMore: data.amsSelect2FormatLoadMore === undefined ?
-																	function (pageNumber) {
-																		return ams.i18n.SELECT2_LOADMORE;
-																	}
-																	: ams.getFunctionByName(data.amsSelect2FormatLoadMore),
-												formatSearching: data.amsSelect2FormatSearching === undefined ?
-																	function() {
-																		return ams.i18n.SELECT2_SEARCHING;
-																	}
-																	: ams.getFunctionByName(data.amsSelect2FormatSearching),
-												separator: data.amsSelect2Separator || ',',
-												tokenSeparators: data.amsSelect2TokensSeparators || [','],
-												tokenizer: ams.getFunctionByName(data.amsSelect2Tokenizer)
-											};
-
-											switch (select.context.type) {
-												case 'text':
-												case 'hidden':
-													if (!dataOptions.initSelection) {
-														var valuesData = select.data('ams-select2-values');
-														if (valuesData) {
-															dataOptions.initSelection = function(element, callback) {
-																var data = [];
-																$(element.val().split(dataOptions.separator)).each(function() {
-																	data.push({id: this,
-																			   text: valuesData[this] || this});
-																});
-																callback(data);
-															};
-														}
-													}
-													break;
-												default:
-													break;
+																}
+																: ams.getFunctionByName(data.amsFormInvalidHandler)
+															: undefined
+										};
+										$('[data-ams-validate-rules]', form).each(function(index) {
+											if (index === 0) {
+												dataOptions.rules = {};
 											}
-
-											if (select.attr('readonly')) {
-												if (select.attr('type') === 'hidden') {
-													dataOptions.query = function () {
-														return [];
-													};
-												}
-											} else if (data.amsSelect2Query) {
-												// Custom query method
-												dataOptions.query = ams.getFunctionByName(data.amsSelect2Query);
-												dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
-											} else if (data.amsSelect2QueryUrl) {
-												// AJAX query
-												dataOptions.ajax = {
-													url: data.amsSelect2QueryUrl,
-													quietMillis: data.amsSelect2QuietMillis || 200,
-													type: data.amsSelect2QueryType || 'POST',
-													dataType: data.amsSelect2QueryDatatype || 'json',
-													data: function(term, page, context) {
-														var options = {};
-														options[data.amsSelect2QueryParamName || 'query'] = term;
-														options[data.amsSelect2PageParamName || 'page'] = page;
-														options[data.amsSelect2ContextParamName || 'context'] = context;
-														return $.extend({}, options, data.amsSelect2QueryOptions);
-													},
-													results: ams.helpers.select2QueryUrlResultsCallback
-												};
-												dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
-											} else if (data.amsSelect2QueryMethod) {
-												// JSON-RPC query
-												dataOptions.query = function(options) {
-													var settings = {
-														id: new Date().getTime(),
-														params: data.amsSelect2QueryParams || {},
-														success: function(result) {
-															return ams.helpers.select2QueryMethodSuccessCallback.call(select, result, 'success', options);
-														},
-														error: ams.error.show
-													};
-													settings.params[data.amsSelect2QueryParamName || 'query'] = options.term;
-													settings.params[data.amsSelect2PageParamName || 'page'] = options.page;
-													settings.params[data.amsSelect2ContextParamName || 'context'] = options.context;
-													settings = $.extend({}, settings, data.amsSelect2QueryOptions);
-													settings = ams.executeFunctionByName(data.amsSelect2QueryInitCallback, select, settings) || settings;
-													ams.ajax.check($.jsonRPC,
-																   ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
-																   function() {
-																		$.jsonRPC.withOptions({
-																			endPoint: data.amsSelect2MethodTarget || ams.jsonrpc.getAddr(),
-																			namespace: data.amsSelect2MethodNamespace,
-																			cache: false
-																		}, function() {
-																			$.jsonRPC.request(data.amsSelect2QueryMethod, settings);
-																		});
-																   });
-												};
-												dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
-											} else if (data.amsSelect2Tags) {
-												// Tags mode
-												dataOptions.tags = data.amsSelect2Tags;
-											} else if (data.amsSelect2Data) {
-												// Provided data mode
-												dataOptions.data = data.amsSelect2Data;
-											}
-
-											if (data.amsSelect2EnableFreeTags) {
-												dataOptions.createSearchChoice = function(term) {
-													return {id: term,
-															text: (data.amsSelect2FreeTagsPrefix || ams.i18n.SELECT2_FREETAG_PREFIX) + term};
-												};
-											}
-
-											var settings = $.extend({}, dataOptions, data.amsSelect2Options);
-											settings = ams.executeFunctionByName(data.amsSelect2InitCallback, select, settings) || settings;
-											var plugin = select.select2(settings);
-											ams.executeFunctionByName(data.amsSelect2AfterInitCallback, select, plugin, settings);
-											if (select.hasClass('ordered')) {
-												ams.ajax.check($.fn.select2Sortable,
-															   ams.baseURL + 'ext/jquery-select2-sortable' + ams.devext + '.js',
-															   function() {
-																	select.select2Sortable({
-																		bindOrder: 'sortableStop'
-																	});
-															   });
-											}
-
-											select.on('change', function() {
-												var validator = $(select.get(0).form).data('validator');
-												if (validator !== undefined) {
-													$(select).valid();
-												}
-											});
+											dataOptions.rules[$(this).attr('name')] = $(this).data('ams-validate-rules');
 										});
-								   });
-				}
-			},
-
-			/**
-			 * Edit mask plug-in
-			 */
-			maskedit: function(element) {
-				var masks = $('input[data-mask]', element);
-				if (masks.length > 0) {
-					ams.ajax.check($.fn.mask,
-								   ams.baseURL + 'ext/jquery-maskedinput-1.4.1' + ams.devext + '.js',
-								   function() {
-										masks.each(function() {
-											var mask = $(this);
-											var data = mask.data();
-											var dataOptions = {
-												placeholder: data.amsMaskeditPlaceholder === undefined ? 'X' : data.amsMaskeditPlaceholder,
-												complete: ams.getFunctionByName(data.amsMaskeditComplete)
-											};
-											var settings = $.extend({}, dataOptions, data.amsMaskeditOptions);
-											settings = ams.executeFunctionByName(data.amsMaskeditInitCallback, mask, settings) || settings;
-											var plugin = mask.mask(mask.attr('data-mask'), settings);
-											ams.executeFunctionByName(data.amsMaskeditAfterInitCallback, mask, plugin, settings);
-										});
-								   });
-				}
-			},
-
-			/**
-			 * JQuery input-mask plug-in
-			 *
-			 * Mask value can be set in a "data-input-mask" attribute defined:
-			 * - as a simple string containing mask
-			 * - as a JSON object defining all mask attributes, for example:
-			 *   data-input-mask='{"alias": "integer", "allowPlus": false, "allowMinus": false}'
-			 */
-			inputmask: function(element) {
-				var masks = $('input[data-input-mask]', element);
-				if (masks.length > 0) {
-					ams.ajax.check($.fn.inputmask,
-								   ams.baseURL + 'ext/jquery-inputmask-bundle-3.2.8' + ams.devext + '.js',
-								   function() {
-										masks.each(function() {
-											var input = $(this);
-											var data = input.data();
-											var dataOptions;
-											if (typeof(data.inputMask) === 'object') {
-												dataOptions = data.inputMask;
-											} else {
-												dataOptions = {
-													mask: data.inputMask.toString()
-												};
-											}
-											var settings = $.extend({}, dataOptions, data.amsInputmaskOptions);
-											settings = ams.executeFunctionByName(data.amsInputmaskInitCallback, input, settings) || settings;
-											var plugin = input.inputmask(settings);
-											ams.executeFunctionByName(data.amsInputmaskAfterInitCallback, input, plugin, settings);
-										});
-								   });
-				}
-			},
-
-			/**
-			 * JQuery date picker
-			 */
-			datepicker: function(element) {
-				var datepickers = $('.datepicker', element);
-				if (datepickers.length > 0) {
-					ams.ajax.check($.fn.datetimepicker,
-								   ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
-								   function(first_load) {
-										if (first_load) {
-											ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
-										}
-										ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
-												   'jquery-datetimepicker',
-												   function () {
-													   datepickers.each(function () {
-														   var input = $(this);
-														   var data = input.data();
+										var settings = $.extend({}, dataOptions, data.amsValidateOptions);
+										settings = ams.executeFunctionByName(data.amsValidateInitCallback, form, settings) || settings;
+										var plugin = form.validate(settings);
+										ams.executeFunctionByName(data.amsValidateAfterInitCallback, form, plugin, settings);
+									});
+							   });
+			}
+		},
+
+		/**
+		 * JQuery dataTables
+		 */
+		datatable: function(element) {
+			var tables = $('.datatable', element);
+			if (tables.length > 0) {
+				ams.ajax.check($.fn.dataTable,
+							   ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js',
+							   function() {
+									ams.ajax.check($.fn.dataTableExt.oPagination.bootstrap_full,
+												   ams.baseURL + 'myams-dataTables' + ams.devext + '.js',
+												   function() {
+													   $(tables).each(function () {
+														   var table = $(this);
+														   var data = table.data();
+														   var extensions = (data.amsDatatableExtensions || '').split(/\s+/);
+														   // Check DOM elements
+														   var sDom = data.amsDatatableSdom ||
+															   "W" +
+															   ((extensions.indexOf('colreorder') >= 0 ||
+															   extensions.indexOf('colreorderwithresize') >= 0) ? 'R' : '') +
+															   "<'dt-top-row'" +
+															   (extensions.indexOf('colvis') >= 0 ? 'C' : '') +
+															   ((data.amsDatatablePagination === false ||
+															   data.amsDatatablePaginationSize === false) ? '' : 'L') +
+															   (data.amsDatatableGlobalFilter === false ? '' : 'F') +
+															   ">r<'dt-wrapper't" +
+															   (extensions.indexOf('scroller') >= 0 ? 'S' : '') +
+															   "><'dt-row dt-bottom-row'<'row'<'col-sm-6'" +
+															   (data.amsDatatableInformation === false ? '' : 'i') +
+															   "><'col-sm-6 text-right'p>>";
+
+														   var index;
+														   // Check initial sorting
+														   var sorting = data.amsDatatableSorting;
+														   if (typeof(sorting) === 'string') {
+															   var sortings = sorting.split(';');
+															   sorting = [];
+															   for (index = 0; index < sortings.length; index++) {
+																   var colSorting = sortings[index].split(',');
+																   colSorting[0] = parseInt(colSorting[0]);
+																   sorting.push(colSorting);
+															   }
+														   }
+														   // Check columns sortings
+														   var columns = [];
+														   var column;
+														   var sortables = $('th', table).listattr('data-ams-datatable-sortable');
+														   for (index = 0; index < sortables.length; index++) {
+															   var sortable = sortables[index];
+															   if (sortable !== undefined) {
+																   column = columns[index] || {};
+																   column.bSortable = typeof(sortable) === 'string' ? JSON.parse(sortable) : sortable;
+																   columns[index] = column;
+															   } else {
+																   columns[index] = columns[index] || {};
+															   }
+														   }
+														   // Check columns types
+														   var sortTypes = $('th', table).listattr('data-ams-datatable-stype');
+														   for (index = 0; index < sortTypes.length; index++) {
+															   var sortType = sortTypes[index];
+															   if (sortType) {
+																   column = columns[index] || {};
+																   column.sType = sortType;
+																   columns[index] = column;
+															   } else {
+																   columns[index] = columns[index] || {};
+															   }
+														   }
+														   // Set options
 														   var dataOptions = {
-															   lang: data.amsDatetimepickerLang || ams.lang,
-															   format: data.amsDatetimepickerFormat || 'd/m/y',
-															   datepicker: true,
-															   dayOfWeekStart: 1,
-															   timepicker: false,
-															   closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
-															   weeks: data.amsDatetimepickerWeeks
+															   bJQueryUI: false,
+															   bServerSide: data.amsDatatableServerSide || false,
+															   sAjaxSource: data.amsDatatableServerSide === true ? data.amsDatatableAjaxSource : undefined,
+															   sServerMethod: data.amsDatatableServerSide === true ? 'POST' : undefined,
+															   bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0,
+															   bPaginate: data.amsDatatablePagination !== false,
+															   bInfo: data.amsDatatableInfo !== false,
+															   bSort: data.amsDatatableSort !== false,
+															   aaSorting: sorting,
+															   aoColumns: columns.length > 0 ? columns : undefined,
+															   bDeferRender: true,
+															   bAutoWidth: false,
+															   iDisplayLength: data.amsDatatableDisplayLength || 25,
+															   sPaginationType: data.amsDatatablePaginationType || 'bootstrap_full',
+															   sDom: sDom,
+															   oLanguage: ams.plugins.i18n.datatables,
+															   fnInitComplete: function (oSettings, json) {
+																   $('.ColVis_Button').addClass('btn btn-default btn-sm')
+																	   .html((ams.plugins.i18n.datatables.sColumns || "Columns") +
+																			 ' <i class="fa fa-fw fa-caret-down"></i>');
+															   }
 														   };
-														   var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
-														   settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
-														   var plugin = input.datetimepicker(settings);
-														   ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
-													   });
-												   });
-								   });
-				}
-			},
-
-			/**
-			 * JQuery datetime picker
-			 */
-			datetimepicker: function(element) {
-				var datetimepickers = $('.datetimepicker', element);
-				if (datetimepickers.length > 0) {
-					ams.ajax.check($.fn.datetimepicker,
-								   ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
-								   function(first_load) {
-										if (first_load) {
-											ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
-										}
-										ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
-												   'jquery-datetimepicker',
-												   function () {
-													   datetimepickers.each(function () {
-														   var input = $(this);
-														   var data = input.data();
-														   var dataOptions = {
-															   lang: data.amsDatetimepickerLang || ams.lang,
-															   format: data.amsDatetimepickerFormat || 'd/m/y H:i',
-															   datepicker: true,
-															   dayOfWeekStart: 1,
-															   timepicker: true,
-															   closeOnDateSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
-															   closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect,
-															   weeks: data.amsDatetimepickerWeeks
-														   };
-														   var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
-														   settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
-														   var plugin = input.datetimepicker(settings);
-														   ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
-													   });
-												   });
-								   });
-				}
-			},
-
-			/**
-			 * JQuery time picker
-			 */
-			timepicker: function(element) {
-				var timepickers = $('.timepicker', element);
-				if (timepickers.length > 0) {
-					ams.ajax.check($.fn.datetimepicker,
-								   ams.baseURL + 'ext/jquery-datetimepicker' + ams.devext + '.js',
-								   function(first_load) {
-										if (first_load) {
-											ams.dialog.registerHideCallback(ams.helpers.datetimepickerDialogHiddenCallback);
-										}
-										ams.getCSS(ams.baseURL + '../css/ext/jquery-datetimepicker' + ams.devext + '.css',
-												   'jquery-datetimepicker',
-												   function() {
-													   timepickers.each(function () {
-														   var input = $(this);
-														   var data = input.data();
-														   var dataOptions = {
-															   lang: data.amsDatetimepickerLang || ams.lang,
-															   format: data.amsDatetimepickerFormat || 'H:i',
-															   datepicker: false,
-															   timepicker: true,
-															   closeOnTimeSelect: data.amsDatetimepickerCloseOnSelect === undefined ? true : data.amsDatetimepickerCloseOnSelect
-														   };
-														   var settings = $.extend({}, dataOptions, data.amsDatetimepickerOptions);
-														   settings = ams.executeFunctionByName(data.amsDatetimepickerInitCallback, input, settings) || settings;
-														   var plugin = input.datetimepicker(settings);
-														   ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
-													   });
-												   });
-								   });
-				}
-			},
-
-			/**
-			 * JQuery color picker
-			 */
-			colorpicker: function(element) {
-				var colorpickers = $('.colorpicker', element);
-				if (colorpickers.length > 0) {
-					ams.ajax.check($.fn.minicolors,
-								   ams.baseURL + 'ext/jquery-minicolors' + ams.devext + '.js',
-								   function() {
-										ams.getCSS(ams.baseURL + '../css/ext/jquery-minicolors' + ams.devext + '.css',
-												   'jquery-minicolors',
-												   function () {
-													   colorpickers.each(function () {
-														   var input = $(this);
-														   var data = input.data();
-														   var dataOptions = {
-															   position: data.amsColorpickerPosition || input.closest('.input').data('ams-colorpicker-position') || 'bottom left'
-														   };
-														   var settings = $.extend({}, dataOptions, data.amsColorpickerOptions);
-														   settings = ams.executeFunctionByName(data.amsColorpickerInitCallback, input, settings) || settings;
-														   var plugin = input.minicolors(settings);
-														   ams.executeFunctionByName(data.amsDatetimepickerAfterInitCallback, input, plugin, settings);
-													   });
-												   });
-								   });
-				}
-			},
-
-			/**
-			 * Drag & drop upload plug-in
-			 */
-			dndupload: function(element) {
-				var uploads = $('.dndupload', element);
-				if (uploads.length > 0) {
-					ams.ajax.check($.fn.dndupload,
-								   ams.baseURL + 'ext/jquery-dndupload' + ams.devext + '.js',
-								   function() {
-										ams.getCSS(ams.baseURL + '../css/ext/jquery-dndupload' + ams.devext + '.css',
-												   'jquery-dndupload',
-												   function () {
-													   uploads.each(function () {
-														   var upload = $(this);
-														   var data = upload.data();
-														   var dataOptions = {
-															   action: data.amsDnduploadAction || upload.attr('action') || 'upload-files',
-															   fieldname: data.amsDnduploadFieldname || 'files',
-															   autosubmit: data.amsDnduploadAutosubmit
-														   };
-														   var settings = $.extend({}, dataOptions, data.amsDnduploadOptions);
-														   settings = ams.executeFunctionByName(data.amsDnduploadInitCallback, upload, settings) || settings;
-														   var plugin = upload.dndupload(settings);
-														   ams.executeFunctionByName(data.amsDnduploadAfterInitcallback, upload, plugin, settings);
-													   });
-												   });
-								   });
-				}
-			},
-
-			/**
-			 * JQuery validation plug-in
-			 */
-			validate: function(element) {
-				var forms = $('FORM:not([novalidate])', element);
-				if (forms.length > 0) {
-					ams.ajax.check($.fn.validate,
-								   ams.baseURL + 'ext/jquery-validate-1.17.0' + ams.devext + '.js',
-								   function(first_load) {
-										if (first_load) {
-											$.validator.setDefaults({
-												highlight: function(element) {
-													$(element).closest('.form-group, label:not(:parents(.form-group))').addClass('state-error');
-												},
-												unhighlight: function(element) {
-													$(element).closest('.form-group, label:not(:parents(.form-group))').removeClass('state-error');
-												},
-												errorElement: 'span',
-												errorClass: 'state-error',
-												errorPlacement: function(error, element) {
-													var label = element.parents('label:first');
-													if (label.length) {
-														error.insertAfter(label);
-													} else {
-														error.insertAfter(element);
-													}
-												}
-											});
-											if (ams.plugins.i18n) {
-												for (var key in ams.plugins.i18n.validate) {
-													if (!ams.plugins.i18n.validate.hasOwnProperty(key)) {
-														continue;
-													}
-													var message = ams.plugins.i18n.validate[key];
-													if ((typeof(message) === 'string') &&
-														(message.indexOf('{0}') > -1)) {
-														ams.plugins.i18n.validate[key] = $.validator.format(message);
-													}
-												}
-												$.extend($.validator.messages, ams.plugins.i18n.validate);
-											}
-										}
-										forms.each(function() {
-											var form = $(this);
-											var data = form.data();
-											var dataOptions = {
-												ignore: null,
-												submitHandler: form.attr('data-async') !== undefined ?
-															   data.amsFormSubmitHandler === undefined ?
-																	function() {
-																		// JQuery-form plug-in must be loaded synchronously!!
-																		// Otherwise, hidden input fields created by jquery-validate plug-in
-																		// and matching named buttons will be deleted (on first form submit)
-																		// before JQuery-form plug-in can get them when submitting the form...
-																		$('.state-error', form).removeClass('state-error');
-																		ams.ajax.check($.fn.ajaxSubmit,
-																					   ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js');
-																		return ams.form.submit(form);
-																	}
-																	: ams.getFunctionByName(data.amsFormSubmitHandler)
-															   : undefined,
-												invalidHandler: form.attr('data-async') !== undefined ?
-																data.amsFormInvalidHandler === undefined ?
-																	function(event, validator) {
-																		$('.state-error', form).removeClass('state-error');
-																		for (var index=0; index < validator.errorList.length; index++) {
-																			var error = validator.errorList[index];
-																			var tabIndex = $(error.element).parents('.tab-pane').index() + 1;
-																			if (tabIndex > 0) {
-																				var navTabs = $('.nav-tabs', $(error.element).parents('.tabforms'));
-																				$('li:nth-child(' + tabIndex + ')', navTabs)
-																						.removeClassPrefix('state-')
-																						.addClass('state-error');
-																				$('li.state-error:first a', navTabs).click();
-																			}
-																		}
-																	}
-																	: ams.getFunctionByName(data.amsFormInvalidHandler)
-																: undefined
-											};
-											$('[data-ams-validate-rules]', form).each(function(index) {
-												if (index === 0) {
-													dataOptions.rules = {};
-												}
-												dataOptions.rules[$(this).attr('name')] = $(this).data('ams-validate-rules');
-											});
-											var settings = $.extend({}, dataOptions, data.amsValidateOptions);
-											settings = ams.executeFunctionByName(data.amsValidateInitCallback, form, settings) || settings;
-											var plugin = form.validate(settings);
-											ams.executeFunctionByName(data.amsValidateAfterInitCallback, form, plugin, settings);
-										});
-								   });
-				}
-			},
-
-			/**
-			 * JQuery dataTables
-			 */
-			datatable: function(element) {
-				var tables = $('.datatable', element);
-				if (tables.length > 0) {
-					ams.ajax.check($.fn.dataTable,
-								   ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js',
-								   function() {
-										ams.ajax.check($.fn.dataTableExt.oPagination.bootstrap_full,
-													   ams.baseURL + 'myams-dataTables' + ams.devext + '.js',
-													   function() {
-														   $(tables).each(function () {
-															   var table = $(this);
-															   var data = table.data();
-															   var extensions = (data.amsDatatableExtensions || '').split(/\s+/);
-															   // Check DOM elements
-															   var sDom = data.amsDatatableSdom ||
-																   "W" +
-																   ((extensions.indexOf('colreorder') >= 0 ||
-																   extensions.indexOf('colreorderwithresize') >= 0) ? 'R' : '') +
-																   "<'dt-top-row'" +
-																   (extensions.indexOf('colvis') >= 0 ? 'C' : '') +
-																   ((data.amsDatatablePagination === false ||
-																   data.amsDatatablePaginationSize === false) ? '' : 'L') +
-																   (data.amsDatatableGlobalFilter === false ? '' : 'F') +
-																   ">r<'dt-wrapper't" +
-																   (extensions.indexOf('scroller') >= 0 ? 'S' : '') +
-																   "><'dt-row dt-bottom-row'<'row'<'col-sm-6'" +
-																   (data.amsDatatableInformation === false ? '' : 'i') +
-																   "><'col-sm-6 text-right'p>>";
-
-															   var index;
-															   // Check initial sorting
-															   var sorting = data.amsDatatableSorting;
-															   if (typeof(sorting) === 'string') {
-																   var sortings = sorting.split(';');
-																   sorting = [];
-																   for (index = 0; index < sortings.length; index++) {
-																	   var colSorting = sortings[index].split(',');
-																	   colSorting[0] = parseInt(colSorting[0]);
-																	   sorting.push(colSorting);
+														   var settings = $.extend({}, dataOptions, data.amsDatatableOptions);
+														   var checkers = [];
+														   var sources = [];
+														   var callbacks = [];
+														   if (extensions.length > 0) {
+															   for (index = 0; index < extensions.length; index++) {
+																   switch (extensions[index]) {
+																	   case 'autofill':
+																		   checkers.push($.fn.dataTable.AutoFill);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-autoFill' + ams.devext + '.js');
+																		   break;
+																	   case 'columnfilter':
+																		   checkers.push($.fn.columnFilter);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-columnFilter' + ams.devext + '.js');
+																		   break;
+																	   case 'colreorder':
+																		   checkers.push($.fn.dataTable.ColReorder);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorder' + ams.devext + '.js');
+																		   break;
+																	   case 'colreorderwithresize':
+																		   checkers.push(window.ColReorder);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + ams.devext + '.js');
+																		   break;
+																	   case 'colvis':
+																		   checkers.push($.fn.dataTable.ColVis);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js');
+																		   callbacks.push(function () {
+																			   var cvDefault = {
+																				   activate: 'click',
+																				   sAlign: 'right'
+																			   };
+																			   settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions);
+																		   });
+																		   break;
+																	   case 'editable':
+																		   checkers.push($.fn.editable);
+																		   sources.push(ams.baseURL + 'ext/jquery-jeditable' + ams.devext + '.js');
+																		   checkers.push($.fn.makeEditable);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-editable' + ams.devext + '.js');
+																		   break;
+																	   case 'fixedcolumns':
+																		   checkers.push($.fn.dataTable.FixedColumns);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + ams.devext + '.js');
+																		   break;
+																	   case 'fixedheader':
+																		   checkers.push($.fn.dataTable.Fixedheader);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + ams.devext + '.js');
+																		   break;
+																	   case 'keytable':
+																		   checkers.push(window.keyTable);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-keyTable' + ams.devext + '.js');
+																		   break;
+																	   case 'rowgrouping':
+																		   checkers.push($.fn.rowGrouping);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + ams.devext + '.js');
+																		   break;
+																	   case 'rowreordering':
+																		   checkers.push($.fn.rowReordering);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-rowReordering' + ams.devext + '.js');
+																		   break;
+																	   case 'scroller':
+																		   checkers.push($.fn.dataTable.Scroller);
+																		   sources.push(ams.baseURL + 'ext/jquery-dataTables-scroller' + ams.devext + '.js');
+																		   break;
+																	   default:
+																		   break;
 																   }
 															   }
-															   // Check columns sortings
-															   var columns = [];
-															   var column;
-															   var sortables = $('th', table).listattr('data-ams-datatable-sortable');
-															   for (index = 0; index < sortables.length; index++) {
-																   var sortable = sortables[index];
-																   if (sortable !== undefined) {
-																	   column = columns[index] || {};
-																	   column.bSortable = typeof(sortable) === 'string' ? JSON.parse(sortable) : sortable;
-																	   columns[index] = column;
-																   } else {
-																	   columns[index] = columns[index] || {};
-																   }
-															   }
-															   // Check columns types
-															   var sortTypes = $('th', table).listattr('data-ams-datatable-stype');
-															   for (index = 0; index < sortTypes.length; index++) {
-																   var sortType = sortTypes[index];
-																   if (sortType) {
-																	   column = columns[index] || {};
-																	   column.sType = sortType;
-																	   columns[index] = column;
-																   } else {
-																	   columns[index] = columns[index] || {};
-																   }
-															   }
-															   // Set options
-															   var dataOptions = {
-																   bJQueryUI: false,
-																   bServerSide: data.amsDatatableServerSide || false,
-																   sAjaxSource: data.amsDatatableServerSide === true ? data.amsDatatableAjaxSource : undefined,
-																   sServerMethod: data.amsDatatableServerSide === true ? 'POST' : undefined,
-																   bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0,
-																   bPaginate: data.amsDatatablePagination !== false,
-																   bInfo: data.amsDatatableInfo !== false,
-																   bSort: data.amsDatatableSort !== false,
-																   aaSorting: sorting,
-																   aoColumns: columns.length > 0 ? columns : undefined,
-																   bDeferRender: true,
-																   bAutoWidth: false,
-																   iDisplayLength: data.amsDatatableDisplayLength || 25,
-																   sPaginationType: data.amsDatatablePaginationType || 'bootstrap_full',
-																   sDom: sDom,
-																   oLanguage: ams.plugins.i18n.datatables,
-																   fnInitComplete: function (oSettings, json) {
-																	   $('.ColVis_Button').addClass('btn btn-default btn-sm')
-																		   .html((ams.plugins.i18n.datatables.sColumns || "Columns") +
-																				 ' <i class="fa fa-fw fa-caret-down"></i>');
+														   }
+
+														   function initTable() {
+															   settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings;
+															   try {  // Some settings can easily generate DataTables exceptions...
+																   var plugin = table.dataTable(settings);
+																   ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings);
+																   if (extensions.length > 0) {
+																	   for (index = 0; index < extensions.length; index++) {
+																		   switch (extensions[index]) {
+																			   case 'autofill':
+																				   var afSettings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill);
+																				   afSettings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, afSettings) || afSettings;
+																				   table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ?
+																					   new $.fn.dataTable.AutoFill(table, afSettings)
+																					   : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings));
+																				   break;
+																			   case 'columnfilter':
+																				   var cfDefault = {
+																					   sPlaceHolder: 'head:after'
+																				   };
+																				   var cfSettings = $.extend({}, cfDefault, data.amsDatatableColumnfilterOptions, settings.columnfilter);
+																				   cfSettings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cfSettings) || cfSettings;
+																				   table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ?
+																					   plugin.columnFilter(cfSettings)
+																					   : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings));
+																				   break;
+																			   case 'editable':
+																				   var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable);
+																				   edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings;
+																				   table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ?
+																					   table.makeEditable(edSettings)
+																					   : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings));
+																				   break;
+																			   case 'fixedcolumns':
+																				   var fcSettings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns);
+																				   fcSettings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fcSettings) || fcSettings;
+																				   table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ?
+																					   new $.fn.dataTable.FixedColumns(table, fcSettings)
+																					   : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings));
+																				   break;
+																			   case 'fixedheader':
+																				   var fhSettings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader);
+																				   fhSettings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fhSettings) || fhSettings;
+																				   table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ?
+																					   new $.fn.dataTable.FixedHeader(table, fhSettings)
+																					   : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings));
+																				   break;
+																			   case 'keytable':
+																				   var ktDefault = {
+																					   table: table.get(0),
+																					   datatable: plugin
+																				   };
+																				   var ktSettings = $.extend({}, ktDefault, data.amsDatatableKeytableOptions, settings.keytable);
+																				   ktSettings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, ktSettings) || ktSettings;
+																				   table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ?
+																					   new KeyTable(ktSettings)
+																					   : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings));
+																				   break;
+																			   case 'rowgrouping':
+																				   var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping);
+																				   rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings;
+																				   table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ?
+																					   table.rowGrouping(rgSettings)
+																					   : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings));
+																				   break;
+																			   case 'rowreordering':
+																				   var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering);
+																				   rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings;
+																				   table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ?
+																					   table.rowReordering(rrSettings)
+																					   : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings));
+																				   break;
+																			   default:
+																				   break;
+																		   }
+																	   }
 																   }
-															   };
-															   var settings = $.extend({}, dataOptions, data.amsDatatableOptions);
-															   var checkers = [];
-															   var sources = [];
-															   var callbacks = [];
-															   if (extensions.length > 0) {
-																   for (index = 0; index < extensions.length; index++) {
-																	   switch (extensions[index]) {
-																		   case 'autofill':
-																			   checkers.push($.fn.dataTable.AutoFill);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-autoFill' + ams.devext + '.js');
-																			   break;
-																		   case 'columnfilter':
-																			   checkers.push($.fn.columnFilter);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-columnFilter' + ams.devext + '.js');
-																			   break;
-																		   case 'colreorder':
-																			   checkers.push($.fn.dataTable.ColReorder);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorder' + ams.devext + '.js');
-																			   break;
-																		   case 'colreorderwithresize':
-																			   checkers.push(window.ColReorder);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-colReorderWithResize' + ams.devext + '.js');
-																			   break;
-																		   case 'colvis':
-																			   checkers.push($.fn.dataTable.ColVis);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js');
-																			   callbacks.push(function () {
-																				   var cvDefault = {
-																					   activate: 'click',
-																					   sAlign: 'right'
-																				   };
-																				   settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions);
-																			   });
-																			   break;
-																		   case 'editable':
-																			   checkers.push($.fn.editable);
-																			   sources.push(ams.baseURL + 'ext/jquery-jeditable' + ams.devext + '.js');
-																			   checkers.push($.fn.makeEditable);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-editable' + ams.devext + '.js');
-																			   break;
-																		   case 'fixedcolumns':
-																			   checkers.push($.fn.dataTable.FixedColumns);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedColumns' + ams.devext + '.js');
-																			   break;
-																		   case 'fixedheader':
-																			   checkers.push($.fn.dataTable.Fixedheader);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-fixedHeader' + ams.devext + '.js');
-																			   break;
-																		   case 'keytable':
-																			   checkers.push(window.keyTable);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-keyTable' + ams.devext + '.js');
-																			   break;
-																		   case 'rowgrouping':
-																			   checkers.push($.fn.rowGrouping);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-rowGrouping' + ams.devext + '.js');
-																			   break;
-																		   case 'rowreordering':
-																			   checkers.push($.fn.rowReordering);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-rowReordering' + ams.devext + '.js');
-																			   break;
-																		   case 'scroller':
-																			   checkers.push($.fn.dataTable.Scroller);
-																			   sources.push(ams.baseURL + 'ext/jquery-dataTables-scroller' + ams.devext + '.js');
-																			   break;
-																		   default:
-																			   break;
+																   if (data.amsDatatableFinalizeCallback) {
+																	   var finalizers = data.amsDatatableFinalizeCallback.split(/\s+/);
+																	   if (finalizers.length > 0) {
+																		   for (index = 0; index < finalizers.length; index++) {
+																			   ams.executeFunctionByName(finalizers[index], table, plugin, settings);
+																		   }
 																	   }
 																   }
 															   }
-
-															   function initTable() {
-																   settings = ams.executeFunctionByName(data.amsDatatableInitCallback, table, settings) || settings;
-																   try {  // Some settings can easily generate DataTables exceptions...
-																	   var plugin = table.dataTable(settings);
-																	   ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings);
-																	   if (extensions.length > 0) {
-																		   for (index = 0; index < extensions.length; index++) {
-																			   switch (extensions[index]) {
-																				   case 'autofill':
-																					   var afSettings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill);
-																					   afSettings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, afSettings) || afSettings;
-																					   table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ?
-																						   new $.fn.dataTable.AutoFill(table, afSettings)
-																						   : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings));
-																					   break;
-																				   case 'columnfilter':
-																					   var cfDefault = {
-																						   sPlaceHolder: 'head:after'
-																					   };
-																					   var cfSettings = $.extend({}, cfDefault, data.amsDatatableColumnfilterOptions, settings.columnfilter);
-																					   cfSettings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cfSettings) || cfSettings;
-																					   table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ?
-																						   plugin.columnFilter(cfSettings)
-																						   : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings));
-																					   break;
-																				   case 'editable':
-																					   var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable);
-																					   edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings;
-																					   table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ?
-																						   table.makeEditable(edSettings)
-																						   : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings));
-																					   break;
-																				   case 'fixedcolumns':
-																					   var fcSettings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns);
-																					   fcSettings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fcSettings) || fcSettings;
-																					   table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ?
-																						   new $.fn.dataTable.FixedColumns(table, fcSettings)
-																						   : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings));
-																					   break;
-																				   case 'fixedheader':
-																					   var fhSettings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader);
-																					   fhSettings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fhSettings) || fhSettings;
-																					   table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ?
-																						   new $.fn.dataTable.FixedHeader(table, fhSettings)
-																						   : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings));
-																					   break;
-																				   case 'keytable':
-																					   var ktDefault = {
-																						   table: table.get(0),
-																						   datatable: plugin
-																					   };
-																					   var ktSettings = $.extend({}, ktDefault, data.amsDatatableKeytableOptions, settings.keytable);
-																					   ktSettings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, ktSettings) || ktSettings;
-																					   table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ?
-																						   new KeyTable(ktSettings)
-																						   : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings));
-																					   break;
-																				   case 'rowgrouping':
-																					   var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping);
-																					   rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings;
-																					   table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ?
-																						   table.rowGrouping(rgSettings)
-																						   : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings));
-																					   break;
-																				   case 'rowreordering':
-																					   var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering);
-																					   rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings;
-																					   table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ?
-																						   table.rowReordering(rrSettings)
-																						   : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings));
-																					   break;
-																				   default:
-																					   break;
-																			   }
-																		   }
-																	   }
-																	   if (data.amsDatatableFinalizeCallback) {
-																		   var finalizers = data.amsDatatableFinalizeCallback.split(/\s+/);
-																		   if (finalizers.length > 0) {
-																			   for (index = 0; index < finalizers.length; index++) {
-																				   ams.executeFunctionByName(finalizers[index], table, plugin, settings);
-																			   }
-																		   }
-																	   }
-																   }
-																   catch (e) {
-																   }
+															   catch (e) {
 															   }
-
-															   callbacks.push(initTable);
-															   ams.ajax.check(checkers, sources, callbacks);
-														   });
+														   }
+
+														   callbacks.push(initTable);
+														   ams.ajax.check(checkers, sources, callbacks);
 													   });
-								   });
-				}
-			},
-
-			/**
-			 * TableDND plug-in
-			 */
-			tablednd: function(element) {
-				var tables = $('.table-dnd', element);
-				if (tables.length > 0) {
-					ams.ajax.check($.fn.tableDnD,
-								   ams.baseURL + 'ext/jquery-tablednd' + ams.devext + '.js',
-								   function() {
-										tables.each(function() {
-											var table = $(this);
-											var data = table.data();
-											if (data.amsTabledndDragHandle) {
-												$('tr', table).addClass('no-drag-handle');
-											} else {
-												$(table).on('mouseover', 'tr', function () {
-													$(this.cells[0]).addClass('drag-handle');
-												}).on('mouseout', 'tr', function () {
-													$(this.cells[0]).removeClass('drag-handle');
-												});
-											}
-											var dataOptions = {
-												onDragClass: data.amsTabledndDragClass || 'dragging-row',
-												onDragStart: ams.getFunctionByName(data.amsTabledndDragStart),
-												dragHandle: data.amsTabledndDragHandle,
-												scrollAmount: data.amsTabledndScrollAmount,
-												onAllowDrop: data.amsTabledndAllowDrop,
-												onDrop: ams.getFunctionByName(data.amsTabledndDrop) || function(dnd_table, row) {
-													var target = data.amsTabledndDropTarget;
-													if (target) {
-														// Disable row click handler
-														$(row).data('ams-disabled-handlers', 'click');
-														try {
-															var rows = [];
-															$(dnd_table.rows).each(function() {
-																var rowId = $(this).data('ams-element-name');
-																if (rowId) {
-																	rows.push(rowId);
+												   });
+							   });
+			}
+		},
+
+		/**
+		 * TableDND plug-in
+		 */
+		tablednd: function(element) {
+			var tables = $('.table-dnd', element);
+			if (tables.length > 0) {
+				ams.ajax.check($.fn.tableDnD,
+							   ams.baseURL + 'ext/jquery-tablednd' + ams.devext + '.js',
+							   function() {
+									tables.each(function() {
+										var table = $(this);
+										var data = table.data();
+										if (data.amsTabledndDragHandle) {
+											$('tr', table).addClass('no-drag-handle');
+										} else {
+											$(table).on('mouseover', 'tr', function () {
+												$(this.cells[0]).addClass('drag-handle');
+											}).on('mouseout', 'tr', function () {
+												$(this.cells[0]).removeClass('drag-handle');
+											});
+										}
+										var dataOptions = {
+											onDragClass: data.amsTabledndDragClass || 'dragging-row',
+											onDragStart: ams.getFunctionByName(data.amsTabledndDragStart),
+											dragHandle: data.amsTabledndDragHandle,
+											scrollAmount: data.amsTabledndScrollAmount,
+											onAllowDrop: data.amsTabledndAllowDrop,
+											onDrop: ams.getFunctionByName(data.amsTabledndDrop) || function(dnd_table, row) {
+												var target = data.amsTabledndDropTarget;
+												if (target) {
+													// Disable row click handler
+													$(row).data('ams-disabled-handlers', 'click');
+													try {
+														var rows = [];
+														$(dnd_table.rows).each(function() {
+															var rowId = $(this).data('ams-element-name');
+															if (rowId) {
+																rows.push(rowId);
+															}
+														});
+														var localTarget = ams.getFunctionByName(target);
+														if (typeof(localTarget) === 'function') {
+															localTarget.call(table, dnd_table, rows);
+														} else {
+															if (!target.startsWith(window.location.protocol)) {
+																var location = data.amsLocation;
+																if (location) {
+																	target = location + '/' + target;
 																}
-															});
-															var localTarget = ams.getFunctionByName(target);
-															if (typeof(localTarget) === 'function') {
-																localTarget.call(table, dnd_table, rows);
-															} else {
-																if (!target.startsWith(window.location.protocol)) {
-																	var location = data.amsLocation;
-																	if (location) {
-																		target = location + '/' + target;
-																	}
-																}
-																ams.ajax.post(target, {names: JSON.stringify(rows)});
 															}
-														} finally {
-															// Restore row click handler
-															setTimeout(function() {
-																$(row).removeData('ams-disabled-handlers');
-															}, 50);
+															ams.ajax.post(target, {names: JSON.stringify(rows)});
 														}
-													}
-													return false;
-												}
-											};
-											var settings = $.extend({}, dataOptions, data.amsTabledndOptions);
-											settings = ams.executeFunctionByName(data.amsTabledndInitCallback, table, settings) || settings;
-											var plugin = table.tableDnD(settings);
-											ams.executeFunctionByName(data.amsTabledndAfterInitCallback, table, plugin, settings);
-										});
-								   });
-				}
-			},
-
-			/**
-			 * Wizard plug-in
-			 */
-			wizard: function(element) {
-				var wizards = $('.wizard', element);
-				if (wizards.length > 0) {
-					ams.ajax.check($.fn.bootstrapWizard,
-								   ams.baseURL + 'ext/bootstrap-wizard-1.4.2' + ams.devext + '.js',
-								   function() {
-										wizards.each(function() {
-											var wizard = $(this);
-											var data = wizard.data();
-											var dataOptions = {
-												withVisible: data.amsWizardWithVisible === undefined ? true : data.amsWizardWithVisible,
-												tabClass: data.amsWizardTabClass,
-												firstSelector: data.amsWizardFirstSelector,
-												previousSelector: data.amsWizardPreviousSelector,
-												nextSelector: data.amsWizardNextSelector,
-												lastSelector: data.amsWizardLastSelector,
-												finishSelector: data.amsWizardFinishSelector,
-												backSelector: data.amsWizardBackSelector,
-												onInit: ams.getFunctionByName(data.amsWizardInit),
-												onShow: ams.getFunctionByName(data.amsWizardShow),
-												onNext: ams.getFunctionByName(data.amsWizardNext),
-												onPrevious: ams.getFunctionByName(data.amsWizardPrevious),
-												onFirst: ams.getFunctionByName(data.amsWizardFirst),
-												onLast: ams.getFunctionByName(data.amsWizardLast),
-												onBack: ams.getFunctionByName(data.amsWizardBack),
-												onFinish: ams.getFunctionByName(data.amsWizardFinish),
-												onTabChange: ams.getFunctionByName(data.amsWizardTabChange),
-												onTabClick: ams.getFunctionByName(data.amsWizardTabClick),
-												onTabShow: ams.getFunctionByName(data.amsWizardTabShow)
-											};
-											var settings = $.extend({}, dataOptions, data.amsWizardOptions);
-											settings = ams.executeFunctionByName(data.amsWizardInitCallback, wizard, settings) || settings;
-											var plugin = wizard.bootstrapWizard(settings);
-											ams.executeFunctionByName(data.amsWizardAfterInitCallback, wizard, plugin, settings);
-										});
-								   });
-				}
-			},
-
-			/**
-			 * TinyMCE plug-in
-			 */
-			tinymce: function(element) {
-
-				function cleanEditors() {
-					$('.tinymce', $(this)).each(function() {
-						var editor = tinymce.get($(this).attr('id'));
-						if (editor) {
-							editor.remove();
-						}
-					});
-				}
-
-				var editors = $('.tinymce', element);
-				if (editors.length > 0) {
-					var baseURL = ams.baseURL + 'ext/tinymce' + (ams.devmode ? '/dev' : '');
-					ams.ajax.check(window.tinymce,
-								   baseURL + '/tinymce' + ams.devext + '.js',
-								   function(first_load) {
-
-										function initEditors() {
-											editors.each(function() {
-												var editor = $(this);
-												var data = editor.data();
-												var dataOptions = {
-													theme: data.amsTinymceTheme || "modern",
-													language: ams.lang,
-													menubar: data.amsTinymceMenubar !== false,
-													statusbar: data.amsTinymceStatusbar !== false,
-													plugins: data.amsTinymcePlugins || [
-														"advlist autosave autolink lists link charmap print preview hr anchor pagebreak",
-														"searchreplace wordcount visualblocks visualchars code fullscreen",
-														"insertdatetime nonbreaking save table contextmenu directionality",
-														"emoticons paste textcolor colorpicker textpattern autoresize"
-													],
-													toolbar: data.amsTinymceToolbar,
-													toolbar1: data.amsTinymceToolbar1 === false ? false : data.amsTinymceToolbar1 ||
-														"undo redo | pastetext | styleselect | bold italic | alignleft " +
-														"aligncenter alignright alignjustify | bullist numlist " +
-														"outdent indent",
-													toolbar2: data.amsTinymceToolbar2 === false ? false : data.amsTinymceToolbar2 ||
-														"forecolor backcolor emoticons | charmap link image media | " +
-														"fullscreen preview print | code",
-													content_css: data.amsTinymceContentCss,
-													formats: data.amsTinymceFormats,
-													style_formats: data.amsTinymceStyleFormats,
-													block_formats: data.amsTinymceBlockFormats,
-													valid_classes: data.amsTinymceValidClasses,
-													image_advtab: true,
-													image_list: ams.getFunctionByName(data.amsTinymceImageList) || data.amsTinymceImageList,
-													image_class_list: data.amsTinymceImageClassList,
-													link_list: ams.getFunctionByName(data.amsTinymceLinkList) || data.amsTinymceLinkList,
-													link_class_list: data.amsTinymceLinkClassList,
-													paste_as_text: data.amsTinymcePasteAsText === undefined ? true : data.amsTinymcePasteAsText,
-													paste_auto_cleanup_on_paste: data.amsTinymcePasteAutoCleanup === undefined ? true : data.amsTinymcePasteAutoCleanup,
-													paste_strip_class_attributes: data.amsTinymcePasteStripClassAttributes || 'all',
-													paste_remove_spans: data.amsTinymcePaseRemoveSpans === undefined ? true : data.amsTinymcePasteRemoveSpans,
-													paste_remove_styles: data.amsTinymcePasteRemoveStyles === undefined ? true : data.amsTinymcePasteRemoveStyles,
-													height: data.amsTinymceHeight || 50,
-													min_height: 50,
-													resize: true,
-													autoresize_min_height: 50,
-													autoresize_max_height: 500
-												};
-												if (data.amsTinymceExternalPlugins) {
-													var names = data.amsTinymceExternalPlugins.split(/\s+/);
-													for (var index in names) {
-														if (!names.hasOwnProperty(index)) {
-															continue;
-														}
-														var pluginSrc = editor.data('ams-tinymce-plugin-' + names[index]);
-														tinymce.PluginManager.load(names[index], ams.getSource(pluginSrc));
+													} finally {
+														// Restore row click handler
+														setTimeout(function() {
+															$(row).removeData('ams-disabled-handlers');
+														}, 50);
 													}
 												}
-												var settings = $.extend({}, dataOptions, data.amsTinymceOptions);
-												settings = ams.executeFunctionByName(data.amsTinymceInitCallback, editor, settings) || settings;
-												var plugin = editor.tinymce(settings);
-												ams.executeFunctionByName(data.amsTinymceAfterInitCallback, editor, plugin, settings);
-											});
-										}
-
-										if (first_load) {
-											ams.getScript(baseURL + '/jquery.tinymce' + ams.devext + '.js', function() {
-												tinymce.baseURL = baseURL;
-												tinymce.suffix = ams.devext;
-												ams.skin.registerCleanCallback(cleanEditors);
-												initEditors();
-											});
-										} else {
-											initEditors();
-										}
-								   });
-				}
-			},
-
-			/**
-			 * Image area select plug-in
-			 */
-			imgareaselect: function(element) {
-				var images = $('.imgareaselect', element);
-				if (images.length > 0) {
-					ams.ajax.check($.fn.imgAreaSelect,
-								   ams.baseURL + 'ext/jquery-imgareaselect-0.9.11-rc1' + ams.devext + '.js',
-								   function() {
-										ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css',
-												  'jquery-imgareaselect',
-												   function() {
-													   images.each(function () {
-														   var image = $(this);
-														   var data = image.data();
-														   var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body';
-														   var dataOptions = {
-															   instance: true,
-															   handles: true,
-															   parent: parent,
-															   x1: data.amsImgareaselectX1 || 0,
-															   y1: data.amsImgareaselectY1 || 0,
-															   x2: data.amsImgareaselectX2 || data.amsImgareaselectImageWidth,
-															   y2: data.amsImgareaselectY2 || data.amsImgareaselectImageHeight,
-															   imageWidth: data.amsImgareaselectImageWidth,
-															   imageHeight: data.amsImgareaselectImageHeight,
-															   minWidth: 128,
-															   minHeight: 128,
-															   aspectRatio: data.amsImgareaselectRatio,
-															   onSelectEnd: ams.getFunctionByName(data.amsImgareaselectSelectEnd) || function (img, selection) {
-																   var target = data.amsImgareaselectTargetField || 'image_';
-																   $('input[name="' + target + 'x1"]', parent).val(selection.x1);
-																   $('input[name="' + target + 'y1"]', parent).val(selection.y1);
-																   $('input[name="' + target + 'x2"]', parent).val(selection.x2);
-																   $('input[name="' + target + 'y2"]', parent).val(selection.y2);
-															   }
-														   };
-														   var settings = $.extend({}, dataOptions, data.amsImgareaselectOptions);
-														   settings = ams.executeFunctionByName(data.amsImgareaselectInitCallback, image, settings) || settings;
-														   var plugin = image.imgAreaSelect(settings);
-														   ams.executeFunctionByName(data.amsImgareaselectAfterInitCallback, image, plugin, settings);
-														   // Add update timeout when plug-in is displayed into a modal dialog
-														   setTimeout(function () {
-															   plugin.update();
-														   }, 250);
-													   });
-												   });
-								   });
-				}
-			},
-
-			/**
-			 * FancyBox plug-in
-			 */
-			fancybox: function(element) {
-				var fancyboxes = $('.fancybox', element);
-				if (fancyboxes.length > 0) {
-					ams.ajax.check($.fn.fancybox,
-								   ams.baseURL + 'ext/jquery-fancybox-2.1.5' + ams.devext + '.js',
-								   function() {
-										ams.getCSS(ams.baseURL + '../css/ext/jquery-fancybox-2.1.5' + ams.devext + '.css',
-											'jquery-fancybox',
-											function() {
-												fancyboxes.each(function () {
-													var fancybox = $(this);
-													var data = fancybox.data();
-													var elements = fancybox;
-													var index,
-														helper;
-													if (data.amsFancyboxElements) {
-														elements = $(data.amsFancyboxElements, fancybox);
+												return false;
+											}
+										};
+										var settings = $.extend({}, dataOptions, data.amsTabledndOptions);
+										settings = ams.executeFunctionByName(data.amsTabledndInitCallback, table, settings) || settings;
+										var plugin = table.tableDnD(settings);
+										ams.executeFunctionByName(data.amsTabledndAfterInitCallback, table, plugin, settings);
+									});
+							   });
+			}
+		},
+
+		/**
+		 * Wizard plug-in
+		 */
+		wizard: function(element) {
+			var wizards = $('.wizard', element);
+			if (wizards.length > 0) {
+				ams.ajax.check($.fn.bootstrapWizard,
+							   ams.baseURL + 'ext/bootstrap-wizard-1.4.2' + ams.devext + '.js',
+							   function() {
+									wizards.each(function() {
+										var wizard = $(this);
+										var data = wizard.data();
+										var dataOptions = {
+											withVisible: data.amsWizardWithVisible === undefined ? true : data.amsWizardWithVisible,
+											tabClass: data.amsWizardTabClass,
+											firstSelector: data.amsWizardFirstSelector,
+											previousSelector: data.amsWizardPreviousSelector,
+											nextSelector: data.amsWizardNextSelector,
+											lastSelector: data.amsWizardLastSelector,
+											finishSelector: data.amsWizardFinishSelector,
+											backSelector: data.amsWizardBackSelector,
+											onInit: ams.getFunctionByName(data.amsWizardInit),
+											onShow: ams.getFunctionByName(data.amsWizardShow),
+											onNext: ams.getFunctionByName(data.amsWizardNext),
+											onPrevious: ams.getFunctionByName(data.amsWizardPrevious),
+											onFirst: ams.getFunctionByName(data.amsWizardFirst),
+											onLast: ams.getFunctionByName(data.amsWizardLast),
+											onBack: ams.getFunctionByName(data.amsWizardBack),
+											onFinish: ams.getFunctionByName(data.amsWizardFinish),
+											onTabChange: ams.getFunctionByName(data.amsWizardTabChange),
+											onTabClick: ams.getFunctionByName(data.amsWizardTabClick),
+											onTabShow: ams.getFunctionByName(data.amsWizardTabShow)
+										};
+										var settings = $.extend({}, dataOptions, data.amsWizardOptions);
+										settings = ams.executeFunctionByName(data.amsWizardInitCallback, wizard, settings) || settings;
+										var plugin = wizard.bootstrapWizard(settings);
+										ams.executeFunctionByName(data.amsWizardAfterInitCallback, wizard, plugin, settings);
+									});
+							   });
+			}
+		},
+
+		/**
+		 * TinyMCE plug-in
+		 */
+		tinymce: function(element) {
+
+			function cleanEditors() {
+				$('.tinymce', $(this)).each(function() {
+					var editor = tinymce.get($(this).attr('id'));
+					if (editor) {
+						editor.remove();
+					}
+				});
+			}
+
+			var editors = $('.tinymce', element);
+			if (editors.length > 0) {
+				var baseURL = ams.baseURL + 'ext/tinymce' + (ams.devmode ? '/dev' : '');
+				ams.ajax.check(window.tinymce,
+							   baseURL + '/tinymce' + ams.devext + '.js',
+							   function(first_load) {
+
+									function initEditors() {
+										editors.each(function() {
+											var editor = $(this);
+											var data = editor.data();
+											var dataOptions = {
+												theme: data.amsTinymceTheme || "modern",
+												language: ams.lang,
+												menubar: data.amsTinymceMenubar !== false,
+												statusbar: data.amsTinymceStatusbar !== false,
+												plugins: data.amsTinymcePlugins || [
+													"advlist autosave autolink lists link charmap print preview hr anchor pagebreak",
+													"searchreplace wordcount visualblocks visualchars code fullscreen",
+													"insertdatetime nonbreaking save table contextmenu directionality",
+													"emoticons paste textcolor colorpicker textpattern autoresize"
+												],
+												toolbar: data.amsTinymceToolbar,
+												toolbar1: data.amsTinymceToolbar1 === false ? false : data.amsTinymceToolbar1 ||
+													"undo redo | pastetext | styleselect | bold italic | alignleft " +
+													"aligncenter alignright alignjustify | bullist numlist " +
+													"outdent indent",
+												toolbar2: data.amsTinymceToolbar2 === false ? false : data.amsTinymceToolbar2 ||
+													"forecolor backcolor emoticons | charmap link image media | " +
+													"fullscreen preview print | code",
+												content_css: data.amsTinymceContentCss,
+												formats: data.amsTinymceFormats,
+												style_formats: data.amsTinymceStyleFormats,
+												block_formats: data.amsTinymceBlockFormats,
+												valid_classes: data.amsTinymceValidClasses,
+												image_advtab: true,
+												image_list: ams.getFunctionByName(data.amsTinymceImageList) || data.amsTinymceImageList,
+												image_class_list: data.amsTinymceImageClassList,
+												link_list: ams.getFunctionByName(data.amsTinymceLinkList) || data.amsTinymceLinkList,
+												link_class_list: data.amsTinymceLinkClassList,
+												paste_as_text: data.amsTinymcePasteAsText === undefined ? true : data.amsTinymcePasteAsText,
+												paste_auto_cleanup_on_paste: data.amsTinymcePasteAutoCleanup === undefined ? true : data.amsTinymcePasteAutoCleanup,
+												paste_strip_class_attributes: data.amsTinymcePasteStripClassAttributes || 'all',
+												paste_remove_spans: data.amsTinymcePaseRemoveSpans === undefined ? true : data.amsTinymcePasteRemoveSpans,
+												paste_remove_styles: data.amsTinymcePasteRemoveStyles === undefined ? true : data.amsTinymcePasteRemoveStyles,
+												height: data.amsTinymceHeight || 50,
+												min_height: 50,
+												resize: true,
+												autoresize_min_height: 50,
+												autoresize_max_height: 500
+											};
+											if (data.amsTinymceExternalPlugins) {
+												var names = data.amsTinymceExternalPlugins.split(/\s+/);
+												for (var index in names) {
+													if (!names.hasOwnProperty(index)) {
+														continue;
 													}
-													var helpers = (data.amsFancyboxHelpers || '').split(/\s+/);
-													if (helpers.length > 0) {
-														for (index = 0; index < helpers.length; index++) {
-															helper = helpers[index];
-															switch (helper) {
-																case 'buttons':
-																	ams.ajax.check($.fancybox.helpers.buttons,
-																		ams.baseURL + 'ext/fancybox-helpers/fancybox-buttons' + ams.devext + '.js');
-																	break;
-																case 'thumbs':
-																	ams.ajax.check($.fancybox.helpers.thumbs,
-																		ams.baseURL + 'ext/fancybox-helpers/fancybox-thumbs' + ams.devext + '.js');
-																	break;
-																case 'media':
-																	ams.ajax.check($.fancybox.helpers.media,
-																		ams.baseURL + 'ext/fancybox-helpers/fancybox-media' + ams.devext + '.js');
-																	break;
-																default:
-																	break;
-															}
-														}
-													}
-													var dataOptions = {
-														type: data.amsFancyboxType,
-														padding: data.amsFancyboxPadding || 10,
-														margin: data.amsFancyboxMargin || 10,
-														loop: data.amsFancyboxLoop,
-														beforeLoad: ams.getFunctionByName(data.amsFancyboxBeforeLoad) || function () {
-															var title;
-															if (data.amsFancyboxTitleGetter) {
-																title = ams.executeFunctionByName(data.amsFancyboxTitleGetter, this);
-															}
-															if (!title) {
-																var content = $('*:first', this.element);
-																title = content.attr('original-title') || content.attr('title');
-																if (!title) {
-																	title = $(this.element).attr('original-title') || $(this.element).attr('title');
-																}
-															}
-															this.title = title;
-														},
-														afterLoad: ams.getFunctionByName(data.amsFancyboxAfterLoad),
-														helpers: {
-															title: {
-																type: 'inside'
-															}
-														}
-													};
-													if (helpers.length > 0) {
-														for (index = 0; index < helpers.length; index++) {
-															helper = helpers[index];
-															switch (helper) {
-																case 'buttons':
-																	dataOptions.helpers.buttons = {
-																		position: data.amsFancyboxButtonsPosition || 'top'
-																	};
-																	break;
-																case 'thumbs':
-																	dataOptions.helpers.thumbs = {
-																		width: data.amsFancyboxThumbsWidth || 50,
-																		height: data.amsFancyboxThumbsHeight || 50
-																	};
-																	break;
-																case 'media':
-																	dataOptions.helpers.media = true;
-																	break;
-															}
-														}
-													}
-													var settings = $.extend({}, dataOptions, data.amsFancyboxOptions);
-													settings = ams.executeFunctionByName(data.amsFancyboxInitCallback, fancybox, settings) || settings;
-													var plugin = elements.fancybox(settings);
-													ams.executeFunctionByName(data.amsFancyboxAfterInitCallback, fancybox, plugin, settings);
-												});
-											});
-								   });
-				}
-			},
-
-			/**
-			 * Flot charts
-			 */
-			chart: function(element) {
-				var charts = $('.chart', element);
-				if (charts.length > 0) {
-					ams.ajax.check($.fn.plot,
-								   ams.baseURL + 'flot/jquery.flot' + ams.devext + '.js',
-								   function() {
-										charts.each(function() {
-
-											function checkPlugin(plugin) {
-												for (var index in $.plot.plugins) {
-													if ($.plot.plugins.hasOwnProperty(index)) {
-														var pluginInfo = $.plot.plugins[index];
-														if (pluginInfo.name === plugin) {
-															return pluginInfo;
+													var pluginSrc = editor.data('ams-tinymce-plugin-' + names[index]);
+													tinymce.PluginManager.load(names[index], ams.getSource(pluginSrc));
+												}
+											}
+											var settings = $.extend({}, dataOptions, data.amsTinymceOptions);
+											settings = ams.executeFunctionByName(data.amsTinymceInitCallback, editor, settings) || settings;
+											var plugin = editor.tinymce(settings);
+											ams.executeFunctionByName(data.amsTinymceAfterInitCallback, editor, plugin, settings);
+										});
+									}
+
+									if (first_load) {
+										ams.getScript(baseURL + '/jquery.tinymce' + ams.devext + '.js', function() {
+											tinymce.baseURL = baseURL;
+											tinymce.suffix = ams.devext;
+											ams.skin.registerCleanCallback(cleanEditors);
+											initEditors();
+										});
+									} else {
+										initEditors();
+									}
+							   });
+			}
+		},
+
+		/**
+		 * Image area select plug-in
+		 */
+		imgareaselect: function(element) {
+			var images = $('.imgareaselect', element);
+			if (images.length > 0) {
+				ams.ajax.check($.fn.imgAreaSelect,
+							   ams.baseURL + 'ext/jquery-imgareaselect-0.9.11-rc1' + ams.devext + '.js',
+							   function() {
+									ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css',
+											  'jquery-imgareaselect',
+											   function() {
+												   images.each(function () {
+													   var image = $(this);
+													   var data = image.data();
+													   var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body';
+													   var dataOptions = {
+														   instance: true,
+														   handles: true,
+														   parent: parent,
+														   x1: data.amsImgareaselectX1 || 0,
+														   y1: data.amsImgareaselectY1 || 0,
+														   x2: data.amsImgareaselectX2 || data.amsImgareaselectImageWidth,
+														   y2: data.amsImgareaselectY2 || data.amsImgareaselectImageHeight,
+														   imageWidth: data.amsImgareaselectImageWidth,
+														   imageHeight: data.amsImgareaselectImageHeight,
+														   minWidth: 128,
+														   minHeight: 128,
+														   aspectRatio: data.amsImgareaselectRatio,
+														   onSelectEnd: ams.getFunctionByName(data.amsImgareaselectSelectEnd) || function (img, selection) {
+															   var target = data.amsImgareaselectTargetField || 'image_';
+															   $('input[name="' + target + 'x1"]', parent).val(selection.x1);
+															   $('input[name="' + target + 'y1"]', parent).val(selection.y1);
+															   $('input[name="' + target + 'x2"]', parent).val(selection.x2);
+															   $('input[name="' + target + 'y2"]', parent).val(selection.y2);
+														   }
+													   };
+													   var settings = $.extend({}, dataOptions, data.amsImgareaselectOptions);
+													   settings = ams.executeFunctionByName(data.amsImgareaselectInitCallback, image, settings) || settings;
+													   var plugin = image.imgAreaSelect(settings);
+													   ams.executeFunctionByName(data.amsImgareaselectAfterInitCallback, image, plugin, settings);
+													   // Add update timeout when plug-in is displayed into a modal dialog
+													   setTimeout(function () {
+														   plugin.update();
+													   }, 250);
+												   });
+											   });
+							   });
+			}
+		},
+
+		/**
+		 * FancyBox plug-in
+		 */
+		fancybox: function(element) {
+			var fancyboxes = $('.fancybox', element);
+			if (fancyboxes.length > 0) {
+				ams.ajax.check($.fn.fancybox,
+							   ams.baseURL + 'ext/jquery-fancybox-2.1.5' + ams.devext + '.js',
+							   function() {
+									ams.getCSS(ams.baseURL + '../css/ext/jquery-fancybox-2.1.5' + ams.devext + '.css',
+										'jquery-fancybox',
+										function() {
+											fancyboxes.each(function () {
+												var fancybox = $(this);
+												var data = fancybox.data();
+												var elements = fancybox;
+												var index,
+													helper;
+												if (data.amsFancyboxElements) {
+													elements = $(data.amsFancyboxElements, fancybox);
+												}
+												var helpers = (data.amsFancyboxHelpers || '').split(/\s+/);
+												if (helpers.length > 0) {
+													for (index = 0; index < helpers.length; index++) {
+														helper = helpers[index];
+														switch (helper) {
+															case 'buttons':
+																ams.ajax.check($.fancybox.helpers.buttons,
+																	ams.baseURL + 'ext/fancybox-helpers/fancybox-buttons' + ams.devext + '.js');
+																break;
+															case 'thumbs':
+																ams.ajax.check($.fancybox.helpers.thumbs,
+																	ams.baseURL + 'ext/fancybox-helpers/fancybox-thumbs' + ams.devext + '.js');
+																break;
+															case 'media':
+																ams.ajax.check($.fancybox.helpers.media,
+																	ams.baseURL + 'ext/fancybox-helpers/fancybox-media' + ams.devext + '.js');
+																break;
+															default:
+																break;
 														}
 													}
 												}
-												return null;
-											}
-
-											var chart = $(this);
-											var data = chart.data();
-											var dataOptions = {};
-											var plugins = (data.amsChartPlugins || '').split(/\s+/);
-											if (plugins.length > 0) {
-												for (var index in plugins) {
-													if (plugins.hasOwnProperty(index)) {
-														var pluginName = plugins[index];
-														if (!checkPlugin(pluginName)) {
-															ams.getScript(ams.baseURL + 'flot/jquery.flot.' + pluginName + ams.devext + '.js');
+												var dataOptions = {
+													type: data.amsFancyboxType,
+													padding: data.amsFancyboxPadding || 10,
+													margin: data.amsFancyboxMargin || 10,
+													loop: data.amsFancyboxLoop,
+													beforeLoad: ams.getFunctionByName(data.amsFancyboxBeforeLoad) || function () {
+														var title;
+														if (data.amsFancyboxTitleGetter) {
+															title = ams.executeFunctionByName(data.amsFancyboxTitleGetter, this);
+														}
+														if (!title) {
+															var content = $('*:first', this.element);
+															title = content.attr('original-title') || content.attr('title');
+															if (!title) {
+																title = $(this.element).attr('original-title') || $(this.element).attr('title');
+															}
+														}
+														this.title = title;
+													},
+													afterLoad: ams.getFunctionByName(data.amsFancyboxAfterLoad),
+													helpers: {
+														title: {
+															type: 'inside'
 														}
 													}
+												};
+												if (helpers.length > 0) {
+													for (index = 0; index < helpers.length; index++) {
+														helper = helpers[index];
+														switch (helper) {
+															case 'buttons':
+																dataOptions.helpers.buttons = {
+																	position: data.amsFancyboxButtonsPosition || 'top'
+																};
+																break;
+															case 'thumbs':
+																dataOptions.helpers.thumbs = {
+																	width: data.amsFancyboxThumbsWidth || 50,
+																	height: data.amsFancyboxThumbsHeight || 50
+																};
+																break;
+															case 'media':
+																dataOptions.helpers.media = true;
+																break;
+														}
+													}
+												}
+												var settings = $.extend({}, dataOptions, data.amsFancyboxOptions);
+												settings = ams.executeFunctionByName(data.amsFancyboxInitCallback, fancybox, settings) || settings;
+												var plugin = elements.fancybox(settings);
+												ams.executeFunctionByName(data.amsFancyboxAfterInitCallback, fancybox, plugin, settings);
+											});
+										});
+							   });
+			}
+		},
+
+		/**
+		 * Flot charts
+		 */
+		chart: function(element) {
+			var charts = $('.chart', element);
+			if (charts.length > 0) {
+				ams.ajax.check($.fn.plot,
+							   ams.baseURL + 'flot/jquery.flot' + ams.devext + '.js',
+							   function() {
+									charts.each(function() {
+
+										function checkPlugin(plugin) {
+											for (var index in $.plot.plugins) {
+												if ($.plot.plugins.hasOwnProperty(index)) {
+													var pluginInfo = $.plot.plugins[index];
+													if (pluginInfo.name === plugin) {
+														return pluginInfo;
+													}
 												}
 											}
-											var settings = $.extend({}, dataOptions, data.amsChartOptions);
-											settings = ams.executeFunctionByName(data.amsChartInitCallback, chart, settings) || settings;
-											var chartData = data.amsChartData;
-											chartData = ams.executeFunctionByName(data.amsChartInitData, chart, chartData) || chartData;
-											var plugin = chart.plot(chartData, settings);
-											ams.executeFunctionByName(data.amsChartAfterInitCallback, chart, plugin, settings);
-										});
-								   });
-				}
-			},
-
-			/**
-			 * Sparkline graphs
-			 */
-			graphs: function(element) {
-				var graphs = $('.sparkline', element);
-				if (graphs.length > 0) {
-					ams.ajax.check(ams.graphs,
-								   ams.baseURL + 'myams-graphs' + ams.devext + '.js',
-								   function() {
-										ams.graphs.init(graphs);
-								   });
-				}
-			},
-
-			/**
-			 * Custom scrollbars
-			 */
-			scrollbars: function(element) {
-				var scrollbars = $('.scrollbar', element);
-				if (scrollbars.length > 0) {
-					ams.ajax.check($.event.special.mousewheel,
-								   ams.baseURL + 'ext/jquery-mousewheel.min.js',
-								   function() {
-										ams.ajax.check($.fn.mCustomScrollbar,
-													   ams.baseURL + 'ext/jquery-mCustomScrollbar' + ams.devext + '.js',
-													   function() {
-															ams.getCSS(ams.baseURL + '../css/ext/jquery-mCustomScrollbar.css',
-																	   'jquery-mCustomScrollbar',
-																	   function () {
-																		   scrollbars.each(function () {
-																			   var scrollbar = $(this);
-																			   var data = scrollbar.data();
-																			   var dataOptions = {
-																				   theme: data.amsScrollbarTheme || 'light'
-																			   };
-																			   var settings = $.extend({}, dataOptions, data.amsScrollbarOptions);
-																			   settings = ams.executeFunctionByName(data.amsScrollbarInitCallback, scrollbar, settings) || settings;
-																			   var plugin = scrollbar.mCustomScrollbar(settings);
-																			   ams.executeFunctionByName(data.amsScrollbarAfterInitCallback, scrollbar, plugin, settings);
-																		   });
+											return null;
+										}
+
+										var chart = $(this);
+										var data = chart.data();
+										var dataOptions = {};
+										var plugins = (data.amsChartPlugins || '').split(/\s+/);
+										if (plugins.length > 0) {
+											for (var index in plugins) {
+												if (plugins.hasOwnProperty(index)) {
+													var pluginName = plugins[index];
+													if (!checkPlugin(pluginName)) {
+														ams.getScript(ams.baseURL + 'flot/jquery.flot.' + pluginName + ams.devext + '.js');
+													}
+												}
+											}
+										}
+										var settings = $.extend({}, dataOptions, data.amsChartOptions);
+										settings = ams.executeFunctionByName(data.amsChartInitCallback, chart, settings) || settings;
+										var chartData = data.amsChartData;
+										chartData = ams.executeFunctionByName(data.amsChartInitData, chart, chartData) || chartData;
+										var plugin = chart.plot(chartData, settings);
+										ams.executeFunctionByName(data.amsChartAfterInitCallback, chart, plugin, settings);
+									});
+							   });
+			}
+		},
+
+		/**
+		 * Sparkline graphs
+		 */
+		graphs: function(element) {
+			var graphs = $('.sparkline', element);
+			if (graphs.length > 0) {
+				ams.ajax.check(ams.graphs,
+							   ams.baseURL + 'myams-graphs' + ams.devext + '.js',
+							   function() {
+									ams.graphs.init(graphs);
+							   });
+			}
+		},
+
+		/**
+		 * Custom scrollbars
+		 */
+		scrollbars: function(element) {
+			var scrollbars = $('.scrollbar', element);
+			if (scrollbars.length > 0) {
+				ams.ajax.check($.event.special.mousewheel,
+							   ams.baseURL + 'ext/jquery-mousewheel.min.js',
+							   function() {
+									ams.ajax.check($.fn.mCustomScrollbar,
+												   ams.baseURL + 'ext/jquery-mCustomScrollbar' + ams.devext + '.js',
+												   function() {
+														ams.getCSS(ams.baseURL + '../css/ext/jquery-mCustomScrollbar.css',
+																   'jquery-mCustomScrollbar',
+																   function () {
+																	   scrollbars.each(function () {
+																		   var scrollbar = $(this);
+																		   var data = scrollbar.data();
+																		   var dataOptions = {
+																			   theme: data.amsScrollbarTheme || 'light'
+																		   };
+																		   var settings = $.extend({}, dataOptions, data.amsScrollbarOptions);
+																		   settings = ams.executeFunctionByName(data.amsScrollbarInitCallback, scrollbar, settings) || settings;
+																		   var plugin = scrollbar.mCustomScrollbar(settings);
+																		   ams.executeFunctionByName(data.amsScrollbarAfterInitCallback, scrollbar, plugin, settings);
 																	   });
-													   });
-									});
-				}
+																   });
+												   });
+								});
 			}
 		}
-	};
+	});
 
 })(jQuery, this);
 
@@ -6553,7 +6581,10 @@
 			var modal = $(e.target);
 			ams.form.confirmChangedForm(modal, function() {
 				// Confirm closing if OK
-				modal.data('modal').isShown = true;
+				var bsModal = modal.data('modal') || modal.data('bs.modal');
+				if (bsModal) {
+					bsModal.isShown = true;
+				}
 				return true;
 			}, function() {
 				// Prevent closing if cancelled
--- a/src/pyams_skin/resources/js/myams.min.js	Mon Nov 19 15:20:20 2018 +0100
+++ b/src/pyams_skin/resources/js/myams.min.js	Tue Nov 20 09:09:31 2018 +0100
@@ -1,1 +1,1 @@
-"use strict";!function(e,a){var t=a.console;String.prototype.startsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(0,t)===e},String.prototype.endsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(a-t)===e},String.prototype.unserialize=function(e){for(var a=decodeURIComponent(this).split("&"),t={},n=0;n<a.length;n++){var s=a[n].split("=",2);t[s[0]]=s[1]}return t},Array.prototype.indexOf||(Array.prototype.indexOf=function(e,a){var t=this.length;for((a=(a=Number(a)||0)<0?Math.ceil(a):Math.floor(a))<0&&(a+=t);a<t;a++)if(a in this&&this[a]===e)return a;return-1}),e.expr[":"].hasvalue=function(a,t,n){return""!==e(a).val()},e.expr[":"].econtains=function(a,t,n){return(a.textContent||a.innerText||e(a).text()||"").toLowerCase()===n[3].toLowerCase()},e.expr[":"].withtext=function(a,t,n){return(a.textContent||a.innerText||e(a).text()||"")===n[3]},e.expr[":"].parents=function(a,t,n){return e(a).parents(n[3]).length>0},void 0===e.scrollbarWidth&&(e.scrollbarWidth=function(){var a=e('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),t=a.children(),n=t.innerWidth()-t.height(99).innerWidth();return a.remove(),n}),e.fn.extend({exists:function(){return e(this).length>0},objectOrParentWithClass:function(e){return this.hasClass(e)?this:this.parents("."+e)},listattr:function(a){var t=[];return this.each(function(){t.push(e(this).attr(a))}),t},style:function(e,a,t){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==e?void 0!==a?(t=void 0!==t?t:"",n.setProperty(e,a,t),this):n.getPropertyValue(e):n}},removeClassPrefix:function(a){return this.each(function(t,n){var s=n.className.split(" ").map(function(e){return e.startsWith(a)?"":e});n.className=e.trim(s.join(" "))}),this}}),void 0===a.MyAMS&&(a.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var n=a.MyAMS,s=n;n.baseURL=function(){var a=e('script[src*="/myams.js"], script[src*="/myams.min.js"]').attr("src");return s.devmode=a.indexOf(".min.js")<0,s.devext=s.devmode?"":".min",a.substring(0,a.lastIndexOf("/")+1)}(),n.log=function(){t&&t.debug&&t.debug(this,arguments)},n.getQueryVar=function(e,a){if(e.indexOf("?")<0)return!1;e.endsWith("&")||(e+="&");var t=new RegExp(".*?[&\\?]"+a+"=(.*?)&.*"),n=e.replace(t,"$1");return n!==e&&n},n.rgb2hex=function(a){return"#"+e.map(a.match(/\b(\d+)\b/g),function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},n.generateId=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()},n.generateUUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var t=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===a?t:3&t|8).toString(16)})},n.getObject=function(e,a){if(e){if("string"!=typeof e)return e;var t=e.split(".");a=void 0===a||null===a?window:a;for(var n=0;n<t.length;n++)try{a=a[t[n]]}catch(e){return}return a}},n.getFunctionByName=function(e,a){if(void 0!==e){if("function"==typeof e)return e;var t=e.split("."),n=t.pop();a=void 0===a||null===a?window:a;for(var s=0;s<t.length;s++)try{a=a[t[s]]}catch(e){return}try{return a[n]}catch(e){return}}},n.executeFunctionByName=function(e,a){var t=s.getFunctionByName(e,window);if("function"==typeof t){var n=Array.prototype.slice.call(arguments,2);return t.apply(a,n)}},n.isInDOM=function(t){return!!(t=e(t)).exists()&&a.document.body.contains(t[0])},n.getSource=function(e){return e.replace(/{[^{}]*}/g,function(e){return s.getFunctionByName(e.substr(1,e.length-2))})},n.getScript=function(a,t,n){"object"==typeof t&&(n=t,t=null),void 0===n&&(n={});var i={dataType:"script",url:s.getSource(a),success:t,error:s.error.show,cache:!s.devmode,async:void 0===n.async?"function"==typeof t:n.async},r=e.extend({},i,n);return e.ajax(r)},n.getCSS=function(a,t,n,i){n&&(n=s.getFunctionByName(n));var r=e("HEAD"),o=e('style[data-ams-id="'+t+'"]',r);if(0===o.length){if(o=e("<style>").attr("data-ams-id",t).text('@import "'+s.getSource(a)+'";'),n)var c=setInterval(function(){try{o[0].sheet.cssRules;n.call(window,!0,i),clearInterval(c)}catch(e){}},10);o.appendTo(r)}else n&&n.call(window,!1,i)}}(jQuery,this),jQuery.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");for(var a="",t=0;t<e.length;t++){var n=e.charCodeAt(t);n<128?a+=String.fromCharCode(n):n>127&&n<2048?(a+=String.fromCharCode(n>>6|192),a+=String.fromCharCode(63&n|128)):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128),a+=String.fromCharCode(63&n|128))}return a},decode:function(e){for(var a="",t=0,n=0,s=0,i=0;t<e.length;)(n=e.charCodeAt(t))<128?(a+=String.fromCharCode(n),t++):n>191&&n<224?(s=e.charCodeAt(t+1),a+=String.fromCharCode((31&n)<<6|63&s),t+=2):(s=e.charCodeAt(t+1),i=e.charCodeAt(t+2),a+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),t+=3);return a}},function(e,a){var t=a.MyAMS;e.fn.extend({contextMenu:function(a){function n(t,n,s){var i=e(window)[n](),r=e(a.menuSelector)[n](),o=t;return t+r>i&&r<t&&(o-=r),o}return this.each(function(){e("a",e(a.menuSelector)).each(function(){e(this).data("ams-context-menu",!0)}),e(this).on("contextmenu",function(s){if(!s.ctrlKey)return e(a.menuSelector).data("invokedOn",e(s.target)).show().css({position:"fixed",left:n(s.clientX,"width")-10,top:n(s.clientY,"height")-10}).off("click").on("click",function(n){e(this).hide();var s=e(this).data("invokedOn"),i=e(n.target);a.menuSelected.call(this,s,i),t.event.stop(n)}),!1}),e(document).click(function(){e(a.menuSelector).hide()})})},myams_menu:function(a){var t=e.extend({},{accordion:!0,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'},a),n=e(this);n.find("LI").each(function(){var a=e(this);if(a.find("UL").size()>0){a.find("A:first").append("<b class='collapse-sign'>"+t.closedSign+"</b>");var n=a.find("A:first");"#"===n.attr("href")&&n.click(function(){return!1})}}),n.find("LI.active").each(function(){var a=e(this).parents("UL"),n=a.parent("LI");a.slideDown(t.speed),n.find("b:first").html(t.openedSign),n.addClass("open")}),n.find("LI A").on("click",function(){var a=e(this);if(!a.hasClass("active")){var s=a.attr("href").replace(/^#/,""),i=a.parent().find("UL");if(t.accordion){var r=a.parent().parents("UL"),o=n.find("UL:visible");o.each(function(a){var n=!0;if(r.each(function(e){if(r[e]===o[a])return n=!1,!1}),n&&i!==o[a]){var c=e(o[a]);!s&&c.hasClass("active")||c.slideUp(t.speed,function(){e(this).parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}var c=a.parent().find("UL:first");s||!c.is(":visible")||c.hasClass("active")?c.slideDown(t.speed,function(){a.parent("LI").addClass("open").find("B:first").delay(t.speed).html(t.openedSign)}):c.slideUp(t.speed,function(){a.parent("LI").removeClass("open").find("B:first").delay(t.speed).html(t.closedSign)})}})}})}(jQuery,this),function(e,a){var t=a.MyAMS;t.event={stop:function(e){e||(e=window.event),e&&"string"!=typeof e&&(e.stopPropagation?(e.stopPropagation(),e.preventDefault()):(e.cancelBubble=!0,e.returnValue=!1))}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var a=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(a)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",t=this.getInternetExplorerVersion();t>-1&&(e=t>=8?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),a.alert&&a.alert(e)},isIE8orlower:function(){var e="0",a=this.getInternetExplorerVersion();return a>-1&&(e=a>=9?0:1),e},copyToClipboard:function(s){function i(s){var i=!1;if(window.clipboardData&&window.clipboardData.setData)i=clipboardData.setData("Text",s);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var r=e("<textarea>");r.val(s),r.css("position","fixed"),r.appendTo(e("body")),r.get(0).select();try{document.execCommand("copy"),i=!0}catch(e){console&&console.warn&&console.warn("Copy to clipboard failed.",e)}finally{r.remove()}}i?n.skin.smallBox("success",{title:s.length>1?n.i18n.CLIPBOARD_TEXT_COPY_OK:n.i18n.CLIPBOARD_CHARACTER_COPY_OK,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):a.prompt&&a.prompt(t.i18n.CLIPBOARD_COPY,s)}if(void 0===s)return function(){var a=e(this),t=a.text();a.parents(".btn-group").removeClass("open"),i(t)};i(s)}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.error={ajax:function(e,a,t,s){if(!("abort"===s||a&&a.statusText&&"OK"===a.statusText.toUpperCase())){if("json"===(a=n.ajax.getResponse(a)).contentType)n.ajax.handleJSON(a.data);else{var i=s||e.statusText||e.type,r=a.responseText;n.skin.messageBox("error",{title:n.i18n.ERROR_OCCURED,content:"<h4>"+i+"</h4><p>"+(r||"")+"</p>",icon:"fa fa-warning animated shake",timeout:1e4})}console&&(console.error&&console.error(e),console.debug&&console.debug(a))}},show:function(e,a,t){if(t){var s=n.ajax.getResponse(e);"json"===s.contentType?n.ajax.handleJSON(s.data):n.skin.messageBox("error",{title:n.i18n.ERRORS_OCCURED,content:"<h4>"+a+"</h4><p>"+t+"</p>",icon:"fa fa-warning animated shake",timeout:1e4}),console&&(console.error&&console.error(t),console.debug&&console.debug(e))}}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.ajax={check:function(a,t,s,i){function r(e,a){if(void 0!==s){s instanceof Array||(s=[s]);for(var t=0;t<s.length;t++){var i=n.getFunctionByName(s[t]);"function"==typeof i&&i(e,a)}}}s instanceof Array||"object"==typeof s&&(i=s,s=void 0);var o={async:"function"==typeof s},c=e.extend({},o,i);if(a instanceof Array){for(var l=[],d=0;d<a.length;d++)void 0===a[d]&&l.push(n.getScript(t[d],{async:!0}));l.length>0?e.when.apply(e,l).then(function(){r(!0,i)}):r(!1,i)}else void 0===a?"string"==typeof t&&n.getScript(t,function(){r(!0,i)},c):r(!1,i)},getAddr:function(a){var t=a||e("HTML HEAD BASE").attr("href")||window.location.href;return t.substr(0,t.lastIndexOf("/")+1)},start:function(){e("#ajax-gear").show()},stop:function(){e("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||console&&console.log&&console.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var a=e.url;delete e.url,n.ajax.post(a,e,function(e,a,t){n.ajax.handleJSON(e)})}},post:function(t,s,i,r){var o;o=t.startsWith(window.location.protocol)?t:this.getAddr()+t,"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=n.getFunctionByName(r)),delete i.callback;var c,l={url:o,type:"post",cache:!1,async:"function"==typeof r,data:e.param(s),dataType:"json",beforeSend:function(e,t){if(void 0!==a.Cookies){var s=Cookies.get(n.csrfCookieName);s&&e.setRequestHeader(n.csrfHeaderName,s)}},success:r||function(e){c=e.result}},d=e.extend({},l,i);return e.ajax(d),c},getResponse:function(e){var a,t,s=e.getResponseHeader("content-type");if(s)if(s.startsWith("application/javascript"))a="script",t=e.responseText;else if(s.startsWith("text/html"))a="html",t=e.responseText;else if(s.startsWith("text/xml"))a="xml",t=e.responseText;else if(t=e.responseJSON)a="json";else try{t=JSON.parse(e.responseText),a="json"}catch(n){t=e.responseText,a="text"}else a="json",t={status:"alert",alert:{title:n.i18n.ERROR_OCCURED,content:n.i18n.NO_SERVER_RESPONSE}};return{contentType:a,data:t}},handleJSON:function(t,s,i){var r,o=t.status;switch(o){case"alert":a.alert&&a.alert(t.alert.title+"\n\n"+t.alert.content);break;case"error":n.form.showErrors(s,t);break;case"info":case"success":void 0!==s&&(n.form.resetChanged(s),!1!==t.close_form&&n.dialog.close(s));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==s&&(n.form.resetChanged(s),!1!==t.close_form&&n.dialog.close(s));break;case"modal":n.dialog.open(t.location);break;case"reload":void 0!==s&&(n.form.resetChanged(s),!1!==t.close_form&&n.dialog.close(s)),(r=t.location||window.location.hash).startsWith("#")&&(r=r.substr(1));var c=e(t.target||i||"#content");n.skin.loadURL(r,c,{preLoadCallback:n.getFunctionByName(t.pre_reload)||function(){e("[data-ams-pre-reload]",c).each(function(){n.executeFunctionByName(e(this).data("ams-pre-reload"))})},preLoadCallbackOptions:t.pre_reload_options,afterLoadCallback:n.getFunctionByName(t.post_reload)||function(){e("[data-ams-post-reload]",c).each(function(){n.executeFunctionByName(e(this).data("ams-post-reload"))})},afterLoadCallbackOptions:t.post_reload_options});break;case"redirect":void 0!==s&&(n.form.resetChanged(s),!0===t.close_form&&n.dialog.close(s)),r=t.location||window.location.href,t.window?window.open(r,t.window,t.options):window.location.href===r?window.location.reload(!0):window.location.href=r;break;default:console&&console.log&&console.log("Unhandled status: "+o)}var l,d,m;if(t.content&&(d=t.content,m=e(d.target||i||s||"#content"),!0===d.raw?m.text(d.text):(m.html(d.html),n.initContent(m)),d.keep_hidden||m.removeClass("hidden")),t.contents){var u=t.contents;for(l=0;l<u.length;l++)d=u[l],m=e(d.target),!0===d.raw?m.text(d.text):(m.html(d.html),n.initContent(m)),d.keep_hidden||m.removeClass("hidden")}var f;if(t.message&&("string"==typeof(f=t.message)?"info"===o||"success"===o?n.skin.smallBox(o,{title:f,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):n.skin.alert(e(s||"#content"),o,f):n.skin.alert(e(f.target||i||s||"#content"),f.status||"success",f.header,f.body,f.subtitle)),t.smallbox&&("string"==typeof(f=t.smallbox)?n.skin.smallBox(t.smallbox_status||o,{title:t.smallbox,icon:t.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:t.smallbox_timeout||3e3}):n.skin.smallBox(f.status||o,{title:f.message,icon:f.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:f.timeout||3e3})),t.messagebox)if("string"==typeof(f=t.messagebox))n.skin.messageBox("info",{title:n.i18n.ERROR_OCCURED,content:f,timeout:1e4});else{var h=f.status||"info";"error"===h&&s&&i&&n.executeFunctionByName(s.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",s,i),n.skin.messageBox(h,{title:f.title||n.i18n.ERROR_OCCURED,content:f.content,icon:f.icon,number:f.number,timeout:null===f.timeout?void 0:f.timeout||1e4})}if(t.event&&s.trigger(t.event,t.event_options),t.events){var p;for(void 0===s&&(s=e(document)),l=0;l<t.events.length;l++)null!==(p=t.events[l])&&("string"==typeof p?s.trigger(p,t.events_options):s.trigger(p.event,p.options))}if(t.callback&&n.executeFunctionByName(t.callback,s,t.options),t.callbacks){var g;for(l=0;l<t.callbacks.length;l++)"function"==typeof(g=t.callbacks[l])?n.executeFunctionByName(g,s,g.options):n.executeFunctionByName(g.callback,s,g.options)}}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.jsonrpc={getAddr:function(a){var t=(a||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},query:function(a,t,s,i){n.ajax.check(e.jsonRPC,n.baseURL+"ext/jquery-jsonrpc"+n.devext+".js",function(){"function"==typeof s?(i=s,s={}):s||(s={}),"undefined"===i&&(i=s.callback),"string"==typeof i&&(i=n.getFunctionByName(i)),delete s.callback;var r={};"string"==typeof a?r.query=a:"object"==typeof a&&e.extend(r,a),e.extend(r,s);var o,c={id:(new Date).getTime(),params:r,success:i||function(e){o=e},error:n.error.show},l=e.extend({},c,s);return e.jsonRPC.withOptions({endPoint:n.jsonrpc.getAddr(s.url),namespace:s.namespace,cache:!1},function(){e.jsonRPC.request(t,l)}),o})},post:function(a,t,s,i){n.ajax.check(e.jsonRPC,n.baseURL+"ext/jquery-jsonrpc"+n.devext+".js",function(){"function"==typeof s?(i=s,s={}):s||(s={}),void 0===i&&(i=s.callback),"string"==typeof i&&(i=n.getFunctionByName(i)),delete s.callback;var r,o={id:(new Date).getTime(),params:t,success:i||function(e){r=e},error:n.error.show},c=e.extend({},o,s);return e.jsonRPC.withOptions({endPoint:n.jsonrpc.getAddr(s.url),namespace:s.namespace,cache:!1},function(){e.jsonRPC.request(a,c)}),r})}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.xmlrpc={getAddr:function(a){var t=(a||e("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return t.substr(0,t.lastIndexOf("/")+1)},post:function(a,t,s,i,r){n.ajax.check(e.xmlrpc,n.baseURL+"ext/jquery-xmlrpc"+n.devext+".js",function(){"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=n.getFunctionByName(r)),delete i.callback;var o,c={url:n.xmlrpc.getAddr(a),methodName:t,params:s,success:r||function(e){o=e},error:n.error.show},l=e.extend({},c,i);return e.xmlrpc(l),o})}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.form={init:function(a){e("FORM",a).each(function(){var a=e(this);e('INPUT.select2[type="hidden"]',a).each(function(){var a=e(this);a.data("ams-select2-input-value",a.val())})});(n.warnOnFormChange?e('FORM[data-ams-warn-on-change!="false"]',a):e('FORM[data-ams-warn-on-change="true"]',a)).each(function(){var a=e(this);e('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',a).each(function(){var a=e(this);if(!0!==a.data("ams-ignore-change")){var t=a.data("ams-changed-event")||"change";a.on(t,function(){n.form.setChanged(e(this).parents("FORM"))})}}),a.on("reset",function(){n.form.resetChanged(e(this))})})},setFocus:function(a){var t=e("[data-ams-focus-target]",a).first();t.exists()||(t=e("input, select",a).first()),t.exists()&&(t.hasClass("select2-input")&&(t=t.parents(".select2")),t.hasClass("select2")?setTimeout(function(){t.select2("focus"),!0===t.data("ams-focus-open")&&t.select2("open")},100):t.focus())},checkBeforeUnload:function(){if(e('FORM[data-ams-form-changed="true"]').exists())return n.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(t,s,i){"function"==typeof t&&(s=t,t=void 0),e('FORM[data-ams-form-changed="true"]',t).exists()?i?a.confirm(n.i18n.FORM_CHANGED_WARNING,n.i18n.WARNING)?s.call(t):i.call(t):n.skin.bigBox({title:n.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+n.i18n.FORM_CHANGED_WARNING,buttons:n.i18n.BTN_OK_CANCEL},function(e){e===n.i18n.BTN_OK&&s.call(t)}):s.call(t)},setChanged:function(e){e.attr("data-ams-form-changed",!0)},resetChanged:function(a){void 0!==a&&e(a).removeAttr("data-ams-form-changed")},submit:function(t,s,i){if(!(t=e(t)).exists())return!1;if("object"==typeof s&&(i=s,s=void 0),t.data("submitted"))return t.data("ams-form-hide-submitted")||n.skin.messageBox("warning",{title:n.i18n.WAIT,content:n.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:t.data("ams-form-alert-timeout")||5e3}),!1;if(!n.form._checkSubmitValidators(t))return!1;e(".alert-danger, SPAN.state-error",t).not(".persistent").remove(),e(".state-error",t).removeClassPrefix("state-");var r=e(t.data("ams-submit-button"));return r&&!r.data("ams-form-hide-loading")&&(r.data("ams-progress-content",r.html()),r.button("loading")),n.ajax.check(e.fn.ajaxSubmit,n.baseURL+"ext/jquery-form-3.49"+n.devext+".js",function(){function r(t,r){var o,c,l,d,m,u,f,h,p,g=t.data(),b=g.amsFormOptions;if(i&&(m=i.formDataInitCallback),m?delete i.formDataInitCallback:m=g.amsFormDataInitCallback,m){var v={};if(d=n.executeFunctionByName(m,t,v),v.veto)return(o=t.data("ams-submit-button"))&&o.button("reset"),n.form.finalizeSubmitFooter.call(t),!1}else d=g.amsFormData||{};(o=e(t.data("ams-submit-button")))&&o.exists()?l=(c=o.data()).amsFormSubmitTarget:c={};var x,y=s||c.amsFormHandler||g.amsFormHandler||"";if(y.startsWith(window.location.protocol))x=y;else{var C=c.amsFormAction||t.attr("action").replace(/#/,"");x=C.startsWith(window.location.protocol)?C:n.ajax.getAddr()+C,x+=y}u=c.amsProgressHandler||g.amsProgressHandler||"",f=c.amsProgressInterval||g.amsProgressInterval||1e3,h=c.amsProgressCallback||g.amsProgressCallback,p=c.amsProgressEndCallback||g.amsProgressEndCallback;var k=null;i&&i.initSubmitTarget?n.executeFunctionByName(i.initSubmitTarget,t):g.amsFormInitSubmitTarget?(k=e(l||g.amsFormSubmitTarget||"#content"),n.executeFunctionByName(g.amsFormInitSubmit||"MyAMS.form.initSubmit",t,k)):g.amsFormHideSubmitFooter||n.executeFunctionByName(g.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",t),i&&(d=e.extend({},d,i.form_data));var S;u?d.progress_id=n.generateUUID():(S=void 0!==r.uuid)&&(x.indexOf("X-Progress-ID")<0&&(x+="?X-Progress-ID="+r.uuid),delete r.uuid);var w={url:x,type:"post",cache:!1,data:d,dataType:g.amsFormDatatype,beforeSerialize:function(){void 0!==a.tinyMCE&&a.tinyMCE.triggerSave()},beforeSubmit:function(e,a){a.data("submitted",!0)},error:function(e,a,t,s){k&&n.executeFunctionByName(g.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,k),n.form.resetAfterSubmit(s)},iframe:S},T=i&&i.downloadTarget||g.amsFormDownloadTarget;if(T){var N=e('iframe[name="'+T+'"]');N.exists()||(N=e("<iframe></iframe>").hide().attr("name",T).appendTo(e("body"))),w=e.extend({},w,{iframe:!0,iframeTarget:N,success:function(a,t,s,i){if(e(i).parents(".modal-dialog").exists())n.dialog.close(i);else{var r,o=i.data("ams-submit-button");o&&(r=o.data("ams-form-submit-callback")),r||(r=n.getFunctionByName(g.amsFormSubmitCallback)||n.form._submitCallback);try{r.call(i,a,t,s,i)}finally{n.form.resetAfterSubmit(i),n.form.resetChanged(i)}}}})}else w=e.extend({},w,{error:function(e,a,t,s){k&&n.executeFunctionByName(g.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",s,k),n.form.resetAfterSubmit(s)},success:function(e,a,t,s){var i,r=s.data("ams-submit-button");r&&(i=r.data("ams-form-submit-callback")),i||(i=n.getFunctionByName(g.amsFormSubmitCallback)||n.form._submitCallback);try{i.call(s,e,a,t,s)}finally{n.form.resetAfterSubmit(s),n.form.resetChanged(s)}},iframe:S});var F=e.extend({},w,r,b,i);if(u&&function(e,a){function s(){clearInterval(i),n.form.resetAfterSubmit(t,o),o.html(o.data("ams-progress-content")),n.executeFunctionByName(p,t,o),n.form.resetChanged(t)}var i;o.button("loading"),i=setInterval(function(){n.ajax.post(e,{progress_id:a},{error:s},n.getFunctionByName(h)||function(e,a){if("success"===a)if("running"===e.status)if(e.message)o.text(e.message);else{var t=o.data("ams-progress-text")||n.i18n.PROGRESS;e.current?t+=": "+e.current+"/ "+(e.length||100):t+="...",o.text(t)}else"finished"===e.status&&s();else s()})},f)}(u,d.progress_id),e(t).ajaxSubmit(F),T){var j=e(t).parents(".modal-dialog"),R=j.exists()&&o.exists()&&o.data("ams-keep-modal");j.exists()&&!0!==R?n.dialog.close(t):u||setTimeout(function(){n.form.resetAfterSubmit(t,o),n.form.resetChanged(t)},o.data("ams-form-reset-timeout")||2e3)}}if(!0!==t.data("ams-form-ignore-uploads")&&e('INPUT[type="file"]',t).length>0){n.ajax.check(e.progressBar,n.baseURL+"ext/jquery-progressbar"+n.devext+".js");var o=e.extend({},{uuid:e.progressBar.submit(t)});r(t,o)}else r(t,{})}),!1},initSubmit:function(a,t){var n=e(this),s='<i class="fa fa-3x fa-gear fa-spin"></i>';t||(t=n.data("ams-form-submit-message")),t&&(s+="<strong>"+t+"</strong>"),e(a).html('<div class="row margin-20"><div class="text-center">'+s+"</div></div>"),e(a).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(e){if(e.is(":visible")){var a=e.data("ams-submit-button");a&&a.button("reset"),n.form.finalizeSubmitFooter.call(e)}e.data("submitted",!1),e.removeData("ams-submit-button")},finalizeSubmitOnError:function(a){e("i",a).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(a){var t=e(this),n='<i class="fa fa-3x fa-gear fa-spin"></i>';a||(a=e(this).data("ams-form-submit-message")),a&&(n+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+a+"</strong>");var s=e("footer",t);e("button",s).hide(),s.append('<div class="row"><div class="text-center">'+n+"</div></div>")},finalizeSubmitFooter:function(){var a=e(this),t=e("footer",a);t&&(e(".row",t).remove(),e("button",t).show())},_submitCallback:function(a,t,s,i){var r;i.is(":visible")&&(n.form.finalizeSubmitFooter.call(i),(r=i.data("ams-submit-button"))&&r.button("reset"));var o,c=i.data();if(c.amsFormDatatype)o=c.amsFormDatatype;else{var l=n.ajax.getResponse(s);o=l.contentType,a=l.data}var d;switch(d=e(r?r.data("ams-form-submit-target")||c.amsFormSubmitTarget||"#content":c.amsFormSubmitTarget||"#content"),o){case"json":n.ajax.handleJSON(a,i,d);break;case"script":case"xml":break;case"html":case"text":default:n.form.resetChanged(i),r&&!0!==r.data("ams-keep-modal")&&n.dialog.close(i),d.exists()||(d=e("body")),d.parents(".hidden").removeClass("hidden"),e(".alert",d.parents(".alerts-container")).remove(),d.css({opacity:"0.0"}).html(a).delay(50).animate({opacity:"1.0"},300),n.initContent(d),n.form.setFocus(d)}var m=s.getResponseHeader("X-AMS-Callback");if(m){var u=s.getResponseHeader("X-AMS-Callback-Options");n.executeFunctionByName(m,i,void 0===u?{}:JSON.parse(u),s)}},_getSubmitValidators:function(a){var t=[],n=a.data("ams-form-validator");return n&&t.push([a,n]),e("[data-ams-form-validator]",a).each(function(){var a=e(this);t.push([a,a.data("ams-form-validator")])}),t},_checkSubmitValidators:function(e){var a=n.form._getSubmitValidators(e);if(!a.length)return!0;for(var t=[],s=!0,i=0;i<a.length;i++){var r=a[i],o=r[0],c=r[1],l=n.executeFunctionByName(c,e,o);!1===l?s=!1:"string"==typeof l?t.push(l):s.length&&s.length>0&&(t=t.concat(s))}if(t.length>0){var d=1===t.length?n.i18n.ERROR_OCCURED:n.i18n.ERRORS_OCCURED;return n.skin.alert(e,"danger",d,t),!1}return s},showErrors:function(a,t){var s;if("string"==typeof t)n.skin.alert(a,"error",n.i18n.ERROR_OCCURED,t);else if(t instanceof Array)s=1===t.length?n.i18n.ERROR_OCCURED:n.i18n.ERRORS_OCCURED,n.skin.alert(a,"error",s,t);else{e(".state-error",a).removeClass("state-error"),s=t.error_header||(t.widgets&&t.widgets.length>1?n.i18n.ERRORS_OCCURED:n.i18n.ERROR_OCCURED);var i,r=[];if(t.messages)for(i=0;i<t.messages.length;i++){var o=t.messages[i];o.header?r.push("<strong>"+o.header+"</strong><br />"+o.message):r.push(o.message||o)}if(t.widgets)for(i=0;i<t.widgets.length;i++){var c=t.widgets[i],l=e('[name="'+c.name+'"]',a);l.exists()||(l=e('[name="'+c.name+':list"]',a)),l.exists()?l.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+c.message+"</span>"):c.label&&r.push(c.label+" : "+c.message);var d=l.parents(".tab-pane").index()+1;if(d>0){var m=e(".nav-tabs",e(l).parents(".tabforms"));e("li:nth-child("+d+")",m).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",a).click()}}n.skin.alert(e(".form-group:first",a),t.error_level||"error",s,r,t.error_message)}}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.dialog={_shown_callbacks:[],registerShownCallback:function(e,a){var t;a&&(t=a.objectOrParentWithClass("modal-dialog"));var s;t&&t.exists()?void 0===(s=t.data("shown-callbacks"))&&(s=[],t.data("shown-callbacks",s)):s=n.dialog._shown_callbacks,s.indexOf(e)<0&&s.push(e)},_hide_callbacks:[],registerHideCallback:function(e,a){var t;a&&(t=a.objectOrParentWithClass("modal-dialog"));var s;t&&t.exists()?void 0===(s=t.data("hide-callbacks"))&&(s=[],t.data("hide-callbacks",s)):s=n.dialog._hide_callbacks,s.indexOf(e)<0&&s.push(e)},open:function(a,t,s){n.ajax.check(e.fn.modalmanager,n.baseURL+"ext/bootstrap-modalmanager"+n.devext+".js",function(){n.ajax.check(e.fn.modal.defaults,n.baseURL+"ext/bootstrap-modal"+n.devext+".js",function(i){i&&(e(document).off("click.modal"),e.fn.modal.defaults.spinner=e.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 r,o;if("string"==typeof a)r={},o=a;else{r=a.data(),o=a.attr("href")||r.amsUrl;var c=n.getFunctionByName(o);"function"==typeof c&&(o=c.call(a))}o&&(e("body").modalmanager("loading"),0===o.indexOf("#")?e(o).modal("show"):e.ajax({url:o,type:"get",cache:void 0!==r.amsAllowCache&&r.amsAllowCache,data:t,success:function(t,i,c){e("body").modalmanager("removeLoading");var l=n.ajax.getResponse(c),d=l.contentType,m=l.data;switch(d){case"json":n.ajax.handleJSON(m,e(e(a).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var u=e(m),f=e(".modal-dialog",u.wrap("<div></div>").parent()),h=f.data(),p={backdrop:"static",overflow:h.amsModalOverflow||".modal-viewport",maxHeight:void 0===h.amsModalMaxHeight?function(){return e(window).height()-e(".modal-header",u).outerHeight(!0)-e("footer",u).outerHeight(!0)-85}:n.getFunctionByName(h.amsModalMaxHeight)},g=e.extend({},p,h.amsModalOptions);g=n.executeFunctionByName(h.amsModalInitCallback,f,g)||g,s&&(s.shown&&n.dialog.registerShownCallback(s.shown,u),s.hide&&n.dialog.registerHideCallback(s.hide,u)),e("<div>").addClass("modal fade").append(u).modal(g).on("shown",n.dialog.shown).on("hidden",n.dialog.hidden),n.initContent(u),!1!==r.amsLogEvent&&n.stats.logPageview(o)}}}))})})},shown:function(a){function t(a){var t=e(".scrollmarker.top",i),n=i.scrollTop();n>0?t.show():t.hide();var s=e(".scrollmarker.bottom",i);r+n>=i.get(0).scrollHeight?s.hide():s.show()}var s=a.target,i=e(".modal-viewport",s);if(i.exists()){var r=parseInt(i.css("max-height")),o=e.scrollbarWidth();"hidden"!==i.css("overflow")&&i.height()===r?(e("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",i.width()-o).hide().appendTo(i),e("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",r-20).css("width",i.width()-o).appendTo(i),i.scroll(t),i.off("resize").on("resize",t)):e(".scrollmarker",i).remove()}e("[data-ams-shown-callback]",s).each(function(){var a=n.getFunctionByName(e(this).data("ams-shown-callback"));a&&a.call(s,this)});var c,l=e(".modal-dialog",s).data("shown-callbacks");if(l)for(c=0;c<l.length;c++)l[c].call(s);if(l=n.dialog._shown_callbacks)for(c=0;c<l.length;c++)l[c].call(s);n.form.setFocus(s)},close:function(a){"string"==typeof a&&(a=e(a));var t=a.parents(".modal").data("modal");if(t){var n=e("body").data("modalmanager");n&&n.getOpenModals().indexOf(t)>=0&&t.hide()}},hidden:function(a){var t=a.target;n.skin.cleanContainer(t),e("[data-ams-hidden-callback]",t).each(function(){var a=n.getFunctionByName(e(this).data("ams-hidden-callback"));a&&a.call(t,this)});var s,i=e(".modal-dialog",t).data("hide-callbacks");if(i)for(s=0;s<i.length;s++)i[s].call(t);if(i=n.dialog._hide_callbacks)for(s=0;s<i.length;s++)i[s].call(t)}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.helpers={sort:function(a,t){t||(t="weight"),a.children().sort(function(a,n){return+e(a).data(t)-+e(n).data(t)}).each(function(){a.append(this)})},select2ClearSelection:function(){var a=e(this),t=a.parents("label").first(),n=a.data("ams-select2-target");e('[name="'+n+'"]',t).data("select2").val("")},select2FormatSelection:function(a,t){a instanceof Array||(a=[a]),e(a).each(function(){"object"==typeof this?t.append(this.text):t.append(this)})},select2SelectAllHelper:function(){var a=e(this),t=a.parents("label").first(),n=a.data("ams-select2-target"),s=e('[name="'+n+'"]',t);"SELECT"===s.get(0).tagName?s.select2("val",e("option",s).listattr("value")):s.select2("data",s.data("ams-select2-data"))},select2QueryUrlResultsCallback:function(a,t,s){switch(a.status){case"error":n.skin.messageBox("error",{title:n.i18n.ERROR_OCCURED,content:"<h4>"+a.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),n.dialog.open(a.location);break;default:return{results:a.results||a,more:a.has_more||!1,context:a.context}}},select2QueryMethodSuccessCallback:function(a,t,s){var i=a.result;if("string"==typeof i)try{i=JSON.parse(i)}catch(e){}switch(i.status){case"error":n.skin.messageBox("error",{title:n.i18n.ERROR_OCCURED,content:"<h4>"+i.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":e(this).data("select2").dropdown.hide(),n.dialog.open(i.location);break;default:s.callback({results:i.results||i,more:i.has_more||!1,context:i.context})}},select2ChangeHelper:function(){var a=e(this),t=a.data(),s=e(t.amsSelect2HelperTarget);switch(t.amsSelect2HelperType){case"html":s.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');var i={};i[t.amsSelect2HelperArgument||"value"]=a.val(),e.get(t.amsSelect2HelperUrl,i,n.getFunctionByName(t.amsSelect2HelperCallback)||function(e){e?(s.html(e),n.initContent(s)):s.empty()}).fail(function(){s.empty()});break;case"json-rpc":s.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>'),n.jsonrpc.post(t.amsSelect2HelperMethod,{value:a.val()},{url:t.amsSelect2HelperUrl},n.getFunctionByName(t.amsSelect2HelperCallback)||function(e){e.result?(s.html(e.result),n.initContent(s)):s.empty()});break;default:var r=t.amsSelect2HelperCallback;r&&n.executeFunctionByName(r,a,t)}},contextMenuHandler:function(e,a){"A"!==a.get(0).tagName&&(a=a.parents("a").first());var t=a.data();if("modal"===t.toggle)n.dialog.open(a);else{var s=a.attr("href")||t.amsUrl;if(!s||s.startsWith("javascript")||a.attr("target"))return;n.event.stop();var i=n.getFunctionByName(s);"function"==typeof i&&(s=i.call(a,e)),"function"==typeof s?s.call(a,e):(s=s.replace(/\%23/,"#"),(e=a.data("ams-target"))?n.form.confirmChangedForm(e,function(){n.skin.loadURL(s,e,a.data("ams-link-options"),a.data("ams-link-callback"))}):n.form.confirmChangedForm(function(){s.startsWith("#")?s!==location.hash&&(n.root.hasClass("mobile-view-activated")?(n.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=s},150)):window.location.hash=s):window.location=s}))}},datetimepickerDialogHiddenCallback:function(){e(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")},clearSearchTarget:function(){var a=e(this);if(!a.val()){var t=e(a).parents("form").first();e(t.data("ams-form-submit-target")).empty()}},setSEOStatus:function(){var a=e(this),t=a.siblings(".progress").children(".progress-bar"),n=Math.min(a.val().length,100),s="success";n<20||n>80?s="danger":(n<40||n>66)&&(s="warning"),t.removeClassPrefix("progress-bar").addClass("progress-bar").addClass("progress-bar-"+s).css("width",n+"%")}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.plugins={init:function(a){function t(e,a){if(o.hasOwnProperty(e)){var t=o[e];t.css=t.css||a.css,t.callbacks.push({callback:a.callback,context:a.context}),a.register&&(t.register=!0),!1===a.async&&(t.async=!1)}else o[e]={src:a.src,css:a.css,callbacks:[{callback:a.callback,context:a.context}],register:a.register,async:a.async};a.css&&n.getCSS(a.css,e+"_css")}function s(e){var t,s,i=c.callbacks;if(i&&i.length){for(t=0;t<i.length;t++)if(s=i[t],s.callback=n.getFunctionByName(s.callback),!1!==c.register){var o=n.plugins.enabled;o.hasOwnProperty(r)?o[r].push(s):o[r]=[s]}}else!1!==c.register&&(n.plugins.enabled[r]=null);if(!0!==e&&i&&i.length&&!1!==c.async)for(t=0;t<i.length;t++)s=i[t],n.executeFunctionByName(s.callback,a,s.context)}n.plugins.initData(a);var i=[];e("[data-ams-plugins-disabled]",a).each(function(){for(var a=e(this).data("ams-plugins-disabled").split(/\s+/),t=0;t<a.length;t++)i.push(a[t])});var r,o={};e("[data-ams-plugins]",a).each(function(){var a=e(this),n=a.data("ams-plugins");if("string"==typeof n)for(var s=a.data("ams-plugins").split(/\s+/),i=0;i<s.length;i++){r=s[i];var o={src:a.data("ams-plugin-"+r+"-src"),css:a.data("ams-plugin-"+r+"-css"),callback:a.data("ams-plugin-"+r+"-callback"),context:a,register:a.data("ams-plugin-"+r+"-register"),async:a.data("ams-plugin-"+r+"-async")};t(r,o)}else for(r in n)n.hasOwnProperty(r)&&t(r,n[r])});var c;for(r in o)o.hasOwnProperty(r)&&(c=o[r],void 0===n.plugins.enabled[r]?n.getScript(c.src,s,{async:void 0===c.async||c.async}):(!function(){var e=n.plugins.enabled[r];for(l=0;l<e.length;l++){var a=e[l];a&&a.context&&!n.isInDOM(a.context)&&(e[l]=null)}}(),s(!0)));for(var l in n.plugins.enabled)if(n.plugins.enabled.hasOwnProperty(l)&&!(i.indexOf(l)>=0)){var d=n.plugins.enabled[l];if(d)switch(typeof d){case"function":d(a);break;default:for(var m=0;m<d.length;m++){var u=d[m];switch(typeof u){case"function":u(a);break;default:u&&u.callback&&u.callback(u.context)}}}}},initData:function(a){e("[data-ams-data]",a).each(function(){var a=e(this),t=a.data("ams-data");if(t)for(var n in t)if(t.hasOwnProperty(n)){var s=t[n];"string"!=typeof s&&(s=JSON.stringify(s)),a.attr("data-"+n,s)}})},register:function(e,a,t){if("function"==typeof a&&(t=a,a=null),a=a||e.name,n.plugins.enabled.indexOf(a)>=0)console&&console.warn&&console.warn("Plugin "+a+" is already registered!");else if("object"==typeof e){var s=e.src;s?n.ajax.check(e.callback,s,function(s){s&&(n.plugins.enabled[a]=n.getFunctionByName(e.callback),e.css&&n.getCSS(e.css,a+"_css"),t&&n.executeFunctionByName(t))}):(n.plugins.enabled[a]=n.getFunctionByName(e.callback),e.css&&n.getCSS(e.css,a+"_css"),t&&n.executeFunctionByName(t))}else"function"==typeof e&&(n.plugins.enabled[a]=e,t&&n.executeFunctionByName(t))},enabled:{svg:function(a){var t=e(".svg-container",a);t.length>0&&t.each(function(){var a=e(this),t=e("svg",a),n=t.attr("width"),s=t.attr("height");n&&s&&t.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(n))+" "+Math.round(parseFloat(s))),t.attr("width","100%").attr("height","auto")})},hint:function(a){var t=e(".hint:not(:parents(.nohints))",a);t.length>0&&n.ajax.check(e.fn.tipsy,n.baseURL+"ext/jquery-tipsy"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-tipsy"+n.devext+".css","jquery-tipsy",function(){t.each(function(){var a=e(this),t=a.data(),s={html:void 0===t.amsHintHtml?(a.attr("title")||"").startsWith("<"):t.amsHintHtml,title:n.getFunctionByName(t.amsHintTitleGetter)||function(){var a=e(this),n=a.attr("original-title")||a.attr(t.amsHintTitleAttr||"title")||(t.amsHintHtml?a.html():a.text());return n=n.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:t.amsHintOpacity||.95,gravity:t.amsHintGravity||"sw",offset:t.amsHintOffset||0},i=e.extend({},s,t.amsHintOptions);i=n.executeFunctionByName(t.amsHintInitCallback,a,i)||i;var r=a.tipsy(i);n.executeFunctionByName(t.amsHintAfterInitCallback,a,r,i)})})})},contextMenu:function(a){var t=e(".context-menu",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={menuSelector:t.amsContextmenuSelector,menuSelected:n.helpers.contextMenuHandler},i=e.extend({},s,t.amsContextmenuOptions);i=n.executeFunctionByName(t.amsContextmenuInitCallback,a,i)||i;var r=a.contextMenu(i);n.executeFunctionByName(t.amsContextmenuAfterInitCallback,a,r,i)})},switcher:function(a){e("LEGEND.switcher",a).each(function(){var a=e(this),t=a.parent("fieldset"),n=a.data();n.amsSwitcher||(e('<i class="fa fa-fw"></i>').prependTo(e(this)).addClass("open"===n.amsSwitcherState?n.amsSwitcherMinusClass||"fa-minus":n.amsSwitcherPlusClass||"fa-plus"),a.on("click",function(s){s.preventDefault();var i={};if(a.trigger("ams.switcher.before-switch",[a,i]),!i.veto)if(t.hasClass("switched")){t.removeClass("switched"),e(".fa",a).removeClass(n.amsSwitcherPlusClass||"fa-plus").addClass(n.amsSwitcherMinusClass||"fa-minus"),a.trigger("ams.switcher.opened",[a]);var r=a.attr("id");r&&e('legend.switcher[data-ams-switcher-sync="'+r+'"]',t).each(function(){var a=e(this);a.parents("fieldset").hasClass("switched")&&a.click()})}else t.addClass("switched"),e(".fa",a).removeClass(n.amsSwitcherMinusClass||"fa-minus").addClass(n.amsSwitcherPlusClass||"fa-plus"),a.trigger("ams.switcher.closed",[a])}),"open"!==n.amsSwitcherState&&t.addClass("switched"),a.data("ams-switcher","on"))})},checker:function(a){e("LEGEND.checker",a).each(function(){var a=e(this),t=a.parent("fieldset"),s=a.data();if(!s.amsChecker){var i=e('<label class="checkbox"></label>'),r=s.amsCheckerFieldname||"checker_"+n.generateId(),o=r.replace(/\./,"_"),c=s.amsCheckerHiddenPrefix,l=null,d=s.amsCheckerHiddenValueOn||"true",m=s.amsCheckerHiddenValueOff||"false",u=s.amsCheckerMarker||!1;c?l=e('<input type="hidden">').attr("name",c+r).val("on"===s.amsCheckerState?d:m).prependTo(a):u&&e('<input type="hidden">').attr("name",u).attr("value",1).prependTo(a);var f=e('<input type="checkbox">').attr("name",r).attr("id",o).data("ams-checker-hidden-input",l).data("ams-checker-init",!0).val(s.amsCheckerValue||!0).attr("checked","on"===s.amsCheckerState?"checked":null);s.amsCheckerReadonly?f.attr("disabled","disabled"):f.on("change",function(i){i.preventDefault();var r={},o=e(this).is(":checked");if(a.trigger("ams.checker.before-switch",[a,r]),r.veto)e(this).prop("checked",!o);else if(n.executeFunctionByName(s.amsCheckerChangeHandler,a,o),!s.amsCheckerCancelDefault){var c=f.data("ams-checker-hidden-input");o?("disable"===s.amsCheckerMode?(t.removeAttr("disabled"),e(".select2",t).removeAttr("disabled")):t.removeClass("switched"),c&&c.val(d),e("[data-required]",t).attr("required","required"),a.trigger("ams.checker.opened",[a])):("disable"===s.amsCheckerMode?(t.prop("disabled","disabled"),e(".select2",t).attr("disabled","disabled")):t.addClass("switched"),c&&c.val(m),e("[data-required]",t).removeAttr("required"),a.trigger("ams.checker.closed",[a]))}}),f.appendTo(i),e(">label",a).attr("for",f.attr("id")),i.append("<i></i>").prependTo(a);var h=e("[required]",t);h.attr("data-required",!0),"on"===s.amsCheckerState?f.attr("checked",!0):("disable"===s.amsCheckerMode?(t.attr("disabled","disabled"),e(".select2",t).attr("disabled","disabled")):t.addClass("switched"),h.removeAttr("required")),a.data("ams-checker","on")}})},slider:function(a){var t=e(".slider",a);t.length>0&&n.ajax.check(e.fn.slider,n.baseURL+"ext/bootstrap-slider-2.0.0"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s=e.extend({},{},a.data.amsSliderOptions);s=n.executeFunctionByName(t.amsSliderInitCallback,a,s)||s;var i=a.slider(s);n.executeFunctionByName(t.amsSliderAfterInitCallback,a,i,s)})})},draggable:function(a){var t=e(".draggable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={cursor:t.amsDraggableCursor||"move",containment:t.amsDraggableContainment,handle:t.amsDraggableHandle,connectToSortable:t.amsDraggableConnectSortable,helper:n.getFunctionByName(t.amsDraggableHelper)||t.amsDraggableHelper,start:n.getFunctionByName(t.amsDraggableStart),stop:n.getFunctionByName(t.amsDraggableStop)},i=e.extend({},s,t.amsDraggableOptions);i=n.executeFunctionByName(t.amsDraggableInitCallback,a,i)||i;var r=a.draggable(i);a.disableSelection(),n.executeFunctionByName(t.amsDraggableAfterInitCallback,a,r,i)})},droppable:function(a){var t=e(".droppable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={accept:t.amsdroppableAccept,drop:n.getFunctionByName(t.amsDroppableDrop)},i=e.extend({},s,t.amsDroppableOptions);i=n.executeFunctionByName(t.amsDroppableInitCallback,a,i)||i;var r=a.droppable(i);n.executeFunctionByName(t.amsDroppableAfterInitCallback,a,r,i)})},sortable:function(a){var t=e(".sortable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={items:t.amsSortableItems,handle:t.amsSortableHandle,helper:t.amsSortableHelper,connectWith:t.amsSortableConnectwith,start:n.getFunctionByName(t.amsSortableStart),over:n.getFunctionByName(t.amsSortableOver),containment:t.amsSortableContainment,placeholder:t.amsSortablePlaceholder,stop:n.getFunctionByName(t.amsSortableStop)},i=e.extend({},s,t.amsSortableOptions);i=n.executeFunctionByName(t.amsSortableInitCallback,a,i)||i;var r=a.sortable(i);a.disableSelection(),n.executeFunctionByName(t.amsSortableAfterInitCallback,a,r,i)})},resizable:function(a){var t=e(".resizable",a);t.length>0&&t.each(function(){var a=e(this),t=a.data(),s={autoHide:!1===t.amsResizableAutohide||t.amsResizableAutohide,containment:t.amsResizableContainment,grid:t.amsResizableGrid,handles:t.amsResizableHandles,start:n.getFunctionByName(t.amsResizableStart),stop:n.getFunctionByName(t.amsResizableStop)},i=e.extend({},s,t.amsResizableOptions);i=n.executeFunctionByName(t.amsResizableInitCallback,a,i)||i;var r=a.resizable(i);a.disableSelection(),n.executeFunctionByName(t.amsResizableAfterInitCallback,a,r,i)})},typeahead:function(a){var t=e(".typeahead",a);t.length>0&&n.ajax.check(e.fn.typeahead,n.baseURL+"ext/jquery-typeahead"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s=e.extend({},{},t.amsTypeaheadOptions);s=n.executeFunctionByName(t.amsTypeaheadInitCallback,a,s)||s;var i=a.typeahead(s);n.executeFunctionByName(t.amsTypeaheadAfterInitCallback,a,i,s)})})},treeview:function(a){var t=e(".treeview",a);t.length>0&&n.ajax.check(e.fn.treview,n.baseURL+"ext/bootstrap-treeview"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/bootstrap-treeview"+n.devext+".css","bootstrap-treeview",function(){t.each(function(){var a=e(this),t=a.data(),s={data:t.amsTreeviewData,levels:t.amsTreeviewLevels,injectStyle:t.amsTreeviewInjectStyle,expandIcon:t.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:t.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:t.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:t.amsTreeviewNodeIcon,selectedIcon:t.amsTreeviewSelectedIcon,checkedIcon:t.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:t.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:t.amsTreeviewColor,backColor:t.amsTreeviewBackColor,borderColor:t.amsTreeviewBorderColor,onHoverColor:t.amsTreeviewHoverColor,selectedColor:t.amsTreeviewSelectedColor,selectedBackColor:t.amsTreeviewSelectedBackColor,unselectableColor:t.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:t.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:t.amsTreeviewEnableLinks,highlightSelected:t.amsTreeviewHighlightSelected,highlightSearchResults:t.amsTreeviewhighlightSearchResults,showBorder:t.amsTreeviewShowBorder,showIcon:t.amsTreeviewShowIcon,showCheckbox:t.amsTreeviewShowCheckbox,showTags:t.amsTreeviewShowTags,toggleUnselectable:t.amsTreeviewToggleUnselectable,multiSelect:t.amsTreeviewMultiSelect,onNodeChecked:n.getFunctionByName(t.amsTreeviewNodeChecked),onNodeCollapsed:n.getFunctionByName(t.amsTreeviewNodeCollapsed),onNodeDisabled:n.getFunctionByName(t.amsTreeviewNodeDisabled),onNodeEnabled:n.getFunctionByName(t.amsTreeviewNodeEnabled),onNodeExpanded:n.getFunctionByName(t.amsTreeviewNodeExpanded),onNodeSelected:n.getFunctionByName(t.amsTreeviewNodeSelected),onNodeUnchecked:n.getFunctionByName(t.amsTreeviewNodeUnchecked),onNodeUnselected:n.getFunctionByName(t.amsTreeviewNodeUnselected),onSearchComplete:n.getFunctionByName(t.amsTreeviewSearchComplete),onSearchCleared:n.getFunctionByName(t.amsTreeviewSearchCleared)},i=e.extend({},s,t.amsTreeviewOptions);i=n.executeFunctionByName(t.amsTreeviewInitcallback,a,i)||i;var r=a.treeview(i);n.executeFunctionByName(t.amsTreeviewAfterInitCallback,a,r,i)})})})},select2:function(a){var t=e(".select2",a);t.length>0&&n.ajax.check(e.fn.select2,n.baseURL+"ext/jquery-select2-3.5.4"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data();if(!t.select2){var s={placeholder:t.amsSelect2Placeholder,multiple:t.amsSelect2Multiple,minimumInputLength:t.amsSelect2MinimumInputLength||0,maximumSelectionSize:t.amsSelect2MaximumSelectionSize,openOnEnter:void 0===t.amsSelect2EnterOpen||t.amsSelect2EnterOpen,allowClear:void 0===t.amsSelect2AllowClear||t.amsSelect2AllowClear,width:t.amsSelect2Width||"100%",initSelection:n.getFunctionByName(t.amsSelect2InitSelection),formatSelection:void 0===t.amsSelect2FormatSelection?n.helpers.select2FormatSelection:n.getFunctionByName(t.amsSelect2FormatSelection),formatResult:n.getFunctionByName(t.amsSelect2FormatResult),formatMatches:void 0===t.amsSelect2FormatMatches?function(e){return 1===e?n.i18n.SELECT2_MATCH:e+n.i18n.SELECT2_MATCHES}:n.getFunctionByName(t.amsSelect2FormatMatches),formatNoMatches:void 0===t.amsSelect2FormatResult?function(e){return n.i18n.SELECT2_NOMATCHES}:n.getFunctionByName(t.amsSelect2FormatResult),formatInputTooShort:void 0===t.amsSelect2FormatInputTooShort?function(e,a){var t=a-e.length;return n.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":n.i18n.SELECT2_PLURAL)}:n.getFunctionByName(t.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===t.amsSelect2FormatInputTooLong?function(e,a){var t=e.length-a;return n.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":n.i18n.SELECT2_PLURAL)}:n.getFunctionByName(t.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===t.amsSelect2FormatSelectionTooBig?function(e){return n.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":n.i18n.SELECT2_PLURAL)}:n.getFunctionByName(t.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===t.amsSelect2FormatLoadMore?function(e){return n.i18n.SELECT2_LOADMORE}:n.getFunctionByName(t.amsSelect2FormatLoadMore),formatSearching:void 0===t.amsSelect2FormatSearching?function(){return n.i18n.SELECT2_SEARCHING}:n.getFunctionByName(t.amsSelect2FormatSearching),separator:t.amsSelect2Separator||",",tokenSeparators:t.amsSelect2TokensSeparators||[","],tokenizer:n.getFunctionByName(t.amsSelect2Tokenizer)};switch(a.context.type){case"text":case"hidden":if(!s.initSelection){var i=a.data("ams-select2-values");i&&(s.initSelection=function(a,t){var n=[];e(a.val().split(s.separator)).each(function(){n.push({id:this,text:i[this]||this})}),t(n)})}}a.attr("readonly")?"hidden"===a.attr("type")&&(s.query=function(){return[]}):t.amsSelect2Query?(s.query=n.getFunctionByName(t.amsSelect2Query),s.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2QueryUrl?(s.ajax={url:t.amsSelect2QueryUrl,quietMillis:t.amsSelect2QuietMillis||200,type:t.amsSelect2QueryType||"POST",dataType:t.amsSelect2QueryDatatype||"json",data:function(a,n,s){var i={};return i[t.amsSelect2QueryParamName||"query"]=a,i[t.amsSelect2PageParamName||"page"]=n,i[t.amsSelect2ContextParamName||"context"]=s,e.extend({},i,t.amsSelect2QueryOptions)},results:n.helpers.select2QueryUrlResultsCallback},s.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2QueryMethod?(s.query=function(s){var i={id:(new Date).getTime(),params:t.amsSelect2QueryParams||{},success:function(e){return n.helpers.select2QueryMethodSuccessCallback.call(a,e,"success",s)},error:n.error.show};i.params[t.amsSelect2QueryParamName||"query"]=s.term,i.params[t.amsSelect2PageParamName||"page"]=s.page,i.params[t.amsSelect2ContextParamName||"context"]=s.context,i=e.extend({},i,t.amsSelect2QueryOptions),i=n.executeFunctionByName(t.amsSelect2QueryInitCallback,a,i)||i,n.ajax.check(e.jsonRPC,n.baseURL+"ext/jquery-jsonrpc"+n.devext+".js",function(){e.jsonRPC.withOptions({endPoint:t.amsSelect2MethodTarget||n.jsonrpc.getAddr(),namespace:t.amsSelect2MethodNamespace,cache:!1},function(){e.jsonRPC.request(t.amsSelect2QueryMethod,i)})})},s.minimumInputLength=t.amsSelect2MinimumInputLength||1):t.amsSelect2Tags?s.tags=t.amsSelect2Tags:t.amsSelect2Data&&(s.data=t.amsSelect2Data),t.amsSelect2EnableFreeTags&&(s.createSearchChoice=function(e){return{id:e,text:(t.amsSelect2FreeTagsPrefix||n.i18n.SELECT2_FREETAG_PREFIX)+e}});var r=e.extend({},s,t.amsSelect2Options);r=n.executeFunctionByName(t.amsSelect2InitCallback,a,r)||r;var o=a.select2(r);n.executeFunctionByName(t.amsSelect2AfterInitCallback,a,o,r),a.hasClass("ordered")&&n.ajax.check(e.fn.select2Sortable,n.baseURL+"ext/jquery-select2-sortable"+n.devext+".js",function(){a.select2Sortable({bindOrder:"sortableStop"})}),a.on("change",function(){void 0!==e(a.get(0).form).data("validator")&&e(a).valid()})}})})},maskedit:function(a){var t=e("input[data-mask]",a);t.length>0&&n.ajax.check(e.fn.mask,n.baseURL+"ext/jquery-maskedinput-1.4.1"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s={placeholder:void 0===t.amsMaskeditPlaceholder?"X":t.amsMaskeditPlaceholder,complete:n.getFunctionByName(t.amsMaskeditComplete)},i=e.extend({},s,t.amsMaskeditOptions);i=n.executeFunctionByName(t.amsMaskeditInitCallback,a,i)||i;var r=a.mask(a.attr("data-mask"),i);n.executeFunctionByName(t.amsMaskeditAfterInitCallback,a,r,i)})})},inputmask:function(a){var t=e("input[data-input-mask]",a);t.length>0&&n.ajax.check(e.fn.inputmask,n.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+n.devext+".js",function(){t.each(function(){var a,t=e(this),s=t.data();a="object"==typeof s.inputMask?s.inputMask:{mask:s.inputMask.toString()};var i=e.extend({},a,s.amsInputmaskOptions);i=n.executeFunctionByName(s.amsInputmaskInitCallback,t,i)||i;var r=t.inputmask(i);n.executeFunctionByName(s.amsInputmaskAfterInitCallback,t,r,i)})})},datepicker:function(a){var t=e(".datepicker",a);t.length>0&&n.ajax.check(e.fn.datetimepicker,n.baseURL+"ext/jquery-datetimepicker"+n.devext+".js",function(a){a&&n.dialog.registerHideCallback(n.helpers.datetimepickerDialogHiddenCallback),n.getCSS(n.baseURL+"../css/ext/jquery-datetimepicker"+n.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),s={lang:t.amsDatetimepickerLang||n.lang,format:t.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,weeks:t.amsDatetimepickerWeeks},i=e.extend({},s,t.amsDatetimepickerOptions);i=n.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);n.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},datetimepicker:function(a){var t=e(".datetimepicker",a);t.length>0&&n.ajax.check(e.fn.datetimepicker,n.baseURL+"ext/jquery-datetimepicker"+n.devext+".js",function(a){a&&n.dialog.registerHideCallback(n.helpers.datetimepickerDialogHiddenCallback),n.getCSS(n.baseURL+"../css/ext/jquery-datetimepicker"+n.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),s={lang:t.amsDatetimepickerLang||n.lang,format:t.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect,weeks:t.amsDatetimepickerWeeks},i=e.extend({},s,t.amsDatetimepickerOptions);i=n.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);n.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},timepicker:function(a){var t=e(".timepicker",a);t.length>0&&n.ajax.check(e.fn.datetimepicker,n.baseURL+"ext/jquery-datetimepicker"+n.devext+".js",function(a){a&&n.dialog.registerHideCallback(n.helpers.datetimepickerDialogHiddenCallback),n.getCSS(n.baseURL+"../css/ext/jquery-datetimepicker"+n.devext+".css","jquery-datetimepicker",function(){t.each(function(){var a=e(this),t=a.data(),s={lang:t.amsDatetimepickerLang||n.lang,format:t.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===t.amsDatetimepickerCloseOnSelect||t.amsDatetimepickerCloseOnSelect},i=e.extend({},s,t.amsDatetimepickerOptions);i=n.executeFunctionByName(t.amsDatetimepickerInitCallback,a,i)||i;var r=a.datetimepicker(i);n.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},colorpicker:function(a){var t=e(".colorpicker",a);t.length>0&&n.ajax.check(e.fn.minicolors,n.baseURL+"ext/jquery-minicolors"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-minicolors"+n.devext+".css","jquery-minicolors",function(){t.each(function(){var a=e(this),t=a.data(),s={position:t.amsColorpickerPosition||a.closest(".input").data("ams-colorpicker-position")||"bottom left"},i=e.extend({},s,t.amsColorpickerOptions);i=n.executeFunctionByName(t.amsColorpickerInitCallback,a,i)||i;var r=a.minicolors(i);n.executeFunctionByName(t.amsDatetimepickerAfterInitCallback,a,r,i)})})})},dndupload:function(a){var t=e(".dndupload",a);t.length>0&&n.ajax.check(e.fn.dndupload,n.baseURL+"ext/jquery-dndupload"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-dndupload"+n.devext+".css","jquery-dndupload",function(){t.each(function(){var a=e(this),t=a.data(),s={action:t.amsDnduploadAction||a.attr("action")||"upload-files",fieldname:t.amsDnduploadFieldname||"files",autosubmit:t.amsDnduploadAutosubmit},i=e.extend({},s,t.amsDnduploadOptions);i=n.executeFunctionByName(t.amsDnduploadInitCallback,a,i)||i;var r=a.dndupload(i);n.executeFunctionByName(t.amsDnduploadAfterInitcallback,a,r,i)})})})},validate:function(a){var t=e("FORM:not([novalidate])",a);t.length>0&&n.ajax.check(e.fn.validate,n.baseURL+"ext/jquery-validate-1.17.0"+n.devext+".js",function(a){if(a&&(e.validator.setDefaults({highlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(a){e(a).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),n.plugins.i18n)){for(var s in n.plugins.i18n.validate)if(n.plugins.i18n.validate.hasOwnProperty(s)){var i=n.plugins.i18n.validate[s];"string"==typeof i&&i.indexOf("{0}")>-1&&(n.plugins.i18n.validate[s]=e.validator.format(i))}e.extend(e.validator.messages,n.plugins.i18n.validate)}t.each(function(){var a=e(this),t=a.data(),s={ignore:null,submitHandler:void 0!==a.attr("data-async")?void 0===t.amsFormSubmitHandler?function(){return e(".state-error",a).removeClass("state-error"),n.ajax.check(e.fn.ajaxSubmit,n.baseURL+"ext/jquery-form-3.49"+n.devext+".js"),n.form.submit(a)}:n.getFunctionByName(t.amsFormSubmitHandler):void 0,invalidHandler:void 0!==a.attr("data-async")?void 0===t.amsFormInvalidHandler?function(t,n){e(".state-error",a).removeClass("state-error");for(var s=0;s<n.errorList.length;s++){var i=n.errorList[s],r=e(i.element).parents(".tab-pane").index()+1;if(r>0){var o=e(".nav-tabs",e(i.element).parents(".tabforms"));e("li:nth-child("+r+")",o).removeClassPrefix("state-").addClass("state-error"),e("li.state-error:first a",o).click()}}}:n.getFunctionByName(t.amsFormInvalidHandler):void 0};e("[data-ams-validate-rules]",a).each(function(a){0===a&&(s.rules={}),s.rules[e(this).attr("name")]=e(this).data("ams-validate-rules")});var i=e.extend({},s,t.amsValidateOptions);i=n.executeFunctionByName(t.amsValidateInitCallback,a,i)||i;var r=a.validate(i);n.executeFunctionByName(t.amsValidateAfterInitCallback,a,r,i)})})},datatable:function(a){var t=e(".datatable",a);t.length>0&&n.ajax.check(e.fn.dataTable,n.baseURL+"ext/jquery-dataTables-1.9.4"+n.devext+".js",function(){n.ajax.check(e.fn.dataTableExt.oPagination.bootstrap_full,n.baseURL+"myams-dataTables"+n.devext+".js",function(){e(t).each(function(){var a,t=e(this),s=t.data(),i=(s.amsDatatableExtensions||"").split(/\s+/),r=s.amsDatatableSdom||"W"+(i.indexOf("colreorder")>=0||i.indexOf("colreorderwithresize")>=0?"R":"")+"<'dt-top-row'"+(i.indexOf("colvis")>=0?"C":"")+(!1===s.amsDatatablePagination||!1===s.amsDatatablePaginationSize?"":"L")+(!1===s.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(i.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===s.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",o=s.amsDatatableSorting;if("string"==typeof o){var c=o.split(";");for(o=[],a=0;a<c.length;a++){var l=c[a].split(",");l[0]=parseInt(l[0]),o.push(l)}}var d,m=[],u=e("th",t).listattr("data-ams-datatable-sortable");for(a=0;a<u.length;a++){var f=u[a];void 0!==f?((d=m[a]||{}).bSortable="string"==typeof f?JSON.parse(f):f,m[a]=d):m[a]=m[a]||{}}var h=e("th",t).listattr("data-ams-datatable-stype");for(a=0;a<h.length;a++){var p=h[a];p?((d=m[a]||{}).sType=p,m[a]=d):m[a]=m[a]||{}}var g={bJQueryUI:!1,bServerSide:s.amsDatatableServerSide||!1,sAjaxSource:!0===s.amsDatatableServerSide?s.amsDatatableAjaxSource:void 0,sServerMethod:!0===s.amsDatatableServerSide?"POST":void 0,bFilter:!1!==s.amsDatatableGlobalFilter||i.indexOf("columnfilter")>=0,bPaginate:!1!==s.amsDatatablePagination,bInfo:!1!==s.amsDatatableInfo,bSort:!1!==s.amsDatatableSort,aaSorting:o,aoColumns:m.length>0?m:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:s.amsDatatableDisplayLength||25,sPaginationType:s.amsDatatablePaginationType||"bootstrap_full",sDom:r,oLanguage:n.plugins.i18n.datatables,fnInitComplete:function(a,t){e(".ColVis_Button").addClass("btn btn-default btn-sm").html((n.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},b=e.extend({},g,s.amsDatatableOptions),v=[],x=[],y=[];if(i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":v.push(e.fn.dataTable.AutoFill),x.push(n.baseURL+"ext/jquery-dataTables-autoFill"+n.devext+".js");break;case"columnfilter":v.push(e.fn.columnFilter),x.push(n.baseURL+"ext/jquery-dataTables-columnFilter"+n.devext+".js");break;case"colreorder":v.push(e.fn.dataTable.ColReorder),x.push(n.baseURL+"ext/jquery-dataTables-colReorder"+n.devext+".js");break;case"colreorderwithresize":v.push(window.ColReorder),x.push(n.baseURL+"ext/jquery-dataTables-colReorderWithResize"+n.devext+".js");break;case"colvis":v.push(e.fn.dataTable.ColVis),x.push(n.baseURL+"ext/jquery-dataTables-colVis"+n.devext+".js"),y.push(function(){b.oColVis=e.extend({},{activate:"click",sAlign:"right"},s.amsDatatableColvisOptions)});break;case"editable":v.push(e.fn.editable),x.push(n.baseURL+"ext/jquery-jeditable"+n.devext+".js"),v.push(e.fn.makeEditable),x.push(n.baseURL+"ext/jquery-dataTables-editable"+n.devext+".js");break;case"fixedcolumns":v.push(e.fn.dataTable.FixedColumns),x.push(n.baseURL+"ext/jquery-dataTables-fixedColumns"+n.devext+".js");break;case"fixedheader":v.push(e.fn.dataTable.Fixedheader),x.push(n.baseURL+"ext/jquery-dataTables-fixedHeader"+n.devext+".js");break;case"keytable":v.push(window.keyTable),x.push(n.baseURL+"ext/jquery-dataTables-keyTable"+n.devext+".js");break;case"rowgrouping":v.push(e.fn.rowGrouping),x.push(n.baseURL+"ext/jquery-dataTables-rowGrouping"+n.devext+".js");break;case"rowreordering":v.push(e.fn.rowReordering),x.push(n.baseURL+"ext/jquery-dataTables-rowReordering"+n.devext+".js");break;case"scroller":v.push(e.fn.dataTable.Scroller),x.push(n.baseURL+"ext/jquery-dataTables-scroller"+n.devext+".js")}y.push(function(){b=n.executeFunctionByName(s.amsDatatableInitCallback,t,b)||b;try{var r=t.dataTable(b);if(n.executeFunctionByName(s.amsDatatableAfterInitCallback,t,r,b),i.length>0)for(a=0;a<i.length;a++)switch(i[a]){case"autofill":var o=e.extend({},s.amsDatatableAutofillOptions,b.autofill);o=n.executeFunctionByName(s.amsDatatableAutofillInitCallback,t,o)||o,t.data("ams-autofill",void 0===s.amsDatatableAutofillConstructor?new e.fn.dataTable.AutoFill(t,o):n.executeFunctionByName(s.amsDatatableAutofillConstructor,t,r,o));break;case"columnfilter":var c=e.extend({},{sPlaceHolder:"head:after"},s.amsDatatableColumnfilterOptions,b.columnfilter);c=n.executeFunctionByName(s.amsDatatableColumnfilterInitCallback,t,c)||c,t.data("ams-columnfilter",void 0===s.amsDatatableColumnfilterConstructor?r.columnFilter(c):n.executeFunctionByName(s.amsDatatableColumnfilterConstructor,t,r,c));break;case"editable":var l=e.extend({},s.amsDatatableEditableOptions,b.editable);l=n.executeFunctionByName(s.amsDatatableEditableInitCallback,t,l)||l,t.data("ams-editable",void 0===s.amsDatatableEditableConstructor?t.makeEditable(l):n.executeFunctionByName(s.amsDatatableEditableConstructor,t,r,l));break;case"fixedcolumns":var d=e.extend({},s.amsDatatableFixedcolumnsOptions,b.fixedcolumns);d=n.executeFunctionByName(s.amsDatatableFixedcolumnsInitCallback,t,d)||d,t.data("ams-fixedcolumns",void 0===s.amsDatatableFixedcolumnsConstructor?new e.fn.dataTable.FixedColumns(t,d):n.executeFunctionByName(s.amsDatatableFixedcolumnsConstructor,t,r,d));break;case"fixedheader":var m=e.extend({},s.amsDatatableFixedheaderOptions,b.fixedheader);m=n.executeFunctionByName(s.amsDatatableFixedheadeInitCallback,t,m)||m,t.data("ams-fixedheader",void 0===s.amsDatatableFixedheaderConstructor?new e.fn.dataTable.FixedHeader(t,m):n.executeFunctionByName(s.amsDatatableFixedheaderConstructor,t,r,m));break;case"keytable":var u={table:t.get(0),datatable:r},f=e.extend({},u,s.amsDatatableKeytableOptions,b.keytable);f=n.executeFunctionByName(s.amsDatatableKeytableInitCallback,t,f)||f,t.data("ams-keytable",void 0===s.amsDatatableKeytableConstructor?new KeyTable(f):n.executeFunctionByName(s.amsDatatableKeytableConstructor,t,r,f));break;case"rowgrouping":var h=e.extend({},s.amsDatatableRowgroupingOptions,b.rowgrouping);h=n.executeFunctionByName(s.amsDatatableRowgroupingInitCallback,t,h)||h,t.data("ams-rowgrouping",void 0===s.amsDatatableRowgroupingConstructor?t.rowGrouping(h):n.executeFunctionByName(s.amsDatatableRowgroupingConstructor,t,r,h));break;case"rowreordering":var p=e.extend({},s.amsDatatableRowreorderingOptions,b.rowreordering);p=n.executeFunctionByName(s.amsDatatableRowreorderingInitCallback,t,p)||p,t.data("ams-rowreordering",void 0===s.amsDatatableRowreorderingConstructor?t.rowReordering(p):n.executeFunctionByName(s.amsDatatableRowreorderingConstructor,t,r,p))}if(s.amsDatatableFinalizeCallback){var g=s.amsDatatableFinalizeCallback.split(/\s+/);if(g.length>0)for(a=0;a<g.length;a++)n.executeFunctionByName(g[a],t,r,b)}}catch(e){}}),n.ajax.check(v,x,y)})})})},tablednd:function(a){var t=e(".table-dnd",a);t.length>0&&n.ajax.check(e.fn.tableDnD,n.baseURL+"ext/jquery-tablednd"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data();t.amsTabledndDragHandle?e("tr",a).addClass("no-drag-handle"):e(a).on("mouseover","tr",function(){e(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){e(this.cells[0]).removeClass("drag-handle")});var s={onDragClass:t.amsTabledndDragClass||"dragging-row",onDragStart:n.getFunctionByName(t.amsTabledndDragStart),dragHandle:t.amsTabledndDragHandle,scrollAmount:t.amsTabledndScrollAmount,onAllowDrop:t.amsTabledndAllowDrop,onDrop:n.getFunctionByName(t.amsTabledndDrop)||function(s,i){var r=t.amsTabledndDropTarget;if(r){e(i).data("ams-disabled-handlers","click");try{var o=[];e(s.rows).each(function(){var a=e(this).data("ams-element-name");a&&o.push(a)});var c=n.getFunctionByName(r);if("function"==typeof c)c.call(a,s,o);else{if(!r.startsWith(window.location.protocol)){var l=t.amsLocation;l&&(r=l+"/"+r)}n.ajax.post(r,{names:JSON.stringify(o)})}}finally{setTimeout(function(){e(i).removeData("ams-disabled-handlers")},50)}}return!1}},i=e.extend({},s,t.amsTabledndOptions);i=n.executeFunctionByName(t.amsTabledndInitCallback,a,i)||i;var r=a.tableDnD(i);n.executeFunctionByName(t.amsTabledndAfterInitCallback,a,r,i)})})},wizard:function(a){var t=e(".wizard",a);t.length>0&&n.ajax.check(e.fn.bootstrapWizard,n.baseURL+"ext/bootstrap-wizard-1.4.2"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s={withVisible:void 0===t.amsWizardWithVisible||t.amsWizardWithVisible,tabClass:t.amsWizardTabClass,firstSelector:t.amsWizardFirstSelector,previousSelector:t.amsWizardPreviousSelector,nextSelector:t.amsWizardNextSelector,lastSelector:t.amsWizardLastSelector,finishSelector:t.amsWizardFinishSelector,backSelector:t.amsWizardBackSelector,onInit:n.getFunctionByName(t.amsWizardInit),onShow:n.getFunctionByName(t.amsWizardShow),onNext:n.getFunctionByName(t.amsWizardNext),onPrevious:n.getFunctionByName(t.amsWizardPrevious),onFirst:n.getFunctionByName(t.amsWizardFirst),onLast:n.getFunctionByName(t.amsWizardLast),onBack:n.getFunctionByName(t.amsWizardBack),onFinish:n.getFunctionByName(t.amsWizardFinish),onTabChange:n.getFunctionByName(t.amsWizardTabChange),onTabClick:n.getFunctionByName(t.amsWizardTabClick),onTabShow:n.getFunctionByName(t.amsWizardTabShow)},i=e.extend({},s,t.amsWizardOptions);i=n.executeFunctionByName(t.amsWizardInitCallback,a,i)||i;var r=a.bootstrapWizard(i);n.executeFunctionByName(t.amsWizardAfterInitCallback,a,r,i)})})},tinymce:function(a){function t(){e(".tinymce",e(this)).each(function(){var a=tinymce.get(e(this).attr("id"));a&&a.remove()})}var s=e(".tinymce",a);if(s.length>0){var i=n.baseURL+"ext/tinymce"+(n.devmode?"/dev":"");n.ajax.check(window.tinymce,i+"/tinymce"+n.devext+".js",function(a){function r(){s.each(function(){var a=e(this),t=a.data(),s={theme:t.amsTinymceTheme||"modern",language:n.lang,menubar:!1!==t.amsTinymceMenubar,statusbar:!1!==t.amsTinymceStatusbar,plugins:t.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:t.amsTinymceToolbar,toolbar1:!1!==t.amsTinymceToolbar1&&(t.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==t.amsTinymceToolbar2&&(t.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:t.amsTinymceContentCss,formats:t.amsTinymceFormats,style_formats:t.amsTinymceStyleFormats,block_formats:t.amsTinymceBlockFormats,valid_classes:t.amsTinymceValidClasses,image_advtab:!0,image_list:n.getFunctionByName(t.amsTinymceImageList)||t.amsTinymceImageList,image_class_list:t.amsTinymceImageClassList,link_list:n.getFunctionByName(t.amsTinymceLinkList)||t.amsTinymceLinkList,link_class_list:t.amsTinymceLinkClassList,paste_as_text:void 0===t.amsTinymcePasteAsText||t.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===t.amsTinymcePasteAutoCleanup||t.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:t.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===t.amsTinymcePaseRemoveSpans||t.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===t.amsTinymcePasteRemoveStyles||t.amsTinymcePasteRemoveStyles,height:t.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(t.amsTinymceExternalPlugins){var i=t.amsTinymceExternalPlugins.split(/\s+/);for(var r in i)if(i.hasOwnProperty(r)){var o=a.data("ams-tinymce-plugin-"+i[r]);tinymce.PluginManager.load(i[r],n.getSource(o))}}var c=e.extend({},s,t.amsTinymceOptions);c=n.executeFunctionByName(t.amsTinymceInitCallback,a,c)||c;var l=a.tinymce(c);n.executeFunctionByName(t.amsTinymceAfterInitCallback,a,l,c)})}a?n.getScript(i+"/jquery.tinymce"+n.devext+".js",function(){tinymce.baseURL=i,tinymce.suffix=n.devext,n.skin.registerCleanCallback(t),r()}):r()})}},imgareaselect:function(a){var t=e(".imgareaselect",a);t.length>0&&n.ajax.check(e.fn.imgAreaSelect,n.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-imgareaselect"+n.devext+".css","jquery-imgareaselect",function(){t.each(function(){var a=e(this),t=a.data(),s=t.amsImgareaselectParent?a.parents(t.amsImgareaselectParent):"body",i={instance:!0,handles:!0,parent:s,x1:t.amsImgareaselectX1||0,y1:t.amsImgareaselectY1||0,x2:t.amsImgareaselectX2||t.amsImgareaselectImageWidth,y2:t.amsImgareaselectY2||t.amsImgareaselectImageHeight,imageWidth:t.amsImgareaselectImageWidth,imageHeight:t.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:t.amsImgareaselectRatio,onSelectEnd:n.getFunctionByName(t.amsImgareaselectSelectEnd)||function(a,n){var i=t.amsImgareaselectTargetField||"image_";e('input[name="'+i+'x1"]',s).val(n.x1),e('input[name="'+i+'y1"]',s).val(n.y1),e('input[name="'+i+'x2"]',s).val(n.x2),e('input[name="'+i+'y2"]',s).val(n.y2)}},r=e.extend({},i,t.amsImgareaselectOptions);r=n.executeFunctionByName(t.amsImgareaselectInitCallback,a,r)||r;var o=a.imgAreaSelect(r);n.executeFunctionByName(t.amsImgareaselectAfterInitCallback,a,o,r),setTimeout(function(){o.update()},250)})})})},fancybox:function(a){var t=e(".fancybox",a);t.length>0&&n.ajax.check(e.fn.fancybox,n.baseURL+"ext/jquery-fancybox-2.1.5"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-fancybox-2.1.5"+n.devext+".css","jquery-fancybox",function(){t.each(function(){var a,t=e(this),s=t.data(),i=t;s.amsFancyboxElements&&(i=e(s.amsFancyboxElements,t));var r=(s.amsFancyboxHelpers||"").split(/\s+/);if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":n.ajax.check(e.fancybox.helpers.buttons,n.baseURL+"ext/fancybox-helpers/fancybox-buttons"+n.devext+".js");break;case"thumbs":n.ajax.check(e.fancybox.helpers.thumbs,n.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+n.devext+".js");break;case"media":n.ajax.check(e.fancybox.helpers.media,n.baseURL+"ext/fancybox-helpers/fancybox-media"+n.devext+".js")}var o={type:s.amsFancyboxType,padding:s.amsFancyboxPadding||10,margin:s.amsFancyboxMargin||10,loop:s.amsFancyboxLoop,beforeLoad:n.getFunctionByName(s.amsFancyboxBeforeLoad)||function(){var a;if(s.amsFancyboxTitleGetter&&(a=n.executeFunctionByName(s.amsFancyboxTitleGetter,this)),!a){var t=e("*:first",this.element);(a=t.attr("original-title")||t.attr("title"))||(a=e(this.element).attr("original-title")||e(this.element).attr("title"))}this.title=a},afterLoad:n.getFunctionByName(s.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(r.length>0)for(a=0;a<r.length;a++)switch(r[a]){case"buttons":o.helpers.buttons={position:s.amsFancyboxButtonsPosition||"top"};break;case"thumbs":o.helpers.thumbs={width:s.amsFancyboxThumbsWidth||50,height:s.amsFancyboxThumbsHeight||50};break;case"media":o.helpers.media=!0}var c=e.extend({},o,s.amsFancyboxOptions);c=n.executeFunctionByName(s.amsFancyboxInitCallback,t,c)||c;var l=i.fancybox(c);n.executeFunctionByName(s.amsFancyboxAfterInitCallback,t,l,c)})})})},chart:function(a){var t=e(".chart",a);t.length>0&&n.ajax.check(e.fn.plot,n.baseURL+"flot/jquery.flot"+n.devext+".js",function(){t.each(function(){var a=e(this),t=a.data(),s=(t.amsChartPlugins||"").split(/\s+/);if(s.length>0)for(var i in s)if(s.hasOwnProperty(i)){var r=s[i];(function(a){for(var t in e.plot.plugins)if(e.plot.plugins.hasOwnProperty(t)){var n=e.plot.plugins[t];if(n.name===a)return n}return null})(r)||n.getScript(n.baseURL+"flot/jquery.flot."+r+n.devext+".js")}var o=e.extend({},{},t.amsChartOptions);o=n.executeFunctionByName(t.amsChartInitCallback,a,o)||o;var c=t.amsChartData;c=n.executeFunctionByName(t.amsChartInitData,a,c)||c;var l=a.plot(c,o);n.executeFunctionByName(t.amsChartAfterInitCallback,a,l,o)})})},graphs:function(a){var t=e(".sparkline",a);t.length>0&&n.ajax.check(n.graphs,n.baseURL+"myams-graphs"+n.devext+".js",function(){n.graphs.init(t)})},scrollbars:function(a){var t=e(".scrollbar",a);t.length>0&&n.ajax.check(e.event.special.mousewheel,n.baseURL+"ext/jquery-mousewheel.min.js",function(){n.ajax.check(e.fn.mCustomScrollbar,n.baseURL+"ext/jquery-mCustomScrollbar"+n.devext+".js",function(){n.getCSS(n.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){t.each(function(){var a=e(this),t=a.data(),s={theme:t.amsScrollbarTheme||"light"},i=e.extend({},s,t.amsScrollbarOptions);i=n.executeFunctionByName(t.amsScrollbarInitCallback,a,i)||i;var r=a.mCustomScrollbar(i);n.executeFunctionByName(t.amsScrollbarAfterInitCallback,a,r,i)})})})})}}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.callbacks={init:function(a){e("[data-ams-callback]",a).each(function(){var a=this,t=e(a).data();try{var s=JSON.parse(t.amsCallback);Array.isArray(s)||(s=[s])}catch(e){s=t.amsCallback.split(/\s+/)}for(var i=0;i<s.length;i++){var r=s[i];if("string"==typeof r){var o=n.getFunctionByName(r),c=t.amsCallbackOptions;"string"==typeof c&&(c=c.unserialize()),void 0===o?t.amsCallbackSource?n.getScript(t.amsCallbackSource,function(e){n.executeFunctionByName(e,a,c)}(r),{async:void 0===t.amsCallbackAsync||t.amsCallbackAsync}):console&&console.warn&&console.warn("Undefined callback: "+t.amsCallback):o.call(a,c)}else o=n.getFunctionByName(r.callback),"string"==typeof(c=r.options)&&(c=c.unserialize()),void 0===o?r.source?n.getScript(r.source,function(e){n.executeFunctionByName(e.callback,a,e.options)}(r),{async:void 0===r.async||r.async}):console&&console.warn&&console.warn("Undefined callback: "+r.callback):o.call(a,r.options)}})},alert:function(a){var t=e(this).data(),s=e.extend({},a,t.amsAlertOptions),i=e(t.amsAlertParent||s.parent||this),r=t.amsAlertStatus||s.status||"info",o=t.amsAlertHeader||s.header,c=t.amsAlertMessage||s.message,l=t.amsAlertSubtitle||s.subtitle,d=void 0===t.amsAlertMargin?void 0!==s.margin&&s.margin:t.amsAlertMargin;n.skin.alert(i,r,o,c,l,d)},messageBox:function(a){var t=e(this).data(),s=e.extend({},a,t.amsMessageboxOptions),i=e.extend({},s,{title:t.amsMessageboxTitle||s.title||"",content:t.amsMessageboxContent||s.content||"",icon:t.amsMessageboxIcon||s.icon,number:t.amsMessageboxNumber||s.number,timeout:t.amsMessageboxTimeout||s.timeout}),r=t.amsMessageboxStatus||s.status||"info",o=n.getFunctionByName(t.amsMessageboxCallback||s.callback);n.skin.messageBox(r,i,o)},smallBox:function(a){var t=e(this).data(),s=e.extend({},a,t.amsSmallboxOptions),i=e.extend({},s,{title:t.amsSmallboxTitle||s.title||"",content:t.amsSmallboxContent||s.content||"",icon:t.amsSmallboxIcon||s.icon,iconSmall:t.amsSmallboxIconSmall||s.iconSmall,timeout:t.amsSmallboxTimeout||s.timeout}),r=t.amsSmallboxStatus||s.status||"info",o=n.getFunctionByName(t.amsSmallboxCallback||s.callback);n.skin.smallBox(r,i,o)}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.events={init:function(a){e("[data-ams-events-handlers]",a).each(function(){var a=e(this),t=a.data("ams-events-handlers");if(t)for(var s in t)t.hasOwnProperty(s)&&a.on(s,n.getFunctionByName(t[s]))})}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.container={changeOrder:function(a,t){e('input[name="'+e(this).data("ams-input-name")+'"]',e(this)).val(t.join(";"))},deleteElement:function(){return function(){var a=e(this);t.skin.bigBox({title:n.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i>&nbsp; '+n.i18n.DELETE_WARNING,status:"info",buttons:n.i18n.BTN_OK_CANCEL},function(e){if(e===n.i18n.BTN_OK){var s=a.parents("tr").first(),i=s.parents("table").first(),r=s.data("ams-location")||i.data("ams-location")||"";r&&(r+="/");var o=s.data("ams-delete-target")||i.data("ams-delete-target")||"delete-element.json",c=s.data("ams-element-name");t.ajax.post(r+o,{object_name:c},function(e,a){"success"===e.status?(i.hasClass("datatable")?i.dataTable().fnDeleteRow(s[0]):s.remove(),e.handle_json&&t.ajax.handleJSON(e)):t.ajax.handleJSON(e)})}})}},switchElementVisibility:function(){return function(){var a=e(this),t=a.parents("td").first(),s=a.parents("tr").first(),i=s.parents("table");e("i",a).attr("class","fa fa-fw fa-spinner fa-pulse"),n.ajax.post(i.data("ams-location")+"/"+(t.data("ams-attribute-switcher")||i.data("ams-attribute-switcher")),{object_name:s.data("ams-element-name")},function(t,n){t.visible?e("i",a).attr("class","fa fa-fw fa-eye"):e("i",a).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var a=e(this),t=a.parents("td").first(),s=t.data("ams-switcher-attribute-name"),i=a.parents("tr").first(),r=i.parents("table");e("i",a).attr("class","fa fa-fw fa-spinner fa-pulse"),n.ajax.post(r.data("ams-location")+"/"+(t.data("ams-attribute-switcher")||r.data("ams-attribute-switcher")),{object_name:i.data("ams-element-name")},function(t,n){t[s]||t.on?e("i",a).attr("class",r.data("ams-"+s+"-icon-on")||"fa fa-fw fa-check-square-o"):e("i",a).attr("class",r.data("ams-"+s+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.tree={switchTableNode:function(){function a(t){e('tr[data-ams-tree-node-parent-id="'+t+'"]').each(function(){var t=e(this);a(t.data("ams-tree-node-id")),t.remove()})}var s=e(this),i=e("i.switch",s),r=s.parents("tr").first(),o=r.parents("table").first();if(i.hasClass("fa-minus-square-o"))a(r.data("ams-tree-node-id")),i.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var c=r.data("ams-location")||o.data("ams-location")||"",l=r.data("ams-tree-nodes-target")||o.data("ams-tree-nodes-target")||"get-tree-nodes.json",d=r.data("ams-element-name");i.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),t.ajax.post(c+"/"+d+"/"+l,{can_sort:!e("td.sorter",r).is(":empty")},function(a,t){if(a.length>0){for(var s=r,c=0;c<a.length;c++){var l=e(a[c]);l.insertAfter(s).addClass("no-drag-handle"),n.initContent(l),s=l}o.hasClass("table-dnd")&&o.tableDnDUpdate()}i.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},switchTree:function(){var a=e(this),s=e("i.switch",a),i=e(this).parents("table").first(),r=i.data("ams-tree-node-id");if(s.hasClass("fa-minus-square-o"))e("tr[data-ams-tree-node-parent-id]").filter('tr[data-ams-tree-node-parent-id!="'+r+'"]').remove(),e("i.switch",i).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var o=e("tbody tr",i).first(),c=i.data("ams-location")||"",l=i.data("ams-tree-nodes-target")||"get-tree.json";s.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),t.ajax.post(c+"/"+l,{can_sort:!e("td.sorter",o).is(":empty")},function(a,t){e("tr[data-ams-tree-node-id]",i).remove();for(var r=null,o=0;o<a.length;o++){var c=e(a[o]);null===r?c.appendTo(e("tbody",i)):c.insertAfter(r),c.addClass("no-drag-handle"),n.initContent(c),r=c}i.hasClass("table-dnd")&&i.tableDnDUpdate(),e("i.switch",i).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),s.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},sortTree:function(a,t){var s=e(a).data(),i=s.amsTabledndDropTarget;if(i){(t=e(t)).data("ams-disabled-handlers","click");try{var r=t.parents("table").first().data("ams-tree-node-id"),o=t.data("ams-tree-node-id"),c=t.data("ams-tree-node-parent-id"),l=t.prev("tr");if(l.exists()){var d=l.data("ams-tree-node-id"),m=e(".switch",l);if(m.hasClass("fa-minus-square-o"))if(c===d)var u="reorder";else u="reparent";else u=c===(d=l.data("ams-tree-node-parent-id"))?"reorder":"reparent"}else m=null,u=c===(d=r)?"reorder":"reparent";var f=n.getFunctionByName(i);if("function"==typeof f)f.call(table,a,p);else{if(!i.startsWith(window.location.protocol)){var h=s.amsLocation;h&&(i=h+"/"+i)}var p={action:u,child:o,parent:d,order:JSON.stringify(e("tr[data-ams-tree-node-id]").listattr("data-ams-tree-node-id")),can_sort:!e("td.sorter",t).is(":empty")};n.ajax.post(i,p,function(a){function s(a){e('tr[data-ams-tree-node-parent-id="'+a+'"]').each(function(){var a=e(this);s(a.attr("data-ams-tree-node-id")),a.remove()})}if(a.status)n.ajax.handleJSON(a);else{var i=e(t).parents("tbody").first();if(s(o),"reparent"===p.action){s(d),t.remove();for(var r=e('tr[data-ams-tree-node-id="'+d+'"]'),c=0;c<a.length;c++){var l=e(a[c]);r.exists()?l.insertAfter(r).addClass("no-drag-handle"):l.prependTo(i).addClass("no-drag-handle"),n.initContent(l),r=l}}e("tr").parents("table").tableDnDUpdate()}})}}finally{setTimeout(function(){e(t).removeData("ams-disabled-handlers")},50)}}return!1}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.skin={_setPageHeight:function(){var a=e("#main").height(),t=(n.leftPanel.height(),e(window).height()-n.navbarHeight);a>t?n.root.css("min-height",a+n.navbarHeight):n.root.css("min-height",t),n.leftPanel.css("min-height",t),n.leftPanel.css("max-height",t)},_checkMobileWidth:function(){e(window).width()<979?n.root.addClass("mobile-view-activated"):n.root.hasClass("mobile-view-activated")&&n.root.removeClass("mobile-view-activated")},_showShortcutButtons:function(){n.shortcuts.animate({height:"show"},200,"easeOutCirc"),n.root.addClass("shortcut-on")},_hideShortcutButtons:function(){n.shortcuts.animate({height:"hide"},300,"easeOutCirc"),n.root.removeClass("shortcut-on")},checkNotification:function(){var a=e(".badge","#user-activity >span");parseInt(a.text())>0?a.removeClass("hidden").addClass("bg-color-red bounceIn animated"):a.addClass("hidden").removeClass("bg-color-red bounceIn animated")},refreshNotificationsPanel:function(a){var t=e(this);t.addClass("disabled"),e("i",t).addClass("fa-spin"),e('input[name="activity"]:checked',"#user-activity").change(),e("i",t).removeClass("fa-spin"),t.removeClass("disabled")},refreshContent:function(a){var n=e('[id="'+a.object_id+'"]');return n.replaceWith(e(a.content)),n=e('[id="'+a.object_id+'"]'),t.initContent(n),n},refreshImage:function(a){e('img[src^="'+a.src+'"]').attr("src",a.target)},refreshWidget:function(a){var n=e('[id="'+a.parent_id+'"]'),s=e('[name="'+a.widget_name+'"]',n);s.exists()||(s=e('[name="'+a.widget_name+':list"]',n));var i=s.parents(".input").last();return i.html(a.content),t.initContent(i),i},refreshTable:function(a){var n=e('[id="'+a.object_id+'"]').parents(".ams-widget:first");return n.replaceWith(e(a.table)),n=e('[id="'+a.object_id+'"]').parents(".ams-widget:first"),t.initContent(n),n},refreshSwitchedTable:function(e){var a=n.skin.refreshTable(e).siblings("legend");a.parents("fieldset:first").hasClass("switched")&&a.click()},refreshRow:function(a){var n=e('tr[id="'+a.object_id+'"]'),s=n.parents("table").first(),i=e(a.row);return n.replaceWith(i),t.initContent(i),s.hasClass("table-dnd")&&(i.addClass("no-drag-handle"),s.tableDnDUpdate()),i},refreshRowCell:function(a){var n=e('tr[id="'+a.object_id+'"]'),s=n.parents("table").first(),i=e("tr",e("thead",s)),r=e('th[data-ams-column-name="'+a.col_name+'"]',i),o=e("th",i).index(r);if(o>-1){var c=e(e("td",n).get(o));c.html(a.cell),t.initContent(c)}},switchCellContent:function(a){var n=e(this),s=e("i.switch",n),i=n.parents("td"),r=e(n.data("ams-switch-target")||".inner-table-form",i),o=n.parents("tr");if(s.hasClass("fa-plus-square-o")){var c=o.parents("table");r.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>'),t.ajax.post(c.data("ams-location")+"/"+n.data("ams-switch-handler"),{object_name:o.data("ams-element-name")},function(e){r.html(e),e&&(t.initContent(r),s.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"))})}else t.skin.cleanContainer(r),r.empty(),s.removeClass("fa-minus-square-o").addClass("fa-plus-square-o")},_initDesktopWidgets:function(t){if(n.enableWidgets){var s=e(".ams-widget",t);s.length>0&&n.ajax.check(e.fn.MyAMSWidget,n.baseURL+"myams-widgets"+n.devext+".js",function(){s.each(function(){var a=e(this),t=a.data(),s=e.extend({},{deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"},t.amsWidgetOptions);s=n.executeFunctionByName(t.amsWidgetInitcallback,a,s)||s,a.MyAMSWidget(s)}),a.MyAMSWidget.initWidgetsGrid(e(".ams-widget-grid",t))})}},_initMobileWidgets:function(e){n.enableMobile&&n.enableWidgets&&n.skin._initDesktopWidgets(e)},alert:function(a,t,s,i,r,o){"error"===t&&(t="danger"),e(".alert-"+t,a).not(".persistent").remove();var c='<div class="'+(o?"margin-10":"")+" alert alert-block alert-"+t+' padding-5 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> '+s+"</h4>"+(r?"<p>"+r+"</p>":"");if("string"==typeof i)c+="<ul><li>"+i+"</li></ul>";else if(i){c+="<ul>";for(var l in i)e.isNumeric(l)&&(c+="<li>"+i[l]+"</li>");c+="</ul>"}e(c+="</div>").insertBefore(a),a.exists&&n.skin.scrollTo(a,{offset:{top:-50}})},bigBox:function(e,a){n.ajax.check(n.notify,n.baseURL+"myams-notify"+n.devext+".js",function(){n.notify.messageBox(e,a)})},messageBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),n.ajax.check(n.notify,n.baseURL+"myams-notify"+n.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,n.notify.bigBox(a,t)})},smallBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),n.ajax.check(n.notify,n.baseURL+"myams-notify"+n.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,n.notify.smallBox(a,t)})},scrollTo:function(a,t){n.ajax.check(e.scrollTo,n.baseURL+"ext/jquery-scrollto-2.1.2"+n.devext+".js",function(){var n=e("body"),s=t.offset||0;n.hasClass("fixed-header")&&(s-=e("#header").height()),n.hasClass("fixed-ribbon")&&(s-=e("#ribbon").height()),t=e.extend({},t,{offset:s}),e.scrollTo(a,t)})},_drawBreadCrumb:function(){var a=e("OL.breadcrumb","#ribbon");e("li",a).not(".parent").remove(),e("li",a).exists()||a.append(e("<li></li>").append(e("<a></a>").text(n.i18n.HOME).addClass("padding-right-5").attr("href",e('nav a[href!="#"]:first').attr("href")))),e("LI.active >A","nav").each(function(){var t=e(this),n=e.trim(t.clone().children(".badge").remove().end().text()),s=e("<li></li>").append(t.attr("href").replace(/^#/,"")?e("<a></a>").html(n).attr("href",t.attr("href")):n);a.append(s)})},checkURL:function(){function a(a){e(".active",s).removeClass("active"),a.addClass("open").addClass("active"),a.parents("li").addClass("open active").children("ul").addClass("active").show(),a.parents("li:first").removeClass("open"),a.parents("ul").addClass(a.attr("href").replace(/^#/,"")?"active":"").show()}var t,s=e("nav"),i=location.hash,r=i.replace(/^#/,"");if(r){var o=e("#content");o.exists()||(o=e("body")),(t=e('A[href="'+i+'"]',s)).exists()&&a(t),n.skin.loadURL(r,o,{afterLoadCallback:function(){var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+(e("[data-ams-page-title]:first",o).data("ams-page-title")||t.attr("title")||document.title)}})}else{var c=e("[data-ams-active-menu]").data("ams-active-menu");(t=c?e('A[href="'+c+'"]',s):e('>UL >LI >A[href!="#"]',s).first()).exists()&&(a(t),c?n.skin._drawBreadCrumb():window.location.hash=t.attr("href"))}},_clean_callbacks:[],registerCleanCallback:function(e){var a=n.skin._clean_callbacks;a.indexOf(e)<0&&a.push(e)},unregisterCleanCallback:function(e){var a=n.skin._clean_callbacks,t=a.indexOf(e);t>=0&&a.splice(t,1)},cleanContainer:function(e){for(var a=n.skin._clean_callbacks,t=0;t<a.length;t++)a[t].call(e)},loadURL:function(a,t,s,i){a.startsWith("#")&&(a=a.substr(1)),"function"==typeof s?(i=s,s={}):void 0===s&&(s={}),t=e(t);var r={type:"GET",url:a,dataType:"html",cache:!1,beforeSend:function(){if(s&&s.preLoadCallback&&n.executeFunctionByName(s.preLoadCallback,this,s.preLoadCallbackOptions),n.skin.cleanContainer(t),t.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> '+n.i18n.LOADING+" </h1>"),t[0]===e("#content")[0]){n.skin._drawBreadCrumb();var a=e("html head title").data("ams-title-prefix");document.title=(a?a+" > ":"")+e(".breadcrumb LI:last-child").text(),e("html, body").animate({scrollTop:0},"fast")}else t.animate({scrollTop:0},"fast")},success:function(a,r,o){if(i)n.executeFunctionByName(i,this,a,r,o,s);else{var c=n.ajax.getResponse(o),l=c.contentType,d=c.data;switch(e(".loading",t).remove(),l){case"json":n.ajax.handleJSON(d,t);break;case"script":case"xml":break;case"html":case"text":default:t.parents(".hidden").removeClass("hidden"),e(".alert",t.parents(".alerts-container")).remove(),t.css({opacity:"0.0"}).html(a).removeClass("hidden").delay(50).animate({opacity:"1.0"},300),n.initContent(t),n.form.setFocus(t)}s&&s.afterLoadCallback&&n.executeFunctionByName(s.afterLoadCallback,this,s.afterLoadCallbackOptions),n.stats.logPageview()}},error:function(e,a,i){t.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+n.i18n.ERROR+i+"</h3>"+e.responseText),s&&s.afterErrorCallback&&n.executeFunctionByName(s.afterErrorCallback,this)},async:void 0===s.async||s.async},o=e.extend({},r,s);e.ajax(o)},setLanguage:function(e,a){var t=a.lang;switch(a.handler_type||"json"){case"json":var s=a.method||"setUserLanguage";n.jsonrpc.post(s,{lang:t},function(){window.location.reload(!0)});break;case"ajax":var i=a.href||"setUserLanguage";n.ajax.post(i,{lang:t},function(){window.location.reload(!0)})}},logout:function(){window.location=n.loginURL}}}(jQuery,this),function(e,a){var t=a.MyAMS;t.stats={logPageview:function(e){if(void 0!==a._gaq){var t=a.window.location;a._gaq.push(["_trackPageview",e||t.pathname+t.hash])}},logEvent:function(e,t,n){void 0!==a._gaq&&("object"==typeof e&&(t=e.action,n=e.label,e=e.category),a._gaq.push(["_trackEvent",e,t,n]))}}}(jQuery,this),function(e,a){var t=a.MyAMS,n=t;t.initPage=function(){var s=e("body");n.root=s,n.leftPanel=e("#left-panel"),n.shortcuts=e("#shortcuts"),n.plugins.initData(s);var i=e.ajaxSettings.xhr;e.ajaxSetup({beforeSend:function(e,t){if(n.safeMethods.indexOf(t.type)<0&&void 0!==a.Cookies){var s=Cookies.get(n.csrfCookieName);s&&e.setRequestHeader(n.csrfHeaderName,s)}},progress:n.ajax.progress,progressUpload:n.ajax.progress,xhr:function(){var e=i();if(e&&"function"==typeof e.addEventListener){var a=this;a&&a.progress&&e.addEventListener("progress",function(e){a.progress(e)},!1)}return e}}),e(document).ajaxStart(n.ajax.start),e(document).ajaxStop(n.ajax.stop),e(document).ajaxError(n.error.ajax);var r=a.localStorage&&a.localStorage.getItem("window-state");r&&s.addClass(r),n.isMobile?(n.root.addClass("mobile-detected"),n.device="mobile",n.enableFastclick&&n.ajax.check(e.fn.noClickDelay,n.baseURL+"/ext/jquery-smartclick"+n.devext+".js",function(){e("NAV UL A").noClickDelay(),e("A","#hide-menu").noClickDelay()})):(n.root.addClass("desktop-detected"),n.device="desktop"),e("#show-shortcuts").click(function(e){n.shortcuts.is(":visible")?n.skin._hideShortcutButtons():n.skin._showShortcutButtons(),e.preventDefault()}),n.shortcuts.click(function(e){n.skin._hideShortcutButtons()}),e(document).mouseup(function(e){n.shortcuts.is(e.target)||0!==n.shortcuts.has(e.target).length||n.skin._hideShortcutButtons()}),e("#search-mobile").click(function(){n.root.addClass("search-mobile")}),e("#cancel-search-js").click(function(){n.root.removeClass("search-mobile")}),e(".activity-button","#user-activity").click(function(a){var t=e("#user-activity"),n=e(".ajax-dropdown",t);n.is(":visible")?(n.fadeOut(150),t.removeClass("active")):(n.css("left",-n.innerWidth()+t.innerWidth()).fadeIn(150),t.addClass("active")),a.preventDefault()}),n.skin.checkNotification(),e(document).mouseup(function(a){var t=e(".ajax-dropdown");t.is(a.target)||0!==t.has(a.target).length||t.fadeOut(150).prev().removeClass("active")}),e('input[name="activity"]').change(function(a){var t=e(this).data("ams-url");if(t){a.preventDefault(),a.stopPropagation();var s=n.getFunctionByName(t);if("function"==typeof s&&(t=s.call(this)),"function"==typeof t)t.call(this);else{var i=e(".ajax-notifications");n.skin.loadURL(t,i)}}}),e("a","#user-menu LI.logout").click(function(a){a.preventDefault(),a.stopPropagation(),n.loginURL=e(this).attr("href"),n.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+n.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+e("#show-shortcut").text()+"</strong></span> ?",content:n.i18n.LOGOUT_COMMENT,buttons:n.i18n.BTN_YES_NO},function(e){e===n.i18n.BTN_YES&&(n.root.addClass("animated fadeOutUp"),setTimeout(n.skin.logout,1e3))})});var o=e("nav");e("UL",o).myams_menu({accordion:!1!==o.data("ams-menu-accordion"),speed:n.menuSpeed}),e("#hide-menu").find(">:first-child >A").click(function(e){s.toggleClass("hidden-menu"),a.localStorage&&(s.hasClass("hidden-menu")?a.localStorage.setItem("window-state","hidden-menu"):a.localStorage.setItem("window-state","")),e.preventDefault()}),e(".minifyme").click(function(t){s.toggleClass("minified"),a.localStorage&&(s.hasClass("minified")?a.localStorage.setItem("window-state","minified"):a.localStorage.setItem("window-state","")),e(this).effect("highlight",{},500),t.preventDefault()}),e("#refresh").click(function(e){n.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+n.i18n.CLEAR_STORAGE_TITLE,content:n.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+n.i18n.BTN_CANCEL+"]["+n.i18n.BTN_OK+"]"},function(e){e===n.i18n.BTN_OK&&localStorage&&(localStorage.clear(),location.reload())}),e.preventDefault()}),s.on("click",function(a){var t=e(this);t.is(a.target)||0!==t.has(a.target).length||0!==e(".popover").has(a.target).length||t.popover("hide")}),n.ajax.check(e.resize,n.baseURL+"ext/jquery-resize"+n.devext+".js",function(){e("#main").resize(function(){n.skin._setPageHeight(),n.skin._checkMobileWidth()}),o.resize(function(){n.skin._setPageHeight()})}),n.ajaxNav&&(e(document).on("click",'a[href="#"]',function(e){e.preventDefault()}),e(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(a){var t=e(a.currentTarget),s=t.data("ams-disabled-handlers");if(!0!==s&&"click"!==s&&"all"!==s){var i=t.attr("href")||t.data("ams-url");if(i&&!i.startsWith("javascript")&&!t.attr("target")&&!0!==t.data("ams-context-menu")){a.preventDefault(),a.stopPropagation();var r,o,c;i.indexOf("?")>=0?(r=i.split("?"),o=r[0],c=r[1].unserialize()):(o=i,c=void 0);var l=n.getFunctionByName(o);"function"==typeof l&&(i=l.call(t,c)),"function"==typeof i?i.call(t,c):(i=i.replace(/\%23/,"#"),a.ctrlKey?window.open(i):(o=t.data("ams-target"))?n.form.confirmChangedForm(o,function(){n.skin.loadURL(i,o,t.data("ams-link-options"),t.data("ams-link-callback"))}):n.form.confirmChangedForm(function(){i.startsWith("#")?i!==location.hash&&(n.root.hasClass("mobile-view-activated")?(n.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=i},50)):window.location.hash=i):window.location=i}))}}}),e(document).on("click",'a[target="_blank"]',function(a){a.preventDefault();var t=e(a.currentTarget);window.open(t.attr("href")),n.stats.logEvent(t.data("ams-stats-category")||"Navigation",t.data("ams-stats-action")||"External",t.data("ams-stats-label")||t.attr("href"))}),e(document).on("click",'a[target="_top"]',function(a){a.preventDefault(),n.form.confirmChangedForm(function(){window.location=e(a.currentTarget).attr("href")})}),e(window).on("hashchange",n.skin.checkURL)),e(document).off("click.modal").on("click",'[data-toggle="modal"]',function(a){var t=e(this),s=t.data("ams-disabled-handlers");!0!==s&&"click"!==s&&"all"!==s&&!0!==t.data("ams-context-menu")&&(!0===t.data("ams-stop-propagation")&&a.stopPropagation(),a.preventDefault(),n.dialog.open(t),t.parents("#shortcut").exists()&&setTimeout(n.skin._hideShortcutButtons,300))}),e(document).on("click",'button[type="submit"], button.submit',function(){var a=e(this);e(a.get(0).form).data("ams-submit-button",a)}),e(document).on("click",'input[type="checkbox"][readonly]',function(){return!1}),e(document).on("click","[data-ams-click-handler]",function(a){var t=e(this),s=t.data("ams-disabled-handlers");if(!0!==s&&"click"!==s&&"all"!==s){var i=t.data();if(i.amsClickHandler){!0!==i.amsStopPropagation&&!0!==i.amsClickStopPropagation||a.stopPropagation(),!0!==i.amsClickKeepDefault&&a.preventDefault();for(var r=i.amsClickHandler.split(/\s+/),o=0;o<r.length;o++){var c=n.getFunctionByName(r[o]);void 0!==c&&c.call(t,a,i.amsClickHandlerOptions)}}}}),e(document).on("change","[data-ams-change-handler]",function(a){var t=e(this);if(!t.prop("readonly")){var s=t.data("ams-disabled-handlers");if(!0!==s&&"change"!==s&&"all"!==s){var i=t.data();if(i.amsChangeHandler){!0!==i.amsStopPropagation&&!0!==i.amsChangeStopPropagation||a.stopPropagation(),!0!==i.amsChangeKeepDefault&&a.preventDefault();for(var r=i.amsChangeHandler.split(/\s+/),o=0;o<r.length;o++){var c=n.getFunctionByName(r[o]);void 0!==c&&c.call(t,a,i.amsChangeHandlerOptions)}}}}}),e(document).on("keydown","textarea",function(a){10!==a.keyCode&&13!==a.keyCode||!a.ctrlKey&&!a.metaKey||e(this).closest("form").submit()}),e(document).on("reset","form",function(a){var t=e(this);setTimeout(function(){e(".alert-danger, SPAN.state-error",t).not(".persistent").remove(),e("LABEL.state-error",t).removeClass("state-error"),e('INPUT.select2[type="hidden"]',t).each(function(){var a=e(this),t=a.data("select2"),n=a.data("ams-select2-input-value");n&&a.select2("val",n.split(t.opts.separator))}),t.find(".select2").trigger("change"),e("[data-ams-reset-callback]",t).each(function(){var a=e(this),s=a.data(),i=n.getFunctionByName(s.amsResetCallback);void 0!==i&&i.call(t,a,s.amsResetCallbackOptions)})},10),n.form.setFocus(t)}),e(document).on("reset","[data-ams-reset-handler]",function(a){var t=e(this),s=t.data();if(s.amsResetHandler){!0!==s.amsResetKeepDefault&&a.preventDefault();var i=n.getFunctionByName(s.amsResetHandler);void 0!==i&&i.call(t,s.amsResetHandlerOptions)}}),e(document).on("click","[data-ams-click-event]",function(a){var t=e(this);e(a.target).trigger(t.data("ams-click-event"),t.data("ams-click-event-options"))}),e(document).on("change",'input[type="file"]',function(a){a.preventDefault();var t=e(this),n=t.parent(".button");n.exists()&&n.parent().hasClass("input-file")&&n.next('input[type="text"]').val(t.val())}),e(document).on("focus",'input[readonly="readonly"]',function(){e(this).blur()}),e(document).on("focusin",function(a){e(a.target).closest(".mce-window").length&&a.stopImmediatePropagation()}),e(document).on("click",".nav-tabs a[data-toggle=tab]",function(a){if(e(this).parent("li").hasClass("disabled"))return a.preventDefault(),!1}),e(document).on("show.bs.dropdown",".btn-group",function(){var a=e(this),t=a.children(".dropdown-menu"),n=a.get(0).getBoundingClientRect(),s=n.top,i=n.height,r=t.outerHeight();s>r&&e(window).height()-s<i+r&&a.addClass("dropup")}).on("hidden.bs.dropdown",".btn-group",function(){e(this).removeClass("dropup")}),e(document).on("show.bs.tab",function(a){var t=e(a.target);t.exists()&&"A"!==t.get(0).tagName&&(t=e("a[href]",t));var s=t.data();if(s&&s.amsUrl){if(s.amsTabLoaded)return;t.append('<i class="fa fa-spin fa-cog margin-left-5"></i>'),n.skin.loadURL(s.amsUrl,t.attr("href"),{afterLoadCallback:function(){s.amsTabLoadOnce&&t.data("ams-tab-loaded",!0),e("i",t).remove()},afterErrorCallback:function(){e("i",t).remove()}})}}),e(document).on("hide.bs.modal",function(a){var t=e(a.target);n.form.confirmChangedForm(t,function(){return t.data("modal").isShown=!0,!0},function(){return a.preventDefault(),!1})}),e(document).on("myams.refresh",function(e,a){t.executeFunctionByName(a.handler||t.skin.refreshContent,e.target,a)}),n.initContent(document),n.ajaxNav&&o.exists()&&n.skin.checkURL(),n.form.setFocus(document),e(window).on("beforeunload",n.form.checkBeforeUnload)},t.initContent=function(a){e(".tipsy").remove(),e("[rel=tooltip]",a).tooltip(),e("[rel=popover]",a).popover(),e("[rel=popover-hover]",a).popover({trigger:"hover"}),n.plugins.init(a),n.callbacks.init(a),n.events.init(a),n.form.init(a),"desktop"===n.device?n.skin._initDesktopWidgets(a):n.skin._initMobileWidgets(a),n.skin._setPageHeight()},t.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",LOADING:"Loading...",PROGRESS:"Processing",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",CLIPBOARD_CHARACTER_COPY_OK:"Character copied to clipboard",CLIPBOARD_TEXT_COPY_OK:"Text copied to clipboard",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"},t.plugins.i18n={widgets:{},validate:{},datatables:{},fancybox:{ERROR:"Can't load requested content.",RETRY:"Please check URL or try again later.",CLOSE:"Close",NEXT:"Next",PREVIOUS:"Previous"},dndupload:{FILES_SELECTED:"{count} files selected",CHOOSE_FILE:"Select file(s)",ADD_INFO:"to add them to current folder,",DRAG_FILE:"or drag and drop them here!",UPLOAD:"Upload",UPLOADING:"Uploading&hellip;",DONE:"Done!",UPLOAD_MORE:"Upload more?",ERROR:"Error!",TRY_AGAIN:"Try again?"}},e(document).ready(function(){var a=(e=jQuery.noConflict())("HTML");a.removeClass("no-js").addClass("js");var n=a.attr("lang")||a.attr("xml:lang");n&&!n.startsWith("en")?(t.lang=n,t.getScript(t.baseURL+"i18n/myams_"+n.substr(0,2)+t.devext+".js",function(){t.initPage()})):t.initPage()})}(jQuery,this);
+"use strict";!function(o,a){var e=a.console;String.prototype.startsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(0,t)===e},String.prototype.endsWith=function(e){var a=this.length,t=e.length;return!(a<t)&&this.substr(a-t)===e},String.prototype.unserialize=function(e){for(var a=decodeURIComponent(this).split("&"),t={},n=0;n<a.length;n++){var s=a[n].split("=",2);t[s[0]]=s[1]}return t},Array.prototype.indexOf||(Array.prototype.indexOf=function(e,a){var t=this.length;for((a=(a=Number(a)||0)<0?Math.ceil(a):Math.floor(a))<0&&(a+=t);a<t;a++)if(a in this&&this[a]===e)return a;return-1}),o.expr[":"].hasvalue=function(e,a,t){return""!==o(e).val()},o.expr[":"].econtains=function(e,a,t){return(e.textContent||e.innerText||o(e).text()||"").toLowerCase()===t[3].toLowerCase()},o.expr[":"].withtext=function(e,a,t){return(e.textContent||e.innerText||o(e).text()||"")===t[3]},o.expr[":"].parents=function(e,a,t){return 0<o(e).parents(t[3]).length},void 0===o.scrollbarWidth&&(o.scrollbarWidth=function(){var e=o('<div style="width: 50px; height: 50px; overflow: auto"><div/></div>').appendTo("body"),a=e.children(),t=a.innerWidth()-a.height(99).innerWidth();return e.remove(),t}),o.fn.extend({exists:function(){return 0<o(this).length},objectOrParentWithClass:function(e){return this.hasClass(e)?this:this.parents("."+e)},listattr:function(e){var a=[];return this.each(function(){a.push(o(this).attr(e))}),a},style:function(e,a,t){if(void 0!==this.get(0)){var n=this.get(0).style;return void 0!==e?void 0!==a?(t=void 0!==t?t:"",n.setProperty(e,a,t),this):n.getPropertyValue(e):n}},removeClassPrefix:function(n){return this.each(function(e,a){var t=a.className.split(" ").map(function(e){return e.startsWith(n)?"":e});a.className=o.trim(t.join(" "))}),this}}),void 0===a.MyAMS&&(a.MyAMS={devmode:!0,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:!0,safeMethods:["GET","HEAD","OPTIONS","TRACE"],csrfCookieName:"csrf_token",csrfHeaderName:"X-CSRF-Token",enableWidgets:!0,enableMobile:!1,enableFastclick:!1,warnOnFormChange:!1,ismobile:/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())});var t,n=a.MyAMS,c=n;n.baseURL=(t=o('script[src*="/myams.js"], script[src*="/myams.min.js"]').attr("src"),c.devmode=t.indexOf(".min.js")<0,c.devext=c.devmode?"":".min",t.substring(0,t.lastIndexOf("/")+1)),n.log=function(){e&&e.debug&&e.debug(this,arguments)},n.getQueryVar=function(e,a){if(e.indexOf("?")<0)return!1;e.endsWith("&")||(e+="&");var t=new RegExp(".*?[&\\?]"+a+"=(.*?)&.*"),n=e.replace(t,"$1");return n!==e&&n},n.rgb2hex=function(e){return"#"+o.map(e.match(/\b(\d+)\b/g),function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},n.generateId=function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+e()+e()},n.generateUUID=function(){var t=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var a=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?a:3&a|8).toString(16)})},n.getObject=function(e,a){if(e){if("string"!=typeof e)return e;var t=e.split(".");a=null==a?window:a;for(var n=0;n<t.length;n++)try{a=a[t[n]]}catch(e){return}return a}},n.getFunctionByName=function(e,a){if(void 0!==e){if("function"==typeof e)return e;var t=e.split("."),n=t.pop();a=null==a?window:a;for(var s=0;s<t.length;s++)try{a=a[t[s]]}catch(e){return}try{return a[n]}catch(e){return}}},n.executeFunctionByName=function(e,a){var t=c.getFunctionByName(e,window);if("function"==typeof t){var n=Array.prototype.slice.call(arguments,2);return t.apply(a,n)}},n.isInDOM=function(e){return!!(e=o(e)).exists()&&a.document.body.contains(e[0])},n.getSource=function(e){return e.replace(/{[^{}]*}/g,function(e){return c.getFunctionByName(e.substr(1,e.length-2))})},n.getScript=function(e,a,t){"object"==typeof a&&(t=a,a=null),void 0===t&&(t={});var n={dataType:"script",url:c.getSource(e),success:a,error:c.error.show,cache:!c.devmode,async:void 0===t.async?"function"==typeof a:t.async},s=o.extend({},n,t);return o.ajax(s)},n.getCSS=function(e,a,t,n){t&&(t=c.getFunctionByName(t));var s=o("HEAD"),i=o('style[data-ams-id="'+a+'"]',s);if(0===i.length){if(i=o("<style>").attr("data-ams-id",a).text('@import "'+c.getSource(e)+'";'),t)var r=setInterval(function(){try{i[0].sheet.cssRules;t.call(window,!0,n),clearInterval(r)}catch(e){}},10);i.appendTo(s)}else t&&t.call(window,!1,n)}}(jQuery,this),jQuery.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");for(var a="",t=0;t<e.length;t++){var n=e.charCodeAt(t);n<128?a+=String.fromCharCode(n):(127<n&&n<2048?a+=String.fromCharCode(n>>6|192):(a+=String.fromCharCode(n>>12|224),a+=String.fromCharCode(n>>6&63|128)),a+=String.fromCharCode(63&n|128))}return a},decode:function(e){for(var a="",t=0,n=0,s=0,i=0;t<e.length;)(n=e.charCodeAt(t))<128?(a+=String.fromCharCode(n),t++):191<n&&n<224?(s=e.charCodeAt(t+1),a+=String.fromCharCode((31&n)<<6|63&s),t+=2):(s=e.charCodeAt(t+1),i=e.charCodeAt(t+2),a+=String.fromCharCode((15&n)<<12|(63&s)<<6|63&i),t+=3);return a}},function(c,e){var n=e.MyAMS;c.fn.extend({contextMenu:function(r){function a(e,a,t){var n=c(window)[a](),s=c(r.menuSelector)[a](),i=e;return n<e+s&&s<e&&(i-=s),i}return this.each(function(){c("a",c(r.menuSelector)).each(function(){c(this).data("ams-context-menu",!0)}),c(this).on("contextmenu",function(e){if(!e.ctrlKey)return c(r.menuSelector).data("invokedOn",c(e.target)).show().css({position:"fixed",left:a(e.clientX,"width")-10,top:a(e.clientY,"height")-10}).off("click").on("click",function(e){c(this).hide();var a=c(this).data("invokedOn"),t=c(e.target);r.menuSelected.call(this,a,t),n.event.stop(e)}),!1}),c(document).click(function(){c(r.menuSelector).hide()})})},myams_menu:function(e){var o=c.extend({},{accordion:!0,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'},e),t=c(this);t.find("LI").each(function(){var e=c(this);if(0<e.find("UL").size()){e.find("A:first").append("<b class='collapse-sign'>"+o.closedSign+"</b>");var a=e.find("A:first");"#"===a.attr("href")&&a.click(function(){return!1})}}),t.find("LI.active").each(function(){var e=c(this).parents("UL"),a=e.parent("LI");e.slideDown(o.speed),a.find("b:first").html(o.openedSign),a.addClass("open")}),t.find("LI A").on("click",function(){var e=c(this);if(!e.hasClass("active")){var n=e.attr("href").replace(/^#/,""),s=e.parent().find("UL");if(o.accordion){var i=e.parent().parents("UL"),r=t.find("UL:visible");r.each(function(a){var t=!0;if(i.each(function(e){if(i[e]===r[a])return t=!1}),t&&s!==r[a]){var e=c(r[a]);!n&&e.hasClass("active")||e.slideUp(o.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(o.speed).html(o.closedSign)})}})}var a=e.parent().find("UL:first");n||!a.is(":visible")||a.hasClass("active")?a.slideDown(o.speed,function(){e.parent("LI").addClass("open").find("B:first").delay(o.speed).html(o.openedSign)}):a.slideUp(o.speed,function(){e.parent("LI").removeClass("open").find("B:first").delay(o.speed).html(o.closedSign)})}})}})}(jQuery,this),function(e,a){var t=a.MyAMS;t.event={stop:function(e){e||(e=window.event),e&&"string"!=typeof e&&(e.stopPropagation?(e.stopPropagation(),e.preventDefault()):(e.cancelBubble=!0,e.returnValue=!1))}}}(jQuery,this),function(n,s){var i=s.MyAMS,r=i;i.browser={getInternetExplorerVersion:function(){var e=-1;if("Microsoft Internet Explorer"===navigator.appName){var a=navigator.userAgent;null!==new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(a)&&(e=parseFloat(RegExp.$1))}return e},checkVersion:function(){var e="You're not using Windows Internet Explorer.",a=this.getInternetExplorerVersion();-1<a&&(e=8<=a?"You're using a recent copy of Windows Internet Explorer.":"You should upgrade your copy of Windows Internet Explorer."),s.alert&&s.alert(e)},isIE8orlower:function(){var e="0",a=this.getInternetExplorerVersion();return-1<a&&(e=9<=a?0:1),e},copyToClipboard:function(e){function t(e){var a=!1;if(window.clipboardData&&window.clipboardData.setData)a=clipboardData.setData("Text",e);else if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var t=n("<textarea>");t.val(e),t.css("position","fixed"),t.appendTo(n("body")),t.get(0).select();try{document.execCommand("copy"),a=!0}catch(e){console&&console.warn&&console.warn("Copy to clipboard failed.",e)}finally{t.remove()}}a?r.skin.smallBox("success",{title:1<e.length?r.i18n.CLIPBOARD_TEXT_COPY_OK:r.i18n.CLIPBOARD_CHARACTER_COPY_OK,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):s.prompt&&s.prompt(i.i18n.CLIPBOARD_COPY,e)}if(void 0===e)return function(){var e=n(this),a=e.text();e.parents(".btn-group").removeClass("open"),t(a)};t(e)}}}(jQuery,this),function(e,a){var t=a.MyAMS,r=t;t.error={ajax:function(e,a,t,n){if(!("abort"===n||a&&a.statusText&&"OK"===a.statusText.toUpperCase())){if("json"===(a=r.ajax.getResponse(a)).contentType)r.ajax.handleJSON(a.data);else{var s=n||e.statusText||e.type,i=a.responseText;r.skin.messageBox("error",{title:r.i18n.ERROR_OCCURED,content:"<h4>"+s+"</h4><p>"+(i||"")+"</p>",icon:"fa fa-warning animated shake",timeout:1e4})}console&&(console.error&&console.error(e),console.debug&&console.debug(a))}},show:function(e,a,t){if(t){var n=r.ajax.getResponse(e);"json"===n.contentType?r.ajax.handleJSON(n.data):r.skin.messageBox("error",{title:r.i18n.ERRORS_OCCURED,content:"<h4>"+a+"</h4><p>"+t+"</p>",icon:"fa fa-warning animated shake",timeout:1e4}),console&&(console.error&&console.error(t),console.debug&&console.debug(e))}}}}(jQuery,this),function(h,p){var e=p.MyAMS,g=e;e.ajax={check:function(e,a,s,t){function n(e,a){if(void 0!==s){s instanceof Array||(s=[s]);for(var t=0;t<s.length;t++){var n=g.getFunctionByName(s[t]);"function"==typeof n&&n(e,a)}}}s instanceof Array||"object"==typeof s&&(t=s,s=void 0);var i={async:"function"==typeof s},r=h.extend({},i,t);if(e instanceof Array){for(var o=[],c=0;c<e.length;c++)void 0===e[c]&&o.push(g.getScript(a[c],{async:!0}));0<o.length?h.when.apply(h,o).then(function(){n(!0,t)}):n(!1,t)}else void 0===e?"string"==typeof a&&g.getScript(a,function(){n(!0,t)},r):n(!1,t)},getAddr:function(e){var a=e||h("HTML HEAD BASE").attr("href")||window.location.href;return a.substr(0,a.lastIndexOf("/")+1)},start:function(){h("#ajax-gear").show()},stop:function(){h("#ajax-gear").hide()},progress:function(e){e.lengthComputable&&(e.loaded>=e.total||console&&console.log&&console.log(parseInt(e.loaded/e.total*100,10)+"%"))},getJSON:function(){return function(e){var a=e.url;delete e.url,g.ajax.post(a,e,function(e,a,t){g.ajax.handleJSON(e)})}},post:function(e,a,t,n){var s,i;s=e.startsWith(window.location.protocol)?e:this.getAddr()+e,"function"==typeof t?(n=t,t={}):t||(t={}),void 0===n&&(n=t.callback),"string"==typeof n&&(n=g.getFunctionByName(n)),delete t.callback;var r={url:s,type:"post",cache:!1,async:"function"==typeof n,data:h.param(a),dataType:"json",beforeSend:function(e,a){if(void 0!==p.Cookies){var t=Cookies.get(g.csrfCookieName);t&&e.setRequestHeader(g.csrfHeaderName,t)}},success:n||function(e){i=e.result}},o=h.extend({},r,t);return h.ajax(o),i},getResponse:function(a){var t,n,e=a.getResponseHeader("content-type");if(e)if(e.startsWith("application/javascript"))t="script",n=a.responseText;else if(e.startsWith("text/html"))t="html",n=a.responseText;else if(e.startsWith("text/xml"))t="xml",n=a.responseText;else if(n=a.responseJSON)t="json";else try{n=JSON.parse(a.responseText),t="json"}catch(e){n=a.responseText,t="text"}else t="json",n={status:"alert",alert:{title:g.i18n.ERROR_OCCURED,content:g.i18n.NO_SERVER_RESPONSE}};return{contentType:t,data:n}},handleJSON:function(e,a,t){var n,s,i,r,o,c,l,d=e.status;switch(d){case"alert":p.alert&&p.alert(e.alert.title+"\n\n"+e.alert.content);break;case"error":g.form.showErrors(a,e);break;case"info":case"success":void 0!==a&&(g.form.resetChanged(a),!1!==e.close_form&&g.dialog.close(a));break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":void 0!==a&&(g.form.resetChanged(a),!1!==e.close_form&&g.dialog.close(a));break;case"modal":g.dialog.open(e.location);break;case"reload":void 0!==a&&(g.form.resetChanged(a),!1!==e.close_form&&g.dialog.close(a)),(n=e.location||window.location.hash).startsWith("#")&&(n=n.substr(1));var m=h(e.target||t||"#content");g.skin.loadURL(n,m,{preLoadCallback:g.getFunctionByName(e.pre_reload)||function(){h("[data-ams-pre-reload]",m).each(function(){g.executeFunctionByName(h(this).data("ams-pre-reload"))})},preLoadCallbackOptions:e.pre_reload_options,afterLoadCallback:g.getFunctionByName(e.post_reload)||function(){h("[data-ams-post-reload]",m).each(function(){g.executeFunctionByName(h(this).data("ams-post-reload"))})},afterLoadCallbackOptions:e.post_reload_options});break;case"redirect":void 0!==a&&(g.form.resetChanged(a),!0===e.close_form&&g.dialog.close(a)),(n=e.location||window.location.href).endsWith("##")&&(n=n.replace(/##/,window.location.hash)),e.window?window.open(n,e.window,e.options):window.location.href===n?window.location.reload(!0):window.location.href=n;break;default:console&&console.log&&console.log("Unhandled status: "+d)}if(e.content&&(i=e.content,r=h(i.target||t||a||"#content"),!0===i.raw?r.text(i.text):(r.html(i.html),g.initContent(r)),i.keep_hidden||r.removeClass("hidden")),e.contents){var u=e.contents;for(s=0;s<u.length;s++)i=u[s],r=h(i.target),!0===i.raw?r.text(i.text):(r.html(i.html),g.initContent(r)),i.keep_hidden||r.removeClass("hidden")}if(e.message&&("string"==typeof(o=e.message)?"info"===d||"success"===d?g.skin.smallBox(d,{title:o,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3e3}):g.skin.alert(h(a||"#content"),d,o):g.skin.alert(h(o.target||t||a||"#content"),o.status||"success",o.header,o.body,o.subtitle)),e.smallbox&&("string"==typeof(o=e.smallbox)?g.skin.smallBox(e.smallbox_status||d,{title:e.smallbox,icon:e.smallbox_icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:e.smallbox_timeout||3e3}):g.skin.smallBox(o.status||d,{title:o.message,icon:o.icon||"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:o.timeout||3e3})),e.messagebox)if("string"==typeof(o=e.messagebox))g.skin.messageBox("info",{title:g.i18n.ERROR_OCCURED,content:o,timeout:1e4});else{var f=o.status||"info";"error"===f&&a&&t&&g.executeFunctionByName(a.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",a,t),g.skin.messageBox(f,{title:o.title||g.i18n.ERROR_OCCURED,content:o.content,icon:o.icon,number:o.number,timeout:null===o.timeout?void 0:o.timeout||1e4})}if(e.event&&a.trigger(e.event,e.event_options),e.events)for(void 0===a&&(a=h(document)),s=0;s<e.events.length;s++)null!==(c=e.events[s])&&("string"==typeof c?a.trigger(c,e.events_options):a.trigger(c.event,c.options));if(e.callback&&g.executeFunctionByName(e.callback,a,e.options),e.callbacks)for(s=0;s<e.callbacks.length;s++)"function"==typeof(l=e.callbacks[s])?g.executeFunctionByName(l,a,l.options):g.executeFunctionByName(l.callback,a,l.options)}}}(jQuery,this),function(c,e){var a=e.MyAMS,l=a;a.jsonrpc={getAddr:function(e){var a=(e||c("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return a.substr(0,a.lastIndexOf("/")+1)},query:function(s,i,r,o){l.ajax.check(c.jsonRPC,l.baseURL+"ext/jquery-jsonrpc"+l.devext+".js",function(){"function"==typeof r?(o=r,r={}):r||(r={}),"undefined"===o&&(o=r.callback),"string"==typeof o&&(o=l.getFunctionByName(o)),delete r.callback;var a,e={};"string"==typeof s?e.query=s:"object"==typeof s&&c.extend(e,s),c.extend(e,r);var t={id:(new Date).getTime(),params:e,success:o||function(e){a=e},error:l.error.show},n=c.extend({},t,r);return c.jsonRPC.withOptions({endPoint:l.jsonrpc.getAddr(r.url),namespace:r.namespace,cache:!1},function(){c.jsonRPC.request(i,n)}),a})},post:function(n,s,i,r){l.ajax.check(c.jsonRPC,l.baseURL+"ext/jquery-jsonrpc"+l.devext+".js",function(){var a;"function"==typeof i?(r=i,i={}):i||(i={}),void 0===r&&(r=i.callback),"string"==typeof r&&(r=l.getFunctionByName(r)),delete i.callback;var e={id:(new Date).getTime(),params:s,success:r||function(e){a=e},error:l.error.show},t=c.extend({},e,i);return c.jsonRPC.withOptions({endPoint:l.jsonrpc.getAddr(i.url),namespace:i.namespace,cache:!1},function(){c.jsonRPC.request(n,t)}),a})}}}(jQuery,this),function(c,e){var a=e.MyAMS,l=a;a.xmlrpc={getAddr:function(e){var a=(e||c("HTML HEAD BASE").attr("href")||window.location.href).replace(/\+\+skin\+\+\w+\//,"");return a.substr(0,a.lastIndexOf("/")+1)},post:function(n,s,i,r,o){l.ajax.check(c.xmlrpc,l.baseURL+"ext/jquery-xmlrpc"+l.devext+".js",function(){var a;"function"==typeof r?(o=r,r={}):r||(r={}),void 0===o&&(o=r.callback),"string"==typeof o&&(o=l.getFunctionByName(o)),delete r.callback;var e={url:l.xmlrpc.getAddr(n),methodName:s,params:i,success:o||function(e){a=e},error:l.error.show},t=c.extend({},e,r);return c.xmlrpc(t),a})}}}(jQuery,this),function(F,j){var e=j.MyAMS,R=e;e.form={init:function(e){F("FORM",e).each(function(){var e=F(this);F('INPUT.select2[type="hidden"]',e).each(function(){var e=F(this);e.data("ams-select2-input-value",e.val())})}),(R.warnOnFormChange?F('FORM[data-ams-warn-on-change!="false"]',e):F('FORM[data-ams-warn-on-change="true"]',e)).each(function(){var e=F(this);F('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',e).each(function(){var e=F(this);if(!0!==e.data("ams-ignore-change")){var a=e.data("ams-changed-event")||"change";e.on(a,function(){R.form.setChanged(F(this).parents("FORM"))})}}),e.on("reset",function(){R.form.resetChanged(F(this))})})},setFocus:function(e){var a=F("[data-ams-focus-target]",e).first();a.exists()||(a=F("input, select",e).first()),a.exists()&&(a.hasClass("select2-input")&&(a=a.parents(".select2")),a.hasClass("select2")?setTimeout(function(){a.select2("focus"),!0===a.data("ams-focus-open")&&a.select2("open")},100):a.focus())},checkBeforeUnload:function(){if(F('FORM[data-ams-form-changed="true"]').exists())return R.i18n.FORM_CHANGED_WARNING},confirmChangedForm:function(a,t,e){"function"==typeof a&&(t=a,a=void 0),F('FORM[data-ams-form-changed="true"]',a).exists()?e?j.confirm(R.i18n.FORM_CHANGED_WARNING,R.i18n.WARNING)?t.call(a):e.call(a):R.skin.bigBox({title:R.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+R.i18n.FORM_CHANGED_WARNING,buttons:R.i18n.BTN_OK_CANCEL},function(e){e===R.i18n.BTN_OK&&t.call(a)}):t.call(a)},setChanged:function(e){e.attr("data-ams-form-changed",!0)},resetChanged:function(e){void 0!==e&&F(e).removeAttr("data-ams-form-changed")},submit:function(t,T,N){if(!(t=F(t)).exists())return!1;if("object"==typeof T&&(N=T,T=void 0),t.data("submitted"))return t.data("ams-form-hide-submitted")||R.skin.messageBox("warning",{title:R.i18n.WAIT,content:R.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:t.data("ams-form-alert-timeout")||5e3}),!1;if(!R.form._checkSubmitValidators(t))return!1;F(".alert-danger, SPAN.state-error",t).not(".persistent").remove(),F(".state-error",t).removeClassPrefix("state-");var e=F(t.data("ams-submit-button"));return e&&!e.data("ams-form-hide-loading")&&(e.data("ams-progress-content",e.html()),e.button("loading")),R.ajax.check(F.fn.ajaxSubmit,R.baseURL+"ext/jquery-form-3.49"+R.devext+".js",function(){function e(s,e){var i,a,t,n,r,o,c,l,d,m,u=s.data(),f=u.amsFormOptions;if(N&&(r=N.formDataInitCallback),r?delete N.formDataInitCallback:r=u.amsFormDataInitCallback,r){var h={};if(n=R.executeFunctionByName(r,s,h),h.veto)return(i=s.data("ams-submit-button"))&&i.button("reset"),R.form.finalizeSubmitFooter.call(s),!1}else n=u.amsFormData||{};(i=F(s.data("ams-submit-button")))&&i.exists()?t=(a=i.data()).amsFormSubmitTarget:a={};var p=T||a.amsFormHandler||u.amsFormHandler||"";if(p.startsWith(window.location.protocol))m=p;else{var g=a.amsFormAction||s.attr("action").replace(/#/,"");m=g.startsWith(window.location.protocol)?g:R.ajax.getAddr()+g,m+=p}o=a.amsProgressHandler||u.amsProgressHandler||"",c=a.amsProgressInterval||u.amsProgressInterval||1e3,l=a.amsProgressCallback||u.amsProgressCallback,d=a.amsProgressEndCallback||u.amsProgressEndCallback;var b,v=null;N&&N.initSubmitTarget?R.executeFunctionByName(N.initSubmitTarget,s):u.amsFormInitSubmitTarget?(v=F(t||u.amsFormSubmitTarget||"#content"),R.executeFunctionByName(u.amsFormInitSubmit||"MyAMS.form.initSubmit",s,v)):u.amsFormHideSubmitFooter||R.executeFunctionByName(u.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",s),N&&(n=F.extend({},n,N.form_data)),o?n.progress_id=R.generateUUID():(b=void 0!==e.uuid)&&(m.indexOf("X-Progress-ID")<0&&(m+="?X-Progress-ID="+e.uuid),delete e.uuid);var y={url:m,type:"post",cache:!1,data:n,dataType:u.amsFormDatatype,beforeSerialize:function(){void 0!==j.tinyMCE&&j.tinyMCE.triggerSave()},beforeSubmit:function(e,a){a.data("submitted",!0)},error:function(e,a,t,n){v&&R.executeFunctionByName(u.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",n,v),R.form.resetAfterSubmit(n)},iframe:b},x=N&&N.downloadTarget||u.amsFormDownloadTarget;if(x){var C=F('iframe[name="'+x+'"]');C.exists()||(C=F("<iframe></iframe>").hide().attr("name",x).appendTo(F("body"))),y=F.extend({},y,{iframe:!0,iframeTarget:C,success:function(e,a,t,n){if(F(n).parents(".modal-dialog").exists())R.dialog.close(n);else{var s,i=n.data("ams-submit-button");i&&(s=i.data("ams-form-submit-callback")),s||(s=R.getFunctionByName(u.amsFormSubmitCallback)||R.form._submitCallback);try{s.call(n,e,a,t,n)}finally{R.form.resetAfterSubmit(n),R.form.resetChanged(n)}}}})}else y=F.extend({},y,{error:function(e,a,t,n){v&&R.executeFunctionByName(u.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",n,v),R.form.resetAfterSubmit(n)},success:function(e,a,t,n){var s,i=n.data("ams-submit-button");i&&(s=i.data("ams-form-submit-callback")),s||(s=R.getFunctionByName(u.amsFormSubmitCallback)||R.form._submitCallback);try{s.call(n,e,a,t,n)}finally{R.form.resetAfterSubmit(n),R.form.resetChanged(n)}},iframe:b});var k=F.extend({},y,e,f,N);if(o&&function(e,a){var t;function n(){clearInterval(t),R.form.resetAfterSubmit(s,i),i.html(i.data("ams-progress-content")),R.executeFunctionByName(d,s,i),R.form.resetChanged(s)}i.button("loading"),t=setInterval(function(){R.ajax.post(e,{progress_id:a},{error:n},R.getFunctionByName(l)||function(e,a){if("success"===a)if("running"===e.status)if(e.message)i.text(e.message);else{var t=i.data("ams-progress-text")||R.i18n.PROGRESS;e.current?t+=": "+e.current+"/ "+(e.length||100):t+="...",i.text(t)}else"finished"===e.status&&n();else n()})},c)}(o,n.progress_id),F(s).ajaxSubmit(k),x){var S=F(s).parents(".modal-dialog"),w=S.exists()&&i.exists()&&i.data("ams-keep-modal");S.exists()&&!0!==w?R.dialog.close(s):o||setTimeout(function(){R.form.resetAfterSubmit(s,i),R.form.resetChanged(s)},i.data("ams-form-reset-timeout")||2e3)}}if(!0!==t.data("ams-form-ignore-uploads")&&0<F('INPUT[type="file"]',t).length){R.ajax.check(F.progressBar,R.baseURL+"ext/jquery-progressbar"+R.devext+".js");var a=F.extend({},{uuid:F.progressBar.submit(t)});e(t,a)}else e(t,{})}),!1},initSubmit:function(e,a){var t=F(this),n='<i class="fa fa-3x fa-gear fa-spin"></i>';a||(a=t.data("ams-form-submit-message")),a&&(n+="<strong>"+a+"</strong>"),F(e).html('<div class="row margin-20"><div class="text-center">'+n+"</div></div>"),F(e).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(e){if(e.is(":visible")){var a=e.data("ams-submit-button");a&&a.button("reset"),R.form.finalizeSubmitFooter.call(e)}e.data("submitted",!1),e.removeData("ams-submit-button")},finalizeSubmitOnError:function(e){F("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(e){var a=F(this),t='<i class="fa fa-3x fa-gear fa-spin"></i>';e||(e=F(this).data("ams-form-submit-message")),e&&(t+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+e+"</strong>");var n=F("footer",a);F("button",n).hide(),n.append('<div class="row"><div class="text-center">'+t+"</div></div>")},finalizeSubmitFooter:function(){var e=F(this),a=F("footer",e);a&&(F(".row",a).remove(),F("button",a).show())},_submitCallback:function(e,a,t,n){var s;n.is(":visible")&&(R.form.finalizeSubmitFooter.call(n),(s=n.data("ams-submit-button"))&&s.button("reset"));var i,r,o=n.data();if(o.amsFormDatatype)i=o.amsFormDatatype;else{var c=R.ajax.getResponse(t);i=c.contentType,e=c.data}switch(r=F(s?s.data("ams-form-submit-target")||o.amsFormSubmitTarget||"#content":o.amsFormSubmitTarget||"#content"),i){case"json":R.ajax.handleJSON(e,n,r);break;case"script":case"xml":break;case"html":case"text":default:R.form.resetChanged(n),s&&!0!==s.data("ams-keep-modal")&&R.dialog.close(n),r.exists()||(r=F("body")),r.parents(".hidden").removeClass("hidden"),F(".alert",r.parents(".alerts-container")).remove(),r.css({opacity:"0.0"}).html(e).delay(50).animate({opacity:"1.0"},300),R.initContent(r),R.form.setFocus(r)}var l=t.getResponseHeader("X-AMS-Callback");if(l){var d=t.getResponseHeader("X-AMS-Callback-Options");R.executeFunctionByName(l,n,void 0===d?{}:JSON.parse(d),t)}},_getSubmitValidators:function(e){var a=[],t=e.data("ams-form-validator");return t&&a.push([e,t]),F("[data-ams-form-validator]",e).each(function(){var e=F(this);a.push([e,e.data("ams-form-validator")])}),a},_checkSubmitValidators:function(e){var a=R.form._getSubmitValidators(e);if(!a.length)return!0;for(var t=[],n=!0,s=0;s<a.length;s++){var i=a[s],r=i[0],o=i[1],c=R.executeFunctionByName(o,e,r);!1===c?n=!1:"string"==typeof c?t.push(c):n.length&&0<n.length&&(t=t.concat(n))}if(0<t.length){var l=1===t.length?R.i18n.ERROR_OCCURED:R.i18n.ERRORS_OCCURED;return R.skin.alert(e,"danger",l,t),!1}return n},showErrors:function(e,a){var t;if("string"==typeof a)R.skin.alert(e,"error",R.i18n.ERROR_OCCURED,a);else if(a instanceof Array)t=1===a.length?R.i18n.ERROR_OCCURED:R.i18n.ERRORS_OCCURED,R.skin.alert(e,"error",t,a);else{F(".state-error",e).removeClass("state-error"),t=a.error_header||(a.widgets&&1<a.widgets.length?R.i18n.ERRORS_OCCURED:R.i18n.ERROR_OCCURED);var n,s=[];if(a.messages)for(n=0;n<a.messages.length;n++){var i=a.messages[n];i.header?s.push("<strong>"+i.header+"</strong><br />"+i.message):s.push(i.message||i)}if(a.widgets)for(n=0;n<a.widgets.length;n++){var r=a.widgets[n],o=F('[name="'+r.name+'"]',e);o.exists()||(o=F('[name="'+r.name+':list"]',e)),o.exists()?o.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+r.message+"</span>"):r.label&&s.push(r.label+" : "+r.message);var c=o.parents(".tab-pane").index()+1;if(0<c){var l=F(".nav-tabs",F(o).parents(".tabforms"));F("li:nth-child("+c+")",l).removeClassPrefix("state-").addClass("state-error"),F("li.state-error:first a",e).click()}}R.skin.alert(F(".form-group:first",e),a.error_level||"error",t,s,a.error_message)}}}}(jQuery,this),function(p,e){var a=e.MyAMS,g=a;a.dialog={_shown_callbacks:[],registerShownCallback:function(e,a){var t,n;a&&(t=a.objectOrParentWithClass("modal-dialog")),t&&t.exists()?void 0===(n=t.data("shown-callbacks"))&&(n=[],t.data("shown-callbacks",n)):n=g.dialog._shown_callbacks,n.indexOf(e)<0&&n.push(e)},_hide_callbacks:[],registerHideCallback:function(e,a){var t,n;a&&(t=a.objectOrParentWithClass("modal-dialog")),t&&t.exists()?void 0===(n=t.data("hide-callbacks"))&&(n=[],t.data("hide-callbacks",n)):n=g.dialog._hide_callbacks,n.indexOf(e)<0&&n.push(e)},open:function(f,t,h){g.ajax.check(p.fn.modalmanager,g.baseURL+"ext/bootstrap-modalmanager"+g.devext+".js",function(){g.ajax.check(p.fn.modal.defaults,g.baseURL+"ext/bootstrap-modal"+g.devext+".js",function(e){var m,u;if(e&&(p(document).off("click.modal"),p.fn.modal.defaults.spinner=p.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>'),"string"==typeof f)m={},u=f;else{m=f.data(),u=f.attr("href")||m.amsUrl;var a=g.getFunctionByName(u);"function"==typeof a&&(u=a.call(f))}u&&(p("body").modalmanager("loading"),0===u.indexOf("#")?p(u).modal("show"):p.ajax({url:u,type:"get",cache:void 0!==m.amsAllowCache&&m.amsAllowCache,data:t,success:function(e,a,t){p("body").modalmanager("removeLoading");var n=g.ajax.getResponse(t),s=n.contentType,i=n.data;switch(s){case"json":g.ajax.handleJSON(i,p(p(f).data("ams-json-target")||"#content"));break;case"script":case"xml":break;case"html":case"text":default:var r=p(i),o=p(".modal-dialog",r.wrap("<div></div>").parent()),c=o.data()||{},l={backdrop:"static",overflow:c.amsModalOverflow||".modal-viewport",maxHeight:void 0===c.amsModalMaxHeight?function(){return p(window).height()-p(".modal-header",r).outerHeight(!0)-p("footer",r).outerHeight(!0)-85}:g.getFunctionByName(c.amsModalMaxHeight)},d=p.extend({},l,c.amsModalOptions);d=g.executeFunctionByName(c.amsModalInitCallback,o,d)||d,h&&(h.shown&&g.dialog.registerShownCallback(h.shown,r),h.hide&&g.dialog.registerHideCallback(h.hide,r)),p("<div>").addClass("modal fade").append(r).modal(d).on("shown",g.dialog.shown).on("hidden",g.dialog.hidden),g.initContent(r),!1!==m.amsLogEvent&&g.stats.logPageview(u)}}}))})})},shown:function(e){function a(e){var a=p(".scrollmarker.top",s),t=s.scrollTop();0<t?a.show():a.hide();var n=p(".scrollmarker.bottom",s);i+t>=s.get(0).scrollHeight?n.hide():n.show()}var t,n=e.target,s=p(".modal-viewport",n);if(s.exists()){var i=parseInt(s.css("max-height")),r=p.scrollbarWidth();"hidden"!==s.css("overflow")&&s.height()===i?(p("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",s.width()-r).hide().appendTo(s),p("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",i-20).css("width",s.width()-r).appendTo(s),s.scroll(a),s.off("resize").on("resize",a)):p(".scrollmarker",s).remove()}p("[data-ams-shown-callback]",n).each(function(){var e=g.getFunctionByName(p(this).data("ams-shown-callback"));e&&e.call(n,this)});var o=p(".modal-dialog",n).data("shown-callbacks");if(o)for(t=0;t<o.length;t++)o[t].call(n);if(o=g.dialog._shown_callbacks)for(t=0;t<o.length;t++)o[t].call(n);g.form.setFocus(n)},close:function(e){"string"==typeof e&&(e=p(e));var a=e.parents(".modal").data("modal");if(a){var t=p("body").data("modalmanager");t&&0<=t.getOpenModals().indexOf(a)&&a.hide()}},hidden:function(e){var a,t=e.target;g.skin.cleanContainer(t),p("[data-ams-hidden-callback]",t).each(function(){var e=g.getFunctionByName(p(this).data("ams-hidden-callback"));e&&e.call(t,this)});var n=p(".modal-dialog",t).data("hide-callbacks");if(n)for(a=0;a<n.length;a++)n[a].call(t);if(n=g.dialog._hide_callbacks)for(a=0;a<n.length;a++)n[a].call(t)}}}(jQuery,this),function(i,e){var a=e.MyAMS,r=a;a.helpers={sort:function(e,t){t||(t="weight"),e.children().sort(function(e,a){return+i(e).data(t)-+i(a).data(t)}).each(function(){e.append(this)})},select2ClearSelection:function(){var e=i(this),a=e.parents("label").first(),t=e.data("ams-select2-target");i('[name="'+t+'"]',a).data("select2").val("")},select2FormatSelection:function(e,a){e instanceof Array||(e=[e]),i(e).each(function(){"object"==typeof this?a.append(this.text):a.append(this)})},select2SelectAllHelper:function(){var e=i(this),a=e.parents("label").first(),t=e.data("ams-select2-target"),n=i('[name="'+t+'"]',a);"SELECT"===n.get(0).tagName?n.select2("val",i("option",n).listattr("value")):n.select2("data",n.data("ams-select2-data"))},select2QueryUrlResultsCallback:function(e,a,t){switch(e.status){case"error":r.skin.messageBox("error",{title:r.i18n.ERROR_OCCURED,content:"<h4>"+e.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":i(this).data("select2").dropdown.hide(),r.dialog.open(e.location);break;default:return{results:e.results||e,more:e.has_more||!1,context:e.context}}},select2QueryMethodSuccessCallback:function(e,a,t){var n=e.result;if("string"==typeof n)try{n=JSON.parse(n)}catch(e){}switch(n.status){case"error":r.skin.messageBox("error",{title:r.i18n.ERROR_OCCURED,content:"<h4>"+n.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:1e4});break;case"modal":i(this).data("select2").dropdown.hide(),r.dialog.open(n.location);break;default:t.callback({results:n.results||n,more:n.has_more||!1,context:n.context})}},select2ChangeHelper:function(){var e=i(this),a=e.data(),t=i(a.amsSelect2HelperTarget);switch(a.amsSelect2HelperType){case"html":t.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>');var n={};n[a.amsSelect2HelperArgument||"value"]=e.val(),i.get(a.amsSelect2HelperUrl,n,r.getFunctionByName(a.amsSelect2HelperCallback)||function(e){e?(t.html(e),r.initContent(t)):t.empty()}).fail(function(){t.empty()});break;case"json-rpc":t.html('<div class="text-center"><i class="fa fa-2x fa-gear fa-spin"></i></div>'),r.jsonrpc.post(a.amsSelect2HelperMethod,{value:e.val()},{url:a.amsSelect2HelperUrl},r.getFunctionByName(a.amsSelect2HelperCallback)||function(e){e.result?(t.html(e.result),r.initContent(t)):t.empty()});break;default:var s=a.amsSelect2HelperCallback;s&&r.executeFunctionByName(s,e,a)}},contextMenuHandler:function(e,a){"A"!==a.get(0).tagName&&(a=a.parents("a").first());var t=a.data();if("modal"===t.toggle)r.dialog.open(a);else{var n=a.attr("href")||t.amsUrl;if(!n||n.startsWith("javascript")||a.attr("target"))return;r.event.stop();var s=r.getFunctionByName(n);"function"==typeof s&&(n=s.call(a,e)),"function"==typeof n?n.call(a,e):(n=n.replace(/\%23/,"#"),(e=a.data("ams-target"))?r.form.confirmChangedForm(e,function(){r.skin.loadURL(n,e,a.data("ams-link-options"),a.data("ams-link-callback"))}):r.form.confirmChangedForm(function(){n.startsWith("#")?n!==location.hash&&(r.root.hasClass("mobile-view-activated")?(r.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=n},150)):window.location.hash=n):window.location=n}))}},datetimepickerDialogHiddenCallback:function(){i(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")},clearSearchTarget:function(){var e=i(this);if(!e.val()){var a=i(e).parents("form").first();i(a.data("ams-form-submit-target")).empty()}},setSEOStatus:function(){var e=i(this),a=e.siblings(".progress").children(".progress-bar"),t=Math.min(e.val().length,100),n="success";t<20||80<t?n="danger":(t<40||66<t)&&(n="warning"),a.removeClassPrefix("progress-bar").addClass("progress-bar").addClass("progress-bar-"+n).css("width",t+"%")}}}(jQuery,this),function(u,e){var a=e.MyAMS,f=a;a.plugins={enabled:{},init:function(i){f.plugins.initData(i);var t=[];u("[data-ams-plugins-disabled]",i).each(function(){for(var e=u(this).data("ams-plugins-disabled").split(/\s+/),a=0;a<e.length;a++)t.push(e[a])});var r,o,n={};function c(e,a){if(n.hasOwnProperty(e)){var t=n[e];t.css=t.css||a.css,t.callbacks.push({callback:a.callback,context:a.context}),a.register&&(t.register=!0),!1===a.async&&(t.async=!1)}else n[e]={src:a.src,css:a.css,callbacks:[{callback:a.callback,context:a.context}],register:a.register,async:a.async};a.css&&f.getCSS(a.css,e+"_css")}function e(e){var a,t,n=o.callbacks;if(n&&n.length){for(a=0;a<n.length;a++)if((t=n[a]).callback=f.getFunctionByName(t.callback),!1!==o.register){var s=f.plugins.enabled;s.hasOwnProperty(r)?s[r].push(t):s[r]=[t]}}else!1!==o.register&&(f.plugins.enabled[r]=null);if(!0!==e&&n&&n.length&&!1!==o.async)for(a=0;a<n.length;a++)t=n[a],f.executeFunctionByName(t.callback,i,t.context)}function a(){var e=f.plugins.enabled[r];for(s=0;s<e.length;s++){var a=e[s];a&&a.context&&!f.isInDOM(a.context)&&(e[s]=null)}}for(r in u("[data-ams-plugins]",i).each(function(){var e=u(this),a=e.data("ams-plugins");if("string"==typeof a)for(var t=e.data("ams-plugins").split(/\s+/),n=0;n<t.length;n++){r=t[n];var s={src:e.data("ams-plugin-"+r+"-src"),css:e.data("ams-plugin-"+r+"-css"),callback:e.data("ams-plugin-"+r+"-callback"),context:e,register:e.data("ams-plugin-"+r+"-register"),async:e.data("ams-plugin-"+r+"-async")};c(r,s)}else for(r in a)a.hasOwnProperty(r)&&c(r,a[r])}),n)n.hasOwnProperty(r)&&(o=n[r],void 0===f.plugins.enabled[r]?f.getScript(o.src,e,{async:void 0===o.async||o.async}):(a(),e(!0)));for(var s in f.plugins.enabled)if(f.plugins.enabled.hasOwnProperty(s)&&!(0<=t.indexOf(s))){var l=f.plugins.enabled[s];if(l)switch(typeof l){case"function":l(i);break;default:for(var d=0;d<l.length;d++){var m=l[d];switch(typeof m){case"function":m(i);break;default:m&&m.callback&&m.callback(m.context)}}}}},initData:function(e){u("[data-ams-data]",e).each(function(){var e=u(this),a=e.data("ams-data");if(a)for(var t in a)if(a.hasOwnProperty(t)){var n=a[t];"string"!=typeof n&&(n=JSON.stringify(n)),e.attr("data-"+t,n)}})},register:function(a,t,n){if("function"==typeof t&&(n=t,t=null),t=t||a.name,0<=f.plugins.enabled.indexOf(t))console&&console.warn&&console.warn("Plugin "+t+" is already registered!");else if("object"==typeof a){var e=a.src;e?f.ajax.check(a.callback,e,function(e){e&&(f.plugins.enabled[t]=f.getFunctionByName(a.callback),a.css&&f.getCSS(a.css,t+"_css"),n&&f.executeFunctionByName(n))}):(f.plugins.enabled[t]=f.getFunctionByName(a.callback),a.css&&f.getCSS(a.css,t+"_css"),n&&f.executeFunctionByName(n))}else"function"==typeof a&&(f.plugins.enabled[t]=a,n&&f.executeFunctionByName(n))}}}(jQuery,this),function(y,e){var x=e.MyAMS;y.extend(x.plugins.enabled,{svg:function(e){var a=y(".svg-container",e);0<a.length&&a.each(function(){var e=y(this),a=y("svg",e),t=a.attr("width"),n=a.attr("height");t&&n&&a.get(0).setAttribute("viewBox","0 0 "+Math.round(parseFloat(t))+" "+Math.round(parseFloat(n))),a.attr("width","100%").attr("height","auto")})},hint:function(e){var a=y(".hint:not(:parents(.nohints))",e);0<a.length&&x.ajax.check(y.fn.tipsy,x.baseURL+"ext/jquery-tipsy"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-tipsy"+x.devext+".css","jquery-tipsy",function(){a.each(function(){var e=y(this),t=e.data(),a={html:void 0===t.amsHintHtml?(e.attr("title")||"").startsWith("<"):t.amsHintHtml,title:x.getFunctionByName(t.amsHintTitleGetter)||function(){var e=y(this),a=e.attr("original-title")||e.attr(t.amsHintTitleAttr||"title")||(t.amsHintHtml?e.html():e.text());return a=a.replace(/\?_="/,"?_="+(new Date).getTime()+'"')},opacity:t.amsHintOpacity||.95,gravity:t.amsHintGravity||"sw",offset:t.amsHintOffset||0},n=y.extend({},a,t.amsHintOptions);n=x.executeFunctionByName(t.amsHintInitCallback,e,n)||n;var s=e.tipsy(n);x.executeFunctionByName(t.amsHintAfterInitCallback,e,s,n)})})})},contextMenu:function(e){var a=y(".context-menu",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={menuSelector:a.amsContextmenuSelector,menuSelected:x.helpers.contextMenuHandler},n=y.extend({},t,a.amsContextmenuOptions);n=x.executeFunctionByName(a.amsContextmenuInitCallback,e,n)||n;var s=e.contextMenu(n);x.executeFunctionByName(a.amsContextmenuAfterInitCallback,e,s,n)})},switcher:function(e){y("LEGEND.switcher",e).each(function(){var n=y(this),s=n.parent("fieldset"),i=n.data();i.amsSwitcher||(y('<i class="fa fa-fw"></i>').prependTo(y(this)).addClass("open"===i.amsSwitcherState?i.amsSwitcherMinusClass||"fa-minus":i.amsSwitcherPlusClass||"fa-plus"),n.on("click",function(e){e.preventDefault();var a={};if(n.trigger("ams.switcher.before-switch",[n,a]),!a.veto)if(s.hasClass("switched")){s.removeClass("switched"),y(".fa",n).removeClass(i.amsSwitcherPlusClass||"fa-plus").addClass(i.amsSwitcherMinusClass||"fa-minus"),n.trigger("ams.switcher.opened",[n]);var t=n.attr("id");t&&y('legend.switcher[data-ams-switcher-sync="'+t+'"]',s).each(function(){var e=y(this);e.parents("fieldset").hasClass("switched")&&e.click()})}else s.addClass("switched"),y(".fa",n).removeClass(i.amsSwitcherMinusClass||"fa-minus").addClass(i.amsSwitcherPlusClass||"fa-plus"),n.trigger("ams.switcher.closed",[n])}),"open"!==i.amsSwitcherState&&s.addClass("switched"),n.data("ams-switcher","on"))})},checker:function(e){y("LEGEND.checker",e).each(function(){var s=y(this),i=s.parent("fieldset"),r=s.data();if(!r.amsChecker){var e=y('<label class="checkbox"></label>'),a=r.amsCheckerFieldname||"checker_"+x.generateId(),t=a.replace(/\./,"_"),n=r.amsCheckerHiddenPrefix,o=null,c=r.amsCheckerHiddenValueOn||"true",l=r.amsCheckerHiddenValueOff||"false",d=r.amsCheckerMarker||!1;n?o=y('<input type="hidden">').attr("name",n+a).val("on"===r.amsCheckerState?c:l).prependTo(s):d&&y('<input type="hidden">').attr("name",d).attr("value",1).prependTo(s);var m=y('<input type="checkbox">').attr("name",a).attr("id",t).data("ams-checker-hidden-input",o).data("ams-checker-init",!0).val(r.amsCheckerValue||!0).attr("checked","on"===r.amsCheckerState?"checked":null);r.amsCheckerReadonly?m.attr("disabled","disabled"):m.on("change",function(e){e.preventDefault();var a={},t=y(this).is(":checked");if(s.trigger("ams.checker.before-switch",[s,a]),a.veto)y(this).prop("checked",!t);else if(x.executeFunctionByName(r.amsCheckerChangeHandler,s,t),!r.amsCheckerCancelDefault){var n=m.data("ams-checker-hidden-input");t?("disable"===r.amsCheckerMode?(i.removeAttr("disabled"),y(".select2",i).removeAttr("disabled")):i.removeClass("switched"),n&&n.val(c),y("[data-required]",i).attr("required","required"),s.trigger("ams.checker.opened",[s])):("disable"===r.amsCheckerMode?(i.prop("disabled","disabled"),y(".select2",i).attr("disabled","disabled")):i.addClass("switched"),n&&n.val(l),y("[data-required]",i).removeAttr("required"),s.trigger("ams.checker.closed",[s]))}}),m.appendTo(e),y(">label",s).attr("for",m.attr("id")),e.append("<i></i>").prependTo(s);var u=y("[required]",i);u.attr("data-required",!0),"on"===r.amsCheckerState?m.attr("checked",!0):("disable"===r.amsCheckerMode?(i.attr("disabled","disabled"),y(".select2",i).attr("disabled","disabled")):i.addClass("switched"),u.removeAttr("required")),s.data("ams-checker","on")}})},slider:function(e){var a=y(".slider",e);0<a.length&&x.ajax.check(y.fn.slider,x.baseURL+"ext/bootstrap-slider-2.0.0"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t=y.extend({},{},e.data.amsSliderOptions);t=x.executeFunctionByName(a.amsSliderInitCallback,e,t)||t;var n=e.slider(t);x.executeFunctionByName(a.amsSliderAfterInitCallback,e,n,t)})})},draggable:function(e){var a=y(".draggable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={cursor:a.amsDraggableCursor||"move",containment:a.amsDraggableContainment,handle:a.amsDraggableHandle,connectToSortable:a.amsDraggableConnectSortable,helper:x.getFunctionByName(a.amsDraggableHelper)||a.amsDraggableHelper,start:x.getFunctionByName(a.amsDraggableStart),stop:x.getFunctionByName(a.amsDraggableStop)},n=y.extend({},t,a.amsDraggableOptions);n=x.executeFunctionByName(a.amsDraggableInitCallback,e,n)||n;var s=e.draggable(n);e.disableSelection(),x.executeFunctionByName(a.amsDraggableAfterInitCallback,e,s,n)})},droppable:function(e){var a=y(".droppable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={accept:a.amsdroppableAccept,drop:x.getFunctionByName(a.amsDroppableDrop)},n=y.extend({},t,a.amsDroppableOptions);n=x.executeFunctionByName(a.amsDroppableInitCallback,e,n)||n;var s=e.droppable(n);x.executeFunctionByName(a.amsDroppableAfterInitCallback,e,s,n)})},sortable:function(e){var a=y(".sortable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={items:a.amsSortableItems,handle:a.amsSortableHandle,helper:a.amsSortableHelper,connectWith:a.amsSortableConnectwith,start:x.getFunctionByName(a.amsSortableStart),over:x.getFunctionByName(a.amsSortableOver),containment:a.amsSortableContainment,placeholder:a.amsSortablePlaceholder,stop:x.getFunctionByName(a.amsSortableStop)},n=y.extend({},t,a.amsSortableOptions);n=x.executeFunctionByName(a.amsSortableInitCallback,e,n)||n;var s=e.sortable(n);e.disableSelection(),x.executeFunctionByName(a.amsSortableAfterInitCallback,e,s,n)})},resizable:function(e){var a=y(".resizable",e);0<a.length&&a.each(function(){var e=y(this),a=e.data(),t={autoHide:!1===a.amsResizableAutohide||a.amsResizableAutohide,containment:a.amsResizableContainment,grid:a.amsResizableGrid,handles:a.amsResizableHandles,start:x.getFunctionByName(a.amsResizableStart),stop:x.getFunctionByName(a.amsResizableStop)},n=y.extend({},t,a.amsResizableOptions);n=x.executeFunctionByName(a.amsResizableInitCallback,e,n)||n;var s=e.resizable(n);e.disableSelection(),x.executeFunctionByName(a.amsResizableAfterInitCallback,e,s,n)})},typeahead:function(e){var a=y(".typeahead",e);0<a.length&&x.ajax.check(y.fn.typeahead,x.baseURL+"ext/jquery-typeahead"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t=y.extend({},{},a.amsTypeaheadOptions);t=x.executeFunctionByName(a.amsTypeaheadInitCallback,e,t)||t;var n=e.typeahead(t);x.executeFunctionByName(a.amsTypeaheadAfterInitCallback,e,n,t)})})},treeview:function(e){var a=y(".treeview",e);0<a.length&&x.ajax.check(y.fn.treview,x.baseURL+"ext/bootstrap-treeview"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/bootstrap-treeview"+x.devext+".css","bootstrap-treeview",function(){a.each(function(){var e=y(this),a=e.data(),t={data:a.amsTreeviewData,levels:a.amsTreeviewLevels,injectStyle:a.amsTreeviewInjectStyle,expandIcon:a.amsTreeviewExpandIcon||"fa fa-fw fa-plus-square-o",collapseIcon:a.amsTreeviewCollaspeIcon||"fa fa-fw fa-minus-square-o",emptyIcon:a.amsTreeviewEmptyIcon||"fa fa-fw",nodeIcon:a.amsTreeviewNodeIcon,selectedIcon:a.amsTreeviewSelectedIcon,checkedIcon:a.amsTreeviewCheckedIcon||"fa fa-fw fa-check-square-o",uncheckedIcon:a.amsTreeviewUncheckedIcon||"fa fa-fw fa-square-o",color:a.amsTreeviewColor,backColor:a.amsTreeviewBackColor,borderColor:a.amsTreeviewBorderColor,onHoverColor:a.amsTreeviewHoverColor,selectedColor:a.amsTreeviewSelectedColor,selectedBackColor:a.amsTreeviewSelectedBackColor,unselectableColor:a.amsTreeviewUnselectableColor||"rgba(1,1,1,0.25)",unselectableBackColor:a.amsTreeviewUnselectableBackColor||"rgba(1,1,1,0.25)",enableLinks:a.amsTreeviewEnableLinks,highlightSelected:a.amsTreeviewHighlightSelected,highlightSearchResults:a.amsTreeviewhighlightSearchResults,showBorder:a.amsTreeviewShowBorder,showIcon:a.amsTreeviewShowIcon,showCheckbox:a.amsTreeviewShowCheckbox,showTags:a.amsTreeviewShowTags,toggleUnselectable:a.amsTreeviewToggleUnselectable,multiSelect:a.amsTreeviewMultiSelect,onNodeChecked:x.getFunctionByName(a.amsTreeviewNodeChecked),onNodeCollapsed:x.getFunctionByName(a.amsTreeviewNodeCollapsed),onNodeDisabled:x.getFunctionByName(a.amsTreeviewNodeDisabled),onNodeEnabled:x.getFunctionByName(a.amsTreeviewNodeEnabled),onNodeExpanded:x.getFunctionByName(a.amsTreeviewNodeExpanded),onNodeSelected:x.getFunctionByName(a.amsTreeviewNodeSelected),onNodeUnchecked:x.getFunctionByName(a.amsTreeviewNodeUnchecked),onNodeUnselected:x.getFunctionByName(a.amsTreeviewNodeUnselected),onSearchComplete:x.getFunctionByName(a.amsTreeviewSearchComplete),onSearchCleared:x.getFunctionByName(a.amsTreeviewSearchCleared)},n=y.extend({},t,a.amsTreeviewOptions);n=x.executeFunctionByName(a.amsTreeviewInitcallback,e,n)||n;var s=e.treeview(n);x.executeFunctionByName(a.amsTreeviewAfterInitCallback,e,s,n)})})})},select2:function(e){var a=y(".select2",e);0<a.length&&x.ajax.check(y.fn.select2,x.baseURL+"ext/jquery-select2-3.5.4"+x.devext+".js",function(){a.each(function(){var t=y(this),s=t.data();if(!s.select2){var n={placeholder:s.amsSelect2Placeholder,multiple:s.amsSelect2Multiple,minimumInputLength:s.amsSelect2MinimumInputLength||0,maximumSelectionSize:s.amsSelect2MaximumSelectionSize,openOnEnter:void 0===s.amsSelect2EnterOpen||s.amsSelect2EnterOpen,allowClear:void 0===s.amsSelect2AllowClear||s.amsSelect2AllowClear,width:s.amsSelect2Width||"100%",initSelection:x.getFunctionByName(s.amsSelect2InitSelection),formatSelection:void 0===s.amsSelect2FormatSelection?x.helpers.select2FormatSelection:x.getFunctionByName(s.amsSelect2FormatSelection),formatResult:x.getFunctionByName(s.amsSelect2FormatResult),formatMatches:void 0===s.amsSelect2FormatMatches?function(e){return 1===e?x.i18n.SELECT2_MATCH:e+x.i18n.SELECT2_MATCHES}:x.getFunctionByName(s.amsSelect2FormatMatches),formatNoMatches:void 0===s.amsSelect2FormatResult?function(e){return x.i18n.SELECT2_NOMATCHES}:x.getFunctionByName(s.amsSelect2FormatResult),formatInputTooShort:void 0===s.amsSelect2FormatInputTooShort?function(e,a){var t=a-e.length;return x.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":x.i18n.SELECT2_PLURAL)}:x.getFunctionByName(s.amsSelect2FormatInputTooShort),formatInputTooLong:void 0===s.amsSelect2FormatInputTooLong?function(e,a){var t=e.length-a;return x.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,t).replace(/\{1\}/,1===t?"":x.i18n.SELECT2_PLURAL)}:x.getFunctionByName(s.amsSelect2FormatInputTooLong),formatSelectionTooBig:void 0===s.amsSelect2FormatSelectionTooBig?function(e){return x.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,e).replace(/\{1\}/,1===e?"":x.i18n.SELECT2_PLURAL)}:x.getFunctionByName(s.amsSelect2FormatSelectionTooBig),formatLoadMore:void 0===s.amsSelect2FormatLoadMore?function(e){return x.i18n.SELECT2_LOADMORE}:x.getFunctionByName(s.amsSelect2FormatLoadMore),formatSearching:void 0===s.amsSelect2FormatSearching?function(){return x.i18n.SELECT2_SEARCHING}:x.getFunctionByName(s.amsSelect2FormatSearching),separator:s.amsSelect2Separator||",",tokenSeparators:s.amsSelect2TokensSeparators||[","],tokenizer:x.getFunctionByName(s.amsSelect2Tokenizer)};switch(t.context.type){case"text":case"hidden":if(!n.initSelection){var i=t.data("ams-select2-values");i&&(n.initSelection=function(e,a){var t=[];y(e.val().split(n.separator)).each(function(){t.push({id:this,text:i[this]||this})}),a(t)})}}t.attr("readonly")?"hidden"===t.attr("type")&&(n.query=function(){return[]}):s.amsSelect2Query?(n.query=x.getFunctionByName(s.amsSelect2Query),n.minimumInputLength=s.amsSelect2MinimumInputLength||1):s.amsSelect2QueryUrl?(n.ajax={url:s.amsSelect2QueryUrl,quietMillis:s.amsSelect2QuietMillis||200,type:s.amsSelect2QueryType||"POST",dataType:s.amsSelect2QueryDatatype||"json",data:function(e,a,t){var n={};return n[s.amsSelect2QueryParamName||"query"]=e,n[s.amsSelect2PageParamName||"page"]=a,n[s.amsSelect2ContextParamName||"context"]=t,y.extend({},n,s.amsSelect2QueryOptions)},results:x.helpers.select2QueryUrlResultsCallback},n.minimumInputLength=s.amsSelect2MinimumInputLength||1):s.amsSelect2QueryMethod?(n.query=function(a){var e={id:(new Date).getTime(),params:s.amsSelect2QueryParams||{},success:function(e){return x.helpers.select2QueryMethodSuccessCallback.call(t,e,"success",a)},error:x.error.show};e.params[s.amsSelect2QueryParamName||"query"]=a.term,e.params[s.amsSelect2PageParamName||"page"]=a.page,e.params[s.amsSelect2ContextParamName||"context"]=a.context,e=y.extend({},e,s.amsSelect2QueryOptions),e=x.executeFunctionByName(s.amsSelect2QueryInitCallback,t,e)||e,x.ajax.check(y.jsonRPC,x.baseURL+"ext/jquery-jsonrpc"+x.devext+".js",function(){y.jsonRPC.withOptions({endPoint:s.amsSelect2MethodTarget||x.jsonrpc.getAddr(),namespace:s.amsSelect2MethodNamespace,cache:!1},function(){y.jsonRPC.request(s.amsSelect2QueryMethod,e)})})},n.minimumInputLength=s.amsSelect2MinimumInputLength||1):s.amsSelect2Tags?n.tags=s.amsSelect2Tags:s.amsSelect2Data&&(n.data=s.amsSelect2Data),s.amsSelect2EnableFreeTags&&(n.createSearchChoice=function(e){return{id:e,text:(s.amsSelect2FreeTagsPrefix||x.i18n.SELECT2_FREETAG_PREFIX)+e}});var e=y.extend({},n,s.amsSelect2Options);e=x.executeFunctionByName(s.amsSelect2InitCallback,t,e)||e;var a=t.select2(e);x.executeFunctionByName(s.amsSelect2AfterInitCallback,t,a,e),t.hasClass("ordered")&&x.ajax.check(y.fn.select2Sortable,x.baseURL+"ext/jquery-select2-sortable"+x.devext+".js",function(){t.select2Sortable({bindOrder:"sortableStop"})}),t.on("change",function(){void 0!==y(t.get(0).form).data("validator")&&y(t).valid()})}})})},maskedit:function(e){var a=y("[data-mask]",e);0<a.length&&x.ajax.check(y.fn.mask,x.baseURL+"ext/jquery-maskedinput-1.4.1"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t={placeholder:void 0===a.amsMaskeditPlaceholder?"X":a.amsMaskeditPlaceholder,complete:x.getFunctionByName(a.amsMaskeditComplete)},n=y.extend({},t,a.amsMaskeditOptions);n=x.executeFunctionByName(a.amsMaskeditInitCallback,e,n)||n;var s=e.mask(e.attr("data-mask"),n);x.executeFunctionByName(a.amsMaskeditAfterInitCallback,e,s,n)})})},inputmask:function(e){var a=y("input[data-input-mask]",e);0<a.length&&x.ajax.check(y.fn.inputmask,x.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+x.devext+".js",function(){a.each(function(){var e,a=y(this),t=a.data();e="object"==typeof t.inputMask?t.inputMask:{mask:t.inputMask.toString()};var n=y.extend({},e,t.amsInputmaskOptions);n=x.executeFunctionByName(t.amsInputmaskInitCallback,a,n)||n;var s=a.inputmask(n);x.executeFunctionByName(t.amsInputmaskAfterInitCallback,a,s,n)})})},datepicker:function(e){var a=y(".datepicker",e);0<a.length&&x.ajax.check(y.fn.datetimepicker,x.baseURL+"ext/jquery-datetimepicker"+x.devext+".js",function(e){e&&x.dialog.registerHideCallback(x.helpers.datetimepickerDialogHiddenCallback),x.getCSS(x.baseURL+"../css/ext/jquery-datetimepicker"+x.devext+".css","jquery-datetimepicker",function(){a.each(function(){var e=y(this),a=e.data(),t={lang:a.amsDatetimepickerLang||x.lang,format:a.amsDatetimepickerFormat||"d/m/y",datepicker:!0,dayOfWeekStart:1,timepicker:!1,closeOnDateSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect,weeks:a.amsDatetimepickerWeeks},n=y.extend({},t,a.amsDatetimepickerOptions);n=x.executeFunctionByName(a.amsDatetimepickerInitCallback,e,n)||n;var s=e.datetimepicker(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,s,n)})})})},datetimepicker:function(e){var a=y(".datetimepicker",e);0<a.length&&x.ajax.check(y.fn.datetimepicker,x.baseURL+"ext/jquery-datetimepicker"+x.devext+".js",function(e){e&&x.dialog.registerHideCallback(x.helpers.datetimepickerDialogHiddenCallback),x.getCSS(x.baseURL+"../css/ext/jquery-datetimepicker"+x.devext+".css","jquery-datetimepicker",function(){a.each(function(){var e=y(this),a=e.data(),t={lang:a.amsDatetimepickerLang||x.lang,format:a.amsDatetimepickerFormat||"d/m/y H:i",datepicker:!0,dayOfWeekStart:1,timepicker:!0,closeOnDateSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect,closeOnTimeSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect,weeks:a.amsDatetimepickerWeeks},n=y.extend({},t,a.amsDatetimepickerOptions);n=x.executeFunctionByName(a.amsDatetimepickerInitCallback,e,n)||n;var s=e.datetimepicker(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,s,n)})})})},timepicker:function(e){var a=y(".timepicker",e);0<a.length&&x.ajax.check(y.fn.datetimepicker,x.baseURL+"ext/jquery-datetimepicker"+x.devext+".js",function(e){e&&x.dialog.registerHideCallback(x.helpers.datetimepickerDialogHiddenCallback),x.getCSS(x.baseURL+"../css/ext/jquery-datetimepicker"+x.devext+".css","jquery-datetimepicker",function(){a.each(function(){var e=y(this),a=e.data(),t={lang:a.amsDatetimepickerLang||x.lang,format:a.amsDatetimepickerFormat||"H:i",datepicker:!1,timepicker:!0,closeOnTimeSelect:void 0===a.amsDatetimepickerCloseOnSelect||a.amsDatetimepickerCloseOnSelect},n=y.extend({},t,a.amsDatetimepickerOptions);n=x.executeFunctionByName(a.amsDatetimepickerInitCallback,e,n)||n;var s=e.datetimepicker(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,s,n)})})})},colorpicker:function(e){var a=y(".colorpicker",e);0<a.length&&x.ajax.check(y.fn.minicolors,x.baseURL+"ext/jquery-minicolors"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-minicolors"+x.devext+".css","jquery-minicolors",function(){a.each(function(){var e=y(this),a=e.data(),t={position:a.amsColorpickerPosition||e.closest(".input").data("ams-colorpicker-position")||"bottom left"},n=y.extend({},t,a.amsColorpickerOptions);n=x.executeFunctionByName(a.amsColorpickerInitCallback,e,n)||n;var s=e.minicolors(n);x.executeFunctionByName(a.amsDatetimepickerAfterInitCallback,e,s,n)})})})},dndupload:function(e){var a=y(".dndupload",e);0<a.length&&x.ajax.check(y.fn.dndupload,x.baseURL+"ext/jquery-dndupload"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-dndupload"+x.devext+".css","jquery-dndupload",function(){a.each(function(){var e=y(this),a=e.data(),t={action:a.amsDnduploadAction||e.attr("action")||"upload-files",fieldname:a.amsDnduploadFieldname||"files",autosubmit:a.amsDnduploadAutosubmit},n=y.extend({},t,a.amsDnduploadOptions);n=x.executeFunctionByName(a.amsDnduploadInitCallback,e,n)||n;var s=e.dndupload(n);x.executeFunctionByName(a.amsDnduploadAfterInitcallback,e,s,n)})})})},validate:function(e){var n=y("FORM:not([novalidate])",e);0<n.length&&x.ajax.check(y.fn.validate,x.baseURL+"ext/jquery-validate-1.17.0"+x.devext+".js",function(e){if(e&&(y.validator.setDefaults({highlight:function(e){y(e).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(e){y(e).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(e,a){var t=a.parents("label:first");t.length?e.insertAfter(t):e.insertAfter(a)}}),x.plugins.i18n)){for(var a in x.plugins.i18n.validate)if(x.plugins.i18n.validate.hasOwnProperty(a)){var t=x.plugins.i18n.validate[a];"string"==typeof t&&-1<t.indexOf("{0}")&&(x.plugins.i18n.validate[a]=y.validator.format(t))}y.extend(y.validator.messages,x.plugins.i18n.validate)}n.each(function(){var r=y(this),e=r.data(),a={ignore:null,submitHandler:void 0!==r.attr("data-async")?void 0===e.amsFormSubmitHandler?function(){return y(".state-error",r).removeClass("state-error"),x.ajax.check(y.fn.ajaxSubmit,x.baseURL+"ext/jquery-form-3.49"+x.devext+".js"),x.form.submit(r)}:x.getFunctionByName(e.amsFormSubmitHandler):void 0,invalidHandler:void 0!==r.attr("data-async")?void 0===e.amsFormInvalidHandler?function(e,a){y(".state-error",r).removeClass("state-error");for(var t=0;t<a.errorList.length;t++){var n=a.errorList[t],s=y(n.element).parents(".tab-pane").index()+1;if(0<s){var i=y(".nav-tabs",y(n.element).parents(".tabforms"));y("li:nth-child("+s+")",i).removeClassPrefix("state-").addClass("state-error"),y("li.state-error:first a",i).click()}}}:x.getFunctionByName(e.amsFormInvalidHandler):void 0};y("[data-ams-validate-rules]",r).each(function(e){0===e&&(a.rules={}),a.rules[y(this).attr("name")]=y(this).data("ams-validate-rules")});var t=y.extend({},a,e.amsValidateOptions);t=x.executeFunctionByName(e.amsValidateInitCallback,r,t)||t;var n=r.validate(t);x.executeFunctionByName(e.amsValidateAfterInitCallback,r,n,t)})})},datatable:function(e){var a=y(".datatable",e);0<a.length&&x.ajax.check(y.fn.dataTable,x.baseURL+"ext/jquery-dataTables-1.9.4"+x.devext+".js",function(){x.ajax.check(y.fn.dataTableExt.oPagination.bootstrap_full,x.baseURL+"myams-dataTables"+x.devext+".js",function(){y(a).each(function(){var m,u=y(this),f=u.data(),h=(f.amsDatatableExtensions||"").split(/\s+/),e=f.amsDatatableSdom||"W"+(0<=h.indexOf("colreorder")||0<=h.indexOf("colreorderwithresize")?"R":"")+"<'dt-top-row'"+(0<=h.indexOf("colvis")?"C":"")+(!1===f.amsDatatablePagination||!1===f.amsDatatablePaginationSize?"":"L")+(!1===f.amsDatatableGlobalFilter?"":"F")+">r<'dt-wrapper't"+(0<=h.indexOf("scroller")?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(!1===f.amsDatatableInformation?"":"i")+"><'col-sm-6 text-right'p>>",a=f.amsDatatableSorting;if("string"==typeof a){var t=a.split(";");for(a=[],m=0;m<t.length;m++){var n=t[m].split(",");n[0]=parseInt(n[0]),a.push(n)}}var s,i=[],r=y("th",u).listattr("data-ams-datatable-sortable");for(m=0;m<r.length;m++){var o=r[m];void 0!==o?((s=i[m]||{}).bSortable="string"==typeof o?JSON.parse(o):o,i[m]=s):i[m]=i[m]||{}}var c=y("th",u).listattr("data-ams-datatable-stype");for(m=0;m<c.length;m++){var l=c[m];l?((s=i[m]||{}).sType=l,i[m]=s):i[m]=i[m]||{}}var d={bJQueryUI:!1,bServerSide:f.amsDatatableServerSide||!1,sAjaxSource:!0===f.amsDatatableServerSide?f.amsDatatableAjaxSource:void 0,sServerMethod:!0===f.amsDatatableServerSide?"POST":void 0,bFilter:!1!==f.amsDatatableGlobalFilter||0<=h.indexOf("columnfilter"),bPaginate:!1!==f.amsDatatablePagination,bInfo:!1!==f.amsDatatableInfo,bSort:!1!==f.amsDatatableSort,aaSorting:a,aoColumns:0<i.length?i:void 0,bDeferRender:!0,bAutoWidth:!1,iDisplayLength:f.amsDatatableDisplayLength||25,sPaginationType:f.amsDatatablePaginationType||"bootstrap_full",sDom:e,oLanguage:x.plugins.i18n.datatables,fnInitComplete:function(e,a){y(".ColVis_Button").addClass("btn btn-default btn-sm").html((x.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}},p=y.extend({},d,f.amsDatatableOptions),g=[],b=[],v=[];if(0<h.length)for(m=0;m<h.length;m++)switch(h[m]){case"autofill":g.push(y.fn.dataTable.AutoFill),b.push(x.baseURL+"ext/jquery-dataTables-autoFill"+x.devext+".js");break;case"columnfilter":g.push(y.fn.columnFilter),b.push(x.baseURL+"ext/jquery-dataTables-columnFilter"+x.devext+".js");break;case"colreorder":g.push(y.fn.dataTable.ColReorder),b.push(x.baseURL+"ext/jquery-dataTables-colReorder"+x.devext+".js");break;case"colreorderwithresize":g.push(window.ColReorder),b.push(x.baseURL+"ext/jquery-dataTables-colReorderWithResize"+x.devext+".js");break;case"colvis":g.push(y.fn.dataTable.ColVis),b.push(x.baseURL+"ext/jquery-dataTables-colVis"+x.devext+".js"),v.push(function(){p.oColVis=y.extend({},{activate:"click",sAlign:"right"},f.amsDatatableColvisOptions)});break;case"editable":g.push(y.fn.editable),b.push(x.baseURL+"ext/jquery-jeditable"+x.devext+".js"),g.push(y.fn.makeEditable),b.push(x.baseURL+"ext/jquery-dataTables-editable"+x.devext+".js");break;case"fixedcolumns":g.push(y.fn.dataTable.FixedColumns),b.push(x.baseURL+"ext/jquery-dataTables-fixedColumns"+x.devext+".js");break;case"fixedheader":g.push(y.fn.dataTable.Fixedheader),b.push(x.baseURL+"ext/jquery-dataTables-fixedHeader"+x.devext+".js");break;case"keytable":g.push(window.keyTable),b.push(x.baseURL+"ext/jquery-dataTables-keyTable"+x.devext+".js");break;case"rowgrouping":g.push(y.fn.rowGrouping),b.push(x.baseURL+"ext/jquery-dataTables-rowGrouping"+x.devext+".js");break;case"rowreordering":g.push(y.fn.rowReordering),b.push(x.baseURL+"ext/jquery-dataTables-rowReordering"+x.devext+".js");break;case"scroller":g.push(y.fn.dataTable.Scroller),b.push(x.baseURL+"ext/jquery-dataTables-scroller"+x.devext+".js")}v.push(function(){p=x.executeFunctionByName(f.amsDatatableInitCallback,u,p)||p;try{var e=u.dataTable(p);if(x.executeFunctionByName(f.amsDatatableAfterInitCallback,u,e,p),0<h.length)for(m=0;m<h.length;m++)switch(h[m]){case"autofill":var a=y.extend({},f.amsDatatableAutofillOptions,p.autofill);a=x.executeFunctionByName(f.amsDatatableAutofillInitCallback,u,a)||a,u.data("ams-autofill",void 0===f.amsDatatableAutofillConstructor?new y.fn.dataTable.AutoFill(u,a):x.executeFunctionByName(f.amsDatatableAutofillConstructor,u,e,a));break;case"columnfilter":var t=y.extend({},{sPlaceHolder:"head:after"},f.amsDatatableColumnfilterOptions,p.columnfilter);t=x.executeFunctionByName(f.amsDatatableColumnfilterInitCallback,u,t)||t,u.data("ams-columnfilter",void 0===f.amsDatatableColumnfilterConstructor?e.columnFilter(t):x.executeFunctionByName(f.amsDatatableColumnfilterConstructor,u,e,t));break;case"editable":var n=y.extend({},f.amsDatatableEditableOptions,p.editable);n=x.executeFunctionByName(f.amsDatatableEditableInitCallback,u,n)||n,u.data("ams-editable",void 0===f.amsDatatableEditableConstructor?u.makeEditable(n):x.executeFunctionByName(f.amsDatatableEditableConstructor,u,e,n));break;case"fixedcolumns":var s=y.extend({},f.amsDatatableFixedcolumnsOptions,p.fixedcolumns);s=x.executeFunctionByName(f.amsDatatableFixedcolumnsInitCallback,u,s)||s,u.data("ams-fixedcolumns",void 0===f.amsDatatableFixedcolumnsConstructor?new y.fn.dataTable.FixedColumns(u,s):x.executeFunctionByName(f.amsDatatableFixedcolumnsConstructor,u,e,s));break;case"fixedheader":var i=y.extend({},f.amsDatatableFixedheaderOptions,p.fixedheader);i=x.executeFunctionByName(f.amsDatatableFixedheadeInitCallback,u,i)||i,u.data("ams-fixedheader",void 0===f.amsDatatableFixedheaderConstructor?new y.fn.dataTable.FixedHeader(u,i):x.executeFunctionByName(f.amsDatatableFixedheaderConstructor,u,e,i));break;case"keytable":var r={table:u.get(0),datatable:e},o=y.extend({},r,f.amsDatatableKeytableOptions,p.keytable);o=x.executeFunctionByName(f.amsDatatableKeytableInitCallback,u,o)||o,u.data("ams-keytable",void 0===f.amsDatatableKeytableConstructor?new KeyTable(o):x.executeFunctionByName(f.amsDatatableKeytableConstructor,u,e,o));break;case"rowgrouping":var c=y.extend({},f.amsDatatableRowgroupingOptions,p.rowgrouping);c=x.executeFunctionByName(f.amsDatatableRowgroupingInitCallback,u,c)||c,u.data("ams-rowgrouping",void 0===f.amsDatatableRowgroupingConstructor?u.rowGrouping(c):x.executeFunctionByName(f.amsDatatableRowgroupingConstructor,u,e,c));break;case"rowreordering":var l=y.extend({},f.amsDatatableRowreorderingOptions,p.rowreordering);l=x.executeFunctionByName(f.amsDatatableRowreorderingInitCallback,u,l)||l,u.data("ams-rowreordering",void 0===f.amsDatatableRowreorderingConstructor?u.rowReordering(l):x.executeFunctionByName(f.amsDatatableRowreorderingConstructor,u,e,l))}if(f.amsDatatableFinalizeCallback){var d=f.amsDatatableFinalizeCallback.split(/\s+/);if(0<d.length)for(m=0;m<d.length;m++)x.executeFunctionByName(d[m],u,e,p)}}catch(e){}}),x.ajax.check(g,b,v)})})})},tablednd:function(e){var a=y(".table-dnd",e);0<a.length&&x.ajax.check(y.fn.tableDnD,x.baseURL+"ext/jquery-tablednd"+x.devext+".js",function(){a.each(function(){var r=y(this),o=r.data();o.amsTabledndDragHandle?y("tr",r).addClass("no-drag-handle"):y(r).on("mouseover","tr",function(){y(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){y(this.cells[0]).removeClass("drag-handle")});var e={onDragClass:o.amsTabledndDragClass||"dragging-row",onDragStart:x.getFunctionByName(o.amsTabledndDragStart),dragHandle:o.amsTabledndDragHandle,scrollAmount:o.amsTabledndScrollAmount,onAllowDrop:o.amsTabledndAllowDrop,onDrop:x.getFunctionByName(o.amsTabledndDrop)||function(e,a){var t=o.amsTabledndDropTarget;if(t){y(a).data("ams-disabled-handlers","click");try{var n=[];y(e.rows).each(function(){var e=y(this).data("ams-element-name");e&&n.push(e)});var s=x.getFunctionByName(t);if("function"==typeof s)s.call(r,e,n);else{if(!t.startsWith(window.location.protocol)){var i=o.amsLocation;i&&(t=i+"/"+t)}x.ajax.post(t,{names:JSON.stringify(n)})}}finally{setTimeout(function(){y(a).removeData("ams-disabled-handlers")},50)}}return!1}},a=y.extend({},e,o.amsTabledndOptions);a=x.executeFunctionByName(o.amsTabledndInitCallback,r,a)||a;var t=r.tableDnD(a);x.executeFunctionByName(o.amsTabledndAfterInitCallback,r,t,a)})})},wizard:function(e){var a=y(".wizard",e);0<a.length&&x.ajax.check(y.fn.bootstrapWizard,x.baseURL+"ext/bootstrap-wizard-1.4.2"+x.devext+".js",function(){a.each(function(){var e=y(this),a=e.data(),t={withVisible:void 0===a.amsWizardWithVisible||a.amsWizardWithVisible,tabClass:a.amsWizardTabClass,firstSelector:a.amsWizardFirstSelector,previousSelector:a.amsWizardPreviousSelector,nextSelector:a.amsWizardNextSelector,lastSelector:a.amsWizardLastSelector,finishSelector:a.amsWizardFinishSelector,backSelector:a.amsWizardBackSelector,onInit:x.getFunctionByName(a.amsWizardInit),onShow:x.getFunctionByName(a.amsWizardShow),onNext:x.getFunctionByName(a.amsWizardNext),onPrevious:x.getFunctionByName(a.amsWizardPrevious),onFirst:x.getFunctionByName(a.amsWizardFirst),onLast:x.getFunctionByName(a.amsWizardLast),onBack:x.getFunctionByName(a.amsWizardBack),onFinish:x.getFunctionByName(a.amsWizardFinish),onTabChange:x.getFunctionByName(a.amsWizardTabChange),onTabClick:x.getFunctionByName(a.amsWizardTabClick),onTabShow:x.getFunctionByName(a.amsWizardTabShow)},n=y.extend({},t,a.amsWizardOptions);n=x.executeFunctionByName(a.amsWizardInitCallback,e,n)||n;var s=e.bootstrapWizard(n);x.executeFunctionByName(a.amsWizardAfterInitCallback,e,s,n)})})},tinymce:function(e){function t(){y(".tinymce",y(this)).each(function(){var e=tinymce.get(y(this).attr("id"));e&&e.remove()})}var n=y(".tinymce",e);if(0<n.length){var s=x.baseURL+"ext/tinymce"+(x.devmode?"/dev":"");x.ajax.check(window.tinymce,s+"/tinymce"+x.devext+".js",function(e){function a(){n.each(function(){var e=y(this),a=e.data(),t={theme:a.amsTinymceTheme||"modern",language:x.lang,menubar:!1!==a.amsTinymceMenubar,statusbar:!1!==a.amsTinymceStatusbar,plugins:a.amsTinymcePlugins||["advlist autosave autolink lists link charmap print preview hr anchor pagebreak","searchreplace wordcount visualblocks visualchars code fullscreen","insertdatetime nonbreaking save table contextmenu directionality","emoticons paste textcolor colorpicker textpattern autoresize"],toolbar:a.amsTinymceToolbar,toolbar1:!1!==a.amsTinymceToolbar1&&(a.amsTinymceToolbar1||"undo redo | pastetext | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent"),toolbar2:!1!==a.amsTinymceToolbar2&&(a.amsTinymceToolbar2||"forecolor backcolor emoticons | charmap link image media | fullscreen preview print | code"),content_css:a.amsTinymceContentCss,formats:a.amsTinymceFormats,style_formats:a.amsTinymceStyleFormats,block_formats:a.amsTinymceBlockFormats,valid_classes:a.amsTinymceValidClasses,image_advtab:!0,image_list:x.getFunctionByName(a.amsTinymceImageList)||a.amsTinymceImageList,image_class_list:a.amsTinymceImageClassList,link_list:x.getFunctionByName(a.amsTinymceLinkList)||a.amsTinymceLinkList,link_class_list:a.amsTinymceLinkClassList,paste_as_text:void 0===a.amsTinymcePasteAsText||a.amsTinymcePasteAsText,paste_auto_cleanup_on_paste:void 0===a.amsTinymcePasteAutoCleanup||a.amsTinymcePasteAutoCleanup,paste_strip_class_attributes:a.amsTinymcePasteStripClassAttributes||"all",paste_remove_spans:void 0===a.amsTinymcePaseRemoveSpans||a.amsTinymcePasteRemoveSpans,paste_remove_styles:void 0===a.amsTinymcePasteRemoveStyles||a.amsTinymcePasteRemoveStyles,height:a.amsTinymceHeight||50,min_height:50,resize:!0,autoresize_min_height:50,autoresize_max_height:500};if(a.amsTinymceExternalPlugins){var n=a.amsTinymceExternalPlugins.split(/\s+/);for(var s in n)if(n.hasOwnProperty(s)){var i=e.data("ams-tinymce-plugin-"+n[s]);tinymce.PluginManager.load(n[s],x.getSource(i))}}var r=y.extend({},t,a.amsTinymceOptions);r=x.executeFunctionByName(a.amsTinymceInitCallback,e,r)||r;var o=e.tinymce(r);x.executeFunctionByName(a.amsTinymceAfterInitCallback,e,o,r)})}e?x.getScript(s+"/jquery.tinymce"+x.devext+".js",function(){tinymce.baseURL=s,tinymce.suffix=x.devext,x.skin.registerCleanCallback(t),a()}):a()})}},imgareaselect:function(e){var a=y(".imgareaselect",e);0<a.length&&x.ajax.check(y.fn.imgAreaSelect,x.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-imgareaselect"+x.devext+".css","jquery-imgareaselect",function(){a.each(function(){var e=y(this),n=e.data(),s=n.amsImgareaselectParent?e.parents(n.amsImgareaselectParent):"body",a={instance:!0,handles:!0,parent:s,x1:n.amsImgareaselectX1||0,y1:n.amsImgareaselectY1||0,x2:n.amsImgareaselectX2||n.amsImgareaselectImageWidth,y2:n.amsImgareaselectY2||n.amsImgareaselectImageHeight,imageWidth:n.amsImgareaselectImageWidth,imageHeight:n.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:n.amsImgareaselectRatio,onSelectEnd:x.getFunctionByName(n.amsImgareaselectSelectEnd)||function(e,a){var t=n.amsImgareaselectTargetField||"image_";y('input[name="'+t+'x1"]',s).val(a.x1),y('input[name="'+t+'y1"]',s).val(a.y1),y('input[name="'+t+'x2"]',s).val(a.x2),y('input[name="'+t+'y2"]',s).val(a.y2)}},t=y.extend({},a,n.amsImgareaselectOptions);t=x.executeFunctionByName(n.amsImgareaselectInitCallback,e,t)||t;var i=e.imgAreaSelect(t);x.executeFunctionByName(n.amsImgareaselectAfterInitCallback,e,i,t),setTimeout(function(){i.update()},250)})})})},fancybox:function(e){var a=y(".fancybox",e);0<a.length&&x.ajax.check(y.fn.fancybox,x.baseURL+"ext/jquery-fancybox-2.1.5"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-fancybox-2.1.5"+x.devext+".css","jquery-fancybox",function(){a.each(function(){var e,a=y(this),t=a.data(),n=a;t.amsFancyboxElements&&(n=y(t.amsFancyboxElements,a));var s=(t.amsFancyboxHelpers||"").split(/\s+/);if(0<s.length)for(e=0;e<s.length;e++)switch(s[e]){case"buttons":x.ajax.check(y.fancybox.helpers.buttons,x.baseURL+"ext/fancybox-helpers/fancybox-buttons"+x.devext+".js");break;case"thumbs":x.ajax.check(y.fancybox.helpers.thumbs,x.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+x.devext+".js");break;case"media":x.ajax.check(y.fancybox.helpers.media,x.baseURL+"ext/fancybox-helpers/fancybox-media"+x.devext+".js")}var i={type:t.amsFancyboxType,padding:t.amsFancyboxPadding||10,margin:t.amsFancyboxMargin||10,loop:t.amsFancyboxLoop,beforeLoad:x.getFunctionByName(t.amsFancyboxBeforeLoad)||function(){var e;if(t.amsFancyboxTitleGetter&&(e=x.executeFunctionByName(t.amsFancyboxTitleGetter,this)),!e){var a=y("*:first",this.element);(e=a.attr("original-title")||a.attr("title"))||(e=y(this.element).attr("original-title")||y(this.element).attr("title"))}this.title=e},afterLoad:x.getFunctionByName(t.amsFancyboxAfterLoad),helpers:{title:{type:"inside"}}};if(0<s.length)for(e=0;e<s.length;e++)switch(s[e]){case"buttons":i.helpers.buttons={position:t.amsFancyboxButtonsPosition||"top"};break;case"thumbs":i.helpers.thumbs={width:t.amsFancyboxThumbsWidth||50,height:t.amsFancyboxThumbsHeight||50};break;case"media":i.helpers.media=!0}var r=y.extend({},i,t.amsFancyboxOptions);r=x.executeFunctionByName(t.amsFancyboxInitCallback,a,r)||r;var o=n.fancybox(r);x.executeFunctionByName(t.amsFancyboxAfterInitCallback,a,o,r)})})})},chart:function(e){var a=y(".chart",e);0<a.length&&x.ajax.check(y.fn.plot,x.baseURL+"flot/jquery.flot"+x.devext+".js",function(){a.each(function(){function e(e){for(var a in y.plot.plugins)if(y.plot.plugins.hasOwnProperty(a)){var t=y.plot.plugins[a];if(t.name===e)return t}return null}var a=y(this),t=a.data(),n=(t.amsChartPlugins||"").split(/\s+/);if(0<n.length)for(var s in n)if(n.hasOwnProperty(s)){var i=n[s];e(i)||x.getScript(x.baseURL+"flot/jquery.flot."+i+x.devext+".js")}var r=y.extend({},{},t.amsChartOptions);r=x.executeFunctionByName(t.amsChartInitCallback,a,r)||r;var o=t.amsChartData;o=x.executeFunctionByName(t.amsChartInitData,a,o)||o;var c=a.plot(o,r);x.executeFunctionByName(t.amsChartAfterInitCallback,a,c,r)})})},graphs:function(e){var a=y(".sparkline",e);0<a.length&&x.ajax.check(x.graphs,x.baseURL+"myams-graphs"+x.devext+".js",function(){x.graphs.init(a)})},scrollbars:function(e){var a=y(".scrollbar",e);0<a.length&&x.ajax.check(y.event.special.mousewheel,x.baseURL+"ext/jquery-mousewheel.min.js",function(){x.ajax.check(y.fn.mCustomScrollbar,x.baseURL+"ext/jquery-mCustomScrollbar"+x.devext+".js",function(){x.getCSS(x.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar",function(){a.each(function(){var e=y(this),a=e.data(),t={theme:a.amsScrollbarTheme||"light"},n=y.extend({},t,a.amsScrollbarOptions);n=x.executeFunctionByName(a.amsScrollbarInitCallback,e,n)||n;var s=e.mCustomScrollbar(n);x.executeFunctionByName(a.amsScrollbarAfterInitCallback,e,s,n)})})})})}})}(jQuery,this),function(l,e){var a=e.MyAMS,d=a;a.callbacks={init:function(e){l("[data-ams-callback]",e).each(function(){var e,a,t=this,n=l(t).data();try{var s=JSON.parse(n.amsCallback);Array.isArray(s)||(s=[s])}catch(e){s=n.amsCallback.split(/\s+/)}for(var i=0;i<s.length;i++){var r=s[i];if("string"==typeof r){var o=d.getFunctionByName(r),c=n.amsCallbackOptions;"string"==typeof c&&(c=c.unserialize()),void 0===o?n.amsCallbackSource?d.getScript(n.amsCallbackSource,(a=r,void d.executeFunctionByName(a,t,c)),{async:void 0===n.amsCallbackAsync||n.amsCallbackAsync}):console&&console.warn&&console.warn("Undefined callback: "+n.amsCallback):o.call(t,c)}else o=d.getFunctionByName(r.callback),"string"==typeof(c=r.options)&&(c=c.unserialize()),void 0===o?r.source?d.getScript(r.source,(e=r,void d.executeFunctionByName(e.callback,t,e.options)),{async:void 0===r.async||r.async}):console&&console.warn&&console.warn("Undefined callback: "+r.callback):o.call(t,r.options)}})},alert:function(e){var a=l(this).data(),t=l.extend({},e,a.amsAlertOptions),n=l(a.amsAlertParent||t.parent||this),s=a.amsAlertStatus||t.status||"info",i=a.amsAlertHeader||t.header,r=a.amsAlertMessage||t.message,o=a.amsAlertSubtitle||t.subtitle,c=void 0===a.amsAlertMargin?void 0!==t.margin&&t.margin:a.amsAlertMargin;d.skin.alert(n,s,i,r,o,c)},messageBox:function(e){var a=l(this).data(),t=l.extend({},e,a.amsMessageboxOptions),n=l.extend({},t,{title:a.amsMessageboxTitle||t.title||"",content:a.amsMessageboxContent||t.content||"",icon:a.amsMessageboxIcon||t.icon,number:a.amsMessageboxNumber||t.number,timeout:a.amsMessageboxTimeout||t.timeout}),s=a.amsMessageboxStatus||t.status||"info",i=d.getFunctionByName(a.amsMessageboxCallback||t.callback);d.skin.messageBox(s,n,i)},smallBox:function(e){var a=l(this).data(),t=l.extend({},e,a.amsSmallboxOptions),n=l.extend({},t,{title:a.amsSmallboxTitle||t.title||"",content:a.amsSmallboxContent||t.content||"",icon:a.amsSmallboxIcon||t.icon,iconSmall:a.amsSmallboxIconSmall||t.iconSmall,timeout:a.amsSmallboxTimeout||t.timeout}),s=a.amsSmallboxStatus||t.status||"info",i=d.getFunctionByName(a.amsSmallboxCallback||t.callback);d.skin.smallBox(s,n,i)}}}(jQuery,this),function(n,e){var a=e.MyAMS,s=a;a.events={init:function(e){n("[data-ams-events-handlers]",e).each(function(){var e=n(this),a=e.data("ams-events-handlers");if(a)for(var t in a)a.hasOwnProperty(t)&&e.on(t,s.getFunctionByName(a[t]))})}}}(jQuery,this),function(i,e){var o=e.MyAMS,c=o;o.container={changeOrder:function(e,a){i('input[name="'+i(this).data("ams-input-name")+'"]',i(this)).val(a.join(";"))},deleteElement:function(){return function(){var r=i(this);o.skin.bigBox({title:c.i18n.WARNING,content:'<i class="text-danger fa fa-fw fa-bell"></i>&nbsp; '+c.i18n.DELETE_WARNING,status:"info",buttons:c.i18n.BTN_OK_CANCEL},function(e){if(e===c.i18n.BTN_OK){var t=r.parents("tr").first(),n=t.parents("table").first(),a=t.data("ams-location")||n.data("ams-location")||"";a&&(a+="/");var s=t.data("ams-delete-target")||n.data("ams-delete-target")||"delete-element.json",i=t.data("ams-element-name");o.ajax.post(a+s,{object_name:i},function(e,a){"success"===e.status?(n.hasClass("datatable")?n.dataTable().fnDeleteRow(t[0]):t.remove(),e.handle_json&&o.ajax.handleJSON(e)):o.ajax.handleJSON(e)})}})}},switchElementVisibility:function(){return function(){var t=i(this),e=t.parents("td").first(),a=t.parents("tr").first(),n=a.parents("table");i("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),c.ajax.post(n.data("ams-location")+"/"+(e.data("ams-attribute-switcher")||n.data("ams-attribute-switcher")),{object_name:a.data("ams-element-name")},function(e,a){e.visible?i("i",t).attr("class","fa fa-fw fa-eye"):i("i",t).attr("class","fa fa-fw fa-eye-slash text-danger")})}},switchElementAttribute:function(){return function(){var t=i(this),e=t.parents("td").first(),n=e.data("ams-switcher-attribute-name"),a=t.parents("tr").first(),s=a.parents("table");i("i",t).attr("class","fa fa-fw fa-spinner fa-pulse"),c.ajax.post(s.data("ams-location")+"/"+(e.data("ams-attribute-switcher")||s.data("ams-attribute-switcher")),{object_name:a.data("ams-element-name")},function(e,a){e[n]||e.on?i("i",t).attr("class",s.data("ams-"+n+"-icon-on")||"fa fa-fw fa-check-square-o"):i("i",t).attr("class",s.data("ams-"+n+"-icon-off")||"fa fa-fw fa-check-square txt-color-silver opacity-75")})}}}}(jQuery,this),function(h,e){var c=e.MyAMS,p=c;c.tree={switchTableNode:function(){var e=h(this),i=h("i.switch",e),r=e.parents("tr").first(),o=r.parents("table").first();if(i.hasClass("fa-minus-square-o"))!function a(e){h('tr[data-ams-tree-node-parent-id="'+e+'"]').each(function(){var e=h(this);a(e.data("ams-tree-node-id")),e.remove()})}(r.data("ams-tree-node-id")),i.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var a=r.data("ams-location")||o.data("ams-location")||"",t=r.data("ams-tree-nodes-target")||o.data("ams-tree-nodes-target")||"get-tree-nodes.json",n=r.data("ams-element-name");i.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),c.ajax.post(a+"/"+n+"/"+t,{can_sort:!h("td.sorter",r).is(":empty")},function(e,a){if(0<e.length){for(var t=r,n=0;n<e.length;n++){var s=h(e[n]);s.insertAfter(t).addClass("no-drag-handle"),p.initContent(s),t=s}o.hasClass("table-dnd")&&o.tableDnDUpdate()}i.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},switchTree:function(){var e=h(this),i=h("i.switch",e),r=h(this).parents("table").first(),a=r.data("ams-tree-node-id");if(i.hasClass("fa-minus-square-o"))h("tr[data-ams-tree-node-parent-id]").filter('tr[data-ams-tree-node-parent-id!="'+a+'"]').remove(),h("i.switch",r).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");else{var t=h("tbody tr",r).first(),n=r.data("ams-location")||"",s=r.data("ams-tree-nodes-target")||"get-tree.json";i.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin"),c.ajax.post(n+"/"+s,{can_sort:!h("td.sorter",t).is(":empty")},function(e,a){h("tr[data-ams-tree-node-id]",r).remove();for(var t=null,n=0;n<e.length;n++){var s=h(e[n]);null===t?s.appendTo(h("tbody",r)):s.insertAfter(t),s.addClass("no-drag-handle"),p.initContent(s),t=s}r.hasClass("table-dnd")&&r.tableDnDUpdate(),h("i.switch",r).removeClass("fa-plus-square-o").addClass("fa-minus-square-o"),i.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")})}},sortTree:function(e,r){var a=h(e).data(),t=a.amsTabledndDropTarget;if(t){(r=h(r)).data("ams-disabled-handlers","click");try{var n=r.parents("table").first().data("ams-tree-node-id"),o=r.data("ams-tree-node-id"),s=r.data("ams-tree-node-parent-id"),i=r.prev("tr");if(i.exists()){var c=i.data("ams-tree-node-id"),l=h(".switch",i);if(l.hasClass("fa-minus-square-o"))if(s===c)var d="reorder";else d="reparent";else d=s===(c=i.data("ams-tree-node-parent-id"))?"reorder":"reparent"}else l=null,d=s===(c=n)?"reorder":"reparent";var m=p.getFunctionByName(t);if("function"==typeof m)m.call(table,e,f);else{if(!t.startsWith(window.location.protocol)){var u=a.amsLocation;u&&(t=u+"/"+t)}var f={action:d,child:o,parent:c,order:JSON.stringify(h("tr[data-ams-tree-node-id]").listattr("data-ams-tree-node-id")),can_sort:!h("td.sorter",r).is(":empty")};p.ajax.post(t,f,function(e){function a(e){h('tr[data-ams-tree-node-parent-id="'+e+'"]').each(function(){var e=h(this);a(e.attr("data-ams-tree-node-id")),e.remove()})}if(e.status)p.ajax.handleJSON(e);else{var t=h(r).parents("tbody").first();if(a(o),"reparent"===f.action){a(c),r.remove();for(var n=h('tr[data-ams-tree-node-id="'+c+'"]'),s=0;s<e.length;s++){var i=h(e[s]);n.exists()?i.insertAfter(n).addClass("no-drag-handle"):i.prependTo(t).addClass("no-drag-handle"),p.initContent(i),n=i}}h("tr").parents("table").tableDnDUpdate()}})}}finally{setTimeout(function(){h(r).removeData("ams-disabled-handlers")},50)}}return!1}}}(jQuery,this),function(l,t){var o=t.MyAMS,d=o;o.skin={_setPageHeight:function(){var e=l("#main").height(),a=(d.leftPanel.height(),l(window).height()-d.navbarHeight);a<e?d.root.css("min-height",e+d.navbarHeight):d.root.css("min-height",a),d.leftPanel.css("min-height",a),d.leftPanel.css("max-height",a)},_checkMobileWidth:function(){l(window).width()<979?d.root.addClass("mobile-view-activated"):d.root.hasClass("mobile-view-activated")&&d.root.removeClass("mobile-view-activated")},_showShortcutButtons:function(){d.shortcuts.animate({height:"show"},200,"easeOutCirc"),d.root.addClass("shortcut-on")},_hideShortcutButtons:function(){d.shortcuts.animate({height:"hide"},300,"easeOutCirc"),d.root.removeClass("shortcut-on")},checkNotification:function(){var e=l(".badge","#user-activity >span");0<parseInt(e.text())?e.removeClass("hidden").addClass("bg-color-red bounceIn animated"):e.addClass("hidden").removeClass("bg-color-red bounceIn animated")},refreshNotificationsPanel:function(e){var a=l(this);a.addClass("disabled"),l("i",a).addClass("fa-spin"),l('input[name="activity"]:checked',"#user-activity").change(),l("i",a).removeClass("fa-spin"),a.removeClass("disabled")},refreshContent:function(e){var a=l('[id="'+e.object_id+'"]');return a.replaceWith(l(e.content)),a=l('[id="'+e.object_id+'"]'),o.initContent(a),a},refreshImage:function(e){l('img[src^="'+e.src+'"]').attr("src",e.target)},refreshWidget:function(e){var a=l('[id="'+e.parent_id+'"]'),t=l('[name="'+e.widget_name+'"]',a);t.exists()||(t=l('[name="'+e.widget_name+':list"]',a));var n=t.parents(".input").last();return n.html(e.content),o.initContent(n),n},refreshTable:function(e){var a=l('[id="'+e.object_id+'"]').parents(".ams-widget:first");return a.replaceWith(l(e.table)),a=l('[id="'+e.object_id+'"]').parents(".ams-widget:first"),o.initContent(a),a},refreshSwitchedTable:function(e){var a=d.skin.refreshTable(e).siblings("legend");a.parents("fieldset:first").hasClass("switched")&&a.click()},refreshRow:function(e){var a=l('tr[id="'+e.object_id+'"]'),t=a.parents("table").first(),n=l(e.row);return a.replaceWith(n),o.initContent(n),t.hasClass("table-dnd")&&(n.addClass("no-drag-handle"),t.tableDnDUpdate()),n},refreshRowCell:function(e){var a=l('tr[id="'+e.object_id+'"]'),t=a.parents("table").first(),n=l("tr",l("thead",t)),s=l('th[data-ams-column-name="'+e.col_name+'"]',n),i=l("th",n).index(s);if(-1<i){var r=l(l("td",a).get(i));r.html(e.cell),o.initContent(r)}},switchCellContent:function(e){var a=l(this),t=l("i.switch",a),n=a.parents("td"),s=l(a.data("ams-switch-target")||".inner-table-form",n),i=a.parents("tr");if(t.hasClass("fa-plus-square-o")){var r=i.parents("table");s.html('<h1 class="loading"><i class="fa fa-gear fa-spin"></i></h1>'),o.ajax.post(r.data("ams-location")+"/"+a.data("ams-switch-handler"),{object_name:i.data("ams-element-name")},function(e){s.html(e),e&&(o.initContent(s),t.removeClass("fa-plus-square-o").addClass("fa-minus-square-o"))})}else o.skin.cleanContainer(s),s.empty(),t.removeClass("fa-minus-square-o").addClass("fa-plus-square-o")},_initDesktopWidgets:function(e){if(d.enableWidgets){var a=l(".ams-widget",e);0<a.length&&d.ajax.check(l.fn.MyAMSWidget,d.baseURL+"myams-widgets"+d.devext+".js",function(){a.each(function(){var e=l(this),a=e.data(),t=l.extend({},{deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"},a.amsWidgetOptions);t=d.executeFunctionByName(a.amsWidgetInitcallback,e,t)||t,e.MyAMSWidget(t)}),t.MyAMSWidget.initWidgetsGrid(l(".ams-widget-grid",e))})}},_initMobileWidgets:function(e){d.enableMobile&&d.enableWidgets&&d.skin._initDesktopWidgets(e)},alert:function(e,a,t,n,s,i){"error"===a&&(a="danger"),l(".alert-"+a,e).not(".persistent").remove();var r='<div class="'+(i?"margin-10":"")+" alert alert-block alert-"+a+' padding-5 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> '+t+"</h4>"+(s?"<p>"+s+"</p>":"");if("string"==typeof n)r+="<ul><li>"+n+"</li></ul>";else if(n){for(var o in r+="<ul>",n)l.isNumeric(o)&&(r+="<li>"+n[o]+"</li>");r+="</ul>"}l(r+="</div>").insertBefore(e),e.exists&&d.skin.scrollTo(e,{offset:{top:-50}})},bigBox:function(e,a){d.ajax.check(d.notify,d.baseURL+"myams-notify"+d.devext+".js",function(){d.notify.messageBox(e,a)})},messageBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),d.ajax.check(d.notify,d.baseURL+"myams-notify"+d.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,d.notify.bigBox(a,t)})},smallBox:function(e,a,t){"object"==typeof e&&(t=a,a=e||{},e="info"),d.ajax.check(d.notify,d.baseURL+"myams-notify"+d.devext+".js",function(){switch(e){case"error":case"danger":a.color="#C46A69";break;case"warning":a.color="#C79121";break;case"success":a.color="#739E73";break;default:a.color=a.color||"#3276B1"}a.sound=!1,d.notify.smallBox(a,t)})},scrollTo:function(t,n){d.ajax.check(l.scrollTo,d.baseURL+"ext/jquery-scrollto-2.1.2"+d.devext+".js",function(){var e=l("body"),a=n.offset||0;e.hasClass("fixed-header")&&(a-=l("#header").height()),e.hasClass("fixed-ribbon")&&(a-=l("#ribbon").height()),n=l.extend({},n,{offset:a}),l.scrollTo(t,n)})},_drawBreadCrumb:function(){var n=l("OL.breadcrumb","#ribbon");l("li",n).not(".parent").remove(),l("li",n).exists()||n.append(l("<li></li>").append(l("<a></a>").text(d.i18n.HOME).addClass("padding-right-5").attr("href",l('nav a[href!="#"]:first').attr("href")))),l("LI.active >A","nav").each(function(){var e=l(this),a=l.trim(e.clone().children(".badge").remove().end().text()),t=l("<li></li>").append(e.attr("href").replace(/^#/,"")?l("<a></a>").html(a).attr("href",e.attr("href")):a);n.append(t)})},checkURL:function(){function e(e){l(".active",t).removeClass("active"),e.addClass("open").addClass("active"),e.parents("li").addClass("open active").children("ul").addClass("active").show(),e.parents("li:first").removeClass("open"),e.parents("ul").addClass(e.attr("href").replace(/^#/,"")?"active":"").show()}var a,t=l("nav"),n=location.hash,s=n.replace(/^#/,"");if(s){var i=l("#content");i.exists()||(i=l("body")),(a=l('A[href="'+n+'"]',t)).exists()&&e(a),d.skin.loadURL(s,i,{afterLoadCallback:function(){var e=l("html head title").data("ams-title-prefix");document.title=(e?e+" > ":"")+(l("[data-ams-page-title]:first",i).data("ams-page-title")||a.attr("title")||document.title)}})}else{var r=l("[data-ams-active-menu]").data("ams-active-menu");(a=r?l('A[href="'+r+'"]',t):l('>UL >LI >A[href!="#"]',t).first()).exists()&&(e(a),r?d.skin._drawBreadCrumb():window.location.hash=a.attr("href"))}},_clean_callbacks:[],registerCleanCallback:function(e){var a=d.skin._clean_callbacks;a.indexOf(e)<0&&a.push(e)},unregisterCleanCallback:function(e){var a=d.skin._clean_callbacks,t=a.indexOf(e);0<=t&&a.splice(t,1)},cleanContainer:function(e){for(var a=d.skin._clean_callbacks,t=0;t<a.length;t++)a[t].call(e)},loadURL:function(e,r,o,c){e.startsWith("#")&&(e=e.substr(1)),"function"==typeof o?(c=o,o={}):void 0===o&&(o={}),r=l(r);var a={type:"GET",url:e,dataType:"html",cache:!1,beforeSend:function(){if(o&&o.preLoadCallback&&d.executeFunctionByName(o.preLoadCallback,this,o.preLoadCallbackOptions),d.skin.cleanContainer(r),r.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> '+d.i18n.LOADING+" </h1>"),r[0]===l("#content")[0]){d.skin._drawBreadCrumb();var e=l("html head title").data("ams-title-prefix");document.title=(e?e+" > ":"")+l(".breadcrumb LI:last-child").text(),l("html, body").animate({scrollTop:0},"fast")}else r.animate({scrollTop:0},"fast")},success:function(e,a,t){if(c)d.executeFunctionByName(c,this,e,a,t,o);else{var n=d.ajax.getResponse(t),s=n.contentType,i=n.data;switch(l(".loading",r).remove(),s){case"json":d.ajax.handleJSON(i,r);break;case"script":case"xml":break;case"html":case"text":default:r.parents(".hidden").removeClass("hidden"),l(".alert",r.parents(".alerts-container")).remove(),r.css({opacity:"0.0"}).html(e).removeClass("hidden").delay(50).animate({opacity:"1.0"},300),d.initContent(r),d.form.setFocus(r)}o&&o.afterLoadCallback&&d.executeFunctionByName(o.afterLoadCallback,this,o.afterLoadCallbackOptions),d.stats.logPageview()}},error:function(e,a,t){r.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+d.i18n.ERROR+t+"</h3>"+e.responseText),o&&o.afterErrorCallback&&d.executeFunctionByName(o.afterErrorCallback,this)},async:void 0===o.async||o.async},t=l.extend({},a,o);l.ajax(t)},setLanguage:function(e,a){var t=a.lang;switch(a.handler_type||"json"){case"json":var n=a.method||"setUserLanguage";d.jsonrpc.post(n,{lang:t},function(){window.location.reload(!0)});break;case"ajax":var s=a.href||"setUserLanguage";d.ajax.post(s,{lang:t},function(){window.location.reload(!0)})}},logout:function(){window.location=d.loginURL}}}(jQuery,this),function(e,n){var a=n.MyAMS;a.stats={logPageview:function(e){if(void 0!==n._gaq){var a=n.window.location;n._gaq.push(["_trackPageview",e||a.pathname+a.hash])}},logEvent:function(e,a,t){void 0!==n._gaq&&("object"==typeof e&&(a=e.action,t=e.label,e=e.category),n._gaq.push(["_trackEvent",e,a,t]))}}}(jQuery,this),function(c,s){var i=s.MyAMS,l=i;i.initPage=function(){var a=c("body");l.root=a,l.leftPanel=c("#left-panel"),l.shortcuts=c("#shortcuts"),l.plugins.initData(a);var t=c.ajaxSettings.xhr;c.ajaxSetup({beforeSend:function(e,a){if(l.safeMethods.indexOf(a.type)<0&&void 0!==s.Cookies){var t=Cookies.get(l.csrfCookieName);t&&e.setRequestHeader(l.csrfHeaderName,t)}},progress:l.ajax.progress,progressUpload:l.ajax.progress,xhr:function(){var e=t();if(e&&"function"==typeof e.addEventListener){var a=this;a&&a.progress&&e.addEventListener("progress",function(e){a.progress(e)},!1)}return e}}),c(document).ajaxStart(l.ajax.start),c(document).ajaxStop(l.ajax.stop),c(document).ajaxError(l.error.ajax);var e=s.localStorage&&s.localStorage.getItem("window-state");e&&a.addClass(e),l.isMobile?(l.root.addClass("mobile-detected"),l.device="mobile",l.enableFastclick&&l.ajax.check(c.fn.noClickDelay,l.baseURL+"/ext/jquery-smartclick"+l.devext+".js",function(){c("NAV UL A").noClickDelay(),c("A","#hide-menu").noClickDelay()})):(l.root.addClass("desktop-detected"),l.device="desktop"),c("#show-shortcuts").click(function(e){l.shortcuts.is(":visible")?l.skin._hideShortcutButtons():l.skin._showShortcutButtons(),e.preventDefault()}),l.shortcuts.click(function(e){l.skin._hideShortcutButtons()}),c(document).mouseup(function(e){l.shortcuts.is(e.target)||0!==l.shortcuts.has(e.target).length||l.skin._hideShortcutButtons()}),c("#search-mobile").click(function(){l.root.addClass("search-mobile")}),c("#cancel-search-js").click(function(){l.root.removeClass("search-mobile")}),c(".activity-button","#user-activity").click(function(e){var a=c("#user-activity"),t=c(".ajax-dropdown",a);t.is(":visible")?(t.fadeOut(150),a.removeClass("active")):(t.css("left",-t.innerWidth()+a.innerWidth()).fadeIn(150),a.addClass("active")),e.preventDefault()}),l.skin.checkNotification(),c(document).mouseup(function(e){var a=c(".ajax-dropdown");a.is(e.target)||0!==a.has(e.target).length||a.fadeOut(150).prev().removeClass("active")}),c('input[name="activity"]').change(function(e){var a=c(this).data("ams-url");if(a){e.preventDefault(),e.stopPropagation();var t=l.getFunctionByName(a);if("function"==typeof t&&(a=t.call(this)),"function"==typeof a)a.call(this);else{var n=c(".ajax-notifications");l.skin.loadURL(a,n)}}}),c("a","#user-menu LI.logout").click(function(e){e.preventDefault(),e.stopPropagation(),l.loginURL=c(this).attr("href"),l.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+l.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+c("#show-shortcut").text()+"</strong></span> ?",content:l.i18n.LOGOUT_COMMENT,buttons:l.i18n.BTN_YES_NO},function(e){e===l.i18n.BTN_YES&&(l.root.addClass("animated fadeOutUp"),setTimeout(l.skin.logout,1e3))})});var n=c("nav");c("UL",n).myams_menu({accordion:!1!==n.data("ams-menu-accordion"),speed:l.menuSpeed}),c("#hide-menu").find(">:first-child >A").click(function(e){a.toggleClass("hidden-menu"),s.localStorage&&(a.hasClass("hidden-menu")?s.localStorage.setItem("window-state","hidden-menu"):s.localStorage.setItem("window-state","")),e.preventDefault()}),c(".minifyme").click(function(e){a.toggleClass("minified"),s.localStorage&&(a.hasClass("minified")?s.localStorage.setItem("window-state","minified"):s.localStorage.setItem("window-state","")),c(this).effect("highlight",{},500),e.preventDefault()}),c("#refresh").click(function(e){l.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+l.i18n.CLEAR_STORAGE_TITLE,content:l.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+l.i18n.BTN_CANCEL+"]["+l.i18n.BTN_OK+"]"},function(e){e===l.i18n.BTN_OK&&localStorage&&(localStorage.clear(),location.reload())}),e.preventDefault()}),a.on("click",function(e){var a=c(this);a.is(e.target)||0!==a.has(e.target).length||0!==c(".popover").has(e.target).length||a.popover("hide")}),l.ajax.check(c.resize,l.baseURL+"ext/jquery-resize"+l.devext+".js",function(){c("#main").resize(function(){l.skin._setPageHeight(),l.skin._checkMobileWidth()}),n.resize(function(){l.skin._setPageHeight()})}),l.ajaxNav&&(c(document).on("click",'a[href="#"]',function(e){e.preventDefault()}),c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(e){var a=c(e.currentTarget),t=a.data("ams-disabled-handlers");if(!0!==t&&"click"!==t&&"all"!==t){var n=a.attr("href")||a.data("ams-url");if(n&&!n.startsWith("javascript")&&!a.attr("target")&&!0!==a.data("ams-context-menu")){var s,i;e.preventDefault(),e.stopPropagation(),0<=n.indexOf("?")?(s=n.split("?"),r=s[0],i=s[1].unserialize()):(r=n,i=void 0);var r,o=l.getFunctionByName(r);if("function"==typeof o&&(n=o.call(a,i)),"function"==typeof n)n.call(a,i);else if(n=n.replace(/\%23/,"#"),e.ctrlKey)window.open(n);else(r=a.data("ams-target"))?l.form.confirmChangedForm(r,function(){l.skin.loadURL(n,r,a.data("ams-link-options"),a.data("ams-link-callback"))}):l.form.confirmChangedForm(function(){n.startsWith("#")?n!==location.hash&&(l.root.hasClass("mobile-view-activated")?(l.root.removeClass("hidden-menu"),window.setTimeout(function(){window.location.hash=n},50)):window.location.hash=n):window.location=n})}}}),c(document).on("click",'a[target="_blank"]',function(e){e.preventDefault();var a=c(e.currentTarget);window.open(a.attr("href")),l.stats.logEvent(a.data("ams-stats-category")||"Navigation",a.data("ams-stats-action")||"External",a.data("ams-stats-label")||a.attr("href"))}),c(document).on("click",'a[target="_top"]',function(e){e.preventDefault(),l.form.confirmChangedForm(function(){window.location=c(e.currentTarget).attr("href")})}),c(window).on("hashchange",l.skin.checkURL)),c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(e){var a=c(this),t=a.data("ams-disabled-handlers");!0!==t&&"click"!==t&&"all"!==t&&!0!==a.data("ams-context-menu")&&(!0===a.data("ams-stop-propagation")&&e.stopPropagation(),e.preventDefault(),l.dialog.open(a),a.parents("#shortcut").exists()&&setTimeout(l.skin._hideShortcutButtons,300))}),c(document).on("click",'button[type="submit"], button.submit',function(){var e=c(this);c(e.get(0).form).data("ams-submit-button",e)}),c(document).on("click",'input[type="checkbox"][readonly]',function(){return!1}),c(document).on("click","[data-ams-click-handler]",function(e){var a=c(this),t=a.data("ams-disabled-handlers");if(!0!==t&&"click"!==t&&"all"!==t){var n=a.data();if(n.amsClickHandler){!0!==n.amsStopPropagation&&!0!==n.amsClickStopPropagation||e.stopPropagation(),!0!==n.amsClickKeepDefault&&e.preventDefault();for(var s=n.amsClickHandler.split(/\s+/),i=0;i<s.length;i++){var r=l.getFunctionByName(s[i]);void 0!==r&&r.call(a,e,n.amsClickHandlerOptions)}}}}),c(document).on("change","[data-ams-change-handler]",function(e){var a=c(this);if(!a.prop("readonly")){var t=a.data("ams-disabled-handlers");if(!0!==t&&"change"!==t&&"all"!==t){var n=a.data();if(n.amsChangeHandler){!0!==n.amsStopPropagation&&!0!==n.amsChangeStopPropagation||e.stopPropagation(),!0!==n.amsChangeKeepDefault&&e.preventDefault();for(var s=n.amsChangeHandler.split(/\s+/),i=0;i<s.length;i++){var r=l.getFunctionByName(s[i]);void 0!==r&&r.call(a,e,n.amsChangeHandlerOptions)}}}}}),c(document).on("keydown","textarea",function(e){10!==e.keyCode&&13!==e.keyCode||!e.ctrlKey&&!e.metaKey||c(this).closest("form").submit()}),c(document).on("reset","form",function(e){var n=c(this);setTimeout(function(){c(".alert-danger, SPAN.state-error",n).not(".persistent").remove(),c("LABEL.state-error",n).removeClass("state-error"),c('INPUT.select2[type="hidden"]',n).each(function(){var e=c(this),a=e.data("select2"),t=e.data("ams-select2-input-value");t&&e.select2("val",t.split(a.opts.separator))}),n.find(".select2").trigger("change"),c("[data-ams-reset-callback]",n).each(function(){var e=c(this),a=e.data(),t=l.getFunctionByName(a.amsResetCallback);void 0!==t&&t.call(n,e,a.amsResetCallbackOptions)})},10),l.form.setFocus(n)}),c(document).on("reset","[data-ams-reset-handler]",function(e){var a=c(this),t=a.data();if(t.amsResetHandler){!0!==t.amsResetKeepDefault&&e.preventDefault();var n=l.getFunctionByName(t.amsResetHandler);void 0!==n&&n.call(a,t.amsResetHandlerOptions)}}),c(document).on("click","[data-ams-click-event]",function(e){var a=c(this);c(e.target).trigger(a.data("ams-click-event"),a.data("ams-click-event-options"))}),c(document).on("change",'input[type="file"]',function(e){e.preventDefault();var a=c(this),t=a.parent(".button");t.exists()&&t.parent().hasClass("input-file")&&t.next('input[type="text"]').val(a.val())}),c(document).on("focus",'input[readonly="readonly"]',function(){c(this).blur()}),c(document).on("focusin",function(e){c(e.target).closest(".mce-window").length&&e.stopImmediatePropagation()}),c(document).on("click",".nav-tabs a[data-toggle=tab]",function(e){if(c(this).parent("li").hasClass("disabled"))return e.preventDefault(),!1}),c(document).on("show.bs.dropdown",".btn-group",function(){var e=c(this),a=e.children(".dropdown-menu"),t=e.get(0).getBoundingClientRect(),n=t.top,s=t.height,i=a.outerHeight();i<n&&c(window).height()-n<s+i&&e.addClass("dropup")}).on("hidden.bs.dropdown",".btn-group",function(){c(this).removeClass("dropup")}),c(document).on("show.bs.tab",function(e){var a=c(e.target);a.exists()&&"A"!==a.get(0).tagName&&(a=c("a[href]",a));var t=a.data();if(t&&t.amsUrl){if(t.amsTabLoaded)return;a.append('<i class="fa fa-spin fa-cog margin-left-5"></i>'),l.skin.loadURL(t.amsUrl,a.attr("href"),{afterLoadCallback:function(){t.amsTabLoadOnce&&a.data("ams-tab-loaded",!0),c("i",a).remove()},afterErrorCallback:function(){c("i",a).remove()}})}}),c(document).on("hide.bs.modal",function(e){var a=c(e.target);l.form.confirmChangedForm(a,function(){var e=a.data("modal")||a.data("bs.modal");return e&&(e.isShown=!0),!0},function(){return e.preventDefault(),!1})}),c(document).on("myams.refresh",function(e,a){i.executeFunctionByName(a.handler||i.skin.refreshContent,e.target,a)}),l.initContent(document),l.ajaxNav&&n.exists()&&l.skin.checkURL(),l.form.setFocus(document),c(window).on("beforeunload",l.form.checkBeforeUnload)},i.initContent=function(e){c(".tipsy").remove(),c("[rel=tooltip]",e).tooltip(),c("[rel=popover]",e).popover(),c("[rel=popover-hover]",e).popover({trigger:"hover"}),l.plugins.init(e),l.callbacks.init(e),l.events.init(e),l.form.init(e),"desktop"===l.device?l.skin._initDesktopWidgets(e):l.skin._initMobileWidgets(e),l.skin._setPageHeight()},i.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",LOADING:"Loading...",PROGRESS:"Processing",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",CLIPBOARD_CHARACTER_COPY_OK:"Character copied to clipboard",CLIPBOARD_TEXT_COPY_OK:"Text copied to clipboard",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"},i.plugins.i18n={widgets:{},validate:{},datatables:{},fancybox:{ERROR:"Can't load requested content.",RETRY:"Please check URL or try again later.",CLOSE:"Close",NEXT:"Next",PREVIOUS:"Previous"},dndupload:{FILES_SELECTED:"{count} files selected",CHOOSE_FILE:"Select file(s)",ADD_INFO:"to add them to current folder,",DRAG_FILE:"or drag and drop them here!",UPLOAD:"Upload",UPLOADING:"Uploading&hellip;",DONE:"Done!",UPLOAD_MORE:"Upload more?",ERROR:"Error!",TRY_AGAIN:"Try again?"}},c(document).ready(function(){var e=(c=jQuery.noConflict())("HTML");e.removeClass("no-js").addClass("js");var a=e.attr("lang")||e.attr("xml:lang");a&&!a.startsWith("en")?(i.lang=a,i.getScript(i.baseURL+"i18n/myams_"+a.substr(0,2)+i.devext+".js",function(){i.initPage()})):i.initPage()})}(jQuery,this);