--- a/src/ztfy/myams/resources/js/myams.js Wed Oct 05 17:36:07 2016 +0200
+++ b/src/ztfy/myams/resources/js/myams.js Thu Oct 06 15:44:22 2016 +0200
@@ -60,6 +60,15 @@
/**
+ * JQuery 'hasvalue' expression
+ * Filter inputs containing value
+ */
+ $.expr[":"].hasvalue = function(obj, index, meta /*, stack*/) {
+ return $(obj).val() !== "";
+ };
+
+
+ /**
* JQuery 'econtains' expression
* Case insensitive contains expression
*/
@@ -216,9 +225,9 @@
.off('click')
.on('click', function (e) {
$(this).hide();
- var $invokedOn = $(this).data("invokedOn");
- var $selectedMenu = $(e.target);
- settings.menuSelected.call(this, $invokedOn, $selectedMenu);
+ var invokedOn = $(this).data("invokedOn");
+ var selectedMenu = $(e.target);
+ settings.menuSelected.call(this, invokedOn, selectedMenu);
ams.event.stop(e);
});
return false;
@@ -249,17 +258,17 @@
// Add a mark [+] to a multilevel menu
menu.find("LI").each(function() {
- var menu_item = $(this);
- if (menu_item.find("UL").size() > 0) {
+ var menuItem = $(this);
+ if (menuItem.find("UL").size() > 0) {
// add the multilevel sign next to the link
- menu_item.find("A:first")
+ menuItem.find("A:first")
.append("<b class='collapse-sign'>" + settings.closedSign + "</b>");
// avoid jumping to the top of the page when the href is an #
- var first_link = menu_item.find("A:first");
- if (first_link.attr('href') === "#") {
- first_link.click(function() {
+ var firstLink = menuItem.find("A:first");
+ if (firstLink.attr('href') === "#") {
+ firstLink.click(function() {
return false;
});
}
@@ -268,11 +277,11 @@
// Open active level
menu.find("LI.active").each(function() {
- var active_parent = $(this).parents('UL');
- var active_item = active_parent.parent('LI');
- active_parent.slideDown(settings.speed);
- active_item.find("b:first").html(settings.openedSign);
- active_item.addClass("open");
+ var activeParent = $(this).parents('UL');
+ var activeItem = activeParent.parent('LI');
+ activeParent.slideDown(settings.speed);
+ activeItem.find("b:first").html(settings.openedSign);
+ activeItem.addClass("open");
});
menu.find("LI A").on('click', function() {
@@ -281,7 +290,7 @@
return;
}
var href = link.attr('href').replace(/^#/,'');
- var parent_ul = link.parent().find("UL");
+ var parentUL = link.parent().find("UL");
if (settings.accordion) {
var parents = link.parent().parents("UL");
var visible = menu.find("UL:visible");
@@ -294,24 +303,24 @@
}
});
if (close) {
- if (parent_ul !== visible[visibleIndex]) {
+ if (parentUL !== visible[visibleIndex]) {
var visibleItem = $(visible[visibleIndex]);
if (href || !visibleItem.hasClass('active')) {
visibleItem.slideUp(settings.speed, function () {
$(this).parent("LI")
- .removeClass('open')
- .find("B:first")
- .delay(settings.speed)
- .html(settings.closedSign);
+ .removeClass('open')
+ .find("B:first")
+ .delay(settings.speed)
+ .html(settings.closedSign);
});
}
}
}
});
}
- var first_ul = link.parent().find("UL:first");
- if (!href && first_ul.is(":visible") && !first_ul.hasClass("active")) {
- first_ul.slideUp(settings.speed, function() {
+ var firstUL = link.parent().find("UL:first");
+ if (!href && firstUL.is(":visible") && !firstUL.hasClass("active")) {
+ firstUL.slideUp(settings.speed, function() {
link.parent("LI")
.removeClass("open")
.find("B:first")
@@ -319,7 +328,7 @@
.html(settings.closedSign);
});
} else /*if (link.attr('href') !== location.hash)*/ {
- first_ul.slideDown(settings.speed, function() {
+ firstUL.slideDown(settings.speed, function() {
link.parent("LI")
.addClass("open")
.find("B:first")
@@ -404,14 +413,14 @@
devmode: true,
devext: '',
lang: 'en',
- throttle_delay: 350,
- menu_speed: 235,
- navbar_height: 49,
- ajax_nav: true,
- enable_widgets: true,
- enable_mobile: false,
- enable_fastclick: false,
- warn_on_form_change: false,
+ throttleDelay: 350,
+ menuSpeed: 235,
+ navbarHeight: 49,
+ ajaxNav: true,
+ enableWidgets: true,
+ enableMobile: false,
+ enableFastclick: false,
+ warnOnFormChange: false,
ismobile: (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))
};
}
@@ -661,9 +670,9 @@
if (response.statusText === 'OK') {
return;
}
- var ajax_response = ams.ajax.getResponse(response);
- if (ajax_response.content_type === 'json') {
- ams.ajax.handleJSON(ajax_response.data);
+ var response = ams.ajax.getResponse(response);
+ if (response.contentType === 'json') {
+ ams.ajax.handleJSON(response.data);
} else {
var title = event.statusText || event.type;
var message = response.responseText;
@@ -688,7 +697,7 @@
return;
}
var response = ams.ajax.getResponse(request);
- if (response.content_type === 'json') {
+ if (response.contentType === 'json') {
ams.ajax.handleJSON(response.data);
} else {
ams.skin.messageBox('error', {
@@ -769,8 +778,6 @@
* Handle AJAX upload and download progress
*
* @param event: the source event
- * @param request: the request
- * @param options: AJAX options
*/
progress: function(event) {
if (!event.lengthComputable) {
@@ -829,37 +836,37 @@
* Extract data type and result from response
*/
getResponse: function(request) {
- var content_type = request.getResponseHeader('content-type'),
- data_type,
+ var contentType = request.getResponseHeader('content-type'),
+ dataType,
result;
- if (content_type) {
+ if (contentType) {
// Got server response
- if (content_type.startsWith('application/javascript')) {
- data_type = 'script';
+ if (contentType.startsWith('application/javascript')) {
+ dataType = 'script';
result = request.responseText;
- } else if (content_type.startsWith('text/html')) {
- data_type = 'html';
+ } else if (contentType.startsWith('text/html')) {
+ dataType = 'html';
result = request.responseText;
- } else if (content_type.startsWith('text/xml')) {
- data_type = 'xml';
+ } else if (contentType.startsWith('text/xml')) {
+ dataType = 'xml';
result = request.responseText;
} else {
result = request.responseJSON;
if (result) {
- data_type = 'json';
+ dataType = 'json';
} else {
try {
result = JSON.parse(request.responseText);
- data_type = 'json';
+ dataType = 'json';
} catch (e) {
result = request.responseText;
- data_type = 'text';
+ dataType = 'text';
}
}
}
} else {
// Probably no response from server...
- data_type = 'json';
+ dataType = 'json';
result = {
status: 'alert',
alert: {
@@ -868,7 +875,7 @@
}
};
}
- return {content_type: data_type,
+ return {contentType: dataType,
data: result};
},
@@ -1029,11 +1036,11 @@
timeout: 10000
});
} else {
- var message_status = message.status || 'info';
- if (message_status === 'error' && form && target) {
+ var messageStatus = message.status || 'info';
+ if (messageStatus === 'error' && form && target) {
ams.executeFunctionByName(form.data('ams-form-submit-error') || 'MyAMS.form.finalizeSubmitOnError', form, target);
}
- ams.skin.messageBox(message_status,
+ ams.skin.messageBox(messageStatus,
{title: message.title || ams.i18n.ERROR_OCCURED,
content: message.content,
icon: message.icon,
@@ -1248,7 +1255,7 @@
init: function(element) {
// Activate form changes if required
var forms;
- if (ams.warn_on_form_change) {
+ if (ams.warnOnFormChange) {
forms = $('FORM[data-ams-warn-on-change!="false"]', element);
} else {
forms = $('FORM[data-ams-warn-on-change="true"]', element);
@@ -1359,14 +1366,14 @@
/**
* Submit given form
*/
- submit: function(form, handler, submit_options) {
+ submit: function(form, handler, submitOptions) {
// Check params
form = $(form);
if (!form.exists()) {
return false;
}
if (typeof(handler) === 'object') {
- submit_options = handler;
+ submitOptions = handler;
handler = undefined;
}
// Prevent multiple submits of the same form
@@ -1400,17 +1407,17 @@
function _submitAjaxForm(form, options) {
var button,
- button_data,
- button_target;
+ buttonData,
+ buttonTarget;
var data = form.data();
- var form_options = data.amsFormOptions;
- var form_data;
- var form_data_callback;
-
- var progress_handler;
- var progress_interval;
- var progress_callback;
- var progress_end_callback;
+ var formOptions = data.amsFormOptions;
+ var formData;
+ var formDataCallback;
+
+ var progressHandler;
+ var progressInterval;
+ var progressCallback;
+ var progressEndCallback;
// Inner progress status handler
function _getProgress(handler, progress_id) {
@@ -1420,14 +1427,14 @@
function _clearProgressStatus() {
button.button('reset');
clearInterval(interval);
- ams.executeFunctionByName(progress_end_callback, form, button);
+ ams.executeFunctionByName(progressEndCallback, form, button);
}
function _getProgressStatus() {
ams.ajax.post(handler,
{progress_id: progress_id},
{error: _clearProgressStatus},
- ams.getFunctionByName(progress_callback) || function(result, status) {
+ ams.getFunctionByName(progressCallback) || function(result, status) {
if (status == 'success') {
if (result.status === 'running') {
if (result.message) {
@@ -1446,24 +1453,24 @@
}
button.button('loading');
- interval = setInterval(_getProgressStatus, progress_interval);
+ interval = setInterval(_getProgressStatus, progressInterval);
}
// Initialize form data
- if (submit_options) {
- form_data_callback = submit_options.formDataInitCallback;
+ if (submitOptions) {
+ formDataCallback = submitOptions.formDataInitCallback;
}
- if (form_data_callback) {
- delete submit_options.formDataInitCallback;
+ if (formDataCallback) {
+ delete submitOptions.formDataInitCallback;
} else {
- form_data_callback = data.amsFormDataInitCallback;
+ formDataCallback = data.amsFormDataInitCallback;
}
- if (form_data_callback) {
+ if (formDataCallback) {
var veto = {};
- if (typeof(form_data_callback) === 'function') {
- form_data = form_data_callback.call(form, veto);
+ if (typeof(formDataCallback) === 'function') {
+ formData = formDataCallback.call(form, veto);
} else {
- form_data = ams.executeFunctionByName(form_data_callback, form, veto);
+ formData = ams.executeFunctionByName(formDataCallback, form, veto);
}
if (veto.veto) {
button = form.data('ams-submit-button');
@@ -1474,44 +1481,44 @@
return false;
}
} else {
- form_data = data.amsFormData || {};
+ formData = data.amsFormData || {};
}
// Check submit button for custom action handler and target
button = $(form.data('ams-submit-button'));
if (button && button.exists()) {
- button_data = button.data();
- button_target = button_data.amsFormSubmitTarget;
+ buttonData = button.data();
+ buttonTarget = buttonData.amsFormSubmitTarget;
} else {
- button_data = {};
+ buttonData = {};
}
// Check action URL
var url;
- var form_handler = handler || button_data.amsFormHandler || data.amsFormHandler || '';
- if (form_handler.startsWith(window.location.protocol)) {
- url = form_handler;
+ var formHandler = handler || buttonData.amsFormHandler || data.amsFormHandler || '';
+ if (formHandler.startsWith(window.location.protocol)) {
+ url = formHandler;
} else {
- var action = button_data.amsFormAction || form.attr('action').replace(/#/, '');
+ var action = buttonData.amsFormAction || form.attr('action').replace(/#/, '');
if (action.startsWith(window.location.protocol)) {
url = action;
} else {
url = ams.ajax.getAddr() + action;
}
- url += form_handler;
+ url += formHandler;
}
- progress_handler = button_data.amsProgressHandler || data.amsProgressHandler || '';
- progress_interval = button_data.amsProgressInterval || data.amsProgressInterval || 1000;
- progress_callback = button_data.amsProgressCallback || data.amsProgressCallback;
- progress_end_callback = button_data.amsProgressEndCallback || data.amsProgressEndCallback;
+ progressHandler = buttonData.amsProgressHandler || data.amsProgressHandler || '';
+ progressInterval = buttonData.amsProgressInterval || data.amsProgressInterval || 1000;
+ progressCallback = buttonData.amsProgressCallback || data.amsProgressCallback;
+ progressEndCallback = buttonData.amsProgressEndCallback || data.amsProgressEndCallback;
// Initialize submit target with AJAX indicator
var target = null;
- if (submit_options && submit_options.initSubmitTarget) {
- ams.executeFunctionByName(submit_options.initSubmitTarget, form);
+ if (submitOptions && submitOptions.initSubmitTarget) {
+ ams.executeFunctionByName(submitOptions.initSubmitTarget, form);
} else {
if (data.amsFormInitSubmitTarget) {
- target = $(button_target || data.amsFormSubmitTarget || '#content');
+ target = $(buttonTarget || data.amsFormSubmitTarget || '#content');
ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmit', form, target);
} else if (!data.amsFormHideSubmitFooter) {
ams.executeFunctionByName(data.amsFormInitSubmit || 'MyAMS.form.initSubmitFooter', form);
@@ -1519,14 +1526,14 @@
}
// Complete form data
- if (submit_options) {
- form_data = $.extend({}, form_data, submit_options.form_data);
+ if (submitOptions) {
+ formData = $.extend({}, formData, submitOptions.form_data);
}
// Check progress handler
var hasUpload;
- if (progress_handler) {
- form_data.progress_id = ams.generateUUID();
+ if (progressHandler) {
+ formData.progress_id = ams.generateUUID();
} else {
// Check progress meter via Apache progress module
hasUpload = typeof(options.uuid) !== 'undefined';
@@ -1543,7 +1550,7 @@
url: url,
type: 'post',
cache: false,
- data: form_data,
+ data: formData,
dataType: data.amsFormDatatype,
beforeSerialize: function(/*form, options*/) {
if (typeof(globals.tinyMCE) !== 'undefined') {
@@ -1563,12 +1570,12 @@
};
// Initialize IFrame for custom download target
- var download_target = (submit_options && submit_options.downloadTarget) || data.amsFormDownloadTarget;
- if (download_target) {
- var iframe = $('iframe[name="' + download_target + '"]');
+ var downloadTarget = (submitOptions && submitOptions.downloadTarget) || data.amsFormDownloadTarget;
+ if (downloadTarget) {
+ var iframe = $('iframe[name="' + downloadTarget + '"]');
if (!iframe.exists()) {
iframe = $('<iframe></iframe>').hide()
- .attr('name', download_target)
+ .attr('name', downloadTarget)
.appendTo($('body'));
}
defaults = $.extend({}, defaults, {
@@ -1623,21 +1630,21 @@
iframe: hasUpload
});
}
- var settings = $.extend({}, defaults, options, form_options, submit_options);
+ var settings = $.extend({}, defaults, options, formOptions, submitOptions);
// Initialize progress handler
- if (progress_handler) {
- _getProgress(progress_handler, form_data.progress_id);
+ if (progressHandler) {
+ _getProgress(progressHandler, formData.progress_id);
}
// Submit form
$(form).ajaxSubmit(settings);
// If external download target is specified, reset form submit button and footer
- if (download_target) {
+ if (downloadTarget) {
var modal = $(form).parents('.modal-dialog');
- var keep_modal = modal.exists() && button.exists() && button.data('ams-keep-modal');
- if (modal.exists() && (keep_modal !== true)) {
+ var keepModal = modal.exists() && button.exists() && button.data('ams-keep-modal');
+ if (modal.exists() && (keepModal !== true)) {
ams.dialog.close(form);
} else {
setTimeout(function() {
@@ -1780,13 +1787,13 @@
}
var data = form.data();
- var data_type;
+ var dataType;
if (data.amsFormDatatype) {
- data_type = data.amsFormDatatype;
+ dataType = data.amsFormDatatype;
} else {
- var request_data = ams.ajax.getResponse(request);
- data_type = request_data.content_type;
- result = request_data.data;
+ var response = ams.ajax.getResponse(request);
+ dataType = response.contentType;
+ result = response.data;
}
var target;
@@ -1796,7 +1803,7 @@
target = $(data.amsFormSubmitTarget || '#content');
}
- switch (data_type) {
+ switch (dataType) {
case 'json':
ams.ajax.handleJSON(result, form, target);
break;
@@ -1837,9 +1844,9 @@
*/
_getSubmitValidators: function(form) {
var validators = [];
- var form_validator = form.data('ams-form-validator');
- if (form_validator) {
- validators.push([form, form_validator]);
+ var formValidator = form.data('ams-form-validator');
+ if (formValidator) {
+ validators.push([form, formValidator]);
}
$('[data-ams-form-validator]', form).each(function() {
var source = $(this);
@@ -1868,11 +1875,11 @@
var validator = validators[index];
var source = validator[0];
var handler = validator[1];
- var validator_result = ams.executeFunctionByName(handler, form, source);
- if (validator_result === false) {
+ var validatorResult = ams.executeFunctionByName(handler, form, source);
+ if (validatorResult === false) {
result = false;
- } else if (typeof(validator_result) === 'string') {
- output.push(validator_result);
+ } else if (typeof(validatorResult) === 'string') {
+ output.push(validatorResult);
} else if (result.length && (result.length > 0)) {
output = output.concat(result);
}
@@ -1925,22 +1932,22 @@
if (errors.widgets) {
for (index = 0; index < errors.widgets.length; index++) {
// set widget status message
- var widget_data = errors.widgets[index];
- var widget = $('[name="' + widget_data.name + '"]', form);
+ var widgetData = errors.widgets[index];
+ var widget = $('[name="' + widgetData.name + '"]', form);
widget.parents('label:first')
.removeClassPrefix('state-')
.addClass('state-error')
- .after('<span for="name" class="state-error">' + widget_data.message + '</span>');
+ .after('<span for="name" class="state-error">' + widgetData.message + '</span>');
// complete form alert message
- if (widget_data.label) {
- message.push(widget_data.label + ' : ' + widget_data.message);
+ if (widgetData.label) {
+ message.push(widgetData.label + ' : ' + widgetData.message);
}
// mark parent tab (if any) with error status
- var tab_index = widget.parents('.tab-pane').index() + 1;
- if (tab_index > 0) {
- var nav_tabs = $('.nav-tabs', $(widget).parents('.tabforms'));
- $('li:nth-child(' + tab_index + ')', nav_tabs).removeClassPrefix('state-')
- .addClass('state-error');
+ var tabIndex = widget.parents('.tab-pane').index() + 1;
+ if (tabIndex > 0) {
+ var navTabs = $('.nav-tabs', $(widget).parents('.tabforms'));
+ $('li:nth-child(' + tabIndex + ')', navTabs).removeClassPrefix('state-')
+ .addClass('state-error');
$('li.state-error:first a', form).click();
}
}
@@ -2034,14 +2041,14 @@
'</div>';
}
- var source_data;
+ var sourceData;
var url;
if (typeof(source) === 'string') {
- source_data = {};
+ sourceData = {};
url = source;
} else {
- source_data = source.data();
- url = source.attr('href') || source_data.amsUrl;
+ sourceData = source.data();
+ url = source.attr('href') || sourceData.amsUrl;
var url_getter = ams.getFunctionByName(url);
if (typeof(url_getter) === 'function') {
url = url_getter.call(source);
@@ -2059,14 +2066,14 @@
$.ajax({
url: url,
type: 'get',
- cache: source_data.amsAllowCache === undefined ? false : source_data.amsAllowCache,
+ cache: sourceData.amsAllowCache === undefined ? false : sourceData.amsAllowCache,
data: options,
success: function(data, status, request) {
$('body').modalmanager('removeLoading');
- var request_data = ams.ajax.getResponse(request);
- var data_type = request_data.content_type;
- var result = request_data.data;
- switch (data_type) {
+ var response = ams.ajax.getResponse(request);
+ var dataType = response.contentType;
+ var result = response.data;
+ switch (dataType) {
case 'json':
ams.ajax.handleJSON(result, $($(source).data('ams-json-target') || '#content'));
break;
@@ -2081,27 +2088,27 @@
default:
var content = $(result);
var dialog = $('.modal-dialog', content.wrap('<div></div>').parent());
- var dialog_data = dialog.data();
- var data_options = {
+ var dialogData = dialog.data();
+ var dataOptions = {
backdrop: 'static',
- overflow: dialog_data.amsModalOverflow || '.modal-viewport',
- maxHeight: dialog_data.amsModalMaxHeight === undefined ?
+ overflow: dialogData.amsModalOverflow || '.modal-viewport',
+ maxHeight: dialogData.amsModalMaxHeight === undefined ?
function() {
return $(window).height() -
$('.modal-header', content).outerHeight(true) -
$('footer', content).outerHeight(true) - 85;
}
- : ams.getFunctionByName(dialog_data.amsModalMaxHeight)
+ : ams.getFunctionByName(dialogData.amsModalMaxHeight)
};
- var settings = $.extend({}, data_options, dialog_data.amsModalOptions);
- settings = ams.executeFunctionByName(dialog_data.amsModalInitCallback, dialog, settings) || settings;
+ var settings = $.extend({}, dataOptions, dialogData.amsModalOptions);
+ settings = ams.executeFunctionByName(dialogData.amsModalInitCallback, dialog, settings) || settings;
$('<div>').addClass('modal fade')
.append(content)
.modal(settings)
.on('shown', ams.dialog.shown)
.on('hidden', ams.dialog.hidden);
ams.initContent(content);
- if (source_data.amsLogEvent !== false) {
+ if (sourceData.amsLogEvent !== false) {
ams.stats.logPageview(url);
}
}
@@ -2120,14 +2127,14 @@
function resetViewport(ev) {
var top = $('.scrollmarker.top', viewport);
- var top_position = viewport.scrollTop();
- if (top_position > 0) {
+ var topPosition = viewport.scrollTop();
+ if (topPosition > 0) {
top.show();
} else {
top.hide();
}
var bottom = $('.scrollmarker.bottom', viewport);
- if (maxHeight + top_position >= viewport.get(0).scrollHeight) {
+ if (maxHeight + topPosition >= viewport.get(0).scrollHeight) {
bottom.hide();
} else {
bottom.show();
@@ -2314,18 +2321,18 @@
/** Context menu handler */
contextMenuHandler: function(target, menu) {
- var menu_data = menu.data();
- if (menu_data.toggle === 'modal') {
+ var menuData = menu.data();
+ if (menuData.toggle === 'modal') {
ams.dialog.open(menu);
} else {
- var href = menu.attr('href') || menu_data.amsUrl;
+ var href = menu.attr('href') || menuData.amsUrl;
if (!href || href.startsWith('javascript') || menu.attr('target')) {
return;
}
ams.event.stop();
- var href_getter = ams.getFunctionByName(href);
- if (typeof(href_getter) === 'function') {
- href = href_getter.call(menu, target);
+ var hrefGetter = ams.getFunctionByName(href);
+ if (typeof(hrefGetter) === 'function') {
+ href = hrefGetter.call(menu, target);
}
if (typeof(href) === 'function') {
// Javascript function call
@@ -2436,26 +2443,26 @@
$('[data-ams-plugins]', element).each(function() {
var source = $(this);
- var ams_plugins = source.data('ams-plugins');
- if (typeof(ams_plugins) === 'string') {
+ var amsPlugins = source.data('ams-plugins');
+ if (typeof(amsPlugins) === 'string') {
var names = source.data('ams-plugins').split(/\s+/);
for (var index = 0; index < names.length; index++) {
name = names[index];
- var new_plugin = {
+ var newPlugin = {
src: source.data('ams-plugin-' + name + '-src'),
css: source.data('ams-plugin-' + name + '-css'),
callback: source.data('ams-plugin-' + name + '-callback'),
register: source.data('ams-plugin-' + name + '-register'),
async: source.data('ams-plugin-' + name + '-async')
};
- _registerPlugin(name, new_plugin);
+ _registerPlugin(name, newPlugin);
}
} else {
- for (name in ams_plugins) {
- if (!ams_plugins.hasOwnProperty(name)) {
+ for (name in amsPlugins) {
+ if (!amsPlugins.hasOwnProperty(name)) {
continue;
}
- _registerPlugin(name, ams_plugins[name]);
+ _registerPlugin(name, amsPlugins[name]);
}
}
});
@@ -2511,8 +2518,8 @@
callbacks(element);
break;
default:
- for (var cb_index = 0; cb_index < callbacks.length; cb_index++) {
- var callback = callbacks[cb_index];
+ for (var cbIndex = 0; cbIndex < callbacks.length; cbIndex++) {
+ var callback = callbacks[cbIndex];
if (typeof(callback) === 'function') {
callback(element);
}
@@ -2530,12 +2537,12 @@
*/
initData: function(element) {
$('[data-ams-data]', element).each(function() {
- var data_element = $(this);
- var data = data_element.data('ams-data');
+ var dataElement = $(this);
+ var data = dataElement.data('ams-data');
if (data) {
for (var name in data) {
if (data.hasOwnProperty(name)) {
- data_element.attr('data-' + name, data[name]);
+ dataElement.attr('data-' + name, data[name]);
}
}
}
@@ -2621,7 +2628,7 @@
hints.each(function () {
var hint = $(this);
var data = hint.data();
- var data_options = {
+ var dataOptions = {
html: data.amsHintHtml,
title: ams.getFunctionByName(data.amsHintTitleGetter) || function () {
var hint = $(this);
@@ -2633,7 +2640,7 @@
gravity: data.amsHintGravity || 'sw',
offset: data.amsHintOffset || 0
};
- var settings = $.extend({}, data_options, data.amsHintOptions);
+ 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);
@@ -2651,11 +2658,11 @@
menus.each(function() {
var menu = $(this);
var data = menu.data();
- var data_options = {
+ var dataOptions = {
menuSelector: data.amsContextmenuSelector,
menuSelected: ams.helpers.contextMenuHandler
};
- var settings = $.extend({}, data_options, data.amsContextmenuOptions);
+ 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);
@@ -2724,7 +2731,7 @@
if (!data.amsChecker) {
var checker = $('<label class="checkbox"></label>');
var fieldname = data.amsCheckerFieldname || ('checker_'+ams.generateId());
- var checkbox_id = fieldname.replace(/\./, '_');
+ var checkboxId = fieldname.replace(/\./, '_');
var prefix = data.amsCheckerHiddenPrefix;
var hidden = null;
var checkedValue = data.amsCheckerHiddenValueOn || 'true';
@@ -2740,7 +2747,7 @@
.prependTo(legend);
}
var input = $('<input type="checkbox">').attr('name', fieldname)
- .attr('id', checkbox_id)
+ .attr('id', checkboxId)
.data('ams-checker-hidden-input', hidden)
.data('ams-checker-init', true)
.val(data.amsCheckerValue || true)
@@ -2820,8 +2827,8 @@
sliders.each(function() {
var slider = $(this);
var data = slider.data();
- var data_options = {};
- var settings = $.extend({}, data_options, slider.data.amsSliderOptions);
+ 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);
@@ -2839,13 +2846,13 @@
draggables.each(function() {
var draggable = $(this);
var data = draggable.data();
- var data_options = {
+ var dataOptions = {
containment: data.amsDraggableContainment,
helper: ams.getFunctionByName(data.amsDraggableHelper) || data.amsDraggableHelper,
start: ams.getFunctionByName(data.amsDraggableStart),
stop: ams.getFunctionByName(data.amsDraggableStop)
};
- var settings = $.extend({}, data_options, data.amsDraggableOptions);
+ var settings = $.extend({}, dataOptions, data.amsDraggableOptions);
settings = ams.executeFunctionByName(data.amsDraggableInitCallback, draggable, settings) || settings;
var plugin = draggable.draggable(settings);
draggable.disableSelection();
@@ -2863,7 +2870,7 @@
sortables.each(function() {
var sortable = $(this);
var data = sortable.data();
- var data_options = {
+ var dataOptions = {
items: data.amsSortableItems,
handle: data.amsSortableHandle,
connectWith: data.amsSortableConnectwith,
@@ -2873,7 +2880,7 @@
placeholder: data.amsSortablePlaceholder,
stop: ams.getFunctionByName(data.amsSortableStop)
};
- var settings = $.extend({}, data_options, data.amsSortableOptions);
+ var settings = $.extend({}, dataOptions, data.amsSortableOptions);
settings = ams.executeFunctionByName(data.amsSortableInitCallback, sortable, settings) || settings;
var plugin = sortable.sortable(settings);
sortable.disableSelection();
@@ -2891,7 +2898,7 @@
resizables.each(function() {
var resizable = $(this);
var data = resizable.data();
- var data_options = {
+ var dataOptions = {
autoHide: data.amsResizableAutohide === false ? true : data.amsResizableAutohide,
containment: data.amsResizableContainment,
grid: data.amsResizableGrid,
@@ -2899,7 +2906,7 @@
start: ams.getFunctionByName(data.amsResizableStart),
stop: ams.getFunctionByName(data.amsResizableStop)
};
- var settings = $.extend({}, data_options, data.amsResizableOptions);
+ var settings = $.extend({}, dataOptions, data.amsResizableOptions);
settings = ams.executeFunctionByName(data.amsResizableInitCallback, resizable, settings) || settings;
var plugin = resizable.resizable(settings);
resizable.disableSelection();
@@ -2920,8 +2927,8 @@
typeaheads.each(function() {
var input = $(this);
var data = input.data();
- var data_options = {};
- var settings = $.extend({}, data_options, data.amsTypeaheadOptions);
+ 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);
@@ -2942,7 +2949,7 @@
selects.each(function() {
var select = $(this);
var data = select.data();
- var data_options = {
+ var dataOptions = {
placeholder: data.amsSelect2Placeholder,
multiple: data.amsSelect2Multiple,
minimumInputLength: data.amsSelect2MinimumInputLength || 0,
@@ -3010,14 +3017,14 @@
switch (select.context.type) {
case 'text':
case 'hidden':
- if (!data_options.initSelection) {
- var values_data = select.data('ams-select2-values');
- if (values_data) {
- data_options.initSelection = function(element, callback) {
+ if (!dataOptions.initSelection) {
+ var valuesData = select.data('ams-select2-values');
+ if (valuesData) {
+ dataOptions.initSelection = function(element, callback) {
var data = [];
- $(element.val().split(data_options.separator)).each(function() {
+ $(element.val().split(dataOptions.separator)).each(function() {
data.push({id: this,
- text: values_data[this] || this});
+ text: valuesData[this] || this});
});
callback(data);
};
@@ -3030,17 +3037,17 @@
if (select.attr('readonly')) {
if (select.attr('type') === 'hidden') {
- data_options.query = function () {
+ dataOptions.query = function () {
return [];
};
}
} else if (data.amsSelect2Query) {
// Custom query method
- data_options.query = ams.getFunctionByName(data.amsSelect2Query);
- data_options.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+ dataOptions.query = ams.getFunctionByName(data.amsSelect2Query);
+ dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
} else if (data.amsSelect2QueryUrl) {
// AJAX query
- data_options.ajax = {
+ dataOptions.ajax = {
url: data.amsSelect2QueryUrl,
quietMillis: data.amsSelect2QuietMillis || 200,
type: data.amsSelect2QueryType || 'POST',
@@ -3054,10 +3061,10 @@
},
results: ams.helpers.select2QueryUrlResultsCallback
};
- data_options.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+ dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
} else if (data.amsSelect2QueryMethod) {
// JSON-RPC query
- data_options.query = function(options) {
+ dataOptions.query = function(options) {
var settings = {
url: data.amsSelect2MethodTarget || ams.jsonrpc.getAddr(),
type: data.amsSelect2MethodType || 'POST',
@@ -3075,28 +3082,28 @@
settings = $.extend({}, settings, data.amsSelect2QueryOptions);
settings = ams.executeFunctionByName(data.amsSelect2QueryInitCallback, select, settings) || settings;
ams.ajax.check($.jsonRpc,
- ams.baseURL + 'ext/jquery-jsonrpc' + (ams.devmode ? '.js' : '.min.js'),
+ ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
function() {
$.jsonRpc(settings);
});
};
- data_options.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
+ dataOptions.minimumInputLength = data.amsSelect2MinimumInputLength || 1;
} else if (data.amsSelect2Tags) {
// Tags mode
- data_options.tags = data.amsSelect2Tags;
+ dataOptions.tags = data.amsSelect2Tags;
} else if (data.amsSelect2Data) {
// Provided data mode
- data_options.data = data.amsSelect2Data;
+ dataOptions.data = data.amsSelect2Data;
}
if (data.amsSelect2EnableFreeTags) {
- data_options.createSearchChoice = function(term) {
+ dataOptions.createSearchChoice = function(term) {
return {id: term,
text: (data.amsSelect2FreeTagsPrefix || ams.i18n.SELECT2_FREETAG_PREFIX) + term};
};
}
- var settings = $.extend({}, data_options, data.amsSelect2Options);
+ 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);
@@ -3133,11 +3140,11 @@
masks.each(function() {
var mask = $(this);
var data = mask.data();
- var data_options = {
+ var dataOptions = {
placeholder: data.amsMaskeditPlaceholder === undefined ? 'X' : data.amsMaskeditPlaceholder,
complete: ams.getFunctionByName(data.amsMaskeditComplete)
};
- var settings = $.extend({}, data_options, data.amsMaskeditOptions);
+ 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);
@@ -3163,15 +3170,15 @@
masks.each(function() {
var input = $(this);
var data = input.data();
- var data_options;
+ var dataOptions;
if (typeof(data.inputMask) === 'object') {
- data_options = data.inputMask;
+ dataOptions = data.inputMask;
} else {
- data_options = {
+ dataOptions = {
mask: data.inputMask.toString()
};
}
- var settings = $.extend({}, data_options, data.amsInputmaskOptions);
+ 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);
@@ -3196,14 +3203,14 @@
datepickers.each(function() {
var input = $(this);
var data = input.data();
- var data_options = {
+ var dataOptions = {
lang: data.amsDatetimepickerLang || ams.lang,
format: data.amsDatetimepickerFormat || 'd/m/y',
datepicker: true,
dayOfWeekStart: 1,
timepicker: false
};
- var settings = $.extend({}, data_options, data.amsDatetimepickerOptions);
+ 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);
@@ -3228,14 +3235,14 @@
datetimepickers.each(function() {
var input = $(this);
var data = input.data();
- var data_options = {
+ var dataOptions = {
lang: data.amsDatetimepickerLang || ams.lang,
format: data.amsDatetimepickerFormat || 'd/m/y H:i',
datepicker: true,
dayOfWeekStart: 1,
timepicker: true
};
- var settings = $.extend({}, data_options, data.amsDatetimepickerOptions);
+ 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);
@@ -3260,13 +3267,13 @@
timepickers.each(function() {
var input = $(this);
var data = input.data();
- var data_options = {
+ var dataOptions = {
lang: data.amsDatetimepickerLang || ams.lang,
format: data.amsDatetimepickerFormat || 'H:i',
datepicker: false,
timepicker: true
};
- var settings = $.extend({}, data_options, data.amsDatetimepickerOptions);
+ 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);
@@ -3290,10 +3297,10 @@
colorpickers.each(function() {
var input = $(this);
var data = input.data();
- var data_options = {
+ var dataOptions = {
position: data.amsColorpickerPosition || input.closest('label.input').data('ams-colorpicker-position') || 'bottom left'
};
- var settings = $.extend({}, data_options, data.amsColorpickerOptions);
+ 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);
@@ -3347,7 +3354,7 @@
forms.each(function() {
var form = $(this);
var data = form.data();
- var data_options = {
+ var dataOptions = {
ignore: null,
submitHandler: form.attr('data-async') !== undefined ?
data.amsFormSubmitHandler === undefined ?
@@ -3369,13 +3376,13 @@
$('.state-error', form).removeClass('state-error');
for (var index=0; index < validator.errorList.length; index++) {
var error = validator.errorList[index];
- var tab_index = $(error.element).parents('.tab-pane').index() + 1;
- if (tab_index > 0) {
- var nav_tabs = $('.nav-tabs', $(error.element).parents('.tabforms'));
- $('li:nth-child(' + tab_index + ')', nav_tabs)
+ 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', nav_tabs).click();
+ $('li.state-error:first a', navTabs).click();
}
}
}
@@ -3384,11 +3391,11 @@
};
$('[data-ams-validate-rules]', form).each(function(index) {
if (index === 0) {
- data_options.rules = {};
+ dataOptions.rules = {};
}
- data_options.rules[$(this).attr('name')] = $(this).data('ams-validate-rules');
+ dataOptions.rules[$(this).attr('name')] = $(this).data('ams-validate-rules');
});
- var settings = $.extend({}, data_options, data.amsValidateOptions);
+ 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);
@@ -3435,24 +3442,35 @@
var sortings = sorting.split(';');
sorting = [];
for (index=0; index < sortings.length; index++) {
- var col_sorting = sortings[index].split(',');
- col_sorting[0] = parseInt(col_sorting[0]);
- sorting.push(col_sorting);
+ 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 = sortable;
+ columns[index] = column;
}
}
// Check columns types
- var columns = [];
- var sort_types = $('th', table).listattr('data-ams-datatable-stype');
- for (index=0; index < sort_types.length; index++) {
- var sort_type = sort_types[index];
- if (sort_type) {
- var column = columns[index] || {};
- column.sType = sort_type;
+ 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;
}
}
// Set options
- var data_options = {
+ var dataOptions = {
bJQueryUI: false,
bFilter: data.amsDatatableGlobalFilter !== false || extensions.indexOf('columnfilter') >= 0,
bPaginate: data.amsDatatablePagination !== false,
@@ -3468,10 +3486,11 @@
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>');
+ .html((ams.plugins.i18n.datatables.sColumns || "Columns") +
+ ' <i class="fa fa-fw fa-caret-down"></i>');
}
};
- var settings = $.extend({}, data_options, data.amsDatatableOptions);
+ var settings = $.extend({}, dataOptions, data.amsDatatableOptions);
if (extensions.length > 0) {
for (index=0; index < extensions.length; index++) {
switch (extensions[index]) {
@@ -3494,11 +3513,11 @@
case 'colvis':
ams.ajax.check($.fn.dataTable.ColVis,
ams.baseURL + 'ext/jquery-dataTables-colVis' + ams.devext + '.js');
- var cv_default = {
+ var cvDefault = {
activate: 'click',
sAlign: 'right'
};
- settings.oColVis = $.extend({}, cv_default, data.amsDatatableColvisOptions);
+ settings.oColVis = $.extend({}, cvDefault, data.amsDatatableColvisOptions);
break;
case 'editable':
ams.ajax.check($.fn.editable,
@@ -3543,67 +3562,67 @@
for (index=0; index < extensions.length; index++) {
switch (extensions[index]) {
case 'autofill':
- var af_settings = $.extend({}, data.amsDatatableAutofillOptions, settings.autofill);
- af_settings = ams.executeFunctionByName(data.amsDatatableAutofillInitCallback, table, af_settings) || af_settings;
+ 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, af_settings)
- : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, af_settings));
+ new $.fn.dataTable.AutoFill(table, afSettings)
+ : ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, afSettings));
break;
case 'columnfilter':
- var cf_default = {
+ var cfDefault = {
sPlaceHolder: 'head:after'
};
- var cf_settings = $.extend({}, cf_default, data.amsDatatableColumnfilterOptions, settings.columnfilter);
- cf_settings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cf_settings) || cf_settings;
+ 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(cf_settings)
- : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cf_settings));
+ plugin.columnFilter(cfSettings)
+ : ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cfSettings));
break;
case 'editable':
- var ed_settings = $.extend({}, data.amsDatatableEditableOptions, settings.editable);
- ed_settings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, ed_settings) || ed_settings;
+ var edSettings = $.extend({}, data.amsDatatableEditableOptions, settings.editable);
+ edSettings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, edSettings) || edSettings;
table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ?
- table.makeEditable(ed_settings)
- : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, ed_settings));
+ table.makeEditable(edSettings)
+ : ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, edSettings));
break;
case 'fixedcolumns':
- var fc_settings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns);
- fc_settings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fc_settings) || fc_settings;
+ 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, fc_settings)
- : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fc_settings));
+ new $.fn.dataTable.FixedColumns(table, fcSettings)
+ : ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fcSettings));
break;
case 'fixedheader':
- var fh_settings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader);
- fh_settings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fh_settings) || fh_settings;
+ 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, fh_settings)
- : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fh_settings));
+ new $.fn.dataTable.FixedHeader(table, fhSettings)
+ : ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fhSettings));
break;
case 'keytable':
- var kt_default = {
+ var ktDefault = {
table: table.get(0),
datatable: plugin
};
- var kt_settings = $.extend({}, kt_default, data.amsDatatableKeytableOptions, settings.keytable);
- kt_settings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, kt_settings) || kt_settings;
+ 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(kt_settings)
- : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, kt_settings));
+ new KeyTable(ktSettings)
+ : ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, ktSettings));
break;
case 'rowgrouping':
- var rg_settings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping);
- rg_settings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rg_settings) || rg_settings;
+ var rgSettings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping);
+ rgSettings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rgSettings) || rgSettings;
table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ?
- table.rowGrouping(rg_settings)
- : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rg_settings));
+ table.rowGrouping(rgSettings)
+ : ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rgSettings));
break;
case 'rowreordering':
- var rr_settings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering);
- rr_settings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rr_settings) || rr_settings;
+ var rrSettings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering);
+ rrSettings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rrSettings) || rrSettings;
table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ?
- table.rowReordering(rr_settings)
- : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rr_settings));
+ table.rowReordering(rrSettings)
+ : ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rrSettings));
break;
default:
break;
@@ -3644,7 +3663,7 @@
$(this.cells[0]).removeClass('drag-handle');
});
}
- var data_options = {
+ var dataOptions = {
onDragClass: data.amsTabledndDragClass || 'dragging-row',
onDragStart: ams.getFunctionByName(data.amsTabledndDragStart),
dragHandle: data.amsTabledndDragHandle,
@@ -3657,14 +3676,14 @@
$(row).data('ams-disabled-handlers', 'click');
var rows = [];
$(dnd_table.rows).each(function() {
- var row_id = $(this).data('ams-element-name');
- if (row_id) {
- rows.push(row_id);
+ var rowId = $(this).data('ams-element-name');
+ if (rowId) {
+ rows.push(rowId);
}
});
- var local_target = ams.getFunctionByName(target);
- if (typeof(local_target) === 'function') {
- local_target.call(table, dnd_table, rows);
+ var localTarget = ams.getFunctionByName(target);
+ if (typeof(localTarget) === 'function') {
+ localTarget.call(table, dnd_table, rows);
} else {
ams.ajax.post(target, {names: JSON.stringify(rows)});
}
@@ -3676,7 +3695,7 @@
return false;
}
};
- var settings = $.extend({}, data_options, data.amsTabledndOptions);
+ 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);
@@ -3701,7 +3720,7 @@
var image = $(this);
var data = image.data();
var parent = data.amsImgareaselectParent ? image.parents(data.amsImgareaselectParent) : 'body';
- var data_options = {
+ var dataOptions = {
instance: true,
handles: true,
parent: parent,
@@ -3722,7 +3741,7 @@
$('input[name="' + target + 'y2"]', parent).val(selection.y2);
}
};
- var settings = $.extend({}, data_options, data.amsImgareaselectOptions);
+ 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);
@@ -3772,7 +3791,7 @@
}
}
}
- var data_options = {
+ var dataOptions = {
type: data.amsFancyboxType,
padding: data.amsFancyboxPadding || 10,
margin: data.amsFancyboxMargin || 10,
@@ -3785,7 +3804,7 @@
}
}
};
- var settings = $.extend({}, data_options, data.amsFancyboxOptions);
+ var settings = $.extend({}, dataOptions, data.amsFancyboxOptions);
settings = ams.executeFunctionByName(data.amsFancyboxInitCallback, fancybox, settings) || settings;
var plugin = fancybox.fancybox(settings);
ams.executeFunctionByName(data.amsFancyboxAfterInitCallback, fancybox, plugin, settings);
@@ -3827,10 +3846,10 @@
scrollbars.each(function() {
var scrollbar = $(this);
var data = scrollbar.data();
- var data_options = {
+ var dataOptions = {
theme: data.amsScrollbarTheme || 'light'
};
- var settings = $.extend({}, data_options, data.amsScrollbarOptions);
+ 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);
@@ -3920,16 +3939,16 @@
*/
messageBox: function(options) {
var data = $(this).data();
- var data_options = $.extend({}, options, data.amsMessageboxOptions);
- var settings = $.extend({}, data_options, {
- title: data.amsMessageboxTitle || data_options.title || '',
- content: data.amsMessageboxContent || data_options.content || '',
- icon: data.amsMessageboxIcon || data_options.icon,
- number: data.amsMessageboxNumber || data_options.number,
- timeout: data.amsMessageboxTimeout || data_options.timeout
+ var dataOptions = $.extend({}, options, data.amsMessageboxOptions);
+ var settings = $.extend({}, dataOptions, {
+ title: data.amsMessageboxTitle || dataOptions.title || '',
+ content: data.amsMessageboxContent || dataOptions.content || '',
+ icon: data.amsMessageboxIcon || dataOptions.icon,
+ number: data.amsMessageboxNumber || dataOptions.number,
+ timeout: data.amsMessageboxTimeout || dataOptions.timeout
});
- var status = data.amsMessageboxStatus || data_options.status || 'info';
- var callback = ams.getFunctionByName(data.amsMessageboxCallback || data_options.callback);
+ var status = data.amsMessageboxStatus || dataOptions.status || 'info';
+ var callback = ams.getFunctionByName(data.amsMessageboxCallback || dataOptions.callback);
ams.skin.messageBox(status, settings, callback);
},
@@ -3949,16 +3968,16 @@
*/
smallBox: function(options) {
var data = $(this).data();
- var data_options = $.extend({}, options, data.amsSmallboxOptions);
- var settings = $.extend({}, data_options, {
- title: data.amsSmallboxTitle || data_options.title || '',
- content: data.amsSmallboxContent || data_options.content || '',
- icon: data.amsSmallboxIcon || data_options.icon,
- iconSmall: data.amsSmallboxIconSmall || data_options.iconSmall,
- timeout: data.amsSmallboxTimeout || data_options.timeout
+ var dataOptions = $.extend({}, options, data.amsSmallboxOptions);
+ var settings = $.extend({}, dataOptions, {
+ title: data.amsSmallboxTitle || dataOptions.title || '',
+ content: data.amsSmallboxContent || dataOptions.content || '',
+ icon: data.amsSmallboxIcon || dataOptions.icon,
+ iconSmall: data.amsSmallboxIconSmall || dataOptions.iconSmall,
+ timeout: data.amsSmallboxTimeout || dataOptions.timeout
});
- var status = data.amsSmallboxStatus || data_options.status || 'info';
- var callback = ams.getFunctionByName(data.amsSmallboxCallback || data_options.callback);
+ var status = data.amsSmallboxStatus || dataOptions.status || 'info';
+ var callback = ams.getFunctionByName(data.amsSmallboxCallback || dataOptions.callback);
ams.skin.smallBox(status, settings, callback);
}
};
@@ -4029,9 +4048,9 @@
var table = link.parents('table');
var location = table.data('ams-location') || '';
var tr = link.parents('tr');
- var delete_target = tr.data('ams-delete-target') || table.data('ams-delete-target') || 'delete-element.json';
- var object_name = tr.data('ams-element-name');
- MyAMS.ajax.post(location + '/' + delete_target, {'object_name': object_name}, function(result, status) {
+ var deleteTarget = tr.data('ams-delete-target') || table.data('ams-delete-target') || 'delete-element.json';
+ var objectName = tr.data('ams-element-name');
+ MyAMS.ajax.post(location + '/' + deleteTarget, {'object_name': objectName}, function(result, status) {
if (result.status === 'success') {
if (table.hasClass('datatable')) {
table.dataTable().fnDeleteRow(tr[0]);
@@ -4056,15 +4075,15 @@
* Compute navigation page height
*/
_setPageHeight: function() {
- var main_height = $('#main').height();
- var menu_height = ams.left_panel.height();
- var window_height = $(window).height() - ams.navbar_height;
- if (main_height > window_height) {
- ams.left_panel.css('min-height', main_height);
- ams.root.css('min-height', main_height + ams.navbar_height);
+ var mainHeight = $('#main').height();
+ var menuHeight = ams.leftPanel.height();
+ var windowHeight = $(window).height() - ams.navbarHeight;
+ if (mainHeight > windowHeight) {
+ ams.leftPanel.css('min-height', mainHeight);
+ ams.root.css('min-height', mainHeight + ams.navbarHeight);
} else {
- ams.left_panel.css('min-height', window_height);
- ams.root.css('min-height', window_height);
+ ams.leftPanel.css('min-height', windowHeight);
+ ams.root.css('min-height', windowHeight);
}
},
@@ -4123,7 +4142,7 @@
* Initialize desktop and mobile widgets
*/
_initDesktopWidgets: function(element) {
- if (ams.enable_widgets) {
+ if (ams.enableWidgets) {
var widgets = $('.ams-widget', element);
if (widgets.length > 0) {
ams.ajax.check($.fn.MyAMSWidget,
@@ -4132,11 +4151,11 @@
widgets.each(function () {
var widget = $(this);
var data = widget.data();
- var data_options = {
+ var dataOptions = {
deleteSettingsKey: '#deletesettingskey-options',
deletePositionKey: '#deletepositionkey-options'
};
- var settings = $.extend({}, data_options, data.amsWidgetOptions);
+ var settings = $.extend({}, dataOptions, data.amsWidgetOptions);
settings = ams.executeFunctionByName(data.amsWidgetInitcallback, widget, settings) || settings;
widget.MyAMSWidget(settings);
});
@@ -4147,7 +4166,7 @@
},
_initMobileWidgets: function(element) {
- if (ams.enable_mobile && ams.enable_widgets) {
+ if (ams.enableMobile && ams.enableWidgets) {
ams.skin._initDesktopWidgets(element);
}
},
@@ -4331,15 +4350,15 @@
menu.attr('title') ||
document.title);
} else {
- var active_url = $('[data-ams-active-menu]').data('ams-active-menu');
- if (active_url) {
- menu = $('A[href="' + active_url + '"]', nav);
+ var activeUrl = $('[data-ams-active-menu]').data('ams-active-menu');
+ if (activeUrl) {
+ menu = $('A[href="' + activeUrl + '"]', nav);
} else {
menu = $('>UL >LI >A[href!="#"]', nav).first();
}
if (menu.exists()) {
updateActiveMenus(menu);
- if (active_url) {
+ if (activeUrl) {
ams.skin._drawBreadCrumb();
} else {
window.location.hash = menu.attr('href');
@@ -4419,11 +4438,11 @@
if (callback) {
ams.executeFunctionByName(callback, this, data, status, request, options);
} else {
- var request_data = ams.ajax.getResponse(request);
- var data_type = request_data.content_type;
- var result = request_data.data;
+ var response = ams.ajax.getResponse(request);
+ var dataType = response.contentType;
+ var result = response.data;
$('.loading', container).remove();
- switch (data_type) {
+ switch (dataType) {
case 'json':
ams.ajax.handleJSON(result, container);
break;
@@ -4469,8 +4488,8 @@
*/
setLanguage: function(options) {
var lang = options.lang;
- var handler_type = options.handler_type || 'json';
- switch (handler_type) {
+ var handlerType = options.handler_type || 'json';
+ switch (handlerType) {
case 'json':
var method = options.method || 'setUserLanguage';
ams.jsonrpc.post(method, {lang: lang}, function() {
@@ -4542,17 +4561,17 @@
/* Init main components */
ams.root = body;
- ams.left_panel = $('#left-panel');
+ ams.leftPanel = $('#left-panel');
ams.shortcuts = $('#shortcut');
ams.plugins.initData(body);
// Init main AJAX events
- var jquery_xhr = $.ajaxSettings.xhr;
+ var xhr = $.ajaxSettings.xhr;
$.ajaxSetup({
progress: ams.ajax.progress,
progressUpload: ams.ajax.progress,
xhr: function() {
- var request = jquery_xhr();
+ var request = xhr();
if (request && (typeof(request.addEventListener) === "function")) {
var that = this;
request.addEventListener("progress", function(evt) {
@@ -4573,7 +4592,7 @@
} else {
ams.root.addClass('mobile-detected');
ams.device = 'mobile';
- if (ams.enable_fastclick) {
+ if (ams.enableFastclick) {
ams.ajax.check($.fn.noClickDelay,
ams.baseURL + '/ext/jquery-smartclick' + ams.devext + '.js',
function() {
@@ -4648,9 +4667,9 @@
if (href) {
e.preventDefault();
e.stopPropagation();
- var href_getter = ams.getFunctionByName(href);
- if (typeof(href_getter) === 'function') {
- href = href_getter.call(this);
+ var hrefGetter = ams.getFunctionByName(href);
+ if (typeof(hrefGetter) === 'function') {
+ href = hrefGetter.call(this);
}
if (typeof(href) === 'function') {
// Javascript function call
@@ -4686,7 +4705,7 @@
var nav = $('nav');
$('UL', nav).myams_menu({
accordion : nav.data('ams-menu-accordion') !== false,
- speed : ams.menu_speed
+ speed : ams.menuSpeed
});
// Left navigation collapser
@@ -4735,7 +4754,7 @@
});
// Init AJAX navigation
- if (ams.ajax_nav) {
+ if (ams.ajaxNav) {
$(document).on('click', 'a[href="#"]', function(e) {
e.preventDefault();
});
@@ -4751,9 +4770,9 @@
}
e.preventDefault();
e.stopPropagation();
- var href_getter = ams.getFunctionByName(href);
- if (typeof(href_getter) === 'function') {
- href = href_getter.call(link);
+ var hrefGetter = ams.getFunctionByName(href);
+ if (typeof(hrefGetter) === 'function') {
+ href = hrefGetter.call(link);
}
if (typeof(href) === 'function') {
// Javascript function call
@@ -4965,7 +4984,7 @@
// Init page content
ams.initContent(document);
- if (ams.ajax_nav && nav.exists()) {
+ if (ams.ajaxNav && nav.exists()) {
ams.skin.checkURL();
}
ams.form.setFocus(document);
--- a/src/ztfy/myams/resources/js/myams.min.js Wed Oct 05 17:36:07 2016 +0200
+++ b/src/ztfy/myams/resources/js/myams.min.js Thu Oct 06 15:44:22 2016 +0200
@@ -1,1 +1,1 @@
-(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(0,f)===g)};String.prototype.endsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(e-f)===g)};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(f,g){var e=this.length;g=Number(g)||0;g=(g<0)?Math.ceil(g):Math.floor(g);if(g<0){g+=e}for(;g<e;g++){if(g in this&&this[g]===f){return g}}return -1}}c.expr[":"].econtains=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"").toLowerCase()===f[3].toLowerCase()};c.expr[":"].withtext=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"")===f[3]};c.expr[":"].parents=function(g,e,f){return c(g).parents(f[3]).length>0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('<div style="width:50px; height:50px; overflow:auto"><div/></div>').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l<i){g-=l}return g}return this.each(function(){c("a",c(f.menuSelector)).each(function(){c(this).data("ams-context-menu",true)});c(this).on("contextmenu",function(g){if(g.ctrlKey){return}c(f.menuSelector).data("invokedOn",c(g.target)).show().css({position:"fixed",left:e(g.clientX,"width","scrollLeft")-10,top:e(g.clientY,"height","scrollTop")-10}).off("click").on("click",function(i){c(this).hide();var h=c(this).data("invokedOn");var j=c(i.target);f.menuSelected.call(this,h,j);a.event.stop(i)});return false});c(document).click(function(){c(f.menuSelector).hide()})})},myams_menu:function(e){var g={accordion:true,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append("<b class='collapse-sign'>"+f.closedSign+"</b>");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var m=c(this);if(m.hasClass("active")){return}var k=m.attr("href").replace(/^#/,"");var i=m.parent().find("UL");if(f.accordion){var l=m.parent().parents("UL");var n=h.find("UL:visible");n.each(function(o){var q=true;l.each(function(r){if(l[r]===n[o]){q=false;return false}});if(q){if(i!==n[o]){var p=c(n[o]);if(k||!p.hasClass("active")){p.slideUp(f.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}}}})}var j=m.parent().find("UL:first");if(!k&&j.is(":visible")&&!j.hasClass("active")){j.slideUp(f.speed,function(){m.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{j.slideDown(f.speed,function(){m.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h<f.length;h++){var g=f.charCodeAt(h);if(g<128){e+=String.fromCharCode(g)}else{if((g>127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j<e.length){k=e.charCodeAt(j);if(k<128){g+=String.fromCharCode(k);j++}else{if((k>191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.generateUUID=function(){var f=new Date().getTime();var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(h){var g=(f+Math.random()*16)%16|0;f=Math.floor(f/16);return(h=="x"?g:(g&3|8)).toString(16)});return e};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f<j.length;f++){try{g=g[j[f]]}catch(l){return undefined}}try{return g[h]}catch(l){return undefined}};d.executeFunctionByName=function(h,f){var g=a.getFunctionByName(h,window);if(typeof(g)==="function"){var e=Array.prototype.slice.call(arguments,2);return g.apply(f,e)}};d.getSource=function(e){return e.replace(/{[^{}]*}/g,function(f){return a.getFunctionByName(f.substr(1,f.length-2))})};d.getScript=function(f,i,e){if(typeof(i)==="object"){e=i;i=null}if(e===undefined){e={}}var h={dataType:"script",url:a.getSource(f),success:i,error:a.error.show,cache:!a.devmode,async:e.async===undefined?typeof(i)==="function":e.async};var g=c.extend({},h,e);return c.ajax(g)};d.getCSS=function(e,i){var g=c("HEAD");var f=c('link[data-ams-id="'+i+'"]',g);if(f.length===0){var h=a.getSource(e);if(a.devmode){h+="?_="+new Date().getTime()}c("<link />").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(j,e,i,f){if(e.statusText==="OK"){return}var h=a.ajax.getResponse(e);if(h.content_type==="json"){a.ajax.handleJSON(h.data)}else{var k=j.statusText||j.type;var g=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+k+"</h4><p>"+g+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(j);b.console.debug(e)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.content_type==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"<h4>"+e+"</h4><p>"+g+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result}};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var g=h.getResponseHeader("content-type"),j,f;if(g){if(g.startsWith("application/javascript")){j="script";f=h.responseText}else{if(g.startsWith("text/html")){j="html";f=h.responseText}else{if(g.startsWith("text/xml")){j="xml";f=h.responseText}else{f=h.responseJSON;if(f){j="json"}else{try{f=JSON.parse(h.responseText);j="json"}catch(i){f=h.responseText;j="text"}}}}}}else{j="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:j,data:f}},handleJSON:function(p,g,l){var j=p.status;var e;switch(j){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||l||"#content");break;case"redirect":a.form.resetChanged(g);if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+j)}}var k;var m;var f;if(p.content){m=p.content;f=c(m.target||l||g||"#content");if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}if(p.contents){var i=p.contents;for(k=0;k<i.length;k++){m=i[k];f=c(m.target);if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}}var o;if(p.message){o=p.message;if(typeof(o)==="string"){if((j==="info")||(j==="success")){a.skin.smallBox(j,{title:o,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(c(g||"#content"),j,o)}}else{a.skin.alert(c(o.target||l||g||"#content"),o.status||"success",o.header,o.body,o.subtitle)}}if(p.smallbox){a.skin.smallBox(p.smallbox_status||j,{title:p.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(p.messagebox){o=p.messagebox;if(typeof(o)==="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:o,timeout:10000})}else{var h=o.status||"info";if(h==="error"&&g&&l){a.executeFunctionByName(g.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",g,l)}a.skin.messageBox(h,{title:o.title||a.i18n.ERROR_OCCURED,content:o.content,icon:o.icon,number:o.number,timeout:o.timeout===null?undefined:(o.timeout||10000)})}}if(p.event){g.trigger(p.event,p.event_options)}if(p.callback){a.executeFunctionByName(p.callback,g,p.options)}if(p.callbacks){var n;for(k=0;k<p.callbacks.length;k++){n=p.callbacks[k];a.executeFunctionByName(n,g,n.options)}}}};d.jsonrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},query:function(f,h,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(g==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var k={};if(typeof(f)==="string"){k.query=f}else{if(typeof(f)==="object"){c.extend(k,f)}}c.extend(k,e);var i;var j={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:k,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};c.jsonRpc(j);return i})},post:function(h,f,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(typeof(g)==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var i;var k={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:f,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};var j=c.extend({},k,e);c.jsonRpc(j);return i})}};d.xmlrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},post:function(f,i,g,e,h){a.ajax.check(c.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+a.devext+".js",function(){if(typeof(e)==="function"){h=e;e={}}else{if(!e){e={}}}if(typeof(h)==="undefined"){h=e.callback}if(typeof(h)==="string"){h=a.getFunctionByName(h)}delete e.callback;var j;var l={url:a.xmlrpc.getAddr(f),methodName:i,params:g,success:h||function(m){j=m},error:a.error.show};var k=c.extend({},l,e);c.xmlrpc(k);return j})}};d.form={init:function(f){var e;if(a.warn_on_form_change){e=c('FORM[data-ams-warn-on-change!="false"]',f)}else{e=c('FORM[data-ams-warn-on-change="true"]',f)}e.each(function(){var g=c(this);c('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',g).each(function(){var i=c(this);if(i.data("ams-ignore-change")!==true){var h=i.data("ams-changed-event")||"change";i.on(h,function(){a.form.setChanged(c(this).parents("FORM"))})}});g.on("reset",function(){a.form.resetChanged(c(this))})})},setFocus:function(e){var f=c("[data-ams-focus-target]",e).first();if(!f.exists()){f=c("input, select",e).first()}if(f.exists()){if(f.hasClass("select2-input")){f=f.parents(".select2")}if(f.hasClass("select2")){setTimeout(function(){f.select2("focus");if(f.data("ams-focus-open")===true){f.select2("open")}},100)}else{f.focus()}}},checkBeforeUnload:function(){var e=c('FORM[data-ams-form-changed="true"]');if(e.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(g,h,f){if(typeof(g)==="function"){h=g;g=undefined}var e=c('FORM[data-ams-form-changed="true"]',g);if(e.exists()){if(f){if(b.confirm(a.i18n.FORM_CHANGED_WARNING,a.i18n.WARNING)){h.call(g)}else{f.call(g)}}else{a.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){h.call(g)}})}}else{h.call(g)}},setChanged:function(e){e.attr("data-ams-form-changed",true)},resetChanged:function(e){e.removeAttr("data-ams-form-changed")},submit:function(g,f,h){g=c(g);if(!g.exists()){return false}if(typeof(f)==="object"){h=f;f=undefined}if(g.data("submitted")){if(!g.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:g.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(g)){return false}c(".alert-danger, SPAN.state-error",g).not(".persistent").remove();c(".state-error",g).removeClassPrefix("state-");var e=c(g.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(m,p){var l,u,E;var K=m.data();var z=K.amsFormOptions;var o;var r;var H;var v;var F;var C;function n(O,P){var N;function M(){l.button("reset");clearInterval(N);a.executeFunctionByName(C,m,l)}function L(){a.ajax.post(O,{progress_id:P},{error:M},a.getFunctionByName(F)||function(Q,R){if(R=="success"){if(Q.status==="running"){if(Q.message){l.text(Q.message)}else{l.text(l.data("ams-progress-text")+" "+Q.current+" / "+Q.length)}}else{if(Q.status==="finished"){M()}}}else{M()}})}l.button("loading");N=setInterval(L,v)}if(h){r=h.formDataInitCallback}if(r){delete h.formDataInitCallback}else{r=K.amsFormDataInitCallback}if(r){var A={};if(typeof(r)==="function"){o=r.call(m,A)}else{o=a.executeFunctionByName(r,m,A)}if(A.veto){l=m.data("ams-submit-button");if(l){l.button("reset")}a.form.finalizeSubmitFooter.call(m);return false}}else{o=K.amsFormData||{}}l=c(m.data("ams-submit-button"));if(l&&l.exists()){u=l.data();E=u.amsFormSubmitTarget}else{u={}}var q;var w=f||u.amsFormHandler||K.amsFormHandler||"";if(w.startsWith(window.location.protocol)){q=w}else{var D=u.amsFormAction||m.attr("action").replace(/#/,"");if(D.startsWith(window.location.protocol)){q=D}else{q=a.ajax.getAddr()+D}q+=w}H=u.amsProgressHandler||K.amsProgressHandler||"";v=u.amsProgressInterval||K.amsProgressInterval||1000;F=u.amsProgressCallback||K.amsProgressCallback;C=u.amsProgressEndCallback||K.amsProgressEndCallback;var J=null;if(h&&h.initSubmitTarget){a.executeFunctionByName(h.initSubmitTarget,m)}else{if(K.amsFormInitSubmitTarget){J=c(E||K.amsFormSubmitTarget||"#content");a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmit",m,J)}else{if(!K.amsFormHideSubmitFooter){a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",m)}}}if(h){o=c.extend({},o,h.form_data)}var s;if(H){o.progress_id=a.generateUUID()}else{s=typeof(p.uuid)!=="undefined";if(s){if(q.indexOf("X-Progress-ID")<0){q+="?X-Progress-ID="+p.uuid}delete p.uuid}}var x={url:q,type:"post",cache:false,data:o,dataType:K.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(M,L){L.data("submitted",true)},error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},iframe:s};var B=(h&&h.downloadTarget)||K.amsFormDownloadTarget;if(B){var t=c('iframe[name="'+B+'"]');if(!t.exists()){t=c("<iframe></iframe>").hide().attr("name",B).appendTo(c("body"))}x=c.extend({},x,{iframe:true,iframeTarget:t,success:function(L,M,Q,P){var O=c(P).parents(".modal-dialog");if(O.exists()){a.dialog.close(P)}else{var R;var N=P.data("ams-submit-button");if(N){R=N.data("ams-form-submit-callback")}if(!R){R=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{R.call(P,L,M,Q,P)}finally{a.form.resetAfterSubmit(P);a.form.resetChanged(P)}}}})}else{x=c.extend({},x,{error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},success:function(L,M,P,O){var Q;var N=O.data("ams-submit-button");if(N){Q=N.data("ams-form-submit-callback")}if(!Q){Q=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{Q.call(O,L,M,P,O)}finally{a.form.resetAfterSubmit(O);a.form.resetChanged(O)}},iframe:s})}var I=c.extend({},x,p,z,h);if(H){n(H,o.progress_id)}c(m).ajaxSubmit(I);if(B){var G=c(m).parents(".modal-dialog");var y=G.exists()&&l.exists()&&l.data("ams-keep-modal");if(G.exists()&&(y!==true)){a.dialog.close(m)}else{setTimeout(function(){a.form.resetAfterSubmit(m,l);a.form.resetChanged(m)},l.data("ams-form-reset-timeout")||2000)}}}var j=(g.data("ams-form-ignore-uploads")!==true)&&(c('INPUT[type="file"]',g).length>0);if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(g)});k(g,i)}else{k(g,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=e.data("ams-form-submit-message")}if(f){h+="<strong>"+f+"</strong>"}c(g).html('<div class="row margin-20"><div class="text-center">'+h+"</div></div>");c(g).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(f){if(f.is(":visible")){var e=f.data("ams-submit-button");if(e){e.button("reset")}a.form.finalizeSubmitFooter.call(f)}f.data("submitted",false);f.removeData("ams-submit-button")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+f+"</strong>"}var g=c("footer",e);c("button",g).hide();g.append('<div class="row"><div class="text-center">'+h+"</div></div>")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,g,f,e){var i;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);i=e.data("ams-submit-button");if(i){i.button("reset")}}var h=e.data();var l;if(h.amsFormDatatype){l=h.amsFormDatatype}else{var j=a.ajax.getResponse(f);l=j.content_type;o=j.data}var k;if(i){k=c(i.data("ams-form-submit-target")||h.amsFormSubmitTarget||"#content")}else{k=c(h.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:a.form.resetChanged(e);if(i&&(i.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=f.getResponseHeader("X-AMS-Callback");if(m){var n=f.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),f)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k<i.length;k++){var f=i[k];var e=f[0];var l=f[1];var m=a.executeFunctionByName(l,g,e);if(m===false){n=false}else{if(typeof(m)==="string"){h.push(m)}else{if(n.length&&(n.length>0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,m){var i;if(typeof(m)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,m)}else{if(m instanceof Array){i=m.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,m)}else{c(".state-error",e).removeClass("state-error");i=m.error_header||(m.widgets&&(m.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var l;if(m.messages){for(l=0;l<m.messages.length;l++){var f=m.messages[l];if(f.header){n.push("<strong>"+f.header+"</strong><br />"+f.message)}else{n.push(f.message||f)}}}if(m.widgets){for(l=0;l<m.widgets.length;l++){var g=m.widgets[l];var j=c('[name="'+g.name+'"]',e);j.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+g.message+"</span>");if(g.label){n.push(g.label+" : "+g.message)}var k=j.parents(".tab-pane").index()+1;if(k>0){var h=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+k+")",h).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(c("fieldset:first",e),m.error_level||"error",i,n,m.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>'}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(n,m,l){c("body").modalmanager("removeLoading");var o=a.ajax.getResponse(l);var t=o.content_type;var u=o.data;switch(t){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var p=c(u);var r=c(".modal-dialog",p.wrap("<div></div>").parent());var q=r.data();var s={backdrop:"static",overflow:q.amsModalOverflow||".modal-viewport",maxHeight:q.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",p).outerHeight(true)-c("footer",p).outerHeight(true)-85}:a.getFunctionByName(q.amsModalMaxHeight)};var k=c.extend({},s,q.amsModalOptions);k=a.executeFunctionByName(q.amsModalInitCallback,r,k)||k;c("<div>").addClass("modal fade").append(p).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(p);if(i.amsLogEvent!==false){a.stats.logPageview(h)}}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if((f.css("overflow")!=="hidden")&&(f.height()===j)){c("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g<i.length;g++){i[g].call(k)}}i=a.dialog._shown_callbacks;if(i){for(g=0;g<i.length;g++){i[g].call(k)}}a.form.setFocus(k)},close:function(f){if(typeof(f)==="string"){f=c(f)}var g=f.parents(".modal").data("modal");if(g){var e=c("body").data("modalmanager");if(e&&(e.getOpenModals().indexOf(g)>=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f<g.length;f++){g[f].call(h)}}g=a.dialog._hide_callbacks;if(g){for(f=0;f<g.length;f++){g[f].call(h)}}}};d.helpers={select2ClearSelection:function(){var f=c(this);var e=f.parents("label");var g=f.data("ams-select2-target");c('[name="'+g+'"]',e).data("select2").val("")},select2FormatSelection:function(f,e){if(f instanceof Array){c(f).each(function(){if(typeof(this)==="object"){e.append(this.text)}else{e.append(this)}})}else{if(typeof(f)==="object"){e.append(f.text)}else{e.append(f)}}},select2QueryUrlResultsCallback:function(g,f,e){switch(g.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+g.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+f.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var e=i.data();if(e.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||e.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var g=a.getFunctionByName(f);if(typeof(g)==="function"){f=g.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(j){a.plugins.initData(j);var i=[];c("[data-ams-plugins-disabled]",j).each(function(){var o=c(this).data("ams-plugins-disabled").split(/\s+/);for(var p=0;p<o.length;p++){i.push(o[p])}});var g={};var k;var e;function h(o,q){if(g.hasOwnProperty(o)){var p=g[o];p.css=p.css||q.css;if(q.callback){p.callbacks.push(q.callback)}if(q.register){p.register=true}if(q.async===false){p.async=false}}else{g[o]={src:q.src,css:q.css,callbacks:q.callback?[q.callback]:[],register:q.register,async:q.async}}if(q.css){a.getCSS(q.css,o+"_css")}}c("[data-ams-plugins]",j).each(function(){var q=c(this);var o=q.data("ams-plugins");if(typeof(o)==="string"){var r=q.data("ams-plugins").split(/\s+/);for(var p=0;p<r.length;p++){e=r[p];var s={src:q.data("ams-plugin-"+e+"-src"),css:q.data("ams-plugin-"+e+"-css"),callback:q.data("ams-plugin-"+e+"-callback"),register:q.data("ams-plugin-"+e+"-register"),async:q.data("ams-plugin-"+e+"-async")};h(e,s)}}else{for(e in o){if(!o.hasOwnProperty(e)){continue}h(e,o[e])}}});for(e in g){if(a.plugins.enabled[e]===undefined){k=g[e];a.getScript(k.src,function(){var p;var r=k.callbacks;if(r&&r.length){for(p=0;p<r.length;p++){var q=a.getFunctionByName(r[p]);if(k.register!==false){var o=a.plugins.enabled;if(o.hasOwnProperty(e)){o[e].push(q)}else{o[e]=[q]}}}}else{if(k.register!==false){a.plugins.enabled[e]=null}}if(r&&r.length&&(k.async!==false)){for(p=0;p<r.length;p++){a.getFunctionByName(r[p])(j)}}},{async:k.async===undefined?true:k.async})}}for(var l in a.plugins.enabled){if(!a.plugins.enabled.hasOwnProperty(l)){continue}if(i.indexOf(l)>=0){continue}var m=a.plugins.enabled[l];if(m){switch(typeof(m)){case"function":m(j);break;default:for(var f=0;f<m.length;f++){var n=m[f];if(typeof(n)==="function"){n(j)}}}}}},initData:function(e){c("[data-ams-data]",e).each(function(){var g=c(this);var h=g.data("ams-data");if(h){for(var f in h){if(h.hasOwnProperty(f)){g.attr("data-"+f,h[f])}}}})},register:function(f,e,h){if(typeof(e)==="function"){h=e;e=null}e=e||f.name;if(a.plugins.enabled.indexOf(e)>=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var k=c(this);var j=k.data();var h={html:j.amsHintHtml,title:a.getFunctionByName(j.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(j.amsHintTitleAttr||"title")||(j.amsHintHtml?l.html():l.text())},opacity:j.amsHintOpacity||0.95,gravity:j.amsHintGravity||"sw",offset:j.amsHintOffset||0};var g=c.extend({},h,j.amsHintOptions);g=a.executeFunctionByName(j.amsHintInitCallback,k,g)||g;var i=k.tipsy(g);a.executeFunctionByName(j.amsHintAfterInitCallback,k,i,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={menuSelector:j.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},h,j.amsContextmenuOptions);g=a.executeFunctionByName(j.amsContextmenuInitCallback,k,g)||g;var i=k.contextMenu(g);a.executeFunctionByName(j.amsContextmenuAfterInitCallback,k,i,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('<i class="fa fa-fw"></i>').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var q=c(this);var r=q.parent("fieldset");var h=q.data();if(!h.amsChecker){var f=c('<label class="checkbox"></label>');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var o=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('<input type="hidden">').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(q)}else{if(g){c('<input type="hidden">').attr("name",g).attr("value",1).prependTo(q)}}var p=c('<input type="checkbox">').attr("name",k).attr("id",o).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){p.attr("disabled","disabled")}else{p.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");q.trigger("ams.checker.before-switch",[q,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,q,v);if(!h.amsCheckerCancelDefault){var t=p.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");q.trigger("ams.checker.opened",[q])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");q.trigger("ams.checker.closed",[q])}}})}p.appendTo(f);c(">label",q).attr("for",p.attr("id"));f.append("<i></i>").prependTo(q);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){p.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}q.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider-2.0.0"+a.devext+".js",function(){f.each(function(){var j=c(this);var k=j.data();var h={};var g=c.extend({},h,j.data.amsSliderOptions);g=a.executeFunctionByName(k.amsSliderInitCallback,j,g)||g;var i=j.slider(g);a.executeFunctionByName(k.amsSliderAfterInitCallback,j,i,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={containment:k.amsDraggableContainment,helper:a.getFunctionByName(k.amsDraggableHelper)||k.amsDraggableHelper,start:a.getFunctionByName(k.amsDraggableStart),stop:a.getFunctionByName(k.amsDraggableStop)};var h=c.extend({},i,k.amsDraggableOptions);h=a.executeFunctionByName(k.amsDraggableInitCallback,g,h)||h;var j=g.draggable(h);g.disableSelection();a.executeFunctionByName(k.amsDraggableAfterInitCallback,g,j,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={items:j.amsSortableItems,handle:j.amsSortableHandle,connectWith:j.amsSortableConnectwith,start:a.getFunctionByName(j.amsSortableStart),over:a.getFunctionByName(j.amsSortableOver),containment:j.amsSortableContainment,placeholder:j.amsSortablePlaceholder,stop:a.getFunctionByName(j.amsSortableStop)};var g=c.extend({},h,j.amsSortableOptions);g=a.executeFunctionByName(j.amsSortableInitCallback,k,g)||g;var i=k.sortable(g);k.disableSelection();a.executeFunctionByName(j.amsSortableAfterInitCallback,k,i,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={autoHide:k.amsResizableAutohide===false?true:k.amsResizableAutohide,containment:k.amsResizableContainment,grid:k.amsResizableGrid,handles:k.amsResizableHandles,start:a.getFunctionByName(k.amsResizableStart),stop:a.getFunctionByName(k.amsResizableStop)};var h=c.extend({},i,k.amsResizableOptions);h=a.executeFunctionByName(k.amsResizableInitCallback,g,h)||h;var j=g.resizable(h);g.disableSelection();a.executeFunctionByName(k.amsResizableAfterInitCallback,g,j,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={};var h=c.extend({},i,k.amsTypeaheadOptions);h=a.executeFunctionByName(k.amsTypeaheadInitCallback,g,h)||h;var j=g.typeahead(h);a.executeFunctionByName(k.amsTypeaheadAfterInitCallback,g,j,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var l=g.data();var j={placeholder:l.amsSelect2Placeholder,multiple:l.amsSelect2Multiple,minimumInputLength:l.amsSelect2MinimumInputLength||0,maximumSelectionSize:l.amsSelect2MaximumSelectionSize,openOnEnter:l.amsSelect2EnterOpen===undefined?true:l.amsSelect2EnterOpen,allowClear:l.amsSelect2AllowClear===undefined?true:l.amsSelect2AllowClear,width:l.amsSelect2Width||"100%",initSelection:a.getFunctionByName(l.amsSelect2InitSelection),formatSelection:l.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(l.amsSelect2FormatSelection),formatResult:a.getFunctionByName(l.amsSelect2FormatResult),formatMatches:l.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(l.amsSelect2FormatMatches),formatNoMatches:l.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(l.amsSelect2FormatResult),formatInputTooShort:l.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooShort),formatInputTooLong:l.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooLong),formatSelectionTooBig:l.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatSelectionTooBig),formatLoadMore:l.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(l.amsSelect2FormatLoadMore),formatSearching:l.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(l.amsSelect2FormatSearching),separator:l.amsSelect2Separator||",",tokenSeparators:l.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(l.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!j.initSelection){var h=g.data("ams-select2-values");if(h){j.initSelection=function(m,o){var n=[];c(m.val().split(j.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){j.query=function(){return[]}}}else{if(l.amsSelect2Query){j.query=a.getFunctionByName(l.amsSelect2Query);j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryUrl){j.ajax={url:l.amsSelect2QueryUrl,quietMillis:l.amsSelect2QuietMillis||200,type:l.amsSelect2QueryType||"POST",dataType:l.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[l.amsSelect2QueryParamName||"query"]=o;m[l.amsSelect2PageParamName||"page"]=p;m[l.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,l.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryMethod){j.query=function(m){var n={url:l.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:l.amsSelect2MethodType||"POST",cache:false,method:l.amsSelect2QueryMethod,params:l.amsSelect2QueryParams||{},success:function(p,o){return a.helpers.select2QueryMethodSuccessCallback.call(g,p,o,m)},error:a.error.show};n.params[l.amsSelect2QueryParamName||"query"]=m.term;n.params[l.amsSelect2PageParamName||"page"]=m.page;n.params[l.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,l.amsSelect2QueryOptions);n=a.executeFunctionByName(l.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){c.jsonRpc(n)})};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2Tags){j.tags=l.amsSelect2Tags}else{if(l.amsSelect2Data){j.data=l.amsSelect2Data}}}}}}if(l.amsSelect2EnableFreeTags){j.createSearchChoice=function(m){return{id:m,text:(l.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},j,l.amsSelect2Options);i=a.executeFunctionByName(l.amsSelect2InitCallback,g,i)||i;var k=g.select2(i);a.executeFunctionByName(l.amsSelect2AfterInitCallback,g,k,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.4.1"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={placeholder:k.amsMaskeditPlaceholder===undefined?"X":k.amsMaskeditPlaceholder,complete:a.getFunctionByName(k.amsMaskeditComplete)};var h=c.extend({},i,k.amsMaskeditOptions);h=a.executeFunctionByName(k.amsMaskeditInitCallback,g,h)||h;var j=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(k.amsMaskeditAfterInitCallback,g,j,h)})})}},inputmask:function(f){var e=c("[data-input-mask]",f);if(e.length>0){a.ajax.check(c.fn.inputmask,a.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i;if(typeof(k.inputMask)==="object"){i=k.inputMask}else{i={mask:k.inputMask.toString()}}var h=c.extend({},i,k.amsInputmaskOptions);h=a.executeFunctionByName(k.amsInputmaskInitCallback,g,h)||h;var j=g.inputmask(h);a.executeFunctionByName(k.amsInputmaskAfterInitCallback,g,j,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var l=h.data();var j={position:l.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},j,l.amsColorpickerOptions);i=a.executeFunctionByName(l.amsColorpickerInitCallback,h,i)||i;var k=h.minicolors(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var m=c(this);var n=m.data();var k={ignore:null,submitHandler:m.attr("data-async")!==undefined?n.amsFormSubmitHandler===undefined?function(){c(".state-error",m).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(m)}:a.getFunctionByName(n.amsFormSubmitHandler):undefined,invalidHandler:m.attr("data-async")!==undefined?n.amsFormInvalidHandler===undefined?function(s,r){c(".state-error",m).removeClass("state-error");for(var p=0;p<r.errorList.length;p++){var o=r.errorList[p];var q=c(o.element).parents(".tab-pane").index()+1;if(q>0){var t=c(".nav-tabs",c(o.element).parents(".tabforms"));c("li:nth-child("+q+")",t).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",t).click()}}}:a.getFunctionByName(n.amsFormInvalidHandler):undefined};c("[data-ams-validate-rules]",m).each(function(o){if(o===0){k.rules={}}k.rules[c(this).attr("name")]=c(this).data("ams-validate-rules")});var j=c.extend({},k,n.amsValidateOptions);j=a.executeFunctionByName(n.amsValidateInitCallback,m,j)||j;var l=m.validate(j);a.executeFunctionByName(n.amsValidateAfterInitCallback,m,l,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var H=D.data();var F=(H.amsDatatableExtensions||"").split(/\s+/);var m=H.amsDatatableSdom||"W"+((F.indexOf("colreorder")>=0||F.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(F.indexOf("colvis")>=0?"C":"")+((H.amsDatatablePagination===false||H.amsDatatablePaginationSize===false)?"":"L")+(H.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(F.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(H.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var p;var i=H.amsDatatableSorting;if(typeof(i)==="string"){var G=i.split(";");i=[];for(p=0;p<G.length;p++){var x=G[p].split(",");x[0]=parseInt(x[0]);i.push(x)}}var h=[];var t=c("th",D).listattr("data-ams-datatable-stype");for(p=0;p<t.length;p++){var s=t[p];if(s){var j=h[p]||{};j.sType=s;h[p]=j}}var z={bJQueryUI:false,bFilter:H.amsDatatableGlobalFilter!==false||F.indexOf("columnfilter")>=0,bPaginate:H.amsDatatablePagination!==false,bInfo:H.amsDatatableInfo!==false,bSort:H.amsDatatableSort!==false,aaSorting:i,aoColumns:h.length>0?h:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:H.amsDatatableDisplayLength||25,sPaginationType:H.amsDatatablePaginationType||"bootstrap_full",sDom:m,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(K,J){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}};var E=c.extend({},z,H.amsDatatableOptions);if(F.length>0){for(p=0;p<F.length;p++){switch(F[p]){case"autofill":a.ajax.check(c.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+a.devext+".js");break;case"columnfilter":a.ajax.check(c.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+a.devext+".js");break;case"colreorder":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+a.devext+".js");break;case"colreorderwithresize":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+a.devext+".js");break;case"colvis":a.ajax.check(c.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+a.devext+".js");var u={activate:"click",sAlign:"right"};E.oColVis=c.extend({},u,H.amsDatatableColvisOptions);break;case"editable":a.ajax.check(c.fn.editable,a.baseURL+"ext/jquery-jeditable"+a.devext+".js");a.ajax.check(c.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+a.devext+".js");break;case"fixedcolumns":a.ajax.check(c.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+a.devext+".js");break;case"fixedheader":a.ajax.check(c.fn.dataTable.FixedHeader,a.baseURL+"ext/jquery-dataTables-fixedHeader"+a.devext+".js");break;case"keytable":a.ajax.check(window.KeyTable,a.baseURL+"ext/jquery-dataTables-keyTable"+a.devext+".js");break;case"rowgrouping":a.ajax.check(c.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+a.devext+".js");break;case"rowreordering":a.ajax.check(c.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+a.devext+".js");break;case"scroller":a.ajax.check(c.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+a.devext+".js");break;default:break}}}E=a.executeFunctionByName(H.amsDatatableInitCallback,D,E)||E;try{var l=D.dataTable(E);a.executeFunctionByName(H.amsDatatableAfterInitCallback,D,l,E);if(F.length>0){for(p=0;p<F.length;p++){switch(F[p]){case"autofill":var I=c.extend({},H.amsDatatableAutofillOptions,E.autofill);I=a.executeFunctionByName(H.amsDatatableAutofillInitCallback,D,I)||I;D.data("ams-autofill",H.amsDatatableAutofillConstructor===undefined?new c.fn.dataTable.AutoFill(D,I):a.executeFunctionByName(H.amsDatatableAutofillConstructor,D,l,I));break;case"columnfilter":var o={sPlaceHolder:"head:after"};var q=c.extend({},o,H.amsDatatableColumnfilterOptions,E.columnfilter);q=a.executeFunctionByName(H.amsDatatableColumnfilterInitCallback,D,q)||q;D.data("ams-columnfilter",H.amsDatatableColumnfilterConstructor===undefined?l.columnFilter(q):a.executeFunctionByName(H.amsDatatableColumnfilterConstructor,D,l,q));break;case"editable":var r=c.extend({},H.amsDatatableEditableOptions,E.editable);r=a.executeFunctionByName(H.amsDatatableEditableInitCallback,D,r)||r;D.data("ams-editable",H.amsDatatableEditableConstructor===undefined?D.makeEditable(r):a.executeFunctionByName(H.amsDatatableEditableConstructor,D,l,r));break;case"fixedcolumns":var k=c.extend({},H.amsDatatableFixedcolumnsOptions,E.fixedcolumns);k=a.executeFunctionByName(H.amsDatatableFixedcolumnsInitCallback,D,k)||k;D.data("ams-fixedcolumns",H.amsDatatableFixedcolumnsConstructor===undefined?new c.fn.dataTable.FixedColumns(D,k):a.executeFunctionByName(H.amsDatatableFixedcolumnsConstructor,D,l,k));break;case"fixedheader":var A=c.extend({},H.amsDatatableFixedheaderOptions,E.fixedheader);A=a.executeFunctionByName(H.amsDatatableFixedheadeInitCallback,D,A)||A;D.data("ams-fixedheader",H.amsDatatableFixedheaderConstructor===undefined?new c.fn.dataTable.FixedHeader(D,A):a.executeFunctionByName(H.amsDatatableFixedheaderConstructor,D,l,A));break;case"keytable":var n={table:D.get(0),datatable:l};var y=c.extend({},n,H.amsDatatableKeytableOptions,E.keytable);y=a.executeFunctionByName(H.amsDatatableKeytableInitCallback,D,y)||y;D.data("ams-keytable",H.amsDatatableKeytableConstructor===undefined?new KeyTable(y):a.executeFunctionByName(H.amsDatatableKeytableConstructor,D,l,y));break;case"rowgrouping":var w=c.extend({},H.amsDatatableRowgroupingOptions,E.rowgrouping);w=a.executeFunctionByName(H.amsDatatableRowgroupingInitCallback,D,w)||w;D.data("ams-rowgrouping",H.amsDatatableRowgroupingConstructor===undefined?D.rowGrouping(w):a.executeFunctionByName(H.amsDatatableRowgroupingConstructor,D,l,w));break;case"rowreordering":var v=c.extend({},H.amsDatatableRowreorderingOptions,E.rowreordering);v=a.executeFunctionByName(H.amsDatatableRowreorderingInitCallback,D,v)||v;D.data("ams-rowreordering",H.amsDatatableRowreorderingConstructor===undefined?D.rowReordering(v):a.executeFunctionByName(H.amsDatatableRowreorderingConstructor,D,l,v));break;default:break}}}var B=(H.amsDatatableFinalizeCallback||"").split(/\s+/);if(B.length>0){for(p=0;p<B.length;p++){a.executeFunctionByName(B[p],D,l,E)}}}catch(C){}})})}},tablednd:function(f){var e=c(".table-dnd",f);if(e.length>0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var k=c(this);var l=k.data();if(l.amsTabledndDragHandle){c("tr",k).addClass("no-drag-handle")}else{c(k).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")})}var i={onDragClass:l.amsTabledndDragClass||"dragging-row",onDragStart:a.getFunctionByName(l.amsTabledndDragStart),dragHandle:l.amsTabledndDragHandle,scrollAmount:l.amsTabledndScrollAmount,onAllowDrop:l.amsTabledndAllowDrop,onDrop:a.getFunctionByName(l.amsTabledndDrop)||function(o,q){var n=l.amsTabledndDropTarget;if(n){c(q).data("ams-disabled-handlers","click");var m=[];c(o.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var p=a.getFunctionByName(n);if(typeof(p)==="function"){p.call(k,o,m)}else{a.ajax.post(n,{names:JSON.stringify(m)})}setTimeout(function(){c(q).removeData("ams-disabled-handlers")},50)}return false}};var h=c.extend({},i,l.amsTabledndOptions);h=a.executeFunctionByName(l.amsTabledndInitCallback,k,h)||h;var j=k.tableDnD(h);a.executeFunctionByName(l.amsTabledndAfterInitCallback,k,j,h)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var m=c(this);var l=m.data();var j=l.amsImgareaselectParent?m.parents(l.amsImgareaselectParent):"body";var i={instance:true,handles:true,parent:j,x1:l.amsImgareaselectX1||0,y1:l.amsImgareaselectY1||0,x2:l.amsImgareaselectX2||l.amsImgareaselectImageWidth,y2:l.amsImgareaselectY2||l.amsImgareaselectImageHeight,imageWidth:l.amsImgareaselectImageWidth,imageHeight:l.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:l.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(l.amsImgareaselectSelectEnd)||function(n,o){var p=l.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',j).val(o.x1);c('input[name="'+p+'y1"]',j).val(o.y1);c('input[name="'+p+'x2"]',j).val(o.x2);c('input[name="'+p+'y2"]',j).val(o.y2)}};var h=c.extend({},i,l.amsImgareaselectOptions);h=a.executeFunctionByName(l.amsImgareaselectInitCallback,m,h)||h;var k=m.imgAreaSelect(h);a.executeFunctionByName(l.amsImgareaselectAfterInitCallback,m,k,h);setTimeout(function(){k.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var o=h.data();var n=(o.amsFancyboxHelpers||"").split(/\s+/);if(n.length>0){for(var i=0;i<n.length;i++){var m=n[i];switch(m){case"buttons":a.ajax.check(c.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons"+a.devext+".js");break;case"thumbs":a.ajax.check(c.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+a.devext+".js");break;case"media":a.ajax.check(c.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media"+a.devext+".js");break;default:break}}}var k={type:o.amsFancyboxType,padding:o.amsFancyboxPadding||10,margin:o.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(o.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(o.amsFancyboxTitleGetter,this)||c(this.element).attr("original-title")||c(this.element).attr("title")},helpers:{title:{type:"inside"}}};var j=c.extend({},k,o.amsFancyboxOptions);j=a.executeFunctionByName(o.amsFancyboxInitCallback,h,j)||j;var l=h.fancybox(j);a.executeFunctionByName(o.amsFancyboxAfterInitCallback,h,l,j)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var k=l.data();var i={theme:k.amsScrollbarTheme||"light"};var h=c.extend({},i,k.amsScrollbarOptions);h=a.executeFunctionByName(k.amsScrollbarInitCallback,l,h)||h;var j=l.mCustomScrollbar(h);a.executeFunctionByName(k.amsScrollbarAfterInitCallback,l,j,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsMessageboxOptions);var g=c.extend({},h,{title:i.amsMessageboxTitle||h.title||"",content:i.amsMessageboxContent||h.content||"",icon:i.amsMessageboxIcon||h.icon,number:i.amsMessageboxNumber||h.number,timeout:i.amsMessageboxTimeout||h.timeout});var e=i.amsMessageboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsMessageboxCallback||h.callback);a.skin.messageBox(e,g,j)},smallBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsSmallboxOptions);var g=c.extend({},h,{title:i.amsSmallboxTitle||h.title||"",content:i.amsSmallboxContent||h.content||"",icon:i.amsSmallboxIcon||h.icon,iconSmall:i.amsSmallboxIconSmall||h.iconSmall,timeout:i.amsSmallboxTimeout||h.timeout});var e=i.amsSmallboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsSmallboxCallback||h.callback);a.skin.smallBox(e,g,j)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var k=f.parents("table");var h=k.data("ams-location")||"";var l=f.parents("tr");var j=l.data("ams-delete-target")||k.data("ams-delete-target")||"delete-element.json";var g=l.data("ams-element-name");d.ajax.post(h+"/"+j,{object_name:g},function(m,n){if(m.status==="success"){if(k.hasClass("datatable")){k.dataTable().fnDeleteRow(l[0])}else{l.remove()}}})}})}}};d.skin={_setPageHeight:function(){var g=c("#main").height();var e=a.left_panel.height();var f=c(window).height()-a.navbar_height;if(g>f){a.left_panel.css("min-height",g);a.root.css("min-height",g+a.navbar_height)}else{a.left_panel.css("min-height",f);a.root.css("min-height",f)}},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c("#activity > .badge");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},refreshNotificationsPanel:function(g){var f=c(this);f.addClass("disabled");c("i",f).addClass("fa-spin");c('input[name="activity"]:checked',"#user-activity").change();c("i",f).removeClass("fa-spin");f.removeClass("disabled")},_initDesktopWidgets:function(e){if(a.enable_widgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var j=c(this);var i=j.data();var h={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},h,i.amsWidgetOptions);g=a.executeFunctionByName(i.amsWidgetInitcallback,j,g)||g;j.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){if(f==="error"){f="danger"}c(".alert-"+f,l).remove();var i='<div class="'+(e?"margin-10":"")+" alert alert-block alert-"+f+' 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> '+g+"</h4>"+(k?("<p>"+k+"</p>"):"");if(typeof(m)==="string"){i+="<ul><li>"+m+"</li></ul>"}else{if(m){i+="<ul>";for(var h in m){if(!c.isNumeric(h)){continue}i+="<li>"+m[h]+"</li>"}i+="</ul>"}}i+="</div>";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("OL.breadcrumb","#ribbon");c("li",e).not(".parent").remove();if(!c("li",e).exists()){e.append(c("<li></li>").append(c("<a></a>").text(a.i18n.HOME).addClass("padding-right-5").attr("href",c('nav a[href!="#"]:first').attr("href"))))}c("LI.active >A","nav").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("<li></li>").append(h.attr("href").replace(/^#/,"")?c("<a></a>").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(m){c(".active",j).removeClass("active");m.addClass("open").addClass("active");m.parents("li").addClass("open active").children("ul").addClass("active").show();m.parents("li:first").removeClass("open");m.parents("ul").addClass(m.attr("href").replace(/^#/,"")?"active":"").show()}var k;var j=c("nav");var i=location.hash;var g=i.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}k=c('A[href="'+i+'"]',j);if(k.exists()){e(k)}a.skin.loadURL(g,f);var h=c("html head title").data("ams-title-prefix");document.title=(h?h+" > ":"")+(c("[data-ams-page-title]:first",f).data("ams-page-title")||k.attr("title")||document.title)}else{var l=c("[data-ams-active-menu]").data("ams-active-menu");if(l){k=c('A[href="'+l+'"]',j)}else{k=c('>UL >LI >A[href!="#"]',j).first()}if(k.exists()){e(k);if(l){a.skin._drawBreadCrumb()}else{window.location.hash=k.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},unregisterCleanCallback:function(g){var f=a.skin._clean_callbacks;var e=f.indexOf(g);if(e>=0){f.splice(e,1)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f<g.length;f++){g[f].call(e)}},loadURL:function(g,e,f,j){if(g.startsWith("#")){g=g.substr(1)}if(typeof(f)==="function"){j=f;f={}}e=c(e);var i={type:"GET",url:g,dataType:"html",cache:false,beforeSend:function(){a.skin.cleanContainer(e);e.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> Loading... </h1>');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();var k=c("html head title").data("ams-title-prefix");document.title=(k?k+" > ":"")+c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(o,l,n){if(j){a.executeFunctionByName(j,this,o,l,n,f)}else{var m=a.ajax.getResponse(n);var p=m.content_type;var k=m.data;c(".loading",e).remove();switch(p){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(o).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}a.stats.logPageview()}},error:function(m,l,k){e.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+a.i18n.ERROR+k+"</h3>"+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logPageview:function(f){if(typeof(b._gaq)==="undefined"){return}var e=b.window.location;b._gaq.push(["_trackPageview",f||e.pathname+e.hash])},logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.left_panel=c("#left-panel");a.shortcuts=c("#shortcut");a.plugins.initData(e);var f=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var i=f();if(i&&(typeof(i.addEventListener)==="function")){var h=this;i.addEventListener("progress",function(j){h.progress(j)},false)}return i}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("A","#hide-menu").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(h){e.toggleClass("hidden-menu");h.preventDefault()});c("#show-shortcut").click(function(h){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}h.preventDefault()});a.shortcuts.click(function(h){a.skin._hideShortcutButtons()});c(document).mouseup(function(h){if(!a.shortcuts.is(h.target)&&a.shortcuts.has(h.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c("#activity").click(function(i){var h=c(this);var j=h.next(".ajax-dropdown");if(!j.is(":visible")){j.css("left",h.position().left-j.innerWidth()/2+h.innerWidth()/2).fadeIn(150);h.addClass("active")}else{j.fadeOut(150);h.removeClass("active")}i.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(h){var i=c(".ajax-dropdown");if(!i.is(h.target)&&i.has(h.target).length===0){i.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(k){var i=c(this).data("ams-url");if(i){k.preventDefault();k.stopPropagation();var j=a.getFunctionByName(i);if(typeof(j)==="function"){i=j.call(this)}if(typeof(i)==="function"){i.call(this)}else{var h=c(".ajax-notifications");a.skin.loadURL(i,h)}}});c("a","#logout").click(function(h){h.preventDefault();h.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+a.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+c("#show-shortcut").text()+"</strong></span> ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(i){if(i===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});var g=c("nav");c("UL",g).myams_menu({accordion:g.data("ams-menu-accordion")!==false,speed:a.menu_speed});c(".minifyme").click(function(h){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);h.preventDefault()});c("#refresh").click(function(h){a.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(i){if(i===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});h.preventDefault()});e.on("click",function(i){var h=c(this);if(!h.is(i.target)&&h.has(i.target).length===0&&c(".popover").has(i.target).length===0){h.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});g.resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){c(document).on("click",'a[href="#"]',function(h){h.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(m){var k=c(m.currentTarget);var i=k.data("ams-disabled-handlers");if((i===true)||(i==="click")||(i==="all")){return}var h=k.attr("href")||k.data("ams-url");if(!h||h.startsWith("javascript")||k.attr("target")||(k.data("ams-context-menu")===true)){return}m.preventDefault();m.stopPropagation();var j=a.getFunctionByName(h);if(typeof(j)==="function"){h=j.call(k)}if(typeof(h)==="function"){h.call(k)}else{h=h.replace(/\%23/,"#");var l=k.data("ams-target");if(l){a.form.confirmChangedForm(l,function(){a.skin.loadURL(h,l,k.data("ams-link-options"),k.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(h.startsWith("#")){if(h!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=h},50)}else{window.location.hash=h}}}else{window.location=h}})}}});c(document).on("click",'a[target="_blank"]',function(i){i.preventDefault();var h=c(i.currentTarget);window.open(h.attr("href"));a.stats.logEvent(h.data("ams-stats-category")||"Navigation",h.data("ams-stats-action")||"External",h.data("ams-stats-label")||h.attr("href"))});c(document).on("click",'a[target="_top"]',function(h){h.preventDefault();a.form.confirmChangedForm(function(){window.location=c(h.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(j){var i=c(this);var h=i.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}if(i.data("ams-context-menu")===true){return}if(i.data("ams-stop-propagation")===true){j.stopPropagation()}j.preventDefault();a.dialog.open(i);if(i.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var h=c(this);c(h.get(0).form).data("ams-submit-button",h)});c(document).on("click",'input[type="checkbox"][readonly]',function(){return false});c(document).on("click","[data-ams-click-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}var i=j.data();if(i.amsClickHandler){if((i.amsStopPropagation===true)||(i.amsClickStopPropagation===true)){k.stopPropagation()}if(i.amsClickKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsClickHandler);if(l!==undefined){l.call(j,i.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="change")||(h==="all")){return}var i=j.data();if(i.amsChangeHandler){if(i.amsChangeKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsChangeHandler);if(l!==undefined){l.call(j,i.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(i){var h=c(this);setTimeout(function(){h.find(".select2").trigger("change")},10);a.form.setFocus(h)});c(document).on("reset","[data-ams-reset-handler]",function(j){var h=c(this);var i=h.data();if(i.amsResetHandler){if(i.amsResetKeepDefault!==true){j.preventDefault()}var k=a.getFunctionByName(i.amsResetHandler);if(k!==undefined){k.call(h,i.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(j){j.preventDefault();var h=c(this);var i=h.parent(".button");if(i.exists()&&i.parent().hasClass("input-file")){i.next('input[type="text"]').val(h.val())}});c(document).on("focusin",function(h){if(c(h.target).closest(".mce-window").length){h.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(h){if(c(this).parent("li").hasClass("disabled")){h.preventDefault();return false}});c(document).on("show.bs.tab",function(j){var h=c(j.target);var i=h.data();if(i.amsUrl){if(i.amsTabLoaded){return}try{h.append('<i class="fa fa-spin fa-cog margin-left-5"></i>');a.skin.loadURL(i.amsUrl,h.attr("href"));if(i.amsTabLoadOnce){h.data("ams-tab-loaded",true)}}finally{c("i",h).remove()}}});c(document).on("hide.bs.modal",function(i){var h=c(i.target);a.form.confirmChangedForm(h,function(){h.data("modal").isShown=true;return true},function(){i.preventDefault();return false})});a.initContent(document);if(a.ajax_nav&&g.exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this);
\ No newline at end of file
+(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(0,f)===g)};String.prototype.endsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(e-f)===g)};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(f,g){var e=this.length;g=Number(g)||0;g=(g<0)?Math.ceil(g):Math.floor(g);if(g<0){g+=e}for(;g<e;g++){if(g in this&&this[g]===f){return g}}return -1}}c.expr[":"].hasvalue=function(g,e,f){return c(g).val()!==""};c.expr[":"].econtains=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"").toLowerCase()===f[3].toLowerCase()};c.expr[":"].withtext=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"")===f[3]};c.expr[":"].parents=function(g,e,f){return c(g).parents(f[3]).length>0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('<div style="width:50px; height:50px; overflow:auto"><div/></div>').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l<i){g-=l}return g}return this.each(function(){c("a",c(f.menuSelector)).each(function(){c(this).data("ams-context-menu",true)});c(this).on("contextmenu",function(g){if(g.ctrlKey){return}c(f.menuSelector).data("invokedOn",c(g.target)).show().css({position:"fixed",left:e(g.clientX,"width","scrollLeft")-10,top:e(g.clientY,"height","scrollTop")-10}).off("click").on("click",function(h){c(this).hide();var j=c(this).data("invokedOn");var i=c(h.target);f.menuSelected.call(this,j,i);a.event.stop(h)});return false});c(document).click(function(){c(f.menuSelector).hide()})})},myams_menu:function(e){var g={accordion:true,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append("<b class='collapse-sign'>"+f.closedSign+"</b>");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var l=c(this);if(l.hasClass("active")){return}var i=l.attr("href").replace(/^#/,"");var k=l.parent().find("UL");if(f.accordion){var j=l.parent().parents("UL");var m=h.find("UL:visible");m.each(function(o){var q=true;j.each(function(r){if(j[r]===m[o]){q=false;return false}});if(q){if(k!==m[o]){var p=c(m[o]);if(i||!p.hasClass("active")){p.slideUp(f.speed,function(){c(this).parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}}}})}var n=l.parent().find("UL:first");if(!i&&n.is(":visible")&&!n.hasClass("active")){n.slideUp(f.speed,function(){l.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{n.slideDown(f.speed,function(){l.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h<f.length;h++){var g=f.charCodeAt(h);if(g<128){e+=String.fromCharCode(g)}else{if((g>127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j<e.length){k=e.charCodeAt(j);if(k<128){g+=String.fromCharCode(k);j++}else{if((k>191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttleDelay:350,menuSpeed:235,navbarHeight:49,ajaxNav:true,enableWidgets:true,enableMobile:false,enableFastclick:false,warnOnFormChange:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.generateUUID=function(){var f=new Date().getTime();var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(h){var g=(f+Math.random()*16)%16|0;f=Math.floor(f/16);return(h=="x"?g:(g&3|8)).toString(16)});return e};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f<j.length;f++){try{g=g[j[f]]}catch(l){return undefined}}try{return g[h]}catch(l){return undefined}};d.executeFunctionByName=function(h,f){var g=a.getFunctionByName(h,window);if(typeof(g)==="function"){var e=Array.prototype.slice.call(arguments,2);return g.apply(f,e)}};d.getSource=function(e){return e.replace(/{[^{}]*}/g,function(f){return a.getFunctionByName(f.substr(1,f.length-2))})};d.getScript=function(f,i,e){if(typeof(i)==="object"){e=i;i=null}if(e===undefined){e={}}var h={dataType:"script",url:a.getSource(f),success:i,error:a.error.show,cache:!a.devmode,async:e.async===undefined?typeof(i)==="function":e.async};var g=c.extend({},h,e);return c.ajax(g)};d.getCSS=function(e,i){var g=c("HEAD");var f=c('link[data-ams-id="'+i+'"]',g);if(f.length===0){var h=a.getSource(e);if(a.devmode){h+="?_="+new Date().getTime()}c("<link />").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(i,e,h,f){if(e.statusText==="OK"){return}var e=a.ajax.getResponse(e);if(e.contentType==="json"){a.ajax.handleJSON(e.data)}else{var j=i.statusText||i.type;var g=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+j+"</h4><p>"+g+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(i);b.console.debug(e)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.contentType==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"<h4>"+e+"</h4><p>"+g+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result}};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var j=h.getResponseHeader("content-type"),g,f;if(j){if(j.startsWith("application/javascript")){g="script";f=h.responseText}else{if(j.startsWith("text/html")){g="html";f=h.responseText}else{if(j.startsWith("text/xml")){g="xml";f=h.responseText}else{f=h.responseJSON;if(f){g="json"}else{try{f=JSON.parse(h.responseText);g="json"}catch(i){f=h.responseText;g="text"}}}}}}else{g="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{contentType:g,data:f}},handleJSON:function(p,g,k){var i=p.status;var e;switch(i){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":a.form.resetChanged(g);if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||k||"#content");break;case"redirect":a.form.resetChanged(g);if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+i)}}var j;var l;var f;if(p.content){l=p.content;f=c(l.target||k||g||"#content");if(l.raw===true){f.text(l.text)}else{f.html(l.html);a.initContent(f)}if(!l.keep_hidden){f.removeClass("hidden")}}if(p.contents){var h=p.contents;for(j=0;j<h.length;j++){l=h[j];f=c(l.target);if(l.raw===true){f.text(l.text)}else{f.html(l.html);a.initContent(f)}if(!l.keep_hidden){f.removeClass("hidden")}}}var o;if(p.message){o=p.message;if(typeof(o)==="string"){if((i==="info")||(i==="success")){a.skin.smallBox(i,{title:o,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(c(g||"#content"),i,o)}}else{a.skin.alert(c(o.target||k||g||"#content"),o.status||"success",o.header,o.body,o.subtitle)}}if(p.smallbox){a.skin.smallBox(p.smallbox_status||i,{title:p.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(p.messagebox){o=p.messagebox;if(typeof(o)==="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:o,timeout:10000})}else{var m=o.status||"info";if(m==="error"&&g&&k){a.executeFunctionByName(g.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",g,k)}a.skin.messageBox(m,{title:o.title||a.i18n.ERROR_OCCURED,content:o.content,icon:o.icon,number:o.number,timeout:o.timeout===null?undefined:(o.timeout||10000)})}}if(p.event){g.trigger(p.event,p.event_options)}if(p.callback){a.executeFunctionByName(p.callback,g,p.options)}if(p.callbacks){var n;for(j=0;j<p.callbacks.length;j++){n=p.callbacks[j];a.executeFunctionByName(n,g,n.options)}}}};d.jsonrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},query:function(f,h,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(g==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var k={};if(typeof(f)==="string"){k.query=f}else{if(typeof(f)==="object"){c.extend(k,f)}}c.extend(k,e);var i;var j={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:k,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};c.jsonRpc(j);return i})},post:function(h,f,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(typeof(g)==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var i;var k={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:f,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};var j=c.extend({},k,e);c.jsonRpc(j);return i})}};d.xmlrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},post:function(f,i,g,e,h){a.ajax.check(c.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+a.devext+".js",function(){if(typeof(e)==="function"){h=e;e={}}else{if(!e){e={}}}if(typeof(h)==="undefined"){h=e.callback}if(typeof(h)==="string"){h=a.getFunctionByName(h)}delete e.callback;var j;var l={url:a.xmlrpc.getAddr(f),methodName:i,params:g,success:h||function(m){j=m},error:a.error.show};var k=c.extend({},l,e);c.xmlrpc(k);return j})}};d.form={init:function(f){var e;if(a.warnOnFormChange){e=c('FORM[data-ams-warn-on-change!="false"]',f)}else{e=c('FORM[data-ams-warn-on-change="true"]',f)}e.each(function(){var g=c(this);c('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',g).each(function(){var i=c(this);if(i.data("ams-ignore-change")!==true){var h=i.data("ams-changed-event")||"change";i.on(h,function(){a.form.setChanged(c(this).parents("FORM"))})}});g.on("reset",function(){a.form.resetChanged(c(this))})})},setFocus:function(e){var f=c("[data-ams-focus-target]",e).first();if(!f.exists()){f=c("input, select",e).first()}if(f.exists()){if(f.hasClass("select2-input")){f=f.parents(".select2")}if(f.hasClass("select2")){setTimeout(function(){f.select2("focus");if(f.data("ams-focus-open")===true){f.select2("open")}},100)}else{f.focus()}}},checkBeforeUnload:function(){var e=c('FORM[data-ams-form-changed="true"]');if(e.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(g,h,f){if(typeof(g)==="function"){h=g;g=undefined}var e=c('FORM[data-ams-form-changed="true"]',g);if(e.exists()){if(f){if(b.confirm(a.i18n.FORM_CHANGED_WARNING,a.i18n.WARNING)){h.call(g)}else{f.call(g)}}else{a.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){h.call(g)}})}}else{h.call(g)}},setChanged:function(e){e.attr("data-ams-form-changed",true)},resetChanged:function(e){e.removeAttr("data-ams-form-changed")},submit:function(h,g,f){h=c(h);if(!h.exists()){return false}if(typeof(g)==="object"){f=g;g=undefined}if(h.data("submitted")){if(!h.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:h.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(h)){return false}c(".alert-danger, SPAN.state-error",h).not(".persistent").remove();c(".state-error",h).removeClassPrefix("state-");var e=c(h.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(o,s){var m,z,D;var K=o.data();var n=K.amsFormOptions;var C;var q;var u;var t;var l;var H;function p(O,P){var N;function M(){m.button("reset");clearInterval(N);a.executeFunctionByName(H,o,m)}function L(){a.ajax.post(O,{progress_id:P},{error:M},a.getFunctionByName(l)||function(Q,R){if(R=="success"){if(Q.status==="running"){if(Q.message){m.text(Q.message)}else{m.text(m.data("ams-progress-text")+" "+Q.current+" / "+Q.length)}}else{if(Q.status==="finished"){M()}}}else{M()}})}m.button("loading");N=setInterval(L,t)}if(f){q=f.formDataInitCallback}if(q){delete f.formDataInitCallback}else{q=K.amsFormDataInitCallback}if(q){var A={};if(typeof(q)==="function"){C=q.call(o,A)}else{C=a.executeFunctionByName(q,o,A)}if(A.veto){m=o.data("ams-submit-button");if(m){m.button("reset")}a.form.finalizeSubmitFooter.call(o);return false}}else{C=K.amsFormData||{}}m=c(o.data("ams-submit-button"));if(m&&m.exists()){z=m.data();D=z.amsFormSubmitTarget}else{z={}}var v;var I=g||z.amsFormHandler||K.amsFormHandler||"";if(I.startsWith(window.location.protocol)){v=I}else{var B=z.amsFormAction||o.attr("action").replace(/#/,"");if(B.startsWith(window.location.protocol)){v=B}else{v=a.ajax.getAddr()+B}v+=I}u=z.amsProgressHandler||K.amsProgressHandler||"";t=z.amsProgressInterval||K.amsProgressInterval||1000;l=z.amsProgressCallback||K.amsProgressCallback;H=z.amsProgressEndCallback||K.amsProgressEndCallback;var J=null;if(f&&f.initSubmitTarget){a.executeFunctionByName(f.initSubmitTarget,o)}else{if(K.amsFormInitSubmitTarget){J=c(D||K.amsFormSubmitTarget||"#content");a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmit",o,J)}else{if(!K.amsFormHideSubmitFooter){a.executeFunctionByName(K.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",o)}}}if(f){C=c.extend({},C,f.form_data)}var w;if(u){C.progress_id=a.generateUUID()}else{w=typeof(s.uuid)!=="undefined";if(w){if(v.indexOf("X-Progress-ID")<0){v+="?X-Progress-ID="+s.uuid}delete s.uuid}}var y={url:v,type:"post",cache:false,data:C,dataType:K.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(M,L){L.data("submitted",true)},error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},iframe:w};var F=(f&&f.downloadTarget)||K.amsFormDownloadTarget;if(F){var x=c('iframe[name="'+F+'"]');if(!x.exists()){x=c("<iframe></iframe>").hide().attr("name",F).appendTo(c("body"))}y=c.extend({},y,{iframe:true,iframeTarget:x,success:function(L,M,Q,P){var O=c(P).parents(".modal-dialog");if(O.exists()){a.dialog.close(P)}else{var R;var N=P.data("ams-submit-button");if(N){R=N.data("ams-form-submit-callback")}if(!R){R=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{R.call(P,L,M,Q,P)}finally{a.form.resetAfterSubmit(P);a.form.resetChanged(P)}}}})}else{y=c.extend({},y,{error:function(O,L,M,N){if(J){a.executeFunctionByName(K.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",N,J)}a.form.resetAfterSubmit(N)},success:function(L,M,P,O){var Q;var N=O.data("ams-submit-button");if(N){Q=N.data("ams-form-submit-callback")}if(!Q){Q=a.getFunctionByName(K.amsFormSubmitCallback)||a.form._submitCallback}try{Q.call(O,L,M,P,O)}finally{a.form.resetAfterSubmit(O);a.form.resetChanged(O)}},iframe:w})}var G=c.extend({},y,s,n,f);if(u){p(u,C.progress_id)}c(o).ajaxSubmit(G);if(F){var E=c(o).parents(".modal-dialog");var r=E.exists()&&m.exists()&&m.data("ams-keep-modal");if(E.exists()&&(r!==true)){a.dialog.close(o)}else{setTimeout(function(){a.form.resetAfterSubmit(o,m);a.form.resetChanged(o)},m.data("ams-form-reset-timeout")||2000)}}}var j=(h.data("ams-form-ignore-uploads")!==true)&&(c('INPUT[type="file"]',h).length>0);if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(h)});k(h,i)}else{k(h,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=e.data("ams-form-submit-message")}if(f){h+="<strong>"+f+"</strong>"}c(g).html('<div class="row margin-20"><div class="text-center">'+h+"</div></div>");c(g).parents(".hidden").removeClass("hidden")},resetAfterSubmit:function(f){if(f.is(":visible")){var e=f.data("ams-submit-button");if(e){e.button("reset")}a.form.finalizeSubmitFooter.call(f)}f.data("submitted",false);f.removeData("ams-submit-button")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+f+"</strong>"}var g=c("footer",e);c("button",g).hide();g.append('<div class="row"><div class="text-center">'+h+"</div></div>")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,h,g,e){var j;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);j=e.data("ams-submit-button");if(j){j.button("reset")}}var i=e.data();var l;if(i.amsFormDatatype){l=i.amsFormDatatype}else{var f=a.ajax.getResponse(g);l=f.contentType;o=f.data}var k;if(j){k=c(j.data("ams-form-submit-target")||i.amsFormSubmitTarget||"#content")}else{k=c(i.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:a.form.resetChanged(e);if(j&&(j.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k);a.form.setFocus(k)}var m=g.getResponseHeader("X-AMS-Callback");if(m){var n=g.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),g)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k<i.length;k++){var f=i[k];var e=f[0];var m=f[1];var l=a.executeFunctionByName(m,g,e);if(l===false){n=false}else{if(typeof(l)==="string"){h.push(l)}else{if(n.length&&(n.length>0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,l){var i;if(typeof(l)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,l)}else{if(l instanceof Array){i=l.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,l)}else{c(".state-error",e).removeClass("state-error");i=l.error_header||(l.widgets&&(l.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var k;if(l.messages){for(k=0;k<l.messages.length;k++){var h=l.messages[k];if(h.header){n.push("<strong>"+h.header+"</strong><br />"+h.message)}else{n.push(h.message||h)}}}if(l.widgets){for(k=0;k<l.widgets.length;k++){var m=l.widgets[k];var j=c('[name="'+m.name+'"]',e);j.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+m.message+"</span>");if(m.label){n.push(m.label+" : "+m.message)}var g=j.parents(".tab-pane").index()+1;if(g>0){var f=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+g+")",f).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(c("fieldset:first",e),l.error_level||"error",i,n,l.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>'}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(o,n,m){c("body").modalmanager("removeLoading");var l=a.ajax.getResponse(m);var s=l.contentType;var u=l.data;switch(s){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var q=c(u);var r=c(".modal-dialog",q.wrap("<div></div>").parent());var p=r.data();var t={backdrop:"static",overflow:p.amsModalOverflow||".modal-viewport",maxHeight:p.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",q).outerHeight(true)-c("footer",q).outerHeight(true)-85}:a.getFunctionByName(p.amsModalMaxHeight)};var k=c.extend({},t,p.amsModalOptions);k=a.executeFunctionByName(p.amsModalInitCallback,r,k)||k;c("<div>").addClass("modal fade").append(q).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(q);if(i.amsLogEvent!==false){a.stats.logPageview(h)}}}})}})})},shown:function(m){function l(o){var p=c(".scrollmarker.top",f);var n=f.scrollTop();if(n>0){p.show()}else{p.hide()}var e=c(".scrollmarker.bottom",f);if(j+n>=f.get(0).scrollHeight){e.hide()}else{e.show()}}var k=m.target;var f=c(".modal-viewport",k);if(f.exists()){var j=parseInt(f.css("max-height"));var h=c.scrollbarWidth();if((f.css("overflow")!=="hidden")&&(f.height()===j)){c("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",f.width()-h).hide().appendTo(f);c("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",j-20).css("width",f.width()-h).appendTo(f);f.scroll(l);f.off("resize").on("resize",l)}else{c(".scrollmarker",f).remove()}}var g;var i=c(".modal-dialog",k).data("shown-callbacks");if(i){for(g=0;g<i.length;g++){i[g].call(k)}}i=a.dialog._shown_callbacks;if(i){for(g=0;g<i.length;g++){i[g].call(k)}}a.form.setFocus(k)},close:function(f){if(typeof(f)==="string"){f=c(f)}var g=f.parents(".modal").data("modal");if(g){var e=c("body").data("modalmanager");if(e&&(e.getOpenModals().indexOf(g)>=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f<g.length;f++){g[f].call(h)}}g=a.dialog._hide_callbacks;if(g){for(f=0;f<g.length;f++){g[f].call(h)}}}};d.helpers={select2ClearSelection:function(){var f=c(this);var e=f.parents("label");var g=f.data("ams-select2-target");c('[name="'+g+'"]',e).data("select2").val("")},select2FormatSelection:function(f,e){if(f instanceof Array){c(f).each(function(){if(typeof(this)==="object"){e.append(this.text)}else{e.append(this)}})}else{if(typeof(f)==="object"){e.append(f.text)}else{e.append(f)}}},select2QueryUrlResultsCallback:function(g,f,e){switch(g.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+g.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+f.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var g=i.data();if(g.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||g.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var e=a.getFunctionByName(f);if(typeof(e)==="function"){f=e.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(j){a.plugins.initData(j);var i=[];c("[data-ams-plugins-disabled]",j).each(function(){var o=c(this).data("ams-plugins-disabled").split(/\s+/);for(var p=0;p<o.length;p++){i.push(o[p])}});var g={};var k;var e;function h(o,q){if(g.hasOwnProperty(o)){var p=g[o];p.css=p.css||q.css;if(q.callback){p.callbacks.push(q.callback)}if(q.register){p.register=true}if(q.async===false){p.async=false}}else{g[o]={src:q.src,css:q.css,callbacks:q.callback?[q.callback]:[],register:q.register,async:q.async}}if(q.css){a.getCSS(q.css,o+"_css")}}c("[data-ams-plugins]",j).each(function(){var r=c(this);var p=r.data("ams-plugins");if(typeof(p)==="string"){var s=r.data("ams-plugins").split(/\s+/);for(var o=0;o<s.length;o++){e=s[o];var q={src:r.data("ams-plugin-"+e+"-src"),css:r.data("ams-plugin-"+e+"-css"),callback:r.data("ams-plugin-"+e+"-callback"),register:r.data("ams-plugin-"+e+"-register"),async:r.data("ams-plugin-"+e+"-async")};h(e,q)}}else{for(e in p){if(!p.hasOwnProperty(e)){continue}h(e,p[e])}}});for(e in g){if(a.plugins.enabled[e]===undefined){k=g[e];a.getScript(k.src,function(){var p;var r=k.callbacks;if(r&&r.length){for(p=0;p<r.length;p++){var q=a.getFunctionByName(r[p]);if(k.register!==false){var o=a.plugins.enabled;if(o.hasOwnProperty(e)){o[e].push(q)}else{o[e]=[q]}}}}else{if(k.register!==false){a.plugins.enabled[e]=null}}if(r&&r.length&&(k.async!==false)){for(p=0;p<r.length;p++){a.getFunctionByName(r[p])(j)}}},{async:k.async===undefined?true:k.async})}}for(var l in a.plugins.enabled){if(!a.plugins.enabled.hasOwnProperty(l)){continue}if(i.indexOf(l)>=0){continue}var m=a.plugins.enabled[l];if(m){switch(typeof(m)){case"function":m(j);break;default:for(var f=0;f<m.length;f++){var n=m[f];if(typeof(n)==="function"){n(j)}}}}}},initData:function(e){c("[data-ams-data]",e).each(function(){var f=c(this);var h=f.data("ams-data");if(h){for(var g in h){if(h.hasOwnProperty(g)){f.attr("data-"+g,h[g])}}}})},register:function(f,e,h){if(typeof(e)==="function"){h=e;e=null}e=e||f.name;if(a.plugins.enabled.indexOf(e)>=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var j=c(this);var i=j.data();var k={html:i.amsHintHtml,title:a.getFunctionByName(i.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(i.amsHintTitleAttr||"title")||(i.amsHintHtml?l.html():l.text())},opacity:i.amsHintOpacity||0.95,gravity:i.amsHintGravity||"sw",offset:i.amsHintOffset||0};var g=c.extend({},k,i.amsHintOptions);g=a.executeFunctionByName(i.amsHintInitCallback,j,g)||g;var h=j.tipsy(g);a.executeFunctionByName(i.amsHintAfterInitCallback,j,h,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var j=c(this);var i=j.data();var k={menuSelector:i.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},k,i.amsContextmenuOptions);g=a.executeFunctionByName(i.amsContextmenuInitCallback,j,g)||g;var h=j.contextMenu(g);a.executeFunctionByName(i.amsContextmenuAfterInitCallback,j,h,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('<i class="fa fa-fw"></i>').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var p=c(this);var r=p.parent("fieldset");var h=p.data();if(!h.amsChecker){var f=c('<label class="checkbox"></label>');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var q=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('<input type="hidden">').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(p)}else{if(g){c('<input type="hidden">').attr("name",g).attr("value",1).prependTo(p)}}var o=c('<input type="checkbox">').attr("name",k).attr("id",q).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){o.attr("disabled","disabled")}else{o.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");p.trigger("ams.checker.before-switch",[p,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,p,v);if(!h.amsCheckerCancelDefault){var t=o.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");p.trigger("ams.checker.opened",[p])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");p.trigger("ams.checker.closed",[p])}}})}o.appendTo(f);c(">label",p).attr("for",o.attr("id"));f.append("<i></i>").prependTo(p);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){o.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}p.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider-2.0.0"+a.devext+".js",function(){f.each(function(){var i=c(this);var j=i.data();var k={};var g=c.extend({},k,i.data.amsSliderOptions);g=a.executeFunctionByName(j.amsSliderInitCallback,i,g)||g;var h=i.slider(g);a.executeFunctionByName(j.amsSliderAfterInitCallback,i,h,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var j=g.data();var k={containment:j.amsDraggableContainment,helper:a.getFunctionByName(j.amsDraggableHelper)||j.amsDraggableHelper,start:a.getFunctionByName(j.amsDraggableStart),stop:a.getFunctionByName(j.amsDraggableStop)};var h=c.extend({},k,j.amsDraggableOptions);h=a.executeFunctionByName(j.amsDraggableInitCallback,g,h)||h;var i=g.draggable(h);g.disableSelection();a.executeFunctionByName(j.amsDraggableAfterInitCallback,g,i,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var i=k.data();var j={items:i.amsSortableItems,handle:i.amsSortableHandle,connectWith:i.amsSortableConnectwith,start:a.getFunctionByName(i.amsSortableStart),over:a.getFunctionByName(i.amsSortableOver),containment:i.amsSortableContainment,placeholder:i.amsSortablePlaceholder,stop:a.getFunctionByName(i.amsSortableStop)};var g=c.extend({},j,i.amsSortableOptions);g=a.executeFunctionByName(i.amsSortableInitCallback,k,g)||g;var h=k.sortable(g);k.disableSelection();a.executeFunctionByName(i.amsSortableAfterInitCallback,k,h,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var j=g.data();var k={autoHide:j.amsResizableAutohide===false?true:j.amsResizableAutohide,containment:j.amsResizableContainment,grid:j.amsResizableGrid,handles:j.amsResizableHandles,start:a.getFunctionByName(j.amsResizableStart),stop:a.getFunctionByName(j.amsResizableStop)};var h=c.extend({},k,j.amsResizableOptions);h=a.executeFunctionByName(j.amsResizableInitCallback,g,h)||h;var i=g.resizable(h);g.disableSelection();a.executeFunctionByName(j.amsResizableAfterInitCallback,g,i,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k={};var h=c.extend({},k,j.amsTypeaheadOptions);h=a.executeFunctionByName(j.amsTypeaheadInitCallback,g,h)||h;var i=g.typeahead(h);a.executeFunctionByName(j.amsTypeaheadAfterInitCallback,g,i,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var l={placeholder:k.amsSelect2Placeholder,multiple:k.amsSelect2Multiple,minimumInputLength:k.amsSelect2MinimumInputLength||0,maximumSelectionSize:k.amsSelect2MaximumSelectionSize,openOnEnter:k.amsSelect2EnterOpen===undefined?true:k.amsSelect2EnterOpen,allowClear:k.amsSelect2AllowClear===undefined?true:k.amsSelect2AllowClear,width:k.amsSelect2Width||"100%",initSelection:a.getFunctionByName(k.amsSelect2InitSelection),formatSelection:k.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(k.amsSelect2FormatSelection),formatResult:a.getFunctionByName(k.amsSelect2FormatResult),formatMatches:k.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(k.amsSelect2FormatMatches),formatNoMatches:k.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(k.amsSelect2FormatResult),formatInputTooShort:k.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatInputTooShort),formatInputTooLong:k.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatInputTooLong),formatSelectionTooBig:k.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(k.amsSelect2FormatSelectionTooBig),formatLoadMore:k.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(k.amsSelect2FormatLoadMore),formatSearching:k.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(k.amsSelect2FormatSearching),separator:k.amsSelect2Separator||",",tokenSeparators:k.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(k.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!l.initSelection){var h=g.data("ams-select2-values");if(h){l.initSelection=function(m,o){var n=[];c(m.val().split(l.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){l.query=function(){return[]}}}else{if(k.amsSelect2Query){l.query=a.getFunctionByName(k.amsSelect2Query);l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2QueryUrl){l.ajax={url:k.amsSelect2QueryUrl,quietMillis:k.amsSelect2QuietMillis||200,type:k.amsSelect2QueryType||"POST",dataType:k.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[k.amsSelect2QueryParamName||"query"]=o;m[k.amsSelect2PageParamName||"page"]=p;m[k.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,k.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2QueryMethod){l.query=function(m){var n={url:k.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:k.amsSelect2MethodType||"POST",cache:false,method:k.amsSelect2QueryMethod,params:k.amsSelect2QueryParams||{},success:function(p,o){return a.helpers.select2QueryMethodSuccessCallback.call(g,p,o,m)},error:a.error.show};n.params[k.amsSelect2QueryParamName||"query"]=m.term;n.params[k.amsSelect2PageParamName||"page"]=m.page;n.params[k.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,k.amsSelect2QueryOptions);n=a.executeFunctionByName(k.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){c.jsonRpc(n)})};l.minimumInputLength=k.amsSelect2MinimumInputLength||1}else{if(k.amsSelect2Tags){l.tags=k.amsSelect2Tags}else{if(k.amsSelect2Data){l.data=k.amsSelect2Data}}}}}}if(k.amsSelect2EnableFreeTags){l.createSearchChoice=function(m){return{id:m,text:(k.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},l,k.amsSelect2Options);i=a.executeFunctionByName(k.amsSelect2InitCallback,g,i)||i;var j=g.select2(i);a.executeFunctionByName(k.amsSelect2AfterInitCallback,g,j,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.4.1"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k={placeholder:j.amsMaskeditPlaceholder===undefined?"X":j.amsMaskeditPlaceholder,complete:a.getFunctionByName(j.amsMaskeditComplete)};var h=c.extend({},k,j.amsMaskeditOptions);h=a.executeFunctionByName(j.amsMaskeditInitCallback,g,h)||h;var i=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(j.amsMaskeditAfterInitCallback,g,i,h)})})}},inputmask:function(f){var e=c("[data-input-mask]",f);if(e.length>0){a.ajax.check(c.fn.inputmask,a.baseURL+"ext/jquery-inputmask-bundle-3.2.8"+a.devext+".js",function(){e.each(function(){var g=c(this);var j=g.data();var k;if(typeof(j.inputMask)==="object"){k=j.inputMask}else{k={mask:j.inputMask.toString()}}var h=c.extend({},k,j.amsInputmaskOptions);h=a.executeFunctionByName(j.amsInputmaskInitCallback,g,h)||h;var i=g.inputmask(h);a.executeFunctionByName(j.amsInputmaskAfterInitCallback,g,i,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var k=h.data();var l={lang:k.amsDatetimepickerLang||a.lang,format:k.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},l,k.amsDatetimepickerOptions);i=a.executeFunctionByName(k.amsDatetimepickerInitCallback,h,i)||i;var j=h.datetimepicker(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var k=h.data();var l={position:k.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},l,k.amsColorpickerOptions);i=a.executeFunctionByName(k.amsColorpickerInitCallback,h,i)||i;var j=h.minicolors(i);a.executeFunctionByName(k.amsDatetimepickerAfterInitCallback,h,j,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var l=c(this);var m=l.data();var n={ignore:null,submitHandler:l.attr("data-async")!==undefined?m.amsFormSubmitHandler===undefined?function(){c(".state-error",l).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(l)}:a.getFunctionByName(m.amsFormSubmitHandler):undefined,invalidHandler:l.attr("data-async")!==undefined?m.amsFormInvalidHandler===undefined?function(t,s){c(".state-error",l).removeClass("state-error");for(var r=0;r<s.errorList.length;r++){var q=s.errorList[r];var p=c(q.element).parents(".tab-pane").index()+1;if(p>0){var o=c(".nav-tabs",c(q.element).parents(".tabforms"));c("li:nth-child("+p+")",o).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",o).click()}}}:a.getFunctionByName(m.amsFormInvalidHandler):undefined};c("[data-ams-validate-rules]",l).each(function(o){if(o===0){n.rules={}}n.rules[c(this).attr("name")]=c(this).data("ams-validate-rules")});var j=c.extend({},n,m.amsValidateOptions);j=a.executeFunctionByName(m.amsValidateInitCallback,l,j)||j;var k=l.validate(j);a.executeFunctionByName(m.amsValidateAfterInitCallback,l,k,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var K=D.data();var G=(K.amsDatatableExtensions||"").split(/\s+/);var q=K.amsDatatableSdom||"W"+((G.indexOf("colreorder")>=0||G.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(G.indexOf("colvis")>=0?"C":"")+((K.amsDatatablePagination===false||K.amsDatatablePaginationSize===false)?"":"L")+(K.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(G.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(K.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var u;var m=K.amsDatatableSorting;if(typeof(m)==="string"){var J=m.split(";");m=[];for(u=0;u<J.length;u++){var i=J[u].split(",");i[0]=parseInt(i[0]);m.push(i)}}var j=[];var o;var A=c("th",D).listattr("data-ams-datatable-sortable");for(u=0;u<A.length;u++){var n=A[u];if(n!==undefined){o=j[u]||{};o.bSortable=n;j[u]=o}}var v=c("th",D).listattr("data-ams-datatable-stype");for(u=0;u<v.length;u++){var s=v[u];if(s){o=j[u]||{};o.sType=s;j[u]=o}}var x={bJQueryUI:false,bFilter:K.amsDatatableGlobalFilter!==false||G.indexOf("columnfilter")>=0,bPaginate:K.amsDatatablePagination!==false,bInfo:K.amsDatatableInfo!==false,bSort:K.amsDatatableSort!==false,aaSorting:m,aoColumns:j.length>0?j:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:K.amsDatatableDisplayLength||25,sPaginationType:K.amsDatatablePaginationType||"bootstrap_full",sDom:q,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(M,L){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}};var E=c.extend({},x,K.amsDatatableOptions);if(G.length>0){for(u=0;u<G.length;u++){switch(G[u]){case"autofill":a.ajax.check(c.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+a.devext+".js");break;case"columnfilter":a.ajax.check(c.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+a.devext+".js");break;case"colreorder":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+a.devext+".js");break;case"colreorderwithresize":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+a.devext+".js");break;case"colvis":a.ajax.check(c.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+a.devext+".js");var w={activate:"click",sAlign:"right"};E.oColVis=c.extend({},w,K.amsDatatableColvisOptions);break;case"editable":a.ajax.check(c.fn.editable,a.baseURL+"ext/jquery-jeditable"+a.devext+".js");a.ajax.check(c.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+a.devext+".js");break;case"fixedcolumns":a.ajax.check(c.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+a.devext+".js");break;case"fixedheader":a.ajax.check(c.fn.dataTable.FixedHeader,a.baseURL+"ext/jquery-dataTables-fixedHeader"+a.devext+".js");break;case"keytable":a.ajax.check(window.KeyTable,a.baseURL+"ext/jquery-dataTables-keyTable"+a.devext+".js");break;case"rowgrouping":a.ajax.check(c.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+a.devext+".js");break;case"rowreordering":a.ajax.check(c.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+a.devext+".js");break;case"scroller":a.ajax.check(c.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+a.devext+".js");break;default:break}}}E=a.executeFunctionByName(K.amsDatatableInitCallback,D,E)||E;try{var p=D.dataTable(E);a.executeFunctionByName(K.amsDatatableAfterInitCallback,D,p,E);if(G.length>0){for(u=0;u<G.length;u++){switch(G[u]){case"autofill":var l=c.extend({},K.amsDatatableAutofillOptions,E.autofill);l=a.executeFunctionByName(K.amsDatatableAutofillInitCallback,D,l)||l;D.data("ams-autofill",K.amsDatatableAutofillConstructor===undefined?new c.fn.dataTable.AutoFill(D,l):a.executeFunctionByName(K.amsDatatableAutofillConstructor,D,p,l));break;case"columnfilter":var I={sPlaceHolder:"head:after"};var H=c.extend({},I,K.amsDatatableColumnfilterOptions,E.columnfilter);H=a.executeFunctionByName(K.amsDatatableColumnfilterInitCallback,D,H)||H;D.data("ams-columnfilter",K.amsDatatableColumnfilterConstructor===undefined?p.columnFilter(H):a.executeFunctionByName(K.amsDatatableColumnfilterConstructor,D,p,H));break;case"editable":var z=c.extend({},K.amsDatatableEditableOptions,E.editable);z=a.executeFunctionByName(K.amsDatatableEditableInitCallback,D,z)||z;D.data("ams-editable",K.amsDatatableEditableConstructor===undefined?D.makeEditable(z):a.executeFunctionByName(K.amsDatatableEditableConstructor,D,p,z));break;case"fixedcolumns":var y=c.extend({},K.amsDatatableFixedcolumnsOptions,E.fixedcolumns);y=a.executeFunctionByName(K.amsDatatableFixedcolumnsInitCallback,D,y)||y;D.data("ams-fixedcolumns",K.amsDatatableFixedcolumnsConstructor===undefined?new c.fn.dataTable.FixedColumns(D,y):a.executeFunctionByName(K.amsDatatableFixedcolumnsConstructor,D,p,y));break;case"fixedheader":var k=c.extend({},K.amsDatatableFixedheaderOptions,E.fixedheader);k=a.executeFunctionByName(K.amsDatatableFixedheadeInitCallback,D,k)||k;D.data("ams-fixedheader",K.amsDatatableFixedheaderConstructor===undefined?new c.fn.dataTable.FixedHeader(D,k):a.executeFunctionByName(K.amsDatatableFixedheaderConstructor,D,p,k));break;case"keytable":var r={table:D.get(0),datatable:p};var F=c.extend({},r,K.amsDatatableKeytableOptions,E.keytable);F=a.executeFunctionByName(K.amsDatatableKeytableInitCallback,D,F)||F;D.data("ams-keytable",K.amsDatatableKeytableConstructor===undefined?new KeyTable(F):a.executeFunctionByName(K.amsDatatableKeytableConstructor,D,p,F));break;case"rowgrouping":var h=c.extend({},K.amsDatatableRowgroupingOptions,E.rowgrouping);h=a.executeFunctionByName(K.amsDatatableRowgroupingInitCallback,D,h)||h;D.data("ams-rowgrouping",K.amsDatatableRowgroupingConstructor===undefined?D.rowGrouping(h):a.executeFunctionByName(K.amsDatatableRowgroupingConstructor,D,p,h));break;case"rowreordering":var t=c.extend({},K.amsDatatableRowreorderingOptions,E.rowreordering);t=a.executeFunctionByName(K.amsDatatableRowreorderingInitCallback,D,t)||t;D.data("ams-rowreordering",K.amsDatatableRowreorderingConstructor===undefined?D.rowReordering(t):a.executeFunctionByName(K.amsDatatableRowreorderingConstructor,D,p,t));break;default:break}}}var B=(K.amsDatatableFinalizeCallback||"").split(/\s+/);if(B.length>0){for(u=0;u<B.length;u++){a.executeFunctionByName(B[u],D,p,E)}}}catch(C){}})})}},tablednd:function(f){var e=c(".table-dnd",f);if(e.length>0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var j=c(this);var k=j.data();if(k.amsTabledndDragHandle){c("tr",j).addClass("no-drag-handle")}else{c(j).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")})}var l={onDragClass:k.amsTabledndDragClass||"dragging-row",onDragStart:a.getFunctionByName(k.amsTabledndDragStart),dragHandle:k.amsTabledndDragHandle,scrollAmount:k.amsTabledndScrollAmount,onAllowDrop:k.amsTabledndAllowDrop,onDrop:a.getFunctionByName(k.amsTabledndDrop)||function(p,q){var o=k.amsTabledndDropTarget;if(o){c(q).data("ams-disabled-handlers","click");var m=[];c(p.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var n=a.getFunctionByName(o);if(typeof(n)==="function"){n.call(j,p,m)}else{a.ajax.post(o,{names:JSON.stringify(m)})}setTimeout(function(){c(q).removeData("ams-disabled-handlers")},50)}return false}};var h=c.extend({},l,k.amsTabledndOptions);h=a.executeFunctionByName(k.amsTabledndInitCallback,j,h)||h;var i=j.tableDnD(h);a.executeFunctionByName(k.amsTabledndAfterInitCallback,j,i,h)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.11-rc1"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var l=c(this);var k=l.data();var i=k.amsImgareaselectParent?l.parents(k.amsImgareaselectParent):"body";var m={instance:true,handles:true,parent:i,x1:k.amsImgareaselectX1||0,y1:k.amsImgareaselectY1||0,x2:k.amsImgareaselectX2||k.amsImgareaselectImageWidth,y2:k.amsImgareaselectY2||k.amsImgareaselectImageHeight,imageWidth:k.amsImgareaselectImageWidth,imageHeight:k.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:k.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(k.amsImgareaselectSelectEnd)||function(n,o){var p=k.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',i).val(o.x1);c('input[name="'+p+'y1"]',i).val(o.y1);c('input[name="'+p+'x2"]',i).val(o.x2);c('input[name="'+p+'y2"]',i).val(o.y2)}};var h=c.extend({},m,k.amsImgareaselectOptions);h=a.executeFunctionByName(k.amsImgareaselectInitCallback,l,h)||h;var j=l.imgAreaSelect(h);a.executeFunctionByName(k.amsImgareaselectAfterInitCallback,l,j,h);setTimeout(function(){j.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var n=h.data();var m=(n.amsFancyboxHelpers||"").split(/\s+/);if(m.length>0){for(var i=0;i<m.length;i++){var l=m[i];switch(l){case"buttons":a.ajax.check(c.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons"+a.devext+".js");break;case"thumbs":a.ajax.check(c.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+a.devext+".js");break;case"media":a.ajax.check(c.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media"+a.devext+".js");break;default:break}}}var o={type:n.amsFancyboxType,padding:n.amsFancyboxPadding||10,margin:n.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(n.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(n.amsFancyboxTitleGetter,this)||c(this.element).attr("original-title")||c(this.element).attr("title")},helpers:{title:{type:"inside"}}};var j=c.extend({},o,n.amsFancyboxOptions);j=a.executeFunctionByName(n.amsFancyboxInitCallback,h,j)||j;var k=h.fancybox(j);a.executeFunctionByName(n.amsFancyboxAfterInitCallback,h,k,j)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var j=l.data();var k={theme:j.amsScrollbarTheme||"light"};var h=c.extend({},k,j.amsScrollbarOptions);h=a.executeFunctionByName(j.amsScrollbarInitCallback,l,h)||h;var i=l.mCustomScrollbar(h);a.executeFunctionByName(j.amsScrollbarAfterInitCallback,l,i,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var h=c(this).data();var j=c.extend({},f,h.amsMessageboxOptions);var g=c.extend({},j,{title:h.amsMessageboxTitle||j.title||"",content:h.amsMessageboxContent||j.content||"",icon:h.amsMessageboxIcon||j.icon,number:h.amsMessageboxNumber||j.number,timeout:h.amsMessageboxTimeout||j.timeout});var e=h.amsMessageboxStatus||j.status||"info";var i=a.getFunctionByName(h.amsMessageboxCallback||j.callback);a.skin.messageBox(e,g,i)},smallBox:function(f){var h=c(this).data();var j=c.extend({},f,h.amsSmallboxOptions);var g=c.extend({},j,{title:h.amsSmallboxTitle||j.title||"",content:h.amsSmallboxContent||j.content||"",icon:h.amsSmallboxIcon||j.icon,iconSmall:h.amsSmallboxIconSmall||j.iconSmall,timeout:h.amsSmallboxTimeout||j.timeout});var e=h.amsSmallboxStatus||j.status||"info";var i=a.getFunctionByName(h.amsSmallboxCallback||j.callback);a.skin.smallBox(e,g,i)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var j=f.parents("table");var g=j.data("ams-location")||"";var k=f.parents("tr");var h=k.data("ams-delete-target")||j.data("ams-delete-target")||"delete-element.json";var l=k.data("ams-element-name");d.ajax.post(g+"/"+h,{object_name:l},function(m,n){if(m.status==="success"){if(j.hasClass("datatable")){j.dataTable().fnDeleteRow(k[0])}else{k.remove()}}})}})}}};d.skin={_setPageHeight:function(){var e=c("#main").height();var g=a.leftPanel.height();var f=c(window).height()-a.navbarHeight;if(e>f){a.leftPanel.css("min-height",e);a.root.css("min-height",e+a.navbarHeight)}else{a.leftPanel.css("min-height",f);a.root.css("min-height",f)}},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c("#activity > .badge");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},refreshNotificationsPanel:function(g){var f=c(this);f.addClass("disabled");c("i",f).addClass("fa-spin");c('input[name="activity"]:checked',"#user-activity").change();c("i",f).removeClass("fa-spin");f.removeClass("disabled")},_initDesktopWidgets:function(e){if(a.enableWidgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var i=c(this);var h=i.data();var j={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},j,h.amsWidgetOptions);g=a.executeFunctionByName(h.amsWidgetInitcallback,i,g)||g;i.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enableMobile&&a.enableWidgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){if(f==="error"){f="danger"}c(".alert-"+f,l).remove();var i='<div class="'+(e?"margin-10":"")+" alert alert-block alert-"+f+' 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> '+g+"</h4>"+(k?("<p>"+k+"</p>"):"");if(typeof(m)==="string"){i+="<ul><li>"+m+"</li></ul>"}else{if(m){i+="<ul>";for(var h in m){if(!c.isNumeric(h)){continue}i+="<li>"+m[h]+"</li>"}i+="</ul>"}}i+="</div>";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("OL.breadcrumb","#ribbon");c("li",e).not(".parent").remove();if(!c("li",e).exists()){e.append(c("<li></li>").append(c("<a></a>").text(a.i18n.HOME).addClass("padding-right-5").attr("href",c('nav a[href!="#"]:first').attr("href"))))}c("LI.active >A","nav").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("<li></li>").append(h.attr("href").replace(/^#/,"")?c("<a></a>").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(m){c(".active",k).removeClass("active");m.addClass("open").addClass("active");m.parents("li").addClass("open active").children("ul").addClass("active").show();m.parents("li:first").removeClass("open");m.parents("ul").addClass(m.attr("href").replace(/^#/,"")?"active":"").show()}var l;var k=c("nav");var i=location.hash;var g=i.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}l=c('A[href="'+i+'"]',k);if(l.exists()){e(l)}a.skin.loadURL(g,f);var h=c("html head title").data("ams-title-prefix");document.title=(h?h+" > ":"")+(c("[data-ams-page-title]:first",f).data("ams-page-title")||l.attr("title")||document.title)}else{var j=c("[data-ams-active-menu]").data("ams-active-menu");if(j){l=c('A[href="'+j+'"]',k)}else{l=c('>UL >LI >A[href!="#"]',k).first()}if(l.exists()){e(l);if(j){a.skin._drawBreadCrumb()}else{window.location.hash=l.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},unregisterCleanCallback:function(g){var f=a.skin._clean_callbacks;var e=f.indexOf(g);if(e>=0){f.splice(e,1)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f<g.length;f++){g[f].call(e)}},loadURL:function(g,e,f,j){if(g.startsWith("#")){g=g.substr(1)}if(typeof(f)==="function"){j=f;f={}}e=c(e);var i={type:"GET",url:g,dataType:"html",cache:false,beforeSend:function(){a.skin.cleanContainer(e);e.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> Loading... </h1>');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();var k=c("html head title").data("ams-title-prefix");document.title=(k?k+" > ":"")+c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(p,l,o){if(j){a.executeFunctionByName(j,this,p,l,o,f)}else{var n=a.ajax.getResponse(o);var m=n.contentType;var k=n.data;c(".loading",e).remove();switch(m){case"json":a.ajax.handleJSON(k,e);break;case"script":break;case"xml":break;case"html":case"text":default:e.parents(".hidden").removeClass("hidden");c(".alert",e.parents(".alerts-container")).remove();e.css({opacity:"0.0"}).html(p).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(e);a.form.setFocus(e)}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}a.stats.logPageview()}},error:function(m,l,k){e.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+a.i18n.ERROR+k+"</h3>"+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logPageview:function(f){if(typeof(b._gaq)==="undefined"){return}var e=b.window.location;b._gaq.push(["_trackPageview",f||e.pathname+e.hash])},logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.leftPanel=c("#left-panel");a.shortcuts=c("#shortcut");a.plugins.initData(e);var g=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var i=g();if(i&&(typeof(i.addEventListener)==="function")){var h=this;i.addEventListener("progress",function(j){h.progress(j)},false)}return i}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enableFastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("A","#hide-menu").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(h){e.toggleClass("hidden-menu");h.preventDefault()});c("#show-shortcut").click(function(h){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}h.preventDefault()});a.shortcuts.click(function(h){a.skin._hideShortcutButtons()});c(document).mouseup(function(h){if(!a.shortcuts.is(h.target)&&a.shortcuts.has(h.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c("#activity").click(function(i){var h=c(this);var j=h.next(".ajax-dropdown");if(!j.is(":visible")){j.css("left",h.position().left-j.innerWidth()/2+h.innerWidth()/2).fadeIn(150);h.addClass("active")}else{j.fadeOut(150);h.removeClass("active")}i.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(h){var i=c(".ajax-dropdown");if(!i.is(h.target)&&i.has(h.target).length===0){i.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(k){var j=c(this).data("ams-url");if(j){k.preventDefault();k.stopPropagation();var i=a.getFunctionByName(j);if(typeof(i)==="function"){j=i.call(this)}if(typeof(j)==="function"){j.call(this)}else{var h=c(".ajax-notifications");a.skin.loadURL(j,h)}}});c("a","#logout").click(function(h){h.preventDefault();h.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+a.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+c("#show-shortcut").text()+"</strong></span> ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(i){if(i===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});var f=c("nav");c("UL",f).myams_menu({accordion:f.data("ams-menu-accordion")!==false,speed:a.menuSpeed});c(".minifyme").click(function(h){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);h.preventDefault()});c("#refresh").click(function(h){a.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(i){if(i===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});h.preventDefault()});e.on("click",function(i){var h=c(this);if(!h.is(i.target)&&h.has(i.target).length===0&&c(".popover").has(i.target).length===0){h.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});f.resize(function(){a.skin._setPageHeight()})});if(a.ajaxNav){c(document).on("click",'a[href="#"]',function(h){h.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(m){var k=c(m.currentTarget);var j=k.data("ams-disabled-handlers");if((j===true)||(j==="click")||(j==="all")){return}var i=k.attr("href")||k.data("ams-url");if(!i||i.startsWith("javascript")||k.attr("target")||(k.data("ams-context-menu")===true)){return}m.preventDefault();m.stopPropagation();var h=a.getFunctionByName(i);if(typeof(h)==="function"){i=h.call(k)}if(typeof(i)==="function"){i.call(k)}else{i=i.replace(/\%23/,"#");var l=k.data("ams-target");if(l){a.form.confirmChangedForm(l,function(){a.skin.loadURL(i,l,k.data("ams-link-options"),k.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(i.startsWith("#")){if(i!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=i},50)}else{window.location.hash=i}}}else{window.location=i}})}}});c(document).on("click",'a[target="_blank"]',function(i){i.preventDefault();var h=c(i.currentTarget);window.open(h.attr("href"));a.stats.logEvent(h.data("ams-stats-category")||"Navigation",h.data("ams-stats-action")||"External",h.data("ams-stats-label")||h.attr("href"))});c(document).on("click",'a[target="_top"]',function(h){h.preventDefault();a.form.confirmChangedForm(function(){window.location=c(h.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(j){var i=c(this);var h=i.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}if(i.data("ams-context-menu")===true){return}if(i.data("ams-stop-propagation")===true){j.stopPropagation()}j.preventDefault();a.dialog.open(i);if(i.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var h=c(this);c(h.get(0).form).data("ams-submit-button",h)});c(document).on("click",'input[type="checkbox"][readonly]',function(){return false});c(document).on("click","[data-ams-click-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="click")||(h==="all")){return}var i=j.data();if(i.amsClickHandler){if((i.amsStopPropagation===true)||(i.amsClickStopPropagation===true)){k.stopPropagation()}if(i.amsClickKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsClickHandler);if(l!==undefined){l.call(j,i.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(k){var j=c(this);var h=j.data("ams-disabled-handlers");if((h===true)||(h==="change")||(h==="all")){return}var i=j.data();if(i.amsChangeHandler){if(i.amsChangeKeepDefault!==true){k.preventDefault()}var l=a.getFunctionByName(i.amsChangeHandler);if(l!==undefined){l.call(j,i.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(i){var h=c(this);setTimeout(function(){h.find(".select2").trigger("change")},10);a.form.setFocus(h)});c(document).on("reset","[data-ams-reset-handler]",function(j){var h=c(this);var i=h.data();if(i.amsResetHandler){if(i.amsResetKeepDefault!==true){j.preventDefault()}var k=a.getFunctionByName(i.amsResetHandler);if(k!==undefined){k.call(h,i.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(j){j.preventDefault();var h=c(this);var i=h.parent(".button");if(i.exists()&&i.parent().hasClass("input-file")){i.next('input[type="text"]').val(h.val())}});c(document).on("focusin",function(h){if(c(h.target).closest(".mce-window").length){h.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(h){if(c(this).parent("li").hasClass("disabled")){h.preventDefault();return false}});c(document).on("show.bs.tab",function(j){var h=c(j.target);var i=h.data();if(i.amsUrl){if(i.amsTabLoaded){return}try{h.append('<i class="fa fa-spin fa-cog margin-left-5"></i>');a.skin.loadURL(i.amsUrl,h.attr("href"));if(i.amsTabLoadOnce){h.data("ams-tab-loaded",true)}}finally{c("i",h).remove()}}});c(document).on("hide.bs.modal",function(i){var h=c(i.target);a.form.confirmChangedForm(h,function(){h.data("modal").isShown=true;return true},function(){i.preventDefault();return false})});a.initContent(document);if(a.ajaxNav&&f.exists()){a.skin.checkURL()}a.form.setFocus(document);c(window).on("beforeunload",a.form.checkBeforeUnload)};d.initContent=function(e){c(".tipsy").remove();c("[rel=tooltip]",e).tooltip();c("[rel=popover]",e).popover();c("[rel=popover-hover]",e).popover({trigger:"hover"});a.plugins.init(e);a.callbacks.init(e);a.events.init(e);a.form.init(e);if(a.device==="desktop"){a.skin._initDesktopWidgets(e)}else{a.skin._initMobileWidgets(e)}a.skin._setPageHeight()};d.i18n={INFO:"Information",WARNING:"!! WARNING !!",ERROR:"ERROR: ",WAIT:"Please wait!",FORM_SUBMITTED:"This form was already submitted...",NO_SERVER_RESPONSE:"No response from server!",ERROR_OCCURED:"An error occured!",ERRORS_OCCURED:"Some errors occured!",BAD_LOGIN_TITLE:"Bad login!",BAD_LOGIN_MESSAGE:"Your anthentication credentials didn't allow you to open a session; please check your credentials or contact administrator.",CONFIRM:"Confirm",CONFIRM_REMOVE:"Removing this content can't be undone. Do you confirm?",CLEAR_STORAGE_TITLE:"Clear Local Storage",CLEAR_STORAGE_CONTENT:"Would you like to RESET all your saved widgets and clear LocalStorage?",BTN_OK:"OK",BTN_CANCEL:"Cancel",BTN_OK_CANCEL:"[OK][Cancel]",BTN_YES:"Yes",BTN_NO:"No",BTN_YES_NO:"[Yes][No]",CLIPBOARD_COPY:"Copy to clipboard with Ctrl+C, and Enter",FORM_CHANGED_WARNING:"Some changes were not saved. These updates will be lost if you leave this page.",DELETE_WARNING:"This change can't be undone. Are you sure that you want to delete this element?",NO_UPDATE:"No changes were applied.",DATA_UPDATED:"Data successfully updated.",HOME:"Home",LOGOUT:"Logout?",LOGOUT_COMMENT:"You can improve your security further after logging out by closing this opened browser",SELECT2_PLURAL:"s",SELECT2_MATCH:"One result is available, press enter to select it.",SELECT2_MATCHES:" results are available, use up and down arrow keys to navigate.",SELECT2_NOMATCHES:"No matches found",SELECT2_SEARCHING:"Searching...",SELECT2_LOADMORE:"Loading more results...",SELECT2_INPUT_TOOSHORT:"Please enter {0} more character{1}",SELECT2_INPUT_TOOLONG:"Please delete {0} character{1}",SELECT2_SELECTION_TOOBIG:"You can only select {0} item{1}",SELECT2_FREETAG_PREFIX:"Free text: ",DT_COLUMNS:"Columns"};c(document).ready(function(){c=jQuery.noConflict();var e=c("HTML");var f=e.attr("lang")||e.attr("xml:lang");if(f&&!f.startsWith("en")){d.lang=f;d.getScript(d.baseURL+"i18n/myams_"+f.substr(0,2)+".js",function(){d.initPage()})}else{d.initPage()}})})(jQuery,this);
\ No newline at end of file