Switch to 'strict' mode
authorThierry Florac <thierry.florac@onf.fr>
Tue, 17 Nov 2015 12:05:38 +0100
changeset 142 0201f1422bd7
parent 141 a4200ce41c25
child 143 63b798053ece
Switch to 'strict' mode
src/ztfy/myams/resources/js/ext/jquery-color-2.1.2.min.js
src/ztfy/myams/resources/js/ext/jquery-minicolors.min.js
src/ztfy/myams/resources/js/ext/jquery-xmlrpc.min.js
src/ztfy/myams/resources/js/myams-dataTables.js
src/ztfy/myams/resources/js/myams-dataTables.min.js
src/ztfy/myams/resources/js/myams-graphs.js
src/ztfy/myams/resources/js/myams-graphs.min.js
src/ztfy/myams/resources/js/myams-notify.js
src/ztfy/myams/resources/js/myams-notify.min.js
src/ztfy/myams/resources/js/myams-widgets.js
src/ztfy/myams/resources/js/myams-widgets.min.js
src/ztfy/myams/resources/js/myams.js
src/ztfy/myams/resources/js/myams.min.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ztfy/myams/resources/js/ext/jquery-color-2.1.2.min.js	Tue Nov 17 12:05:38 2015 +0100
@@ -0,0 +1,11 @@
+/*
+ * jQuery Color Animations v2.1.2
+ * https://github.com/jquery/jquery-color
+ *
+ * Copyright 2013 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * Date: Wed Jan 16 08:47:09 2013 -0600
+ */
+(function(o,d){var k="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",h=/^([\-+])=\s*(\d+\.?\d*)/,g=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(p){return[p[1],p[2],p[3],p[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(p){return[p[1]*2.55,p[2]*2.55,p[3]*2.55,p[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(p){return[parseInt(p[1],16),parseInt(p[2],16),parseInt(p[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(p){return[parseInt(p[1]+p[1],16),parseInt(p[2]+p[2],16),parseInt(p[3]+p[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(p){return[p[1],p[2]/100,p[3]/100,p[4]]}}],e=o.Color=function(q,r,p,s){return new o.Color.fn.parse(q,r,p,s)},j={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},n={"byte":{floor:true,max:255},percent:{max:1},degrees:{mod:360,floor:true}},m=e.support={},b=o("<p>")[0],a,l=o.each;b.style.cssText="background-color:rgba(1,1,1,.5)";m.rgba=b.style.backgroundColor.indexOf("rgba")>-1;l(j,function(p,q){q.cache="_"+p;q.props.alpha={idx:3,type:"percent",def:1}});function i(q,s,r){var p=n[s.type]||{};if(q==null){return(r||!s.def)?null:s.def}q=p.floor?~~q:parseFloat(q);if(isNaN(q)){return s.def}if(p.mod){return(q+p.mod)%p.mod}return 0>q?0:p.max<q?p.max:q}function f(p){var r=e(),q=r._rgba=[];p=p.toLowerCase();l(g,function(w,x){var u,v=x.re.exec(p),t=v&&x.parse(v),s=x.space||"rgba";if(t){u=r[s](t);r[j[s].cache]=u[j[s].cache];q=r._rgba=u._rgba;return false}});if(q.length){if(q.join()==="0,0,0,0"){o.extend(q,a.transparent)}return r}return a[p]}e.fn=o.extend(e.prototype,{parse:function(v,t,p,u){if(v===d){this._rgba=[null,null,null,null];return this}if(v.jquery||v.nodeType){v=o(v).css(t);t=d}var s=this,r=o.type(v),q=this._rgba=[];if(t!==d){v=[v,t,p,u];r="array"}if(r==="string"){return this.parse(f(v)||a._default)}if(r==="array"){l(j.rgba.props,function(w,x){q[x.idx]=i(v[x.idx],x)});return this}if(r==="object"){if(v instanceof e){l(j,function(w,x){if(v[x.cache]){s[x.cache]=v[x.cache].slice()}})}else{l(j,function(x,y){var w=y.cache;l(y.props,function(z,A){if(!s[w]&&y.to){if(z==="alpha"||v[z]==null){return}s[w]=y.to(s._rgba)}s[w][A.idx]=i(v[z],A,true)});if(s[w]&&o.inArray(null,s[w].slice(0,3))<0){s[w][3]=1;if(y.from){s._rgba=y.from(s[w])}}})}return this}},is:function(r){var p=e(r),s=true,q=this;l(j,function(t,v){var w,u=p[v.cache];if(u){w=q[v.cache]||v.to&&v.to(q._rgba)||[];l(v.props,function(x,y){if(u[y.idx]!=null){s=(u[y.idx]===w[y.idx]);return s}})}return s});return s},_space:function(){var p=[],q=this;l(j,function(r,s){if(q[s.cache]){p.push(r)}});return p.pop()},transition:function(q,w){var r=e(q),s=r._space(),t=j[s],u=this.alpha()===0?e("transparent"):this,v=u[t.cache]||t.to(u._rgba),p=v.slice();r=r[t.cache];l(t.props,function(A,C){var z=C.idx,y=v[z],x=r[z],B=n[C.type]||{};if(x===null){return}if(y===null){p[z]=x}else{if(B.mod){if(x-y>B.mod/2){y+=B.mod}else{if(y-x>B.mod/2){y-=B.mod}}}p[z]=i((x-y)*w+y,C)}});return this[s](p)},blend:function(s){if(this._rgba[3]===1){return this}var r=this._rgba.slice(),q=r.pop(),p=e(s)._rgba;return e(o.map(r,function(t,u){return(1-q)*p[u]+q*t}))},toRgbaString:function(){var q="rgba(",p=o.map(this._rgba,function(r,s){return r==null?(s>2?1:0):r});if(p[3]===1){p.pop();q="rgb("}return q+p.join()+")"},toHslaString:function(){var q="hsla(",p=o.map(this.hsla(),function(r,s){if(r==null){r=s>2?1:0}if(s&&s<3){r=Math.round(r*100)+"%"}return r});if(p[3]===1){p.pop();q="hsl("}return q+p.join()+")"},toHexString:function(p){var q=this._rgba.slice(),r=q.pop();if(p){q.push(~~(r*255))}return"#"+o.map(q,function(s){s=(s||0).toString(16);return s.length===1?"0"+s:s}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}});e.fn.parse.prototype=e.fn;function c(t,s,r){r=(r+1)%1;if(r*6<1){return t+(s-t)*r*6}if(r*2<1){return s}if(r*3<2){return t+(s-t)*((2/3)-r)*6}return t}j.hsla.to=function(t){if(t[0]==null||t[1]==null||t[2]==null){return[null,null,null,t[3]]}var p=t[0]/255,w=t[1]/255,x=t[2]/255,z=t[3],y=Math.max(p,w,x),u=Math.min(p,w,x),A=y-u,B=y+u,q=B*0.5,v,C;if(u===y){v=0}else{if(p===y){v=(60*(w-x)/A)+360}else{if(w===y){v=(60*(x-p)/A)+120}else{v=(60*(p-w)/A)+240}}}if(A===0){C=0}else{if(q<=0.5){C=A/B}else{C=A/(2-B)}}return[Math.round(v)%360,C,q,z==null?1:z]};j.hsla.from=function(w){if(w[0]==null||w[1]==null||w[2]==null){return[null,null,null,w[3]]}var v=w[0]/360,u=w[1],t=w[2],r=w[3],x=t<=0.5?t*(1+u):t+u-t*u,y=2*t-x;return[Math.round(c(y,x,v+(1/3))*255),Math.round(c(y,x,v)*255),Math.round(c(y,x,v-(1/3))*255),r]};l(j,function(q,s){var r=s.props,p=s.cache,u=s.to,t=s.from;e.fn[q]=function(z){if(u&&!this[p]){this[p]=u(this._rgba)}if(z===d){return this[p].slice()}var w,y=o.type(z),v=(y==="array"||y==="object")?z:arguments,x=this[p].slice();l(r,function(A,C){var B=v[y==="object"?A:C.idx];if(B==null){B=x[C.idx]}x[C.idx]=i(B,C)});if(t){w=e(t(x));w[p]=x;return w}else{return e(x)}};l(r,function(v,w){if(e.fn[v]){return}e.fn[v]=function(A){var C=o.type(A),z=(v==="alpha"?(this._hsla?"hsla":"rgba"):q),y=this[z](),B=y[w.idx],x;if(C==="undefined"){return B}if(C==="function"){A=A.call(this,B);C=o.type(A)}if(A==null&&w.empty){return this}if(C==="string"){x=h.exec(A);if(x){A=B+parseFloat(x[2])*(x[1]==="+"?1:-1)}}y[w.idx]=A;return this[z](y)}})});e.hook=function(q){var p=q.split(" ");l(p,function(r,s){o.cssHooks[s]={set:function(w,x){var u,v,t="";if(x!=="transparent"&&(o.type(x)!=="string"||(u=f(x)))){x=e(u||x);if(!m.rgba&&x._rgba[3]!==1){v=s==="backgroundColor"?w.parentNode:w;while((t===""||t==="transparent")&&v&&v.style){try{t=o.css(v,"backgroundColor");v=v.parentNode}catch(y){}}x=x.blend(t&&t!=="transparent"?t:"_default")}x=x.toRgbaString()}try{w.style[s]=x}catch(y){}}};o.fx.step[s]=function(t){if(!t.colorInit){t.start=e(t.elem,s);t.end=e(t.end);t.colorInit=true}o.cssHooks[s].set(t.elem,t.start.transition(t.end,t.pos))}})};e.hook(k);o.cssHooks.borderColor={expand:function(q){var p={};l(["Top","Right","Bottom","Left"],function(s,r){p["border"+r+"Color"]=q});return p}};a=o.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}})(jQuery);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ztfy/myams/resources/js/ext/jquery-minicolors.min.js	Tue Nov 17 12:05:38 2015 +0100
@@ -0,0 +1,1 @@
+(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof exports==="object"){module.exports=a(require("jquery"))}else{a(jQuery)}}}(function(f){f.minicolors={defaults:{animationSpeed:50,animationEasing:"swing",change:null,changeDelay:0,control:"hue",dataUris:true,defaultValue:"",hide:null,hideSpeed:100,inline:false,letterCase:"lowercase",opacity:false,position:"bottom left",show:null,showSpeed:100,theme:"default"}};f.extend(f.fn,{minicolors:function(v,u){switch(v){case"destroy":f(this).each(function(){t(f(this))});return f(this);case"hide":k();return f(this);case"opacity":if(u===undefined){return f(this).attr("data-opacity")}else{f(this).each(function(){b(f(this).attr("data-opacity",u))})}return f(this);case"rgbObject":return i(f(this),v==="rgbaObject");case"rgbString":case"rgbaString":return j(f(this),v==="rgbaString");case"settings":if(u===undefined){return f(this).data("minicolors-settings")}else{f(this).each(function(){var w=f(this).data("minicolors-settings")||{};t(f(this));f(this).minicolors(f.extend(true,w,u))})}return f(this);case"show":s(f(this).eq(0));return f(this);case"value":if(u===undefined){return f(this).val()}else{f(this).each(function(){b(f(this).val(u))})}return f(this);default:if(v!=="create"){u=v}f(this).each(function(){p(f(this),u)});return f(this)}}});function p(u,v){var x=f('<div class="minicolors" />'),w=f.minicolors.defaults;if(u.data("minicolors-initialized")){return}v=f.extend(true,{},w,v);x.addClass("minicolors-theme-"+v.theme).toggleClass("minicolors-with-opacity",v.opacity).toggleClass("minicolors-no-data-uris",v.dataUris!==true);if(v.position!==undefined){f.each(v.position.split(" "),function(){x.addClass("minicolors-position-"+this)})}u.addClass("minicolors-input").data("minicolors-initialized",false).data("minicolors-settings",v).prop("size",7).wrap(x).after('<div class="minicolors-panel minicolors-slider-'+v.control+'"><div class="minicolors-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-opacity-slider minicolors-sprite"><div class="minicolors-picker"></div></div><div class="minicolors-grid minicolors-sprite"><div class="minicolors-grid-inner"></div><div class="minicolors-picker"><div></div></div></div></div>');if(!v.inline){u.after('<span class="minicolors-swatch minicolors-sprite"><span class="minicolors-swatch-color"></span></span>');u.next(".minicolors-swatch").on("click",function(y){y.preventDefault();u.focus()})}u.parent().find(".minicolors-panel").on("selectstart",function(){return false}).end();if(v.inline){u.parent().addClass("minicolors-inline")}b(u,false);u.data("minicolors-initialized",true)}function t(u){var v=u.parent();u.removeData("minicolors-initialized").removeData("minicolors-settings").removeProp("size").removeClass("minicolors-input");v.before(u).remove()}function s(v){var x=v.parent(),u=x.find(".minicolors-panel"),w=v.data("minicolors-settings");if(!v.data("minicolors-initialized")||v.prop("disabled")||x.hasClass("minicolors-inline")||x.hasClass("minicolors-focus")){return}k();x.addClass("minicolors-focus");u.stop(true,true).fadeIn(w.showSpeed,function(){if(w.show){w.show.call(v.get(0))}})}function k(){f(".minicolors-focus").each(function(){var x=f(this),v=x.find(".minicolors-input"),u=x.find(".minicolors-panel"),w=v.data("minicolors-settings");u.fadeOut(w.hideSpeed,function(){if(w.hide){w.hide.call(v.get(0))}x.removeClass("minicolors-focus")})})}function o(H,v,w){var K=H.parents(".minicolors").find(".minicolors-input"),z=K.data("minicolors-settings"),F=H.find("[class$=-picker]"),E=H.offset().left,D=H.offset().top,J=Math.round(v.pageX-E),I=Math.round(v.pageY-D),B=w?z.animationSpeed:0,C,A,u,G;if(v.originalEvent.changedTouches){J=v.originalEvent.changedTouches[0].pageX-E;I=v.originalEvent.changedTouches[0].pageY-D}if(J<0){J=0}if(I<0){I=0}if(J>H.width()){J=H.width()}if(I>H.height()){I=H.height()}if(H.parent().is(".minicolors-slider-wheel")&&F.parent().is(".minicolors-grid")){C=75-J;A=75-I;u=Math.sqrt(C*C+A*A);G=Math.atan2(A,C);if(G<0){G+=Math.PI*2}if(u>75){u=75;J=75-(75*Math.cos(G));I=75-(75*Math.sin(G))}J=Math.round(J);I=Math.round(I)}if(H.is(".minicolors-grid")){F.stop(true).animate({top:I+"px",left:J+"px"},B,z.animationEasing,function(){h(K,H)})}else{F.stop(true).animate({top:I+"px"},B,z.animationEasing,function(){h(K,H)})}}function h(M,T){function P(y,x){var V,U;if(!y.length||!x){return null}V=y.offset().left;U=y.offset().top;return{x:V-x.offset().left+(y.outerWidth()/2),y:U-x.offset().top+(y.outerHeight()/2)}}var D,E,S,K,J,N,A,H=M.val(),B=M.attr("data-opacity"),C=M.parent(),R=M.data("minicolors-settings"),O=C.find(".minicolors-swatch"),u=C.find(".minicolors-grid"),Q=C.find(".minicolors-slider"),G=C.find(".minicolors-opacity-slider"),F=u.find("[class$=-picker]"),L=Q.find("[class$=-picker]"),z=G.find("[class$=-picker]"),w=P(F,u),v=P(L,Q),I=P(z,G);if(T.is(".minicolors-grid, .minicolors-slider")){switch(R.control){case"wheel":K=(u.width()/2)-w.x;J=(u.height()/2)-w.y;N=Math.sqrt(K*K+J*J);A=Math.atan2(J,K);if(A<0){A+=Math.PI*2}if(N>75){N=75;w.x=69-(75*Math.cos(A));w.y=69-(75*Math.sin(A))}E=m(N/0.75,0,100);D=m(A*180/Math.PI,0,360);S=m(100-Math.floor(v.y*(100/Q.height())),0,100);H=c({h:D,s:E,b:S});Q.css("backgroundColor",c({h:D,s:E,b:100}));break;case"saturation":D=m(parseInt(w.x*(360/u.width()),10),0,360);E=m(100-Math.floor(v.y*(100/Q.height())),0,100);S=m(100-Math.floor(w.y*(100/u.height())),0,100);H=c({h:D,s:E,b:S});Q.css("backgroundColor",c({h:D,s:100,b:S}));C.find(".minicolors-grid-inner").css("opacity",E/100);break;case"brightness":D=m(parseInt(w.x*(360/u.width()),10),0,360);E=m(100-Math.floor(w.y*(100/u.height())),0,100);S=m(100-Math.floor(v.y*(100/Q.height())),0,100);H=c({h:D,s:E,b:S});Q.css("backgroundColor",c({h:D,s:E,b:100}));C.find(".minicolors-grid-inner").css("opacity",1-(S/100));break;default:D=m(360-parseInt(v.y*(360/Q.height()),10),0,360);E=m(Math.floor(w.x*(100/u.width())),0,100);S=m(100-Math.floor(w.y*(100/u.height())),0,100);H=c({h:D,s:E,b:S});u.css("backgroundColor",c({h:D,s:100,b:100}));break}M.val(l(H,R.letterCase))}if(T.is(".minicolors-opacity-slider")){if(R.opacity){B=parseFloat(1-(I.y/G.height())).toFixed(2)}else{B=1}if(R.opacity){M.attr("data-opacity",B)}}O.find("SPAN").css({backgroundColor:H,opacity:B});e(M,H,B)}function b(H,I){var C,K,z,F,E,J,w,A=H.parent(),N=H.data("minicolors-settings"),L=A.find(".minicolors-swatch"),u=A.find(".minicolors-grid"),M=A.find(".minicolors-slider"),D=A.find(".minicolors-opacity-slider"),B=u.find("[class$=-picker]"),G=M.find("[class$=-picker]"),v=D.find("[class$=-picker]");C=l(q(H.val(),true),N.letterCase);if(!C){C=l(q(N.defaultValue,true),N.letterCase)}K=d(C);if(!I){H.val(C)}if(N.opacity){z=H.attr("data-opacity")===""?1:m(parseFloat(H.attr("data-opacity")).toFixed(2),0,1);if(isNaN(z)){z=1}H.attr("data-opacity",z);L.find("SPAN").css("opacity",z);E=m(D.height()-(D.height()*z),0,D.height());v.css("top",E+"px")}L.find("SPAN").css("backgroundColor",C);switch(N.control){case"wheel":J=m(Math.ceil(K.s*0.75),0,u.height()/2);w=K.h*Math.PI/180;F=m(75-Math.cos(w)*J,0,u.width());E=m(75-Math.sin(w)*J,0,u.height());B.css({top:E+"px",left:F+"px"});E=150-(K.b/(100/u.height()));if(C===""){E=0}G.css("top",E+"px");M.css("backgroundColor",c({h:K.h,s:K.s,b:100}));break;case"saturation":F=m((5*K.h)/12,0,150);E=m(u.height()-Math.ceil(K.b/(100/u.height())),0,u.height());B.css({top:E+"px",left:F+"px"});E=m(M.height()-(K.s*(M.height()/100)),0,M.height());G.css("top",E+"px");M.css("backgroundColor",c({h:K.h,s:100,b:K.b}));A.find(".minicolors-grid-inner").css("opacity",K.s/100);break;case"brightness":F=m((5*K.h)/12,0,150);E=m(u.height()-Math.ceil(K.s/(100/u.height())),0,u.height());B.css({top:E+"px",left:F+"px"});E=m(M.height()-(K.b*(M.height()/100)),0,M.height());G.css("top",E+"px");M.css("backgroundColor",c({h:K.h,s:K.s,b:100}));A.find(".minicolors-grid-inner").css("opacity",1-(K.b/100));break;default:F=m(Math.ceil(K.s/(100/u.width())),0,u.width());E=m(u.height()-Math.ceil(K.b/(100/u.height())),0,u.height());B.css({top:E+"px",left:F+"px"});E=m(M.height()-(K.h/(360/M.height())),0,M.height());G.css("top",E+"px");u.css("backgroundColor",c({h:K.h,s:100,b:100}));break}if(H.data("minicolors-initialized")){e(H,C,z)}}function e(u,y,v){var w=u.data("minicolors-settings"),x=u.data("minicolors-lastChange");if(!x||x.hex!==y||x.opacity!==v){u.data("minicolors-lastChange",{hex:y,opacity:v});if(w.change){if(w.changeDelay){clearTimeout(u.data("minicolors-changeTimeout"));u.data("minicolors-changeTimeout",setTimeout(function(){w.change.call(u.get(0),y,v)},w.changeDelay))}else{w.change.call(u.get(0),y,v)}}u.trigger("change").trigger("input")}}function i(u){var x=q(f(u).val(),true),w=n(x),v=f(u).attr("data-opacity");if(!w){return null}if(v!==undefined){f.extend(w,{a:parseFloat(v)})}return w}function j(u,y){var x=q(f(u).val(),true),w=n(x),v=f(u).attr("data-opacity");if(!w){return null}if(v===undefined){v=1}if(y){return"rgba("+w.r+", "+w.g+", "+w.b+", "+parseFloat(v)+")"}else{return"rgb("+w.r+", "+w.g+", "+w.b+")"}}function l(u,v){return v==="uppercase"?u.toUpperCase():u.toLowerCase()}function q(u,v){u=u.replace(/[^A-F0-9]/ig,"");if(u.length!==3&&u.length!==6){return""}if(u.length===3&&v){u=u[0]+u[0]+u[1]+u[1]+u[2]+u[2]}return"#"+u}function m(w,v,u){if(w<v){w=v}if(w>u){w=u}return w}function r(u){var x={};var B=Math.round(u.h);var A=Math.round(u.s*255/100);var w=Math.round(u.b*255/100);if(A===0){x.r=x.g=x.b=w}else{var C=w;var z=(255-A)*w/255;var y=(C-z)*(B%60)/60;if(B===360){B=0}if(B<60){x.r=C;x.b=z;x.g=z+y}else{if(B<120){x.g=C;x.b=z;x.r=C-y}else{if(B<180){x.g=C;x.r=z;x.b=z+y}else{if(B<240){x.b=C;x.r=z;x.g=C-y}else{if(B<300){x.b=C;x.g=z;x.r=z+y}else{if(B<360){x.r=C;x.g=z;x.b=C-y}else{x.r=0;x.g=0;x.b=0}}}}}}}return{r:Math.round(x.r),g:Math.round(x.g),b:Math.round(x.b)}}function a(u){var v=[u.r.toString(16),u.g.toString(16),u.b.toString(16)];f.each(v,function(w,x){if(x.length===1){v[w]="0"+x}});return"#"+v.join("")}function c(u){return a(r(u))}function d(v){var u=g(n(v));if(u.s===0){u.h=360}return u}function g(w){var v={h:0,s:0,b:0};var x=Math.min(w.r,w.g,w.b);var u=Math.max(w.r,w.g,w.b);var y=u-x;v.b=u;v.s=u!==0?255*y/u:0;if(v.s!==0){if(w.r===u){v.h=(w.g-w.b)/y}else{if(w.g===u){v.h=2+(w.b-w.r)/y}else{v.h=4+(w.r-w.g)/y}}}else{v.h=-1}v.h*=60;if(v.h<0){v.h+=360}v.s*=100/255;v.b*=100/255;return v}function n(u){u=parseInt(((u.indexOf("#")>-1)?u.substring(1):u),16);return{r:u>>16,g:(u&65280)>>8,b:(u&255)}}f(document).on("mousedown.minicolors touchstart.minicolors",function(u){if(!f(u.target).parents().add(u.target).hasClass("minicolors")){k()}}).on("mousedown.minicolors touchstart.minicolors",".minicolors-grid, .minicolors-slider, .minicolors-opacity-slider",function(u){var v=f(this);u.preventDefault();f(document).data("minicolors-target",v);o(v,u,true)}).on("mousemove.minicolors touchmove.minicolors",function(u){var v=f(document).data("minicolors-target");if(v){o(v,u)}}).on("mouseup.minicolors touchend.minicolors",function(){f(this).removeData("minicolors-target")}).on("mousedown.minicolors touchstart.minicolors",".minicolors-swatch",function(v){var u=f(this).parent().find(".minicolors-input");v.preventDefault();s(u)}).on("focus.minicolors",".minicolors-input",function(){var u=f(this);if(!u.data("minicolors-initialized")){return}s(u)}).on("blur.minicolors",".minicolors-input",function(){var u=f(this),v=u.data("minicolors-settings");if(!u.data("minicolors-initialized")){return}u.val(q(u.val(),true));if(u.val()===""){u.val(q(v.defaultValue,true))}u.val(l(u.val(),v.letterCase))}).on("keydown.minicolors",".minicolors-input",function(v){var u=f(this);if(!u.data("minicolors-initialized")){return}switch(v.keyCode){case 9:k();break;case 13:case 27:k();u.blur();break}}).on("keyup.minicolors",".minicolors-input",function(){var u=f(this);if(!u.data("minicolors-initialized")){return}b(u,true)}).on("paste.minicolors",".minicolors-input",function(){var u=f(this);if(!u.data("minicolors-initialized")){return}setTimeout(function(){b(u,true)},1)})}));
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ztfy/myams/resources/js/ext/jquery-xmlrpc.min.js	Tue Nov 17 12:05:38 2015 +0100
@@ -0,0 +1,1 @@
+(function(g){var c=function(){Error.apply(this,arguments)};c.prototype=new Error();c.prototype.type="XML-RPC fault";var a=g.xmlrpc=function(i,j){if(arguments.length===2){j.url=i}else{j=i;i=j.url}j.dataType="xml json";j.type="POST";j.contentType="text/xml";j.converters={"xml json":a.parseDocument};var k=a.document(j.methodName,j.params||[]);if("XMLSerializer" in window){j.data=new window.XMLSerializer().serializeToString(k)}else{j.data=k.xml}return g.ajax(j)};a.createXMLDocument=function(){if(document.implementation&&"createDocument" in document.implementation){return document.implementation.createDocument(null,null,null)}else{var l,m,j=["MSXML6.DomDocument","MSXML3.DomDocument","MSXML2.DomDocument","MSXML.DomDocument","Microsoft.XmlDom"];for(l=0,m=j.length;l<m;l++){try{return new ActiveXObject(j[l])}catch(k){}}}};a.document=function(l,o){var n=a.createXMLDocument();var m=function(p){return g(n.createElement(p))};var j=m("methodName").text(l);var i=m("params").append(g.map(o,function(q){var p=m("value").append(a.toXmlRpc(q,m));return m("param").append(p)}));var k=m("methodCall").append(j,i);n.appendChild(k.get(0));return n};var b=function(i){return(i===parseInt(i,10))&&!isNaN(i)};a.toXmlRpc=function(l,k){if(l instanceof f){return l.toXmlRpc(k)}var i=g.xmlrpc.types;var j=g.type(l);switch(j){case"undefined":case"null":return i.nil.encode(l,k);case"date":return i["datetime.iso8601"].encode(l,k);case"object":if(l instanceof ArrayBuffer){return i.base64.encode(l,k)}else{return i.struct.encode(l,k)}break;case"number":if(b(l)){return i["int"].encode(l,k)}else{return i["double"].encode(l,k)}break;case"array":case"boolean":case"string":return i[j].encode(l,k);default:throw new Error("Unknown type",l)}};a.parseDocument=function(o){var p=g(o);var i=p.children("methodresponse");var l=i.find("> fault");if(l.length===0){var j=i.find("> params > param > value > *");var k=j.toArray().map(a.parseNode);return k}else{var n=a.parseNode(l.find("> value > *").get(0));var m=new c(n.faultString);m.msg=m.message=n.faultString;m.type=m.code=n.faultCode;throw m}};a.parseNode=function(j){if(j===undefined){return null}var i=j.nodeName.toLowerCase();if(i in a.types){return a.types[i].decode(j)}else{throw new Error("Unknown type "+i)}};a.parseValue=function(i){var j=g(i).children()[0];if(j){return a.parseNode(j)}else{return g(i).text()}};var f=function(){};g.xmlrpc.types={};a.makeType=function(j,o,k,m){var i;i=function(p){this.value=p};i.prototype=new f();i.prototype.tagName=j;if(o){var l=k,n=m;k=function(q,p){var r=l(q);return p(i.tagName).text(r)};m=function(p){return n(g(p).text(),p)}}i.prototype.toXmlRpc=function(p){return i.encode(this.value,p)};i.tagName=j;i.encode=k;i.decode=m;a.types[j.toLowerCase()]=i};var e=function(i){return""+Math.floor(i)};var d=function(j,i){return parseInt(j,10)};a.makeType("int",true,e,d);a.makeType("i4",true,e,d);a.makeType("i8",true,e,d);a.makeType("i16",true,e,d);a.makeType("i32",true,e,d);a.makeType("double",true,String,function(i){return parseFloat(i,10)});a.makeType("string",true,String,String);a.makeType("boolean",true,function(i){return i?"1":"0"},function(i){return i==="1"});var h=function(i){return i<10?"0"+i:i};a.makeType("dateTime.iso8601",true,function(i){return[i.getUTCFullYear(),"-",h(i.getUTCMonth()+1),"-",h(i.getUTCDate()),"T",h(i.getUTCHours()),":",h(i.getUTCMinutes()),":",h(i.getUTCSeconds()),"Z"].join("")},function(i){return new Date(i)});a.binary=(function(){var k="=";var i=("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").split("");var j=i.reduce(function(n,m,l){n[m]=l;return n},{});return{toBase64:function(p){var o=[];var q=new Uint8Array(p);var m=0,n;for(;m<q.length;m+=3){n=(q[m+0]<<16)+(q[m+1]<<8)+(q[m+2]<<0);o.push(i[(n>>18)%64]);o.push(i[(n>>12)%64]);o.push(i[(n>>6)%64]);o.push(i[(n>>0)%64])}var l=3-((p.byteLength%3)||3);while(l--){o[o.length-l-1]=k}return o.join("")},fromBase64:function(m){var l=m.length;var s=(l/4)*3;if(m.charAt(l-1)===k){s--}if(m.charAt(l-2)===k){s--}var q=new ArrayBuffer(s);var r=new Uint8Array(q);var o=0,n=0,p;for(;o<l;o+=4,n+=3){p=(j[m[o+0]]<<18)+(j[m[o+1]]<<12)+(j[m[o+2]]<<6)+(j[m[o+3]]<<0);r[n+0]=(p>>16)%256;r[n+1]=(p>>8)%256;r[n+2]=(p>>0)%256}return q}}})();a.makeType("base64",true,function(i){return a.binary.toBase64(i)},function(i){return a.binary.fromBase64(i)});a.makeType("nil",false,function(j,i){return i("nil")},function(i){return null});a.makeType("struct",false,function(k,j){var i=j("struct");g.each(k,function(l,n){var o=j("name").text(l);var m=j("value").append(a.toXmlRpc(n,j));i.append(j("member").append(o,m))});return i},function(i){return g(i).find("> member").toArray().reduce(function(n,l){var k=g(l);var j=k.find("> name").text();var m=a.parseValue(k.find("> value"));n[j]=m;return n},{})});a.makeType("array",false,function(l,j){var k=j("array");var i=j("data");g.each(l,function(m,n){i.append(j("value").append(a.toXmlRpc(n,j)))});k.append(i);return k},function(i){return g(i).find("> data > value").toArray().map(a.parseValue)});a.force=function(i,j){return new a.types[i](j)}})(jQuery);
\ No newline at end of file
--- a/src/ztfy/myams/resources/js/myams-dataTables.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams-dataTables.js	Tue Nov 17 12:05:38 2015 +0100
@@ -5,7 +5,9 @@
  */
 
 
-(function($) {
+(function($, globals) {
+
+	"use strict";
 
 	/**
 	 * Update default values for DataTables initialization
@@ -86,9 +88,10 @@
 		// date-euro column sorter
 		"date-euro-pre": function(a) {
 			var trimmed = $.trim(a);
-			if (trimmed != '') {
+			var x;
+			if (trimmed !== '') {
 				var frDate= trimmed.split('/');
-				var x = (frDate[2] + frDate[1] + frDate[0]) * 1;
+				x = (frDate[2] + frDate[1] + frDate[0]) * 1;
 			} else {
 				x = 10000000; // = l'an 1000 ...
 			}
@@ -106,11 +109,12 @@
 		// datetime-euro column sorter
 		"datetime-euro-pre": function(a) {
 			var trimmed = $.trim(a);
-			if (trimmed != '') {
+			var x;
+			if (trimmed !== '') {
 				var frDateTime = trimmed.split(' - ');
 				var frDate= frDateTime[0].split('/');
 				var frTime = frDateTime[1].split(':');
-				var x = (frDate[2] + frDate[1] + frDate[0] + frTime[0] + frTime[1]) * 1;
+				x = (frDate[2] + frDate[1] + frDate[0] + frTime[0] + frTime[1]) * 1;
 			} else {
 				x = 100000000000; // = l'an 1000 ...
 			}
@@ -136,8 +140,9 @@
 				var oLang = oSettings.oLanguage.oPaginate;
 				var fnClickHandler = function (e) {
 					e.preventDefault();
-					if (oSettings.oApi._fnPageChange(oSettings, e.data.action))
+					if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) {
 						fnDraw(oSettings);
+					}
 				};
 
 				$(nPaging).append(
@@ -183,7 +188,7 @@
 
 					// Add the new list items and their event handlers
 					for (j=iStart ; j<=iEnd ; j++) {
-						sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
+						sClass = (j === oPaging.iPage+1) ? 'class="active"' : '';
 						$('<li '+sClass+'><a href="#">'+j+'</a></li>')
 							.insertBefore( $('li:last', an[i])[0] )
 							.on('click', function (e) {
@@ -194,15 +199,17 @@
 					}
 
 					// Add / remove disabled classes from the static elements
-					if (oPaging.iPage === 0)
+					if (oPaging.iPage === 0) {
 						$('li:first', an[i]).addClass('disabled');
-					else
+					} else {
 						$('li:first', an[i]).removeClass('disabled');
+					}
 
-					if (oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0)
+					if (oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0) {
 						$('li:last', an[i]).addClass('disabled');
-					else
+					} else {
 						$('li:last', an[i]).removeClass('disabled');
+					}
 				}
 			}
 		}
@@ -218,8 +225,9 @@
 				var oLang = oSettings.oLanguage.oPaginate;
 				var fnClickHandler = function (e) {
 					e.preventDefault();
-					if (oSettings.oApi._fnPageChange(oSettings, e.data.action))
+					if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) {
 						fnDraw(oSettings);
+					}
 				};
 
 				$(nPaging).append(
@@ -269,14 +277,14 @@
 
 					// Add the new list items and their event handlers
 					for (j=iStart ; j<=iEnd ; j++) {
-						sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
+						sClass = (j === oPaging.iPage+1) ? 'class="active"' : '';
 						$('<li '+sClass+'><a href="#">'+j+'</a></li>')
 							.insertBefore( $('li.next', an[i])[0] )
 							.on('click', function (e) {
 								e.preventDefault();
 								oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
 								fnDraw( oSettings );
-							} );
+							});
 					}
 
 					// Add / remove disabled classes from the static elements
@@ -310,8 +318,9 @@
 				var oLang = oSettings.oLanguage.oPaginate;
 				var fnClickHandler = function (e) {
 					e.preventDefault();
-					if (oSettings.oApi._fnPageChange(oSettings, e.data.action))
+					if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) {
 						fnDraw(oSettings);
+					}
 				};
 
 				$(nPaging).append(
@@ -428,12 +437,17 @@
 
 		var BootstrapLength = function(oSettings, oInit) {
 
-			if (!this.CLASS || this.CLASS != 'BootstrapLength')
-				alert("Warning: BootstrapLength must be initialized with the 'new' keyword");
-			if (typeof(oInit) == 'undefined')
+			if (!this.CLASS || this.CLASS !== 'BootstrapLength') {
+				if (globals.alert) {
+					globals.alert("Warning: BootstrapLength must be initialized with the 'new' keyword");
+				}
+			}
+			if (typeof(oInit) === 'undefined') {
 				oInit = {};
-			if ($.fn.dataTable.camelToHungarian)
+			}
+			if ($.fn.dataTable.camelToHungarian) {
 				$.fn.dataTable.camelToHungarian(BootstrapLength.defaults, oInit);
+			}
 
 			this.s = {
 				dt: null,
@@ -447,8 +461,8 @@
 			};
 			BootstrapLength.aInstances.push(this);
 
-			this.s.dt = $.fn.dataTable.Api
-				? new $.fn.dataTable.Api(oSettings).settings()[0]
+			this.s.dt = $.fn.dataTable.Api ?
+				new $.fn.dataTable.Api(oSettings).settings()[0]
 				: oSettings;
 
 			this._fnConstruct(oInit);
@@ -471,22 +485,27 @@
 			_fnConstruct: function(init) {
 				var self = this;
 				var dt = self.s.dt;
-				if (dt.oScroll.bInfinite)
+				if (dt.oScroll.bInfinite) {
 					return;
+				}
 				var sName = dt.sTableId + '_length';
 				var sMenu = $('<select size="1"></select>').attr('name', sName);
 				var i, iLen;
 				var aLengthMenu = dt.aLengthMenu;
-				if (aLengthMenu.length == 2 && typeof(aLengthMenu[0]) == 'object' && typeof(aLengthMenu[1]) == 'object') {
-					for (i=0, iLen=aLengthMenu[0].length; i < iLen; i++)
+				if (aLengthMenu.length === 2 &&
+					typeof(aLengthMenu[0]) === 'object' &&
+					typeof(aLengthMenu[1]) === 'object') {
+					for (i=0, iLen=aLengthMenu[0].length; i < iLen; i++) {
 						$('<option />').attr('value', aLengthMenu[0][i])
 									   .text(aLengthMenu[1][i])
 									   .appendTo(sMenu);
+					}
 				} else {
-					for (i=0, iLen=aLengthMenu.length; i < iLen; i++)
+					for (i=0, iLen=aLengthMenu.length; i < iLen; i++) {
 						$('<option />').attr('value', aLengthMenu[i])
 									   .text(aLengthMenu[i])
 									   .appendTo(sMenu);
+					}
 				}
 				var nLength = $('<div>').addClass(dt.oClasses.sLength)
 										.append($('<span></span>').addClass('ams-form')
@@ -494,8 +513,9 @@
 																							  .css('width', 60)
 																							  .append(sMenu)
 																							  .append($('<i></i>'))));
-				if (!dt.aanFeatures.L)
+				if (!dt.aanFeatures.L) {
 					nLength.attr('id', dt.sTableId + '_length');
+				}
 				this.dom.wrapper = nLength.get(0);
 
 				$('select option[value="' + dt._iDisplayLength + '"]', nLength).attr("selected", true);
@@ -503,18 +523,21 @@
 					var iVal = $(this).val();
 					var n = dt.aanFeatures.L;
 					for (i = 0, iLen = n.length; i < iLen; i++) {
-						if (n[i] != this.parentNode)
-						  $("select", n[i]).val(iVal);
+						if (n[i] !== this.parentNode) {
+							$("select", n[i]).val(iVal);
+						}
 					}
 					dt._iDisplayLength = parseInt(iVal, 10);
 					dt.oInstance._fnCalculateEnd(dt);
-					if (dt.fnDisplayEnd() == dt.fnRecordsDisplay()) {
+					if (dt.fnDisplayEnd() === dt.fnRecordsDisplay()) {
 						dt._iDisplayStart = dt.fnDisplayEnd() - dt._iDisplayLength;
-						if (dt._iDisplayStart < 0)
+						if (dt._iDisplayStart < 0) {
 							dt._iDisplayStart = 0;
+						}
 					}
-					if (dt._iDisplayLength == -1)
+					if (dt._iDisplayLength === -1) {
 						dt._iDisplayStart = 0;
+					}
 					dt.oInstance._fnDraw();
 				});
 				$("select", nLength).attr("aria-controls", dt.sTableId);
@@ -530,8 +553,8 @@
 		BootstrapLength.VERSION = '1.0.0';
 		BootstrapLength.prototype.VERSION = BootstrapLength.VERSION;
 
-		if ((typeof($.fn.dataTable) == 'function') &&
-			(typeof($.fn.dataTableExt.fnVersionCheck) == 'function') &&
+		if ((typeof($.fn.dataTable) === 'function') &&
+			(typeof($.fn.dataTableExt.fnVersionCheck) === 'function') &&
 			$.fn.dataTableExt.fnVersionCheck('1.7.0')) {
 			$.fn.dataTableExt.aoFeatures.push({
 				fnInit: function(oSettings) {
@@ -543,7 +566,9 @@
 				sFeature: "BootstrapLength"
 			});
 		} else {
-			alert("Warning: BootstrapLength required DataTables 1.7 or greater...");
+			if (globals.alert) {
+				globals.alert("Warning: BootstrapLength required DataTables 1.7 or greater...");
+			}
 		}
 
 		$.fn.dataTable.BootstrapLength = BootstrapLength;
@@ -551,7 +576,7 @@
 
 	};
 
-	if (!jQuery.fn.dataTable.BootstrapLength) {
+	if (!$.fn.dataTable.BootstrapLength) {
 		bl_factory($, $.fn.dataTable);
 	}
 
@@ -563,12 +588,17 @@
 
 		var BootstrapFilter = function(oSettings, oInit) {
 
-			if (!this.CLASS || this.CLASS != 'BootstrapFilter')
-				alert("Warning: BootstrapFilter must be initialized with the 'new' keyword");
-			if (typeof(oInit) == 'undefined')
+			if (!this.CLASS || this.CLASS !== 'BootstrapFilter') {
+				if (globals.alert) {
+					globals.alert("Warning: BootstrapFilter must be initialized with the 'new' keyword");
+				}
+			}
+			if (typeof(oInit) === 'undefined') {
 				oInit = {};
-			if ($.fn.dataTable.camelToHungarian)
+			}
+			if ($.fn.dataTable.camelToHungarian) {
 				$.fn.dataTable.camelToHungarian(BootstrapFilter.defaults, oInit);
+			}
 
 			this.s = {
 				dt: null,
@@ -582,8 +612,8 @@
 			};
 			BootstrapFilter.aInstances.push(this);
 
-			this.s.dt = $.fn.dataTable.Api
-				? new $.fn.dataTable.Api(oSettings).settings()[0]
+			this.s.dt = $.fn.dataTable.Api ?
+				new $.fn.dataTable.Api(oSettings).settings()[0]
 				: oSettings;
 
 			this._fnConstruct(oInit);
@@ -627,10 +657,11 @@
 							var n = dt.aanFeatures.F;
 							var val = $(this).val();
 							for (var i = 0, iLen = n.length; i < iLen; i++) {
-								if (n[i] != $(this).parents("div.dataTables_filter")[0])
+								if (n[i] !== $(this).parents("div.dataTables_filter")[0]) {
 									$(n[i]).data('DT_Input').val(val);
+								}
 							}
-							if (val != oPreviousSearch.sSearch) {
+							if (val !== oPreviousSearch.sSearch) {
 								dt.oInstance._fnFilterComplete({
 									sSearch: val,
 									bRegex: oPreviousSearch.bRegex,
@@ -640,7 +671,7 @@
 							}
 						})
 						.on('keypress.DT', function(e) {
-							if (e.keyCode == 13) {
+							if (e.keyCode === 13) {
 								return false;
 							}
 						});
@@ -656,8 +687,8 @@
 		BootstrapFilter.VERSION = '1.0.0';
 		BootstrapFilter.prototype.VERSION = BootstrapFilter.VERSION;
 
-		if ((typeof($.fn.dataTable) == 'function') &&
-			(typeof($.fn.dataTableExt.fnVersionCheck) == 'function') &&
+		if ((typeof($.fn.dataTable) === 'function') &&
+			(typeof($.fn.dataTableExt.fnVersionCheck) === 'function') &&
 			$.fn.dataTableExt.fnVersionCheck('1.7.0')) {
 			$.fn.dataTableExt.aoFeatures.push({
 				fnInit: function(oSettings) {
@@ -669,7 +700,9 @@
 				sFeature: "BootstrapFilter"
 			});
 		} else {
-			alert("Warning: BootstrapFilter required DataTables 1.7 or greater...");
+			if (globals.alert) {
+				globals.alert("Warning: BootstrapFilter required DataTables 1.7 or greater...");
+			}
 		}
 
 		$.fn.dataTable.BootstrapFilter = BootstrapFilter;
@@ -677,8 +710,8 @@
 
 	};
 
-	if (!jQuery.fn.dataTable.BootstrapFilter) {
+	if (!$.fn.dataTable.BootstrapFilter) {
 		bf_factory($, $.fn.dataTable);
 	}
 
-})(jQuery);
+})(jQuery, this);
--- a/src/ztfy/myams/resources/js/myams-dataTables.min.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams-dataTables.min.js	Tue Nov 17 12:05:38 2015 +0100
@@ -1,1 +1,1 @@
-(function(b){b.extend(true,b.fn.dataTable.defaults,{sDom:"R<'dt-top-row'CLF>r<'dt-wrapper't><'dt-row dt-bottom-row'<'row'<'col-sm-6'i><'col-sm-6 text-right'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"_MENU_",sSearch:"_INPUT_"}});b.extend(b.fn.dataTableExt.oStdClasses,{sWrapper:"dataTables_wrapper form-inline"});b.fn.dataTableExt.oApi.fnPagingInfo=function(d){return{iStart:d._iDisplayStart,iEnd:d.fnDisplayEnd(),iLength:d._iDisplayLength,iTotal:d.fnRecordsTotal(),iFilteredTotal:d.fnRecordsDisplay(),iPage:d._iDisplayLength===-1?0:Math.ceil(d._iDisplayStart/d._iDisplayLength),iTotalPages:d._iDisplayLength===-1?0:Math.ceil(d.fnRecordsDisplay()/d._iDisplayLength)}};b.fn.dataTableExt.aTypes.unshift(function(d){if(d!==null&&d.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3}$/)){return"date-euro"}return null});b.fn.dataTableExt.aTypes.unshift(function(d){if(d!==null&&d.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3} - ([0-1][0-9]|2[0-3]):[0-5][0-9]$/)){return"datetime-euro"}return null});b.extend(b.fn.dataTableExt.oSort,{"numeric-comma-asc":function(f,e){var d=f.replace(/,/,".").replace(/ /g,"");var g=e.replace(/,/,".").replace(/ /g,"");d=parseFloat(d);g=parseFloat(g);return((d<g)?-1:((d>g)?1:0))},"numeric-comma-desc":function(f,e){var d=f.replace(/,/,".").replace(/ /g,"");var g=e.replace(/,/,".").replace(/ /g,"");d=parseFloat(d);g=parseFloat(g);return((d<g)?1:((d>g)?-1:0))},"date-euro-pre":function(f){var g=b.trim(f);if(g!=""){var e=g.split("/");var d=(e[2]+e[1]+e[0])*1}else{d=10000000}return d},"date-euro-asc":function(e,d){return e-d},"date-euro-desc":function(e,d){return d-e},"datetime-euro-pre":function(f){var i=b.trim(f);if(i!=""){var g=i.split(" - ");var e=g[0].split("/");var h=g[1].split(":");var d=(e[2]+e[1]+e[0]+h[0]+h[1])*1}else{d=100000000000}return d},"datetime-euro-asc":function(e,d){return e-d},"datetime-euro-desc":function(e,d){return d-e}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('<ul class="pagination"><li class="prev disabled"><a href="#">'+d.sPrevious+'</a></li><li class="next disabled"><a href="#">'+d.sNext+"</a></li></ul>");var f=b("a",e);b(f[0]).on("click.DT",{action:"previous"},i);b(f[1]).on("click.DT",{action:"next"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages<p){d=1;q=k.iTotalPages}else{if(k.iPage<=e){d=1;q=p}else{if(k.iPage>=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m<g;m++){b("li:gt(0)",n[m]).filter(":not(:last)").remove();for(l=d;l<=q;l++){h=(l==k.iPage+1)?'class="active"':"";b("<li "+h+'><a href="#">'+l+"</a></li>").insertBefore(b("li:last",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li:first",n[m]).addClass("disabled")}else{b("li:first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li:last",n[m]).addClass("disabled")}else{b("li:last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_full:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('<ul class="pagination"><li class="first disabled"><a href="#">'+d.sFirst+'</a></li><li class="prev disabled"><a href="#">'+d.sPrevious+'</a></li><li class="next disabled"><a href="#">'+d.sNext+'</a></li><li class="last disabled"><a href="#">'+d.sLast+"</a></li></ul>");var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,g,q,e=Math.floor(p/2);if(k.iTotalPages<p){d=1;q=k.iTotalPages}else{if(k.iPage<=e){d=1;q=p}else{if(k.iPage>=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m<g;m++){b("li",n[m]).filter(":not(.first)").filter(":not(.last)").filter(":not(.prev)").filter(":not(.next)").remove();for(l=d;l<=q;l++){h=(l==k.iPage+1)?'class="active"':"";b("<li "+h+'><a href="#">'+l+"</a></li>").insertBefore(b("li.next",n[m])[0]).on("click",function(i){i.preventDefault();f._iDisplayStart=(parseInt(b("a",this).text(),10)-1)*k.iLength;o(f)})}if(k.iPage===0){b("li.first",n[m]).addClass("disabled");b("li.prev",n[m]).addClass("disabled")}else{b("li.prev",n[m]).removeClass("disabled");b("li.first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li.last",n[m]).addClass("disabled");b("li.next",n[m]).addClass("disabled")}else{b("li.next",n[m]).removeClass("disabled");b("li.last",n[m]).removeClass("disabled")}}}}});b.extend(b.fn.dataTableExt.oPagination,{bootstrap_prevnext:{fnInit:function(h,e,g){var d=h.oLanguage.oPaginate;var i=function(j){j.preventDefault();if(h.oApi._fnPageChange(h,j.data.action)){g(h)}};b(e).append('<ul class="pagination"><li class="first disabled"><a href="#"><i class="fa fa-fw fa-fast-backward"></i></a></li><li class="prev disabled"><a href="#"><i class="fa fa-fw fa-step-backward"></i></a></li><li class="next disabled"><a href="#"><i class="fa fa-fw fa-step-forward"></i></a></li><li class="last disabled"><a href="#"><i class="fa fa-fw fa-fast-forward"></i></a></li></ul>');var f=b("a",e);b(f[0]).on("click.DT",{action:"first"},i);b(f[1]).on("click.DT",{action:"previous"},i);b(f[2]).on("click.DT",{action:"next"},i);b(f[3]).on("click.DT",{action:"last"},i)},fnUpdate:function(f,o){var p=5;var k=f.oInstance.fnPagingInfo();var n=f.aanFeatures.p;var m,l,h,d,q,g,e=Math.floor(p/2);if(k.iTotalPages<p){d=1;q=k.iTotalPages}else{if(k.iPage<=e){d=1;q=p}else{if(k.iPage>=(k.iTotalPages-e)){d=k.iTotalPages-p+1;q=k.iTotalPages}else{d=k.iPage-e+1;q=d+p-1}}}for(m=0,g=n.length;m<g;m++){if(k.iPage===0){b("li.first",n[m]).addClass("disabled");b("li.prev",n[m]).addClass("disabled")}else{b("li.prev",n[m]).removeClass("disabled");b("li.first",n[m]).removeClass("disabled")}if(k.iPage===k.iTotalPages-1||k.iTotalPages===0){b("li.last",n[m]).addClass("disabled");b("li.next",n[m]).addClass("disabled")}else{b("li.next",n[m]).removeClass("disabled");b("li.last",n[m]).removeClass("disabled")}}}}});if(b.fn.DataTable.TableTools){b.extend(true,b.fn.DataTable.TableTools.classes,{container:"DTTT btn-group",buttons:{normal:"btn btn-default btn-sm",disabled:"disabled"},collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:"disabled"}},print:{info:"DTTT_print_info modal"},select:{row:"active"}});b.extend(true,b.fn.DataTable.TableTools.DEFAULTS.oTags,{collection:{container:"ul",button:"li",liner:"a"}})}var a=function(f,e){var d=function(h,g){if(!this.CLASS||this.CLASS!="BootstrapLength"){alert("Warning: BootstrapLength must be initialized with the 'new' keyword")}if(typeof(g)=="undefined"){g={}}if(f.fn.dataTable.camelToHungarian){f.fn.dataTable.camelToHungarian(d.defaults,g)}this.s={dt:null,oInit:g,hidden:true,abOriginal:[]};this.dom={wrapper:null,input:null};d.aInstances.push(this);this.s.dt=f.fn.dataTable.Api?new f.fn.dataTable.Api(h).settings()[0]:h;this._fnConstruct(g);return this};d.prototype={input:function(){return this.dom.wrapper},fnRebuild:function(){return this.rebuild()},rebuild:function(){},_fnConstruct:function(n){var o=this;var g=o.s.dt;if(g.oScroll.bInfinite){return}var j=g.sTableId+"_length";var l=f('<select size="1"></select>').attr("name",j);var k,h;var m=g.aLengthMenu;if(m.length==2&&typeof(m[0])=="object"&&typeof(m[1])=="object"){for(k=0,h=m[0].length;k<h;k++){f("<option />").attr("value",m[0][k]).text(m[1][k]).appendTo(l)}}else{for(k=0,h=m.length;k<h;k++){f("<option />").attr("value",m[k]).text(m[k]).appendTo(l)}}var p=f("<div>").addClass(g.oClasses.sLength).append(f("<span></span>").addClass("ams-form").append(f("<label></label>").addClass("select").css("width",60).append(l).append(f("<i></i>"))));if(!g.aanFeatures.L){p.attr("id",g.sTableId+"_length")}this.dom.wrapper=p.get(0);f('select option[value="'+g._iDisplayLength+'"]',p).attr("selected",true);f("select",p).on("change.DT",function(i){var q=f(this).val();var r=g.aanFeatures.L;for(k=0,h=r.length;k<h;k++){if(r[k]!=this.parentNode){f("select",r[k]).val(q)}}g._iDisplayLength=parseInt(q,10);g.oInstance._fnCalculateEnd(g);if(g.fnDisplayEnd()==g.fnRecordsDisplay()){g._iDisplayStart=g.fnDisplayEnd()-g._iDisplayLength;if(g._iDisplayStart<0){g._iDisplayStart=0}}if(g._iDisplayLength==-1){g._iDisplayStart=0}g.oInstance._fnDraw()});f("select",p).attr("aria-controls",g.sTableId)}};d.fnRebuild=function(g){};d.defaults={};d.aInstances=[];d.prototype.CLASS="BootstrapLength";d.VERSION="1.0.0";d.prototype.VERSION=d.VERSION;if((typeof(f.fn.dataTable)=="function")&&(typeof(f.fn.dataTableExt.fnVersionCheck)=="function")&&f.fn.dataTableExt.fnVersionCheck("1.7.0")){f.fn.dataTableExt.aoFeatures.push({fnInit:function(h){var i=h.oInit;var g=new d(h,i.bootstrapLength||i.oBootstrapLength||{});return g.input()},cFeature:"L",sFeature:"BootstrapLength"})}else{alert("Warning: BootstrapLength required DataTables 1.7 or greater...")}f.fn.dataTable.BootstrapLength=d;return d};if(!jQuery.fn.dataTable.BootstrapLength){a(b,b.fn.dataTable)}var c=function(f,e){var d=function(h,g){if(!this.CLASS||this.CLASS!="BootstrapFilter"){alert("Warning: BootstrapFilter must be initialized with the 'new' keyword")}if(typeof(g)=="undefined"){g={}}if(f.fn.dataTable.camelToHungarian){f.fn.dataTable.camelToHungarian(d.defaults,g)}this.s={dt:null,oInit:g,hidden:true,abOriginal:[]};this.dom={wrapper:null,input:null};d.aInstances.push(this);this.s.dt=f.fn.dataTable.Api?new f.fn.dataTable.Api(h).settings()[0]:h;this._fnConstruct(g);return this};d.prototype={input:function(){return this.dom.wrapper},fnRebuild:function(){return this.rebuild()},rebuild:function(){},_fnConstruct:function(m){var h=this;var j=h.s.dt;var g=j.oPreviousSearch;var l='<input type="text">';var i=f("<div>").addClass(j.oClasses.sFilter).html('<div class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span>'+l+"</div>");if(!j.aanFeatures.F){i.attr("id",j.sTableId+"_filter")}this.dom.wrapper=i.get(0);var k=f('input[type="text"]',i);i.data("DT_Input",k[0]);k.val(g.sSearch.replace('"',"&quot;")).addClass("form-control").attr("placeholder",j.oLanguage.sSearch).attr("aria-control",j.sTableId).on("keyup.DT",function(q){var s=j.aanFeatures.F;var r=f(this).val();for(var p=0,o=s.length;p<o;p++){if(s[p]!=f(this).parents("div.dataTables_filter")[0]){f(s[p]).data("DT_Input").val(r)}}if(r!=g.sSearch){j.oInstance._fnFilterComplete({sSearch:r,bRegex:g.bRegex,bSmart:g.bSmart,bCaseInsensitive:g.bCaseInsensitive})}}).on("keypress.DT",function(n){if(n.keyCode==13){return false}})}};d.fnRebuild=function(g){};d.defaults={};d.aInstances=[];d.prototype.CLASS="BootstrapFilter";d.VERSION="1.0.0";d.prototype.VERSION=d.VERSION;if((typeof(f.fn.dataTable)=="function")&&(typeof(f.fn.dataTableExt.fnVersionCheck)=="function")&&f.fn.dataTableExt.fnVersionCheck("1.7.0")){f.fn.dataTableExt.aoFeatures.push({fnInit:function(h){var i=h.oInit;var g=new d(h,i.bootstrapFilter||i.oBootstrapFilter||{});return g.input()},cFeature:"F",sFeature:"BootstrapFilter"})}else{alert("Warning: BootstrapFilter required DataTables 1.7 or greater...")}f.fn.dataTable.BootstrapFilter=d;return d};if(!jQuery.fn.dataTable.BootstrapFilter){c(b,b.fn.dataTable)}})(jQuery);
\ No newline at end of file
+(function(c,b){c.extend(true,c.fn.dataTable.defaults,{sDom:"R<'dt-top-row'CLF>r<'dt-wrapper't><'dt-row dt-bottom-row'<'row'<'col-sm-6'i><'col-sm-6 text-right'p>>",sPaginationType:"bootstrap",oLanguage:{sLengthMenu:"_MENU_",sSearch:"_INPUT_"}});c.extend(c.fn.dataTableExt.oStdClasses,{sWrapper:"dataTables_wrapper form-inline"});c.fn.dataTableExt.oApi.fnPagingInfo=function(e){return{iStart:e._iDisplayStart,iEnd:e.fnDisplayEnd(),iLength:e._iDisplayLength,iTotal:e.fnRecordsTotal(),iFilteredTotal:e.fnRecordsDisplay(),iPage:e._iDisplayLength===-1?0:Math.ceil(e._iDisplayStart/e._iDisplayLength),iTotalPages:e._iDisplayLength===-1?0:Math.ceil(e.fnRecordsDisplay()/e._iDisplayLength)}};c.fn.dataTableExt.aTypes.unshift(function(e){if(e!==null&&e.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3}$/)){return"date-euro"}return null});c.fn.dataTableExt.aTypes.unshift(function(e){if(e!==null&&e.match(/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-3][0-9]{3} - ([0-1][0-9]|2[0-3]):[0-5][0-9]$/)){return"datetime-euro"}return null});c.extend(c.fn.dataTableExt.oSort,{"numeric-comma-asc":function(g,f){var e=g.replace(/,/,".").replace(/ /g,"");var h=f.replace(/,/,".").replace(/ /g,"");e=parseFloat(e);h=parseFloat(h);return((e<h)?-1:((e>h)?1:0))},"numeric-comma-desc":function(g,f){var e=g.replace(/,/,".").replace(/ /g,"");var h=f.replace(/,/,".").replace(/ /g,"");e=parseFloat(e);h=parseFloat(h);return((e<h)?1:((e>h)?-1:0))},"date-euro-pre":function(g){var h=c.trim(g);var e;if(h!==""){var f=h.split("/");e=(f[2]+f[1]+f[0])*1}else{e=10000000}return e},"date-euro-asc":function(f,e){return f-e},"date-euro-desc":function(f,e){return e-f},"datetime-euro-pre":function(g){var j=c.trim(g);var e;if(j!==""){var h=j.split(" - ");var f=h[0].split("/");var i=h[1].split(":");e=(f[2]+f[1]+f[0]+i[0]+i[1])*1}else{e=100000000000}return e},"datetime-euro-asc":function(f,e){return f-e},"datetime-euro-desc":function(f,e){return e-f}});c.extend(c.fn.dataTableExt.oPagination,{bootstrap:{fnInit:function(i,f,h){var e=i.oLanguage.oPaginate;var j=function(k){k.preventDefault();if(i.oApi._fnPageChange(i,k.data.action)){h(i)}};c(f).append('<ul class="pagination"><li class="prev disabled"><a href="#">'+e.sPrevious+'</a></li><li class="next disabled"><a href="#">'+e.sNext+"</a></li></ul>");var g=c("a",f);c(g[0]).on("click.DT",{action:"previous"},j);c(g[1]).on("click.DT",{action:"next"},j)},fnUpdate:function(g,p){var q=5;var l=g.oInstance.fnPagingInfo();var o=g.aanFeatures.p;var n,m,k,e,r,h,f=Math.floor(q/2);if(l.iTotalPages<q){e=1;r=l.iTotalPages}else{if(l.iPage<=f){e=1;r=q}else{if(l.iPage>=(l.iTotalPages-f)){e=l.iTotalPages-q+1;r=l.iTotalPages}else{e=l.iPage-f+1;r=e+q-1}}}for(n=0,h=o.length;n<h;n++){c("li:gt(0)",o[n]).filter(":not(:last)").remove();for(m=e;m<=r;m++){k=(m===l.iPage+1)?'class="active"':"";c("<li "+k+'><a href="#">'+m+"</a></li>").insertBefore(c("li:last",o[n])[0]).on("click",function(i){i.preventDefault();g._iDisplayStart=(parseInt(c("a",this).text(),10)-1)*l.iLength;p(g)})}if(l.iPage===0){c("li:first",o[n]).addClass("disabled")}else{c("li:first",o[n]).removeClass("disabled")}if(l.iPage===l.iTotalPages-1||l.iTotalPages===0){c("li:last",o[n]).addClass("disabled")}else{c("li:last",o[n]).removeClass("disabled")}}}}});c.extend(c.fn.dataTableExt.oPagination,{bootstrap_full:{fnInit:function(i,f,h){var e=i.oLanguage.oPaginate;var j=function(k){k.preventDefault();if(i.oApi._fnPageChange(i,k.data.action)){h(i)}};c(f).append('<ul class="pagination"><li class="first disabled"><a href="#">'+e.sFirst+'</a></li><li class="prev disabled"><a href="#">'+e.sPrevious+'</a></li><li class="next disabled"><a href="#">'+e.sNext+'</a></li><li class="last disabled"><a href="#">'+e.sLast+"</a></li></ul>");var g=c("a",f);c(g[0]).on("click.DT",{action:"first"},j);c(g[1]).on("click.DT",{action:"previous"},j);c(g[2]).on("click.DT",{action:"next"},j);c(g[3]).on("click.DT",{action:"last"},j)},fnUpdate:function(g,p){var q=5;var l=g.oInstance.fnPagingInfo();var o=g.aanFeatures.p;var n,m,k,e,h,r,f=Math.floor(q/2);if(l.iTotalPages<q){e=1;r=l.iTotalPages}else{if(l.iPage<=f){e=1;r=q}else{if(l.iPage>=(l.iTotalPages-f)){e=l.iTotalPages-q+1;r=l.iTotalPages}else{e=l.iPage-f+1;r=e+q-1}}}for(n=0,h=o.length;n<h;n++){c("li",o[n]).filter(":not(.first)").filter(":not(.last)").filter(":not(.prev)").filter(":not(.next)").remove();for(m=e;m<=r;m++){k=(m===l.iPage+1)?'class="active"':"";c("<li "+k+'><a href="#">'+m+"</a></li>").insertBefore(c("li.next",o[n])[0]).on("click",function(i){i.preventDefault();g._iDisplayStart=(parseInt(c("a",this).text(),10)-1)*l.iLength;p(g)})}if(l.iPage===0){c("li.first",o[n]).addClass("disabled");c("li.prev",o[n]).addClass("disabled")}else{c("li.prev",o[n]).removeClass("disabled");c("li.first",o[n]).removeClass("disabled")}if(l.iPage===l.iTotalPages-1||l.iTotalPages===0){c("li.last",o[n]).addClass("disabled");c("li.next",o[n]).addClass("disabled")}else{c("li.next",o[n]).removeClass("disabled");c("li.last",o[n]).removeClass("disabled")}}}}});c.extend(c.fn.dataTableExt.oPagination,{bootstrap_prevnext:{fnInit:function(i,f,h){var e=i.oLanguage.oPaginate;var j=function(k){k.preventDefault();if(i.oApi._fnPageChange(i,k.data.action)){h(i)}};c(f).append('<ul class="pagination"><li class="first disabled"><a href="#"><i class="fa fa-fw fa-fast-backward"></i></a></li><li class="prev disabled"><a href="#"><i class="fa fa-fw fa-step-backward"></i></a></li><li class="next disabled"><a href="#"><i class="fa fa-fw fa-step-forward"></i></a></li><li class="last disabled"><a href="#"><i class="fa fa-fw fa-fast-forward"></i></a></li></ul>');var g=c("a",f);c(g[0]).on("click.DT",{action:"first"},j);c(g[1]).on("click.DT",{action:"previous"},j);c(g[2]).on("click.DT",{action:"next"},j);c(g[3]).on("click.DT",{action:"last"},j)},fnUpdate:function(g,p){var q=5;var l=g.oInstance.fnPagingInfo();var o=g.aanFeatures.p;var n,m,k,e,r,h,f=Math.floor(q/2);if(l.iTotalPages<q){e=1;r=l.iTotalPages}else{if(l.iPage<=f){e=1;r=q}else{if(l.iPage>=(l.iTotalPages-f)){e=l.iTotalPages-q+1;r=l.iTotalPages}else{e=l.iPage-f+1;r=e+q-1}}}for(n=0,h=o.length;n<h;n++){if(l.iPage===0){c("li.first",o[n]).addClass("disabled");c("li.prev",o[n]).addClass("disabled")}else{c("li.prev",o[n]).removeClass("disabled");c("li.first",o[n]).removeClass("disabled")}if(l.iPage===l.iTotalPages-1||l.iTotalPages===0){c("li.last",o[n]).addClass("disabled");c("li.next",o[n]).addClass("disabled")}else{c("li.next",o[n]).removeClass("disabled");c("li.last",o[n]).removeClass("disabled")}}}}});if(c.fn.DataTable.TableTools){c.extend(true,c.fn.DataTable.TableTools.classes,{container:"DTTT btn-group",buttons:{normal:"btn btn-default btn-sm",disabled:"disabled"},collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:"disabled"}},print:{info:"DTTT_print_info modal"},select:{row:"active"}});c.extend(true,c.fn.DataTable.TableTools.DEFAULTS.oTags,{collection:{container:"ul",button:"li",liner:"a"}})}var a=function(g,f){var e=function(i,h){if(!this.CLASS||this.CLASS!=="BootstrapLength"){if(b.alert){b.alert("Warning: BootstrapLength must be initialized with the 'new' keyword")}}if(typeof(h)==="undefined"){h={}}if(g.fn.dataTable.camelToHungarian){g.fn.dataTable.camelToHungarian(e.defaults,h)}this.s={dt:null,oInit:h,hidden:true,abOriginal:[]};this.dom={wrapper:null,input:null};e.aInstances.push(this);this.s.dt=g.fn.dataTable.Api?new g.fn.dataTable.Api(i).settings()[0]:i;this._fnConstruct(h);return this};e.prototype={input:function(){return this.dom.wrapper},fnRebuild:function(){return this.rebuild()},rebuild:function(){},_fnConstruct:function(o){var p=this;var h=p.s.dt;if(h.oScroll.bInfinite){return}var k=h.sTableId+"_length";var m=g('<select size="1"></select>').attr("name",k);var l,j;var n=h.aLengthMenu;if(n.length===2&&typeof(n[0])==="object"&&typeof(n[1])==="object"){for(l=0,j=n[0].length;l<j;l++){g("<option />").attr("value",n[0][l]).text(n[1][l]).appendTo(m)}}else{for(l=0,j=n.length;l<j;l++){g("<option />").attr("value",n[l]).text(n[l]).appendTo(m)}}var q=g("<div>").addClass(h.oClasses.sLength).append(g("<span></span>").addClass("ams-form").append(g("<label></label>").addClass("select").css("width",60).append(m).append(g("<i></i>"))));if(!h.aanFeatures.L){q.attr("id",h.sTableId+"_length")}this.dom.wrapper=q.get(0);g('select option[value="'+h._iDisplayLength+'"]',q).attr("selected",true);g("select",q).on("change.DT",function(i){var r=g(this).val();var s=h.aanFeatures.L;for(l=0,j=s.length;l<j;l++){if(s[l]!==this.parentNode){g("select",s[l]).val(r)}}h._iDisplayLength=parseInt(r,10);h.oInstance._fnCalculateEnd(h);if(h.fnDisplayEnd()===h.fnRecordsDisplay()){h._iDisplayStart=h.fnDisplayEnd()-h._iDisplayLength;if(h._iDisplayStart<0){h._iDisplayStart=0}}if(h._iDisplayLength===-1){h._iDisplayStart=0}h.oInstance._fnDraw()});g("select",q).attr("aria-controls",h.sTableId)}};e.fnRebuild=function(h){};e.defaults={};e.aInstances=[];e.prototype.CLASS="BootstrapLength";e.VERSION="1.0.0";e.prototype.VERSION=e.VERSION;if((typeof(g.fn.dataTable)==="function")&&(typeof(g.fn.dataTableExt.fnVersionCheck)==="function")&&g.fn.dataTableExt.fnVersionCheck("1.7.0")){g.fn.dataTableExt.aoFeatures.push({fnInit:function(i){var j=i.oInit;var h=new e(i,j.bootstrapLength||j.oBootstrapLength||{});return h.input()},cFeature:"L",sFeature:"BootstrapLength"})}else{if(b.alert){b.alert("Warning: BootstrapLength required DataTables 1.7 or greater...")}}g.fn.dataTable.BootstrapLength=e;return e};if(!c.fn.dataTable.BootstrapLength){a(c,c.fn.dataTable)}var d=function(g,f){var e=function(i,h){if(!this.CLASS||this.CLASS!=="BootstrapFilter"){if(b.alert){b.alert("Warning: BootstrapFilter must be initialized with the 'new' keyword")}}if(typeof(h)==="undefined"){h={}}if(g.fn.dataTable.camelToHungarian){g.fn.dataTable.camelToHungarian(e.defaults,h)}this.s={dt:null,oInit:h,hidden:true,abOriginal:[]};this.dom={wrapper:null,input:null};e.aInstances.push(this);this.s.dt=g.fn.dataTable.Api?new g.fn.dataTable.Api(i).settings()[0]:i;this._fnConstruct(h);return this};e.prototype={input:function(){return this.dom.wrapper},fnRebuild:function(){return this.rebuild()},rebuild:function(){},_fnConstruct:function(n){var i=this;var k=i.s.dt;var h=k.oPreviousSearch;var m='<input type="text">';var j=g("<div>").addClass(k.oClasses.sFilter).html('<div class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span>'+m+"</div>");if(!k.aanFeatures.F){j.attr("id",k.sTableId+"_filter")}this.dom.wrapper=j.get(0);var l=g('input[type="text"]',j);j.data("DT_Input",l[0]);l.val(h.sSearch.replace('"',"&quot;")).addClass("form-control").attr("placeholder",k.oLanguage.sSearch).attr("aria-control",k.sTableId).on("keyup.DT",function(q){var s=k.aanFeatures.F;var r=g(this).val();for(var p=0,o=s.length;p<o;p++){if(s[p]!==g(this).parents("div.dataTables_filter")[0]){g(s[p]).data("DT_Input").val(r)}}if(r!==h.sSearch){k.oInstance._fnFilterComplete({sSearch:r,bRegex:h.bRegex,bSmart:h.bSmart,bCaseInsensitive:h.bCaseInsensitive})}}).on("keypress.DT",function(o){if(o.keyCode===13){return false}})}};e.fnRebuild=function(h){};e.defaults={};e.aInstances=[];e.prototype.CLASS="BootstrapFilter";e.VERSION="1.0.0";e.prototype.VERSION=e.VERSION;if((typeof(g.fn.dataTable)==="function")&&(typeof(g.fn.dataTableExt.fnVersionCheck)==="function")&&g.fn.dataTableExt.fnVersionCheck("1.7.0")){g.fn.dataTableExt.aoFeatures.push({fnInit:function(i){var j=i.oInit;var h=new e(i,j.bootstrapFilter||j.oBootstrapFilter||{});return h.input()},cFeature:"F",sFeature:"BootstrapFilter"})}else{if(b.alert){b.alert("Warning: BootstrapFilter required DataTables 1.7 or greater...")}}g.fn.dataTable.BootstrapFilter=e;return e};if(!c.fn.dataTable.BootstrapFilter){d(c,c.fn.dataTable)}})(jQuery,this);
\ No newline at end of file
--- a/src/ztfy/myams/resources/js/myams-graphs.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams-graphs.js	Tue Nov 17 12:05:38 2015 +0100
@@ -3,17 +3,21 @@
  * Version 0.1.0
  * ©2014 Thierry Florac <tflorac@ulthar.net>
  */
-(function($) {
+(function($, globals) {
+
+	'use strict';
+
+	var MyAMS = globals.MyAMS;
 
 	MyAMS.graphs = {
 
 		init: function(graphs) {
 			MyAMS.ajax.check($.fn.sparkline,
 							   MyAMS.baseURL + 'ext/jquery-sparkline-2.1.1.min.js',
-							   function(first_load) {
+							   function() {
 									graphs.each(function() {
 										var graph = $(this);
-										var graph_data  =graph.data();
+										var graph_data = graph.data();
 										var sparklineType = graph_data.sparklineType || 'bar';
 										switch (sparklineType) {
 											case 'bar':
@@ -61,7 +65,6 @@
 													height : graph_data.sparklinePiesize || 90,
 													tooltipFormat : '<span style="color: {{color}}">&#9679;</span> ({{percent.1}}%)',
 													sliceColors : graph_data.sparklinePiecolor || ["#B4CAD3", "#4490B1", "#98AA56", "#da532c", "#6E9461", "#0099c6", "#990099", "#717D8A"],
-													offset : 0,
 													borderWidth : 1,
 													offset : graph_data.sparklineOffset || 0,
 													borderColor : graph_data.borderColor || '#45494C'
@@ -95,7 +98,7 @@
 													type : 'bullet',
 													height : graph_data.sparklineHeight || 'auto',
 													targetWidth : graph_data.sparklineWidth || 2,
-													targetColor : graph_data.sparklineBullet-color || '#ed1c24',
+													targetColor : graph_data.sparklineBulletColor || '#ed1c24',
 													performanceColor : graph_data.sparklinePerformanceColor || '#3030f0',
 													rangeColors : graph_data.sparklineBulletrangeColor || ["#d3dafe", "#a8b6ff", "#7f94ff"]
 												});
@@ -127,14 +130,14 @@
 												break;
 
 											case 'compositebar':
-												$this.sparkline(graph_data.sparklineBarVal, {
+												graph.sparkline(graph_data.sparklineBarVal, {
 													type : 'bar',
 													width : graph_data.sparklineWidth || '100%',
 													height : graph_data.sparklineHeight || '20px',
 													barColor : graph_data.sparklineColorBottom || '#333333',
 													barWidth : graph_data.sparklineBarwidth || 3
 												});
-												$this.sparkline(graph_data.sparklineLineVal, {
+												graph.sparkline(graph_data.sparklineLineVal, {
 													width : graph_data.sparklineWidth || '100%',
 													height : graph_data.sparklineHeight || '20px',
 													lineColor : graph_data.sparklineColorTop || '#ed1c24',
@@ -145,14 +148,14 @@
 												break;
 
 											case 'compositeline':
-												$this.sparkline(graph_data.sparklineBarVal, {
+												graph.sparkline(graph_data.sparklineBarVal, {
 													type : 'line',
 													spotRadius : graph_data.sparklineSpotradiusTop || 1.5,
 													spotColor : graph_data.sparklineSpotColor || '#f08000',
-													minSpotColor : graph_data.sparklineMinspotColorTop || '#ed1c24',
-													maxSpotColor : graph_data.sparkline-maxspotColorTop || '#f08000',
-													highlightSpotColor : graph_data.sparklineHighlightspotColorTop || '#50f050',
-													highlightLineColor : graph_data.sparklineHighlightlineColorTop || '#f02020',
+													minSpotColor : graph_data.sparklineMinSpotColorTop || '#ed1c24',
+													maxSpotColor : graph_data.sparklineMaxSpotColorTop || '#f08000',
+													highlightSpotColor : graph_data.sparklineHighlightSpotColorTop || '#50f050',
+													highlightLineColor : graph_data.sparklineHighlightLineColorTop || '#f02020',
 													valueSpots : graph_data.sparklineBarValSpotsTop || null,
 													lineWidth : graph_data.sparklineLineWidthTop || 1,
 													width : graph_data.sparklineWidth || '90px',
@@ -160,7 +163,7 @@
 													lineColor : graph_data.sparklineColorTop || '#333333',
 													fillColor : graph_data.sparklineFillcolorTop || 'transparent'
 												});
-												$this.sparkline(graph_data.sparklineLineVal, {
+												graph.sparkline(graph_data.sparklineLineVal, {
 													type : 'line',
 													spotRadius : graph_data.sparklineSpotradiusBottom || graph_data.sparklineSpotradiusTop || 1.5,
 													spotColor : graph_data.sparklineSpotColor || '#f08000',
@@ -181,6 +184,6 @@
 									});
 							   });
 		}
-	}
+	};
 
-})(jQuery);
+})(jQuery, this);
--- a/src/ztfy/myams/resources/js/myams-graphs.min.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams-graphs.min.js	Tue Nov 17 12:05:38 2015 +0100
@@ -1,1 +1,1 @@
-(function(a){MyAMS.graphs={init:function(b){MyAMS.ajax.check(a.fn.sparkline,MyAMS.baseURL+"ext/jquery-sparkline-2.1.1.min.js",function(c){b.each(function(){var f=a(this);var e=f.data();var d=e.sparklineType||"bar";switch(d){case"bar":f.sparkline("html",{type:"bar",barColor:e.sparklineBarColor||f.css("color")||"#0000f0",height:e.sparklineHeight||"26px",barWidth:e.sparklineBarwidth||5,barSpacing:e.sparklineBarspacing||2,stackedBarColor:f.data.sparklineBarstackedColor||["#A90329","#0099c6","#98AA56","#da532c","#4490B1","#6E9461","#990099","#B4CAD3"],negBarColor:f.data.sparklineNegbarColor||"#A90329",zeroAxis:"false"});break;case"line":f.sparkline("html",{type:"line",width:e.sparklineWidth||"90px",height:e.sparklineHeight||"20px",lineWidth:e.sparklineLineWidth||1,lineColor:e.sparklineLineColor||f.css("color")||"#0000f0",fillColor:e.fillColor||"#c0d0f0",spotColor:e.sparklineSpotColor||"#f08000",minSpotColor:e.sparklineMinspotColor||"#ed1c24",maxSpotColor:e.sparklineMaxspotColor||"#f08000",highlightSpotColor:e.sparklineHighlightspotColor||"#50f050",highlightLineColor:e.sparklineHighlightlineColor||"f02020",spotRadius:e.sparklineSpotradius||1.5,chartRangeMin:e.sparklineMinY||"undefined",chartRangeMax:e.sparklineMaxY||"undefined",chartRangeMinX:e.sparklineMinX||"undefined",chartRangeMaxX:e.sparklineMaxX||"undefined",normalRangeMin:e.minVal||"undefined",normalRangeMax:e.maxVal||"undefined",normalRangeColor:e.normColor||"#c0c0c0",drawNormalOnTop:e.drawNormal||false});break;case"pie":f.sparkline("html",{type:"pie",width:e.sparklinePiesize||90,height:e.sparklinePiesize||90,tooltipFormat:'<span style="color: {{color}}">&#9679;</span> ({{percent.1}}%)',sliceColors:e.sparklinePiecolor||["#B4CAD3","#4490B1","#98AA56","#da532c","#6E9461","#0099c6","#990099","#717D8A"],offset:0,borderWidth:1,offset:e.sparklineOffset||0,borderColor:e.borderColor||"#45494C"});break;case"box":f.sparkline("html",{type:"box",width:e.sparklineWidth||"auto",height:e.sparklineHeight||"auto",raw:e.sparklineBoxraw||false,target:e.sparklineTargetval||"undefined",minValue:e.sparklineMin||"undefined",maxValue:e.sparklineMax||"undefined",showOutliers:e.sparklineShowoutlier||true,outlierIQR:e.sparklineOutlierIqr||1.5,spotRadius:e.sparklineSpotradius||1.5,boxLineColor:f.css("color")||"#000000",boxFillColor:e.fillColor||"#c0d0f0",whiskerColor:e.sparklineWhisColor||"#000000",outlierLineColor:e.sparklineOutlineColor||"#303030",outlierFillColor:e.sparklineOutlinefillColor||"#f0f0f0",medianColor:e.sparklineOutlinemedianColor||"#f00000",targetColor:e.sparklineOutlinetargetColor||"#40a020"});break;case"bullet":f.sparkline("html",{type:"bullet",height:e.sparklineHeight||"auto",targetWidth:e.sparklineWidth||2,targetColor:e.sparklineBullet-color||"#ed1c24",performanceColor:e.sparklinePerformanceColor||"#3030f0",rangeColors:e.sparklineBulletrangeColor||["#d3dafe","#a8b6ff","#7f94ff"]});break;case"discrete":f.sparkline("html",{type:"discrete",width:e.sparklineWidth||50,height:e.sparklineHeight||26,lineColor:f.css("color"),lineHeight:e.sparklineLineHeight||5,thresholdValue:e.sparklineThreshold||"undefined",thresholdColor:e.sparklineThresholdColor||"#ed1c24"});break;case"tristate":f.sparkline("html",{type:"tristate",height:e.sparklineHeight||26,posBarColor:e.sparklinePosbarColor||"#60f060",negBarColor:e.sparklineNegbarColor||"#f04040",zeroBarColor:e.sparklineZerobarColor||"#909090",barWidth:e.sparklineBarwidth||5,barSpacing:e.sparklineBarspacing||2,zeroAxis:e.sparklineZeroaxis||false});break;case"compositebar":$this.sparkline(e.sparklineBarVal,{type:"bar",width:e.sparklineWidth||"100%",height:e.sparklineHeight||"20px",barColor:e.sparklineColorBottom||"#333333",barWidth:e.sparklineBarwidth||3});$this.sparkline(e.sparklineLineVal,{width:e.sparklineWidth||"100%",height:e.sparklineHeight||"20px",lineColor:e.sparklineColorTop||"#ed1c24",lineWidth:e.sparklineLineWidth||1,composite:true,fillColor:false});break;case"compositeline":$this.sparkline(e.sparklineBarVal,{type:"line",spotRadius:e.sparklineSpotradiusTop||1.5,spotColor:e.sparklineSpotColor||"#f08000",minSpotColor:e.sparklineMinspotColorTop||"#ed1c24",maxSpotColor:e.sparkline-maxspotColorTop||"#f08000",highlightSpotColor:e.sparklineHighlightspotColorTop||"#50f050",highlightLineColor:e.sparklineHighlightlineColorTop||"#f02020",valueSpots:e.sparklineBarValSpotsTop||null,lineWidth:e.sparklineLineWidthTop||1,width:e.sparklineWidth||"90px",height:e.sparklineHeight||"20px",lineColor:e.sparklineColorTop||"#333333",fillColor:e.sparklineFillcolorTop||"transparent"});$this.sparkline(e.sparklineLineVal,{type:"line",spotRadius:e.sparklineSpotradiusBottom||e.sparklineSpotradiusTop||1.5,spotColor:e.sparklineSpotColor||"#f08000",minSpotColor:e.sparklineMinspotColorBottom||e.sparklineMinspotColorTop||"#ed1c24",maxSpotColor:e.sparklineMaxspotColorBottom||e.sparklineMaxspotColorTop||"#f08000",highlightSpotColor:e.sparklineHighlightspotColorBottom||e.sparklineHighlightspotColorTop||"#50f050",highlightLineColor:e.sparklineHighlightlineColorBottom||e.sparklineHighlightlineColorTop||"#f02020",valueSpots:e.sparklineBarValSpotsBottom||null,lineWidth:e.sparklineLineWidthBottom||1,width:e.sparklineWidth||"90px",height:e.sparklineHeight||"20px",lineColor:e.sparklineColorBottom||"#ed1c24",composite:true,fillColor:e.sparklineFillcolorBottom||"transparent"});break}})})}}})(jQuery);
\ No newline at end of file
+(function(b,a){var c=a.MyAMS;c.graphs={init:function(d){c.ajax.check(b.fn.sparkline,c.baseURL+"ext/jquery-sparkline-2.1.1.min.js",function(){d.each(function(){var g=b(this);var f=g.data();var e=f.sparklineType||"bar";switch(e){case"bar":g.sparkline("html",{type:"bar",barColor:f.sparklineBarColor||g.css("color")||"#0000f0",height:f.sparklineHeight||"26px",barWidth:f.sparklineBarwidth||5,barSpacing:f.sparklineBarspacing||2,stackedBarColor:g.data.sparklineBarstackedColor||["#A90329","#0099c6","#98AA56","#da532c","#4490B1","#6E9461","#990099","#B4CAD3"],negBarColor:g.data.sparklineNegbarColor||"#A90329",zeroAxis:"false"});break;case"line":g.sparkline("html",{type:"line",width:f.sparklineWidth||"90px",height:f.sparklineHeight||"20px",lineWidth:f.sparklineLineWidth||1,lineColor:f.sparklineLineColor||g.css("color")||"#0000f0",fillColor:f.fillColor||"#c0d0f0",spotColor:f.sparklineSpotColor||"#f08000",minSpotColor:f.sparklineMinspotColor||"#ed1c24",maxSpotColor:f.sparklineMaxspotColor||"#f08000",highlightSpotColor:f.sparklineHighlightspotColor||"#50f050",highlightLineColor:f.sparklineHighlightlineColor||"f02020",spotRadius:f.sparklineSpotradius||1.5,chartRangeMin:f.sparklineMinY||"undefined",chartRangeMax:f.sparklineMaxY||"undefined",chartRangeMinX:f.sparklineMinX||"undefined",chartRangeMaxX:f.sparklineMaxX||"undefined",normalRangeMin:f.minVal||"undefined",normalRangeMax:f.maxVal||"undefined",normalRangeColor:f.normColor||"#c0c0c0",drawNormalOnTop:f.drawNormal||false});break;case"pie":g.sparkline("html",{type:"pie",width:f.sparklinePiesize||90,height:f.sparklinePiesize||90,tooltipFormat:'<span style="color: {{color}}">&#9679;</span> ({{percent.1}}%)',sliceColors:f.sparklinePiecolor||["#B4CAD3","#4490B1","#98AA56","#da532c","#6E9461","#0099c6","#990099","#717D8A"],borderWidth:1,offset:f.sparklineOffset||0,borderColor:f.borderColor||"#45494C"});break;case"box":g.sparkline("html",{type:"box",width:f.sparklineWidth||"auto",height:f.sparklineHeight||"auto",raw:f.sparklineBoxraw||false,target:f.sparklineTargetval||"undefined",minValue:f.sparklineMin||"undefined",maxValue:f.sparklineMax||"undefined",showOutliers:f.sparklineShowoutlier||true,outlierIQR:f.sparklineOutlierIqr||1.5,spotRadius:f.sparklineSpotradius||1.5,boxLineColor:g.css("color")||"#000000",boxFillColor:f.fillColor||"#c0d0f0",whiskerColor:f.sparklineWhisColor||"#000000",outlierLineColor:f.sparklineOutlineColor||"#303030",outlierFillColor:f.sparklineOutlinefillColor||"#f0f0f0",medianColor:f.sparklineOutlinemedianColor||"#f00000",targetColor:f.sparklineOutlinetargetColor||"#40a020"});break;case"bullet":g.sparkline("html",{type:"bullet",height:f.sparklineHeight||"auto",targetWidth:f.sparklineWidth||2,targetColor:f.sparklineBulletColor||"#ed1c24",performanceColor:f.sparklinePerformanceColor||"#3030f0",rangeColors:f.sparklineBulletrangeColor||["#d3dafe","#a8b6ff","#7f94ff"]});break;case"discrete":g.sparkline("html",{type:"discrete",width:f.sparklineWidth||50,height:f.sparklineHeight||26,lineColor:g.css("color"),lineHeight:f.sparklineLineHeight||5,thresholdValue:f.sparklineThreshold||"undefined",thresholdColor:f.sparklineThresholdColor||"#ed1c24"});break;case"tristate":g.sparkline("html",{type:"tristate",height:f.sparklineHeight||26,posBarColor:f.sparklinePosbarColor||"#60f060",negBarColor:f.sparklineNegbarColor||"#f04040",zeroBarColor:f.sparklineZerobarColor||"#909090",barWidth:f.sparklineBarwidth||5,barSpacing:f.sparklineBarspacing||2,zeroAxis:f.sparklineZeroaxis||false});break;case"compositebar":g.sparkline(f.sparklineBarVal,{type:"bar",width:f.sparklineWidth||"100%",height:f.sparklineHeight||"20px",barColor:f.sparklineColorBottom||"#333333",barWidth:f.sparklineBarwidth||3});g.sparkline(f.sparklineLineVal,{width:f.sparklineWidth||"100%",height:f.sparklineHeight||"20px",lineColor:f.sparklineColorTop||"#ed1c24",lineWidth:f.sparklineLineWidth||1,composite:true,fillColor:false});break;case"compositeline":g.sparkline(f.sparklineBarVal,{type:"line",spotRadius:f.sparklineSpotradiusTop||1.5,spotColor:f.sparklineSpotColor||"#f08000",minSpotColor:f.sparklineMinSpotColorTop||"#ed1c24",maxSpotColor:f.sparklineMaxSpotColorTop||"#f08000",highlightSpotColor:f.sparklineHighlightSpotColorTop||"#50f050",highlightLineColor:f.sparklineHighlightLineColorTop||"#f02020",valueSpots:f.sparklineBarValSpotsTop||null,lineWidth:f.sparklineLineWidthTop||1,width:f.sparklineWidth||"90px",height:f.sparklineHeight||"20px",lineColor:f.sparklineColorTop||"#333333",fillColor:f.sparklineFillcolorTop||"transparent"});g.sparkline(f.sparklineLineVal,{type:"line",spotRadius:f.sparklineSpotradiusBottom||f.sparklineSpotradiusTop||1.5,spotColor:f.sparklineSpotColor||"#f08000",minSpotColor:f.sparklineMinspotColorBottom||f.sparklineMinspotColorTop||"#ed1c24",maxSpotColor:f.sparklineMaxspotColorBottom||f.sparklineMaxspotColorTop||"#f08000",highlightSpotColor:f.sparklineHighlightspotColorBottom||f.sparklineHighlightspotColorTop||"#50f050",highlightLineColor:f.sparklineHighlightlineColorBottom||f.sparklineHighlightlineColorTop||"#f02020",valueSpots:f.sparklineBarValSpotsBottom||null,lineWidth:f.sparklineLineWidthBottom||1,width:f.sparklineWidth||"90px",height:f.sparklineHeight||"20px",lineColor:f.sparklineColorBottom||"#ed1c24",composite:true,fillColor:f.sparklineFillcolorBottom||"transparent"});break}})})}}})(jQuery,this);
\ No newline at end of file
--- a/src/ztfy/myams/resources/js/myams-notify.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams-notify.js	Tue Nov 17 12:05:38 2015 +0100
@@ -5,7 +5,9 @@
  */
 
 
-(function ($) {
+(function ($, globals) {
+
+	'use strict';
 
 	$(document).ready(function () {
 		$("body").append("<div id='divSmallBoxes'></div>")
@@ -20,18 +22,19 @@
 		});
 		$(".LoadingBoxContainer").fadeOut(300, function () {
 			$(this).remove();
-		})
+		});
 	}
 
 	var ExistMsg = 0,
 		SmartMSGboxCount = 0,
-		PrevTop = 0,
+		heightPrev,
 		BigBoxes = 0,
 		SmallBoxes = 0,
-		SmallCount = 0,
 		SmallBoxesAnchos = 0;
 
 
+	var MyAMS = globals.MyAMS;
+
 	MyAMS.notify = {
 
 		messageBox: function (options, callback) {
@@ -49,10 +52,10 @@
 				placeholder: "",
 				options: undefined,
 				sound: undefined
-			}
+			};
 			var settings = $.extend({}, defaults, options);
 
-			if (settings.sound && (isIE8 == 0)) {
+			if (settings.sound && (isIE8 === 0)) {
 				var audioElement = document.createElement("audio");
 				if (navigator.userAgent.match("Firefox/")) {
 					audioElement.setAttribute("src", MyAMS.baseURL + '../sound/message.ogg');
@@ -61,25 +64,26 @@
 				}
 				$.get();
 				audioElement.addEventListener("load", function () {
-					audioElement.play()
+					audioElement.play();
 				}, true);
 				audioElement.pause();
 				audioElement.play();
 			}
 			SmartMSGboxCount = SmartMSGboxCount + 1;
-			if (ExistMsg == 0) {
+			if (ExistMsg === 0) {
 				ExistMsg = 1;
 				SmartMSG = "<div class='MessageBox animated fadeIn fast' id='MsgBoxBack'></div>";
 				$("body").append(SmartMSG);
-				if (MyAMS.browser.isIE8orlower() == 1) {
+				if (MyAMS.browser.isIE8orlower() === 1) {
 					$("#MsgBoxBack").addClass("MessageIE");
 				}
 			}
+			var i;
 			var InputType = "";
 			var HasInput = 0;
 			var Name = "";
 			var NumButtons = 0;
-			if (settings.input != undefined) {
+			if (settings.input !== undefined) {
 				HasInput = 1;
 				settings.input = settings.input.toLowerCase();
 				switch (settings.input) {
@@ -90,15 +94,17 @@
 						InputType = "<input class='form-control' type='" + settings.input + "' id='txt" + SmartMSGboxCount + "' placeholder='" + settings.placeholder + "'/><br/><br/>";
 						break;
 					case "select":
-						if (settings.options == undefined) {
-							alert("For this type of input, the options parameter is required.");
+						if (settings.options === undefined) {
+							if (globals.alert) {
+								globals.alert("For this type of input, the options parameter is required.");
+							}
 						} else {
 							InputType = "<select class='form-control' id='txt" + SmartMSGboxCount + "'>";
-							for (var i = 0; i <= settings.options.length - 1; i++) {
-								if (settings.options[i] == "[") {
+							for (i=0; i <= settings.options.length - 1; i++) {
+								if (settings.options[i] === "[") {
 									Name = "";
 								} else {
-									if (settings.options[i] == "]") {
+									if (settings.options[i] === "]") {
 										NumButtons = NumButtons + 1;
 										Name = "<option>" + Name + "</option>";
 										InputType += Name;
@@ -111,7 +117,9 @@
 						}
 						break;
 					default:
-						alert("That type of input is not handled yet");
+						if (globals.alert) {
+							globals.alert("That type of input is not handled yet");
+						}
 				}
 			}
 			Content = "<div class='MessageBoxContainer animated fadeIn fast' id='Msg" + SmartMSGboxCount + "'>";
@@ -120,22 +128,22 @@
 			Content += "<p class='pText'>" + settings.content + "</p>";
 			Content += InputType;
 			Content += "<div class='MessageBoxButtonSection'>";
-			if (settings.buttons == undefined) {
+			if (settings.buttons === undefined) {
 				settings.buttons = "[Accept]";
 			}
 			settings.buttons = $.trim(settings.buttons);
 			settings.buttons = settings.buttons.split("");
-			if (settings.NormalButton == undefined) {
+			if (settings.NormalButton === undefined) {
 				settings.NormalButton = "#232323";
 			}
-			if (settings.ActiveButton == undefined) {
+			if (settings.ActiveButton === undefined) {
 				settings.ActiveButton = "#ed145b";
 			}
-			for (var i = 0; i <= settings.buttons.length - 1; i++) {
-				if (settings.buttons[i] == "[") {
+			for (i=0; i <= settings.buttons.length - 1; i++) {
+				if (settings.buttons[i] === "[") {
 					Name = "";
 				} else {
-					if (settings.buttons[i] == "]") {
+					if (settings.buttons[i] === "]") {
 						NumButtons = NumButtons + 1;
 						Name = "<button id='bot" + NumButtons + "-Msg" + SmartMSGboxCount + "' class='btn btn-default btn-sm botTempo'> " + Name + "</button>";
 						Content += Name;
@@ -152,7 +160,7 @@
 				$(".MessageBoxContainer").css("z-index", 99999);
 			}
 			$(".MessageBox").append(Content);
-			if (HasInput == 1) {
+			if (HasInput === 1) {
 				$("#txt" + SmartMSGboxCount).focus();
 			}
 			$(".botTempo").hover(function () {
@@ -164,8 +172,8 @@
 				var ThisID = $(this).attr("id");
 				var MsgBoxID = ThisID.substr(ThisID.indexOf("-") + 1);
 				var Press = $.trim($(this).text());
-				if (HasInput == 1) {
-					if (typeof callback == "function") {
+				if (HasInput === 1) {
+					if (typeof callback === "function") {
 						var IDNumber = MsgBoxID.replace("Msg", "");
 						var Value = $("#txt" + IDNumber).val();
 						if (callback) {
@@ -173,7 +181,7 @@
 						}
 					}
 				} else {
-					if (typeof callback == "function") {
+					if (typeof callback === "function") {
 						if (callback) {
 							callback(Press);
 						}
@@ -181,13 +189,13 @@
 				}
 				$("#" + MsgBoxID).addClass("animated fadeOut fast");
 				SmartMSGboxCount = SmartMSGboxCount - 1;
-				if (SmartMSGboxCount == 0) {
+				if (SmartMSGboxCount === 0) {
 					$("#MsgBoxBack").removeClass("fadeIn").addClass("fadeOut").delay(300).queue(function () {
 						ExistMsg = 0;
 						$(this).remove();
-					})
+					});
 				}
-			})
+			});
 		},
 
 		bigBox: function (settings, callback) {
@@ -204,7 +212,7 @@
 				colors: undefined
 			}, settings);
 			if (settings.sound === true) {
-				if (MyAMS.browser.isIE8orlower() == 0) {
+				if (MyAMS.browser.isIE8orlower() === 0) {
 					var audioElement = document.createElement("audio");
 					if (navigator.userAgent.match("Firefox/")) {
 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/bigbox.ogg');
@@ -221,19 +229,19 @@
 			}
 			BigBoxes = BigBoxes + 1;
 			boxBig = "<div id='bigBox" + BigBoxes + "' class='BigBox animated fadeIn fast'><div id='bigBoxColor" + BigBoxes + "'><i class='btnClose fa fa-times' id='btnClose" + BigBoxes + "'></i>";
-			if (settings.icon == undefined) {
+			if (settings.icon === undefined) {
 				settings.icon = "fa fa-cloud";
 			}
 			boxBig += "<span><i class='" + settings.icon + "'></i>&nbsp; " + settings.title + "</span>";
 			boxBig += "<p>" + settings.content + "</p>";
 			boxBig += "<div class='bigboxnumber'>";
-			if (settings.number != undefined) {
+			if (settings.number !== undefined) {
 				boxBig += settings.number;
 			}
 			boxBig += "</div></div>";
 			boxBig += "</div>";
 			$("#divBigBoxes").append(boxBig);
-			if (settings.color == undefined) {
+			if (settings.color === undefined) {
 				settings.color = "#004d60";
 			}
 			$("#bigBox" + BigBoxes).css("background-color", settings.color);
@@ -252,13 +260,13 @@
 					$(this).show();
 					$(this).addClass("animated fadeIn");
 					$(this).clearQueue();
-				})
+				});
 			});
 			var ThisBigBoxCloseCross = $("#btnClose" + BigBoxes);
 			var ThisBigBox = $("#bigBox" + BigBoxes);
 			var ThisMiniIcon = $("#miniIcon" + BigBoxes);
 			var ColorTimeInterval;
-			if (settings.colors != undefined && settings.colors.length > 0) {
+			if (settings.colors !== undefined && settings.colors.length > 0) {
 				ThisBigBoxCloseCross.attr("colorcount", "0");
 				ColorTimeInterval = setInterval(function () {
 					var ColorIndex = ThisBigBoxCloseCross.attr("colorcount");
@@ -280,7 +288,7 @@
 			}
 			ThisBigBoxCloseCross.bind("click", function () {
 				clearInterval(ColorTimeInterval);
-				if (typeof callback == "function") {
+				if (typeof callback === "function") {
 					if (callback) {
 						callback();
 					}
@@ -297,9 +305,9 @@
 				$("#" + miniIcon).addClass("fadeOut fast").delay(300).queue(function () {
 					$(this).clearQueue();
 					$(this).remove();
-				})
+				});
 			});
-			if (settings.timeout != undefined) {
+			if (settings.timeout !== undefined) {
 				var TimedID = BigBoxes;
 				setTimeout(function () {
 					clearInterval(ColorTimeInterval);
@@ -314,7 +322,7 @@
 					icon.addClass("fadeOut fast").delay(300).queue(function () {
 						$(this).clearQueue();
 						$(this).remove();
-					})
+					});
 				}, settings.timeout);
 			}
 		},
@@ -333,7 +341,7 @@
 				colors: undefined
 			}, settings);
 			if (settings.sound === true) {
-				if (MyAMS.browser.isIE8orlower() == 0) {
+				if (MyAMS.browser.isIE8orlower() === 0) {
 					var audioElement = document.createElement("audio");
 					if (navigator.userAgent.match("Firefox/")) {
 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/smallbox.ogg');
@@ -352,20 +360,20 @@
 			BoxSmall = "";
 			var IconSection = "",
 				CurrentIDSmallbox = "smallbox" + SmallBoxes;
-			if (settings.iconSmall == undefined) {
+			if (settings.iconSmall === undefined) {
 				IconSection = "<div class='miniIcon'></div>";
 			} else {
 				IconSection = "<div class='miniIcon'><i class='miniPic " + settings.iconSmall + "'></i></div>";
-			} if (settings.icon == undefined) {
+			} if (settings.icon === undefined) {
 				BoxSmall = "<div id='smallbox" + SmallBoxes + "' class='SmallBox animated fadeInRight fast'><div class='textoFull'><span>" + settings.title + "</span><p>" + settings.content + "</p></div>" + IconSection + "</div>";
 			} else {
 				BoxSmall = "<div id='smallbox" + SmallBoxes + "' class='SmallBox animated fadeInRight fast'><div class='foto'><i class='" + settings.icon + "'></i></div><div class='textoFoto'><span>" + settings.title + "</span><p>" + settings.content + "</p></div>" + IconSection + "</div>";
-			} if (SmallBoxes == 1) {
+			} if (SmallBoxes === 1) {
 				$("#divSmallBoxes").append(BoxSmall);
 				SmallBoxesAnchos = $("#smallbox" + SmallBoxes).height() + 40;
 			} else {
 				var SmartExist = $(".SmallBox").size();
-				if (SmartExist == 0) {
+				if (SmartExist === 0) {
 					$("#divSmallBoxes").append(BoxSmall);
 					SmallBoxesAnchos = $("#smallbox" + SmallBoxes).height() + 40;
 				} else {
@@ -373,7 +381,7 @@
 					$("#smallbox" + SmallBoxes).css("top", SmallBoxesAnchos);
 					SmallBoxesAnchos = SmallBoxesAnchos + $("#smallbox" + SmallBoxes).height() + 20;
 					$(".SmallBox").each(function (index) {
-						if (index == 0) {
+						if (index === 0) {
 							$(this).css("top", 20);
 							heightPrev = $(this).height() + 40;
 							SmallBoxesAnchos = $(this).height() + 40;
@@ -382,17 +390,17 @@
 							heightPrev = heightPrev + $(this).height() + 20;
 							SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20;
 						}
-					})
+					});
 				}
 			}
 			var ThisSmallBox = $("#smallbox" + SmallBoxes);
-			if (settings.color == undefined) {
-				ThisSmallBox.css("background-color", "#004d60")
+			if (settings.color === undefined) {
+				ThisSmallBox.css("background-color", "#004d60");
 			} else {
-				ThisSmallBox.css("background-color", settings.color)
+				ThisSmallBox.css("background-color", settings.color);
 			}
 			var ColorTimeInterval;
-			if (settings.colors != undefined && settings.colors.length > 0) {
+			if (settings.colors !== undefined && settings.colors.length > 0) {
 				ThisSmallBox.attr("colorcount", "0");
 				ColorTimeInterval = setInterval(function () {
 					var ColorIndex = ThisSmallBox.attr("colorcount");
@@ -406,17 +414,17 @@
 					}
 				}, settings.colortime);
 			}
-			if (settings.timeout != undefined) {
+			if (settings.timeout !== undefined) {
 				setTimeout(function () {
 					clearInterval(ColorTimeInterval);
 					var ThisHeight = $(this).height() + 20;
 					var ID = CurrentIDSmallbox;
 					var ThisTop = $("#" + CurrentIDSmallbox).css("top");
-					if ($("#" + CurrentIDSmallbox + ":hover").length != 0) {
+					if ($("#" + CurrentIDSmallbox + ":hover").length !== 0) {
 						$("#" + CurrentIDSmallbox).on("mouseleave", function () {
 							SmallBoxesAnchos = SmallBoxesAnchos - ThisHeight;
 							$("#" + CurrentIDSmallbox).remove();
-							if (typeof callback == "function") {
+							if (typeof callback === "function") {
 								if (callback) {
 									callback();
 								}
@@ -424,7 +432,7 @@
 							var Primero = 1;
 							var heightPrev = 0;
 							$(".SmallBox").each(function (index) {
-								if (index == 0) {
+								if (index === 0) {
 									$(this).animate({
 										top: 20
 									}, 300);
@@ -437,12 +445,12 @@
 									heightPrev = heightPrev + $(this).height() + 20;
 									SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20;
 								}
-							})
-						})
+							});
+						});
 					} else {
 						clearInterval(ColorTimeInterval);
 						SmallBoxesAnchos = SmallBoxesAnchos - ThisHeight;
-						if (typeof callback == "function") {
+						if (typeof callback === "function") {
 							if (callback) {
 								callback();
 							}
@@ -454,7 +462,7 @@
 							var Primero = 1;
 							var heightPrev = 0;
 							$(".SmallBox").each(function (index) {
-								if (index == 0) {
+								if (index === 0) {
 									$(this).animate({
 										top: 20
 									}, 300);
@@ -467,14 +475,14 @@
 									heightPrev = heightPrev + $(this).height() + 20;
 									SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20;
 								}
-							})
+							});
 						});
 					}
-				}, settings.timeout)
+				}, settings.timeout);
 			}
 			$("#smallbox" + SmallBoxes).bind("click", function () {
 				clearInterval(ColorTimeInterval);
-				if (typeof callback == "function") {
+				if (typeof callback === "function") {
 					if (callback) {
 						callback();
 					}
@@ -490,7 +498,7 @@
 					var Primero = 1;
 					var heightPrev = 0;
 					$(".SmallBox").each(function (index) {
-						if (index == 0) {
+						if (index === 0) {
 							$(this).animate({
 								top: 20
 							}, 300);
@@ -507,6 +515,6 @@
 				});
 			});
 		}
-	}
+	};
 
-})(jQuery);
+})(jQuery, this);
--- a/src/ztfy/myams/resources/js/myams-notify.min.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams-notify.min.js	Tue Nov 17 12:05:38 2015 +0100
@@ -1,1 +1,1 @@
-(function(c){c(document).ready(function(){c("body").append("<div id='divSmallBoxes'></div>").append("<div id='divMiniIcons'></div>").append("<div id='divBigBoxes'></div>")});function e(){c(".divMessageBox").fadeOut(300,function(){c(this).remove()});c(".LoadingBoxContainer").fadeOut(300,function(){c(this).remove()})}var a=0,b=0,d=0,i=0,f=0,h=0,g=0;MyAMS.notify={messageBox:function(v,u){var r,m,k=MyAMS.browser.isIE8orlower();var n={title:"",content:"",NormalButton:undefined,ActiveButton:undefined,buttons:undefined,input:undefined,placeholder:"",options:undefined,sound:undefined};var l=c.extend({},n,v);if(l.sound&&(k==0)){var t=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){t.setAttribute("src",MyAMS.baseURL+"../sound/message.ogg")}else{t.setAttribute("src",MyAMS.baseURL+"../sound/message.mp3")}c.get();t.addEventListener("load",function(){t.play()},true);t.pause();t.play()}b=b+1;if(a==0){a=1;r="<div class='MessageBox animated fadeIn fast' id='MsgBoxBack'></div>";c("body").append(r);if(MyAMS.browser.isIE8orlower()==1){c("#MsgBoxBack").addClass("MessageIE")}}var o="";var s=0;var q="";var j=0;if(l.input!=undefined){s=1;l.input=l.input.toLowerCase();switch(l.input){case"text":o="<input class='form-control' type='"+l.input+"' id='txt"+b+"' placeholder='"+l.placeholder+"'/><br/><br/>";break;case"password":o="<input class='form-control' type='"+l.input+"' id='txt"+b+"' placeholder='"+l.placeholder+"'/><br/><br/>";break;case"select":if(l.options==undefined){alert("For this type of input, the options parameter is required.")}else{o="<select class='form-control' id='txt"+b+"'>";for(var p=0;p<=l.options.length-1;p++){if(l.options[p]=="["){q=""}else{if(l.options[p]=="]"){j=j+1;q="<option>"+q+"</option>";o+=q}else{q+=l.options[p]}}}o+="</select>"}break;default:alert("That type of input is not handled yet")}}m="<div class='MessageBoxContainer animated fadeIn fast' id='Msg"+b+"'>";m+="<div class='MessageBoxMiddle'>";m+="<span class='MsgTitle'>"+l.title+"</span class='MsgTitle'>";m+="<p class='pText'>"+l.content+"</p>";m+=o;m+="<div class='MessageBoxButtonSection'>";if(l.buttons==undefined){l.buttons="[Accept]"}l.buttons=c.trim(l.buttons);l.buttons=l.buttons.split("");if(l.NormalButton==undefined){l.NormalButton="#232323"}if(l.ActiveButton==undefined){l.ActiveButton="#ed145b"}for(var p=0;p<=l.buttons.length-1;p++){if(l.buttons[p]=="["){q=""}else{if(l.buttons[p]=="]"){j=j+1;q="<button id='bot"+j+"-Msg"+b+"' class='btn btn-default btn-sm botTempo'> "+q+"</button>";m+=q}else{q+=l.buttons[p]}}}m+="</div>";m+="</div>";m+="</div>";if(b>1){c(".MessageBoxContainer").hide();c(".MessageBoxContainer").css("z-index",99999)}c(".MessageBox").append(m);if(s==1){c("#txt"+b).focus()}c(".botTempo").hover(function(){var w=c(this).attr("id")},function(){var w=c(this).attr("id")});c(".botTempo").click(function(){var A=c(this).attr("id");var z=A.substr(A.indexOf("-")+1);var x=c.trim(c(this).text());if(s==1){if(typeof u=="function"){var y=z.replace("Msg","");var w=c("#txt"+y).val();if(u){u(x,w)}}}else{if(typeof u=="function"){if(u){u(x)}}}c("#"+z).addClass("animated fadeOut fast");b=b-1;if(b==0){c("#MsgBoxBack").removeClass("fadeIn").addClass("fadeOut").delay(300).queue(function(){a=0;c(this).remove()})}})},bigBox:function(j,q){var m,n;j=c.extend({title:"",content:"",icon:undefined,number:undefined,color:undefined,sound:true,timeout:undefined,colortime:1500,colors:undefined},j);if(j.sound===true){if(MyAMS.browser.isIE8orlower()==0){var p=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){p.setAttribute("src",MyAMS.baseURL+"../snd/bigbox.ogg")}else{p.setAttribute("src",MyAMS.baseURL+"../snd/bigbox.mp3")}c.get();p.addEventListener("load",function(){p.play()},true);p.pause();p.play()}}i=i+1;m="<div id='bigBox"+i+"' class='BigBox animated fadeIn fast'><div id='bigBoxColor"+i+"'><i class='btnClose fa fa-times' id='btnClose"+i+"'></i>";if(j.icon==undefined){j.icon="fa fa-cloud"}m+="<span><i class='"+j.icon+"'></i>&nbsp; "+j.title+"</span>";m+="<p>"+j.content+"</p>";m+="<div class='bigboxnumber'>";if(j.number!=undefined){m+=j.number}m+="</div></div>";m+="</div>";c("#divBigBoxes").append(m);if(j.color==undefined){j.color="#004d60"}c("#bigBox"+i).css("background-color",j.color);c("#divMiniIcons").append("<div id='miniIcon"+i+"' class='cajita animated fadeIn' style='background-color: "+j.color+";'><i class='"+j.icon+"'/></i></div>");c("#miniIcon"+i).bind("click",function(){var v=c(this).attr("id");var u=v.replace("miniIcon","bigBox");var t=v.replace("miniIcon","bigBoxColor");c(".cajita").each(function(x){var w=c(this).attr("id");var y=w.replace("miniIcon","bigBox");c("#"+y).css("z-index",9998)});c("#"+u).css("z-index",9999);c("#"+t).removeClass("animated fadeIn").delay(1).queue(function(){c(this).show();c(this).addClass("animated fadeIn");c(this).clearQueue()})});var k=c("#btnClose"+i);var o=c("#bigBox"+i);var s=c("#miniIcon"+i);var r;if(j.colors!=undefined&&j.colors.length>0){k.attr("colorcount","0");r=setInterval(function(){var t=k.attr("colorcount");k.animate({backgroundColor:j.colors[t].color});o.animate({backgroundColor:j.colors[t].color});s.animate({backgroundColor:j.colors[t].color});if(t<j.colors.length-1){k.attr("colorcount",((t*1)+1))}else{k.attr("colorcount",0)}},j.colortime)}k.bind("click",function(){clearInterval(r);if(typeof q=="function"){if(q){q()}}var u=c(this).attr("id");var t=u.replace("btnClose","bigBox");var v=u.replace("btnClose","miniIcon");c("#"+t).removeClass("fadeIn fast");c("#"+t).addClass("fadeOut fast").delay(300).queue(function(){c(this).clearQueue();c(this).remove()});c("#"+v).removeClass("fadeIn fast");c("#"+v).addClass("fadeOut fast").delay(300).queue(function(){c(this).clearQueue();c(this).remove()})});if(j.timeout!=undefined){var l=i;setTimeout(function(){clearInterval(r);var u=c("#bigBox"+l);u.removeClass("fadeIn fast");u.addClass("fadeOut fast").delay(300).queue(function(){c(this).clearQueue();c(this).remove()});var t=c("#miniIcon"+l);t.removeClass("fadeIn fast");t.addClass("fadeOut fast").delay(300).queue(function(){c(this).clearQueue();c(this).remove()})},j.timeout)}},smallBox:function(k,q){var m,n;k=c.extend({title:"",content:"",icon:undefined,iconSmall:undefined,sound:true,color:undefined,timeout:undefined,colortime:1500,colors:undefined},k);if(k.sound===true){if(MyAMS.browser.isIE8orlower()==0){var o=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){o.setAttribute("src",MyAMS.baseURL+"../snd/smallbox.ogg")}else{o.setAttribute("src",MyAMS.baseURL+"../snd/smallbox.mp3")}c.get();o.addEventListener("load",function(){o.play()},true);o.pause();o.play()}}f=f+1;m="";var l="",j="smallbox"+f;if(k.iconSmall==undefined){l="<div class='miniIcon'></div>"}else{l="<div class='miniIcon'><i class='miniPic "+k.iconSmall+"'></i></div>"}if(k.icon==undefined){m="<div id='smallbox"+f+"' class='SmallBox animated fadeInRight fast'><div class='textoFull'><span>"+k.title+"</span><p>"+k.content+"</p></div>"+l+"</div>"}else{m="<div id='smallbox"+f+"' class='SmallBox animated fadeInRight fast'><div class='foto'><i class='"+k.icon+"'></i></div><div class='textoFoto'><span>"+k.title+"</span><p>"+k.content+"</p></div>"+l+"</div>"}if(f==1){c("#divSmallBoxes").append(m);g=c("#smallbox"+f).height()+40}else{var p=c(".SmallBox").size();if(p==0){c("#divSmallBoxes").append(m);g=c("#smallbox"+f).height()+40}else{c("#divSmallBoxes").append(m);c("#smallbox"+f).css("top",g);g=g+c("#smallbox"+f).height()+20;c(".SmallBox").each(function(t){if(t==0){c(this).css("top",20);heightPrev=c(this).height()+40;g=c(this).height()+40}else{c(this).css("top",heightPrev);heightPrev=heightPrev+c(this).height()+20;g=g+c(this).height()+20}})}}var s=c("#smallbox"+f);if(k.color==undefined){s.css("background-color","#004d60")}else{s.css("background-color",k.color)}var r;if(k.colors!=undefined&&k.colors.length>0){s.attr("colorcount","0");r=setInterval(function(){var t=s.attr("colorcount");s.animate({backgroundColor:k.colors[t].color});if(t<k.colors.length-1){s.attr("colorcount",((t*1)+1))}else{s.attr("colorcount",0)}},k.colortime)}if(k.timeout!=undefined){setTimeout(function(){clearInterval(r);var u=c(this).height()+20;var t=j;var v=c("#"+j).css("top");if(c("#"+j+":hover").length!=0){c("#"+j).on("mouseleave",function(){g=g-u;c("#"+j).remove();if(typeof q=="function"){if(q){q()}}var x=1;var w=0;c(".SmallBox").each(function(y){if(y==0){c(this).animate({top:20},300);w=c(this).height()+40;g=c(this).height()+40}else{c(this).animate({top:w},350);w=w+c(this).height()+20;g=g+c(this).height()+20}})})}else{clearInterval(r);g=g-u;if(typeof q=="function"){if(q){q()}}c("#"+j).removeClass().addClass("SmallBox").animate({opacity:0},300,function(){c(this).remove();var x=1;var w=0;c(".SmallBox").each(function(y){if(y==0){c(this).animate({top:20},300);w=c(this).height()+40;g=c(this).height()+40}else{c(this).animate({top:w});w=w+c(this).height()+20;g=g+c(this).height()+20}})})}},k.timeout)}c("#smallbox"+f).bind("click",function(){clearInterval(r);if(typeof q=="function"){if(q){q()}}var u=c(this).height()+20;var t=c(this).attr("id");var v=c(this).css("top");g=g-u;c(this).removeClass().addClass("SmallBox").animate({opacity:0},300,function(){c(this).remove();var x=1;var w=0;c(".SmallBox").each(function(y){if(y==0){c(this).animate({top:20},300);w=c(this).height()+40;g=c(this).height()+40}else{c(this).animate({top:w},350);w=w+c(this).height()+20;g=g+c(this).height()+20}})})})}}})(jQuery);
\ No newline at end of file
+(function(c,d){c(document).ready(function(){c("body").append("<div id='divSmallBoxes'></div>").append("<div id='divMiniIcons'></div>").append("<div id='divBigBoxes'></div>")});function f(){c(".divMessageBox").fadeOut(300,function(){c(this).remove()});c(".LoadingBoxContainer").fadeOut(300,function(){c(this).remove()})}var a=0,b=0,h,j=0,g=0,i=0;var e=d.MyAMS;e.notify={messageBox:function(w,v){var s,n,l=e.browser.isIE8orlower();var o={title:"",content:"",NormalButton:undefined,ActiveButton:undefined,buttons:undefined,input:undefined,placeholder:"",options:undefined,sound:undefined};var m=c.extend({},o,w);if(m.sound&&(l===0)){var u=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){u.setAttribute("src",e.baseURL+"../sound/message.ogg")}else{u.setAttribute("src",e.baseURL+"../sound/message.mp3")}c.get();u.addEventListener("load",function(){u.play()},true);u.pause();u.play()}b=b+1;if(a===0){a=1;s="<div class='MessageBox animated fadeIn fast' id='MsgBoxBack'></div>";c("body").append(s);if(e.browser.isIE8orlower()===1){c("#MsgBoxBack").addClass("MessageIE")}}var r;var p="";var t=0;var q="";var k=0;if(m.input!==undefined){t=1;m.input=m.input.toLowerCase();switch(m.input){case"text":p="<input class='form-control' type='"+m.input+"' id='txt"+b+"' placeholder='"+m.placeholder+"'/><br/><br/>";break;case"password":p="<input class='form-control' type='"+m.input+"' id='txt"+b+"' placeholder='"+m.placeholder+"'/><br/><br/>";break;case"select":if(m.options===undefined){if(d.alert){d.alert("For this type of input, the options parameter is required.")}}else{p="<select class='form-control' id='txt"+b+"'>";for(r=0;r<=m.options.length-1;r++){if(m.options[r]==="["){q=""}else{if(m.options[r]==="]"){k=k+1;q="<option>"+q+"</option>";p+=q}else{q+=m.options[r]}}}p+="</select>"}break;default:if(d.alert){d.alert("That type of input is not handled yet")}}}n="<div class='MessageBoxContainer animated fadeIn fast' id='Msg"+b+"'>";n+="<div class='MessageBoxMiddle'>";n+="<span class='MsgTitle'>"+m.title+"</span class='MsgTitle'>";n+="<p class='pText'>"+m.content+"</p>";n+=p;n+="<div class='MessageBoxButtonSection'>";if(m.buttons===undefined){m.buttons="[Accept]"}m.buttons=c.trim(m.buttons);m.buttons=m.buttons.split("");if(m.NormalButton===undefined){m.NormalButton="#232323"}if(m.ActiveButton===undefined){m.ActiveButton="#ed145b"}for(r=0;r<=m.buttons.length-1;r++){if(m.buttons[r]==="["){q=""}else{if(m.buttons[r]==="]"){k=k+1;q="<button id='bot"+k+"-Msg"+b+"' class='btn btn-default btn-sm botTempo'> "+q+"</button>";n+=q}else{q+=m.buttons[r]}}}n+="</div>";n+="</div>";n+="</div>";if(b>1){c(".MessageBoxContainer").hide();c(".MessageBoxContainer").css("z-index",99999)}c(".MessageBox").append(n);if(t===1){c("#txt"+b).focus()}c(".botTempo").hover(function(){var x=c(this).attr("id")},function(){var x=c(this).attr("id")});c(".botTempo").click(function(){var B=c(this).attr("id");var A=B.substr(B.indexOf("-")+1);var y=c.trim(c(this).text());if(t===1){if(typeof v==="function"){var z=A.replace("Msg","");var x=c("#txt"+z).val();if(v){v(y,x)}}}else{if(typeof v==="function"){if(v){v(y)}}}c("#"+A).addClass("animated fadeOut fast");b=b-1;if(b===0){c("#MsgBoxBack").removeClass("fadeIn").addClass("fadeOut").delay(300).queue(function(){a=0;c(this).remove()})}})},bigBox:function(k,r){var n,o;k=c.extend({title:"",content:"",icon:undefined,number:undefined,color:undefined,sound:true,timeout:undefined,colortime:1500,colors:undefined},k);if(k.sound===true){if(e.browser.isIE8orlower()===0){var q=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){q.setAttribute("src",e.baseURL+"../snd/bigbox.ogg")}else{q.setAttribute("src",e.baseURL+"../snd/bigbox.mp3")}c.get();q.addEventListener("load",function(){q.play()},true);q.pause();q.play()}}j=j+1;n="<div id='bigBox"+j+"' class='BigBox animated fadeIn fast'><div id='bigBoxColor"+j+"'><i class='btnClose fa fa-times' id='btnClose"+j+"'></i>";if(k.icon===undefined){k.icon="fa fa-cloud"}n+="<span><i class='"+k.icon+"'></i>&nbsp; "+k.title+"</span>";n+="<p>"+k.content+"</p>";n+="<div class='bigboxnumber'>";if(k.number!==undefined){n+=k.number}n+="</div></div>";n+="</div>";c("#divBigBoxes").append(n);if(k.color===undefined){k.color="#004d60"}c("#bigBox"+j).css("background-color",k.color);c("#divMiniIcons").append("<div id='miniIcon"+j+"' class='cajita animated fadeIn' style='background-color: "+k.color+";'><i class='"+k.icon+"'/></i></div>");c("#miniIcon"+j).bind("click",function(){var w=c(this).attr("id");var v=w.replace("miniIcon","bigBox");var u=w.replace("miniIcon","bigBoxColor");c(".cajita").each(function(y){var x=c(this).attr("id");var z=x.replace("miniIcon","bigBox");c("#"+z).css("z-index",9998)});c("#"+v).css("z-index",9999);c("#"+u).removeClass("animated fadeIn").delay(1).queue(function(){c(this).show();c(this).addClass("animated fadeIn");c(this).clearQueue()})});var l=c("#btnClose"+j);var p=c("#bigBox"+j);var t=c("#miniIcon"+j);var s;if(k.colors!==undefined&&k.colors.length>0){l.attr("colorcount","0");s=setInterval(function(){var u=l.attr("colorcount");l.animate({backgroundColor:k.colors[u].color});p.animate({backgroundColor:k.colors[u].color});t.animate({backgroundColor:k.colors[u].color});if(u<k.colors.length-1){l.attr("colorcount",((u*1)+1))}else{l.attr("colorcount",0)}},k.colortime)}l.bind("click",function(){clearInterval(s);if(typeof r==="function"){if(r){r()}}var v=c(this).attr("id");var u=v.replace("btnClose","bigBox");var w=v.replace("btnClose","miniIcon");c("#"+u).removeClass("fadeIn fast");c("#"+u).addClass("fadeOut fast").delay(300).queue(function(){c(this).clearQueue();c(this).remove()});c("#"+w).removeClass("fadeIn fast");c("#"+w).addClass("fadeOut fast").delay(300).queue(function(){c(this).clearQueue();c(this).remove()})});if(k.timeout!==undefined){var m=j;setTimeout(function(){clearInterval(s);var v=c("#bigBox"+m);v.removeClass("fadeIn fast");v.addClass("fadeOut fast").delay(300).queue(function(){c(this).clearQueue();c(this).remove()});var u=c("#miniIcon"+m);u.removeClass("fadeIn fast");u.addClass("fadeOut fast").delay(300).queue(function(){c(this).clearQueue();c(this).remove()})},k.timeout)}},smallBox:function(l,r){var n,o;l=c.extend({title:"",content:"",icon:undefined,iconSmall:undefined,sound:true,color:undefined,timeout:undefined,colortime:1500,colors:undefined},l);if(l.sound===true){if(e.browser.isIE8orlower()===0){var p=document.createElement("audio");if(navigator.userAgent.match("Firefox/")){p.setAttribute("src",e.baseURL+"../snd/smallbox.ogg")}else{p.setAttribute("src",e.baseURL+"../snd/smallbox.mp3")}c.get();p.addEventListener("load",function(){p.play()},true);p.pause();p.play()}}g=g+1;n="";var m="",k="smallbox"+g;if(l.iconSmall===undefined){m="<div class='miniIcon'></div>"}else{m="<div class='miniIcon'><i class='miniPic "+l.iconSmall+"'></i></div>"}if(l.icon===undefined){n="<div id='smallbox"+g+"' class='SmallBox animated fadeInRight fast'><div class='textoFull'><span>"+l.title+"</span><p>"+l.content+"</p></div>"+m+"</div>"}else{n="<div id='smallbox"+g+"' class='SmallBox animated fadeInRight fast'><div class='foto'><i class='"+l.icon+"'></i></div><div class='textoFoto'><span>"+l.title+"</span><p>"+l.content+"</p></div>"+m+"</div>"}if(g===1){c("#divSmallBoxes").append(n);i=c("#smallbox"+g).height()+40}else{var q=c(".SmallBox").size();if(q===0){c("#divSmallBoxes").append(n);i=c("#smallbox"+g).height()+40}else{c("#divSmallBoxes").append(n);c("#smallbox"+g).css("top",i);i=i+c("#smallbox"+g).height()+20;c(".SmallBox").each(function(u){if(u===0){c(this).css("top",20);h=c(this).height()+40;i=c(this).height()+40}else{c(this).css("top",h);h=h+c(this).height()+20;i=i+c(this).height()+20}})}}var t=c("#smallbox"+g);if(l.color===undefined){t.css("background-color","#004d60")}else{t.css("background-color",l.color)}var s;if(l.colors!==undefined&&l.colors.length>0){t.attr("colorcount","0");s=setInterval(function(){var u=t.attr("colorcount");t.animate({backgroundColor:l.colors[u].color});if(u<l.colors.length-1){t.attr("colorcount",((u*1)+1))}else{t.attr("colorcount",0)}},l.colortime)}if(l.timeout!==undefined){setTimeout(function(){clearInterval(s);var v=c(this).height()+20;var u=k;var w=c("#"+k).css("top");if(c("#"+k+":hover").length!==0){c("#"+k).on("mouseleave",function(){i=i-v;c("#"+k).remove();if(typeof r==="function"){if(r){r()}}var y=1;var x=0;c(".SmallBox").each(function(z){if(z===0){c(this).animate({top:20},300);x=c(this).height()+40;i=c(this).height()+40}else{c(this).animate({top:x},350);x=x+c(this).height()+20;i=i+c(this).height()+20}})})}else{clearInterval(s);i=i-v;if(typeof r==="function"){if(r){r()}}c("#"+k).removeClass().addClass("SmallBox").animate({opacity:0},300,function(){c(this).remove();var y=1;var x=0;c(".SmallBox").each(function(z){if(z===0){c(this).animate({top:20},300);x=c(this).height()+40;i=c(this).height()+40}else{c(this).animate({top:x});x=x+c(this).height()+20;i=i+c(this).height()+20}})})}},l.timeout)}c("#smallbox"+g).bind("click",function(){clearInterval(s);if(typeof r==="function"){if(r){r()}}var v=c(this).height()+20;var u=c(this).attr("id");var w=c(this).css("top");i=i-v;c(this).removeClass().addClass("SmallBox").animate({opacity:0},300,function(){c(this).remove();var y=1;var x=0;c(".SmallBox").each(function(z){if(z===0){c(this).animate({top:20},300);x=c(this).height()+40;i=c(this).height()+40}else{c(this).animate({top:x},350);x=x+c(this).height()+20;i=i+c(this).height()+20}})})})}}})(jQuery,this);
\ No newline at end of file
--- a/src/ztfy/myams/resources/js/myams-widgets.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams-widgets.js	Tue Nov 17 12:05:38 2015 +0100
@@ -4,12 +4,15 @@
  * ©2014 Thierry Florac <tflorac@ulthar.net>
  */
 
-(function($) {
+(function($, globals) {
+
+	'use strict';
 
 	/* Private functions */
 	function checkValue(value) {
-		if (value < 10)
+		if (value < 10) {
 			value = '0' + value;
+		}
 		return value;
 	}
 
@@ -24,12 +27,15 @@
 		return options.timestampFormat.replace(/%d%/g, day)
 									  .replace(/%m%/g, month)
 									  .replace(/%y%/g, year)
-									  .replace(/%h%/g, hour)
+									  .replace(/%h%/g, hours)
 									  .replace(/%i%/g, minutes)
 									  .replace(/%s%/g, seconds);
 	}
 
 
+	var MyAMS = globals.MyAMS;
+
+
 	function Widget(element, options) {
 		this.widget = element;
 		this.options = $.extend({}, MyAMSWidget.defaults, options);
@@ -44,51 +50,69 @@
 		this.init();
 	}
 
-
 	Widget.prototype = {
 
 		init: function() {
 			var self = this;
-			if (self.options.rtl === true)
+			var widget;
+
+			if (self.options.rtl === true) {
 				$('body').addClass('rtl');
+			}
 			self.grid.each(function() {
 				$(this).addClass('sortable-grid');
 			});
 			self._getSettings();
 			if (self.hasGrid && self.storage) {
+
+				var key;
 				if (self.position) {
 					var position = JSON.parse(self.position);
-					for (var key in position.grid) {
+					for (key in position.grid) {
+						if (!position.grid.hasOwnProperty(key)) {
+							continue;
+						}
 						var changeOrder = self.grid.find(self.options.subgrid + '.sortable-grid').eq(key);
-						for (var key2 in position.grid[key].section)
+						for (var key2 in position.grid[key].section) {
+							if (!position.grid[key].section.hasOwnProperty(key2)) {
+								continue;
+							}
 							changeOrder.append($('#' + position.grid[key].section[key2].id));
+						}
 					}
 				}
 				if (self.settings) {
 					var settings = JSON.parse(self.settings);
-					for (var key in settings.widget) {
-						var widget = settings.widget[key];
+					for (key in settings.widget) {
+						if (!settings.widget.hasOwnProperty(key)) {
+							continue;
+						}
+						widget = settings.widget[key];
 						var widgetId = $('#' + widget.id);
-						if (widget.style)
+						if (widget.style) {
 							widgetId.removeClassPrefix('ams-widget-color-')
 									.addClass(widget.style)
 									.attr('data-widget-attstyle', widget.style);
-						if (widget.hidden == 1)
+						}
+						if (widget.hidden === 1) {
 							widgetId.hide(1);
-						else
+						} else {
 							widgetId.show(1)
 									.removeAttr('data-widget-hidden');
-						if (widget.collapsed == 1)
+						}
+						if (widget.collapsed === 1) {
 							widgetId.addClass('ams-widget-collapsed')
 									.children('div')
 									.hide(1);
+						}
 						var title = widgetId.children('header').children('h2');
-						if (title.text() != widget.title)
+						if (title.text() !== widget.title) {
 							title.text(widget.title);
+						}
 					}
 				}
 			}
-			var widget = self.widget;
+			widget = self.widget;
 			var data = widget.data();
 			var data_options = {
 				grid: data.amsWidgetGrid,
@@ -142,65 +166,85 @@
 			var widgetOptions = $.extend({}, self.options, data_options);
 			var header = widget.children('header');
 			if (!header.parent().attr('role')) {
-				if (data.widgetHidden === true)
+
+				var customBtn,
+					deleteBtn,
+					editBtn,
+					fullscreenBtn,
+					toggleBtn,
+					refreshBtn;
+				if (data.widgetHidden === true) {
 					widget.hide();
-				if (data.widgetCollapsed === true)
+				}
+				if (data.widgetCollapsed === true) {
 					widget.addClass('ams-widget-collapsed')
 						  .children('div').hide();
+				}
 				if (widgetOptions.customButton &&
 					(data.widgetCustombutton === undefined) &&
-					(self.customClass[0].length != 0))
-					var customBtn = '<a href="#" class="button-icon ams-widget-custom-btn"><i class="' + self.customClass[0] + '"></i></a>';
-				else
+					(self.customClass[0].length !== 0)) {
+					customBtn = '<a href="#" class="button-icon ams-widget-custom-btn"><i class="' + self.customClass[0] + '"></i></a>';
+				} else {
 					customBtn = "";
-				if (widgetOptions.deleteButton && (data.widgetDeleteButton === undefined))
-					var deleteBtn = '<a href="#" class="button-icon ams-widget-delete-btn hint" title="' + MyAMSWidget.i18n.DELETE_BTN + '" data-ams-hint-gravity="se">' +
-									'<i class="' + widgetOptions.deleteClass + '"></i></a>';
-				else
+				}
+				if (widgetOptions.deleteButton && (data.widgetDeleteButton === undefined)) {
+					deleteBtn = '<a href="#" class="button-icon ams-widget-delete-btn hint" title="' + MyAMSWidget.i18n.DELETE_BTN + '" data-ams-hint-gravity="se">' +
+								'<i class="' + widgetOptions.deleteClass + '"></i></a>';
+				} else {
 					deleteBtn = "";
+				}
 				if (widgetOptions.editButton && (data.widgetEditButton === undefined)) {
 					var editClass = widgetOptions.editClass.split('|')[0];
-					var editBtn = '<a href="#" class="button-icon ams-widget-edit-btn hint" title="' + MyAMSWidget.i18n.EDIT_BTN + '" data-ams-hint-gravity="se">' +
-								  '<i class="' + editClass + '"></i></a>';
-				} else
+					editBtn = '<a href="#" class="button-icon ams-widget-edit-btn hint" title="' + MyAMSWidget.i18n.EDIT_BTN + '" data-ams-hint-gravity="se">' +
+							  '<i class="' + editClass + '"></i></a>';
+				} else {
 					editBtn = "";
+				}
 				if (widgetOptions.fullscreenButton && (data.widgetFullscreenButton === undefined)) {
 					var fullscreenClass = widgetOptions.fullscreenClass.split('|')[0];
-					var fullscreenBtn = '<a href="#" class="button-icon ams-widget-fullscreen-btn hint" title="' + MyAMSWidget.i18n.FULLSCREEN_BTN + '" data-ams-hint-gravity="se">' +
-										'<i class="' + fullscreenClass + '"></i></a>';
-				} else
+					fullscreenBtn = '<a href="#" class="button-icon ams-widget-fullscreen-btn hint" title="' + MyAMSWidget.i18n.FULLSCREEN_BTN + '" data-ams-hint-gravity="se">' +
+									'<i class="' + fullscreenClass + '"></i></a>';
+				} else {
 					fullscreenBtn = "";
+				}
 				if (widgetOptions.toggleButton && (data.widgetToggleButton === undefined)) {
 					var toggleClass = widgetOptions.toggleClass.split('|');
+					var toggleSettings;
 					if ((widget.dataWidgetCollapsed === true) ||
-						widget.hasClass('ams-widget-collapsed'))
-						var toggleSettings = toggleClass[1];
-					else
+						widget.hasClass('ams-widget-collapsed')) {
+						toggleSettings = toggleClass[1];
+					} else {
 						toggleSettings = toggleClass[0];
-					var toggleBtn = '<a href="#" class="button-icon ams-widget-toggle-btn hint" title="' + MyAMSWidget.i18n.COLLAPSE_BTN + '" data-ams-hint-gravity="se">' +
-									'<i class="' + toggleSettings + '"></i></a>';
-				} else
+					}
+					toggleBtn = '<a href="#" class="button-icon ams-widget-toggle-btn hint" title="' + MyAMSWidget.i18n.COLLAPSE_BTN + '" data-ams-hint-gravity="se">' +
+								'<i class="' + toggleSettings + '"></i></a>';
+				} else {
 					toggleBtn = "";
+				}
 				if (widgetOptions.refreshButton &&
 					(data.widgetRefreshButton === undefined) &&
-					data.widgetLoad)
-					var refreshBtn = '<a href="#" class="button-icon ams-widget-refresh-btn hint" title="' + MyAMSWidget.i18n.REFRESH_BTN + '" data-loading-text="&nbsp;&nbsp;' + MyAMSWidget.i18n.LOADING_MSG + '&nbsp;" data-ams-hint-gravity="se">' +
-									 '<i class="' + widgetOptions.refreshClass + '"></i></a>';
-				else
+					data.widgetLoad) {
+					refreshBtn = '<a href="#" class="button-icon ams-widget-refresh-btn hint" title="' + MyAMSWidget.i18n.REFRESH_BTN + '" data-loading-text="&nbsp;&nbsp;' + MyAMSWidget.i18n.LOADING_MSG + '&nbsp;" data-ams-hint-gravity="se">' +
+								 '<i class="' + widgetOptions.refreshClass + '"></i></a>';
+				} else {
 					refreshBtn = "";
+				}
 				var buttons = widgetOptions.buttonsOrder.replace(/%refresh%/, refreshBtn)
 														 .replace(/%custom%/, customBtn)
 														 .replace(/%edit%/, editBtn)
 														 .replace(/%toggle%/, toggleBtn)
 														 .replace(/%fullscreen%/, fullscreenBtn)
 														 .replace(/%delete%/, deleteBtn);
-				if (refreshBtn || customBtn || editBtn || toggleBtn || fullscreenBtn || deleteBtn)
+				if (refreshBtn || customBtn || editBtn || toggleBtn || fullscreenBtn || deleteBtn) {
 					header.prepend('<div class="ams-widget-ctrls">' + buttons + '</div>');
-				if (widgetOptions.sortable && (data.widgetSortable === undefined))
+				}
+				if (widgetOptions.sortable && (data.widgetSortable === undefined)) {
 					widget.addClass('ams-widget-sortable');
+				}
 				var placeholder = widget.find(widgetOptions.editPlaceholder);
-				if (placeholder.length > 0)
+				if (placeholder.length > 0) {
 					placeholder.find('input').val($.trim(header.children('h2').text()));
+				}
 				header.append('<span class="ams-widget-loader"><i class="fa fa-refresh fa-spin"></i></span>');
 				widget.attr('role', 'widget')
 					  .children('div').attr('role', 'content')
@@ -209,8 +253,9 @@
 				MyAMS.plugins.enabled.hint(header);
 			}
 			widget.data('widget-options', widgetOptions);
-			if (self.options.hiddenButtons)
+			if (self.options.hiddenButtons) {
 				$(self.controls).hide();
+			}
 			widget.find("[data-widget-load]").each(function() {
 				var item = $(this),
 					header = item.children(),
@@ -224,8 +269,9 @@
 						setInterval(function() {
 							self._loadAjaxFile(item, path, header);
 						}, reloadTime);
-					} else
+					} else {
 						self._loadAjaxFile(item, path, header);
+					}
 				}
 			});
 			if (self.options.hiddenButtons) {
@@ -237,26 +283,30 @@
 			}
 			self._setClickEvents();
 			$(self.options.deleteSettingsKey).on(self.clickEvent, this, function(e) {
-				if (self.storage) {
-					var cleared = confirm(self.options.settingsKeyLabel);
-					if (cleared)
+				if (self.storage && globals.confirm) {
+					var cleared = globals.confirm(self.options.settingsKeyLabel);
+					if (cleared) {
 						self.storage.removeItem(self.settingsKey);
+					}
 				}
 				e.preventDefault();
 			});
 			$(self.options.deletePositionKey).on(self.clickEvent, this, function(e) {
-				if (self.storage) {
-					var cleared = confirm(self.options.positionKeyLabel);
-					if (cleared)
+				if (self.storage && globals.confirm) {
+					var cleared = globals.confirm(self.options.positionKeyLabel);
+					if (cleared) {
 						self.storage.removeItem(self.positionKey);
+					}
 				}
 				e.preventDefault();
 			});
 			if (self.storage) {
-				if (self.settingsKey === null || self.settingsKey.length < 1)
+				if (self.settingsKey === null || self.settingsKey.length < 1) {
 					self._saveWidgetSettings();
-				if (self.positionKey === null || self.positionKey.length < 1)
+				}
+				if (self.positionKey === null || self.positionKey.length < 1) {
 					self._saveWidgetPosition();
+				}
 			}
 			self.grid.data('ams-widgets-loaded', true);
 		},
@@ -269,9 +319,9 @@
 
 		_getSettings: function() {
 			var self = this;
-			if (!self.hasGrid || !self.gridId)
+			if (!self.hasGrid || !self.gridId) {
 				self.storage = null;
-			else {
+			} else {
 				switch (self.options.storage) {
 					case 'local':
 						self.storage = localStorage;
@@ -283,14 +333,14 @@
 						self.storage = null;
 				}
 			}
-			var use_storage = (self.storage != null) && function() {
+			var use_storage = (self.storage !== null) && function() {
 				var result,
-					uid = +new Date;
+					uid = +new Date();
 				try {
 					self.storage.setItem(uid, uid);
-					result = self.storage.getItem(uid) == uid;
+					result = self.storage.getItem(uid) === uid;
 					self.storage.removeItem(uid);
-					return result
+					return result;
 				} catch (e) {}
 			}();
 			if (use_storage) {
@@ -299,21 +349,23 @@
 				self.positionKey = "AMS_position_" + location.pathname + location.hash + "_" + self.gridId;
 				self.position = self.storage.getItem(self.positionKey);
 			}
-			if (("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch) {
-				self.clickEvent = "touchstart"
+			if (("ontouchstart" in globals) ||
+				globals.DocumentTouch && globals.document instanceof globals.DocumentTouch) {
+				self.clickEvent = "touchstart";
 			} else {
-				self.clickEvent = "click"
+				self.clickEvent = "click";
 			}
 		},
 
 		_runLoaderWidget: function(widget) {
 			var self = this;
-			if (self.options.indicator)
+			if (self.options.indicator) {
 				widget.find('.ams-widget-loader')
 					  .stop(true, true)
 					  .fadeIn(100)
 					  .delay(self.options.indicatorTime)
 					  .fadeOut(100);
+			}
 		},
 
 		_loadAjaxFile: function(url, widget, loader) {
@@ -336,10 +388,12 @@
 					gridSettings.push(widgetSettings);
 				});
 				var gridSettingsStr = JSON.stringify({widget: gridSettings});
-				if (self.settings != gridSettingsStr)
+				if (self.settings !== gridSettingsStr) {
 					self.storage.setItem(self.settingsKey, gridSettingsStr);
-				if (typeof(self.options.onSave) == 'function')
+				}
+				if (typeof(self.options.onSave) === 'function') {
 					self.options.onSave.call(this, null, gridSettings);
+				}
 			}
 		},
 
@@ -353,24 +407,27 @@
 					$(this).children(self.options.widgets).each(function () {
 						var subObj = {};
 						subObj.id = $(this).attr("id");
-						subgridPosition.push(subObj)
+						subgridPosition.push(subObj);
 					});
 					var out = {section: subgridPosition};
-					gridPosition.push(out)
+					gridPosition.push(out);
 				});
 				var gridPositionStr = JSON.stringify({grid: gridPosition});
-				if (self.position != gridPositionStr)
+				if (self.position !== gridPositionStr) {
 					self.storage.setItem(self.positionKey, gridPositionStr);
-				if (typeof(self.options.onSave) == 'function')
+				}
+				if (typeof(self.options.onSave) === 'function') {
 					self.options.onSave.call(this, null, gridPosition);
+				}
 			}
 		},
 
 		_setClickEvents: function() {
 
 			function setFullscreenHeight() {
-				if ($('#ams-widget-fullscreen-mode').length > 0) {
-					var widgets = $('#ams-widget-fullscreen-mode').find(self.options.widgets);
+				var mode = $('#ams-widget-fullscreen-mode');
+				if (mode.length > 0) {
+					var widgets = mode.find(self.options.widgets);
 					var windowHeight = $(window).height();
 					var headerHeight = widgets.children('header')
 											  .height();
@@ -386,14 +443,15 @@
 			self.widget.on(self.clickEvent, '.ams-widget-toggle-btn', function(e) {
 				e.preventDefault();
 				var button = $(this);
-				var widget = button.parents(self.options.widgets);
+				var widget = button.parents(self.options.widgets).first();
 				var widgetOptions = widget.data('widget-options');
 				var toggleClass = widgetOptions.toggleClass.split('|');
 				self._runLoaderWidget(widget);
 				var canToggle = true;
 				if (widget.hasClass('ams-widget-collapsed')) {
-					if (widgetOptions.onToggle)
+					if (widgetOptions.onToggle) {
 						canToggle = widgetOptions.onToggle.call(this, widget, 'expand');
+					}
 					if (canToggle !== false) {
 						button.children().removeClass(toggleClass[1])
 										 .addClass(toggleClass[0]);
@@ -403,8 +461,9 @@
 							  });
 					}
 				} else {
-					if (widgetOptions.onToggle)
+					if (widgetOptions.onToggle) {
 						canToggle = widgetOptions.onToggle.call(this, widget, 'collapse');
+					}
 					if (canToggle !== false) {
 						button.children().removeClass(toggleClass[0])
 										 .addClass(toggleClass[1]);
@@ -441,9 +500,10 @@
 						  .parents(self.controls)
 						  .children('a')
 						  .show();
-					if (content.hasClass('ams-widget-visible'))
+					if (content.hasClass('ams-widget-visible')) {
 						content.hide()
 							   .removeClass('ams-widget-visible');
+					}
 				} else {
 					$('body').addClass('nooverflow');
 					widget.wrap('<div id="ams-widget-fullscreen-mode"></div>')
@@ -455,13 +515,15 @@
 						  .parents(self.controls)
 						  .children('a:not(.ams-widget-fullscreen-btn)')
 						  .hide();
-					if (content.is(':hidden'))
+					if (content.is(':hidden')) {
 						content.show()
 							   .addClass('ams-widget-visible');
+					}
 				}
 				setFullscreenHeight();
-				if (typeof(widgetOptions.onFullscreen) == 'function')
+				if (typeof(widgetOptions.onFullscreen) === 'function') {
 					widgetOptions.onFullscreen.call(this, widget);
+				}
 			});
 			$(window).resize(function() {
 				setFullscreenHeight();
@@ -489,8 +551,9 @@
 						  .addClass(editClass[1]);
 					placeholder.slideDown(widgetOptions.editSpeed);
 				}
-				if (typeof(widgetOptions.onEdit) == 'function')
+				if (typeof(widgetOptions.onEdit) === 'function') {
 					widgetOptions.onEdit.call(this, widget);
+				}
 			});
 			$(self.options.editPlaceholder).find('input').keyup(function() {
 				$(this).parents(self.options.widgets)
@@ -511,13 +574,15 @@
 					button.children()
 						  .removeClass(customClass[0])
 						  .addClass(customClass[1]);
-					if (typeof(widgetOptions.customStart) == 'function')
+					if (typeof(widgetOptions.customStart) === 'function') {
 						widgetOptions.customStart.call(this, widget);
+					}
 				} else {
 					button.children('.' + customClass[1])
-						  .addClass(customClass[0]);
-					if (typeof(widgetOptions.customEnd) == 'function')
+							.addClass(customClass[0]);
+					if (typeof(widgetOptions.customEnd) === 'function') {
 						widgetOptions.customEnd.call(this, widget);
+					}
 				}
 				self._saveWidgetSettings();
 			});
@@ -538,12 +603,13 @@
 											content: MyAMSWidget.i18n.DELETE_MSG,
 											buttons: "[" + MyAMS.i18n.BTN_OK + "][" + MyAMS.i18n.BTN_CANCEL + "]"
 										}, function(buttonPressed) {
-											if (buttonPressed == MyAMS.i18n.BTN_OK) {
+											if (buttonPressed === MyAMS.i18n.BTN_OK) {
 												self._runLoaderWidget(widget);
 												$('#' + wId).fadeOut(widgetOptions.deleteSpeed, function() {
 													button.remove();
-													if (typeof(widgetOptions.onDelete) == 'function')
+													if (typeof(widgetOptions.onDelete) === 'function') {
 														widgetOptions.onDelete.call(this, widget);
+													}
 												});
 											}
 										});
@@ -566,10 +632,10 @@
 				}, 1000);
 			});
 		}
-	}
+	};
 
 
-	MyAMSWidget = {
+	var MyAMSWidget = {
 
 		i18n: $.extend({
 			SETTINGS_KEY_LABEL: "Reset settings?",
@@ -589,8 +655,9 @@
 		}, MyAMS.plugins.i18n.widgets),
 
 		initWidgetsGrid: function(grid) {
-			if (!grid.exists())
+			if (!grid.exists()) {
 				return;
+			}
 			var options = $('.ams-widget:first', grid).data('AMSWidget').options;
 			if (options.sortable && $.ui) {
 				var sortItem = grid.find('.sortable-grid').not("[data-widget-excludegrid]");
@@ -611,14 +678,14 @@
 						var widget = ui.item.data('AMSWidget');
 						widget._runLoaderWidget(widget.widget);
 						widget._saveWidgetPosition();
-						if (typeof(options.onChange) == 'function')
+						if (typeof(options.onChange) === 'function') {
 							options.onChange.call(this, ui.item);
+						}
 					}
 				});
 			}
 		}
-	}
-
+	};
 
 	MyAMSWidget.defaults = {
 		grid: '.ams-widget-grid',
@@ -679,7 +746,9 @@
 		onChange : null,
 		onSave : null,
 		ajax_nav : MyAMS.ajax_nav
-	}
+	};
+
+	globals.MyAMSWidget = MyAMSWidget;
 
 
 	$.fn.extend({
@@ -750,4 +819,4 @@
 
 	});
 
-})(jQuery);
+})(jQuery, this);
--- a/src/ztfy/myams/resources/js/myams-widgets.min.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams-widgets.min.js	Tue Nov 17 12:05:38 2015 +0100
@@ -1,1 +1,1 @@
-(function(d){function b(e){if(e<10){e="0"+e}return e}function a(l,m){var e=new Date(l);var g=b(e.getMonth()+1);var i=b(e.getDate());var h=b(e.getFullYear());var j=b(e.getHours());var f=b(e.getMinutes());var k=b(e.getSeconds());return m.timestampFormat.replace(/%d%/g,i).replace(/%m%/g,g).replace(/%y%/g,h).replace(/%h%/g,hour).replace(/%i%/g,f).replace(/%s%/g,k)}function c(f,e){this.widget=f;this.options=d.extend({},MyAMSWidget.defaults,e);this.grid=this.widget.parents(this.options.grid);this.hasGrid=this.grid.exists();this.gridId=this.grid.attr("id");this.controls=this.options.controls;this.toggleClass=this.options.toggleClass.split("|");this.editClass=this.options.editClass.split("|");this.fullscreenClass=this.options.fullscreenClass.split("|");this.customClass=this.options.customClass.split("|");this.init()}c.prototype={init:function(){var m=this;if(m.options.rtl===true){d("body").addClass("rtl")}m.grid.each(function(){d(this).addClass("sortable-grid")});m._getSettings();if(m.hasGrid&&m.storage){if(m.position){var z=JSON.parse(m.position);for(var B in z.grid){var x=m.grid.find(m.options.subgrid+".sortable-grid").eq(B);for(var y in z.grid[B].section){x.append(d("#"+z.grid[B].section[y].id))}}}if(m.settings){var w=JSON.parse(m.settings);for(var B in w.widget){var g=w.widget[B];var v=d("#"+g.id);if(g.style){v.removeClassPrefix("ams-widget-color-").addClass(g.style).attr("data-widget-attstyle",g.style)}if(g.hidden==1){v.hide(1)}else{v.show(1).removeAttr("data-widget-hidden")}if(g.collapsed==1){v.addClass("ams-widget-collapsed").children("div").hide(1)}var C=v.children("header").children("h2");if(C.text()!=g.title){C.text(g.title)}}}}var g=m.widget;var A=g.data();var n={grid:A.amsWidgetGrid,subgrid:A.amsWudgetSubgrid,widgets:A.amsWidgetWidgets,controls:A.amsWidgetControls,storage:A.amsWidgetStorage,deleteSettingsKey:A.amsWidgetDeleteSettingsKey,deletePositionKey:A.amsWidgetDeletePositionKey,sortable:A.amsWidgetSortable,hiddenButtons:A.amsWidgetHiddenButtons,toggleButton:A.amsWidgetToggleButton,toggleClass:A.amsWidgetToggleClass,onToggle:MyAMS.getFunctionByName(A.amsWidgetToggleCallback),deleteButton:A.amsWidgetDeleteButton,deleteClass:A.amsWidgetDeleteClass,onDelete:MyAMS.getFunctionByName(A.amsWidgetDeleteCallback),editButton:A.amsWidgetEditButton,editPlaceholder:A.amsWidgetEditPlaceholder,editClass:A.amsWidgetEditClass,onEdit:MyAMS.getFunctionByName(A.amsWidgetEditCallback),fullscreenButton:A.amsWidgetFullscreenButton,fullscreenClass:A.amsWidgetFullscreenClass,fullscreenDiff:A.amsWidgetFullscreenDiff,onFullscreen:MyAMS.getFunctionByName(A.amsWidgetFullscreenCallback),customButton:A.amsWidgetCustomButton,customClass:A.amsWidgetCustomClass,customStart:MyAMS.getFunctionByName(A.amsWidgetCustomStartCallback),customEnd:MyAMS.getFunctionByName(A.amsWidgetCustomEndCallback),buttonsOrder:A.amsWidgetButtonsOrder,opacity:A.amsWidgetOpacity,dragHandle:A.amsWidgetDragHandle,placeholderClass:A.amsWidgetPlaceholderClass,indicator:A.amsWidgetIndicator,indicatorTime:A.amsWidgetIndicatorTime,ajax:A.amsWidgetAjax,timestampPlaceholder:A.amsWidgetTimestampPlaceholder,timestampFormat:A.amsWidgetTimestampFormat,refreshButton:A.amsWidgetRefreshButton,refreshClass:A.amsWidgetRefreshClass,errorLabel:A.amsWidgetErrorLabel,updatedLabel:A.amsWidgetUpdatedLabel,refreshLabel:A.amsWidgetRefreshLabel,deleteLabel:A.amsWidgetDeleteLabel,afterLoad:MyAMS.getFunctionByName(A.amsWidgetAfterLoadCallback),rtl:A.amsWidgetRtl,onChange:MyAMS.getFunctionByName(A.amsWidgetChangeCallback),onSave:MyAMS.getFunctionByName(A.amsWidgetSaveCallback),ajax_nav:MyAMS.ajax_nav};var u=d.extend({},m.options,n);var s=g.children("header");if(!s.parent().attr("role")){if(A.widgetHidden===true){g.hide()}if(A.widgetCollapsed===true){g.addClass("ams-widget-collapsed").children("div").hide()}if(u.customButton&&(A.widgetCustombutton===undefined)&&(m.customClass[0].length!=0)){var r='<a href="#" class="button-icon ams-widget-custom-btn"><i class="'+m.customClass[0]+'"></i></a>'}else{r=""}if(u.deleteButton&&(A.widgetDeleteButton===undefined)){var o='<a href="#" class="button-icon ams-widget-delete-btn hint" title="'+MyAMSWidget.i18n.DELETE_BTN+'" data-ams-hint-gravity="se"><i class="'+u.deleteClass+'"></i></a>'}else{o=""}if(u.editButton&&(A.widgetEditButton===undefined)){var h=u.editClass.split("|")[0];var j='<a href="#" class="button-icon ams-widget-edit-btn hint" title="'+MyAMSWidget.i18n.EDIT_BTN+'" data-ams-hint-gravity="se"><i class="'+h+'"></i></a>'}else{j=""}if(u.fullscreenButton&&(A.widgetFullscreenButton===undefined)){var k=u.fullscreenClass.split("|")[0];var f='<a href="#" class="button-icon ams-widget-fullscreen-btn hint" title="'+MyAMSWidget.i18n.FULLSCREEN_BTN+'" data-ams-hint-gravity="se"><i class="'+k+'"></i></a>'}else{f=""}if(u.toggleButton&&(A.widgetToggleButton===undefined)){var q=u.toggleClass.split("|");if((g.dataWidgetCollapsed===true)||g.hasClass("ams-widget-collapsed")){var e=q[1]}else{e=q[0]}var l='<a href="#" class="button-icon ams-widget-toggle-btn hint" title="'+MyAMSWidget.i18n.COLLAPSE_BTN+'" data-ams-hint-gravity="se"><i class="'+e+'"></i></a>'}else{l=""}if(u.refreshButton&&(A.widgetRefreshButton===undefined)&&A.widgetLoad){var p='<a href="#" class="button-icon ams-widget-refresh-btn hint" title="'+MyAMSWidget.i18n.REFRESH_BTN+'" data-loading-text="&nbsp;&nbsp;'+MyAMSWidget.i18n.LOADING_MSG+'&nbsp;" data-ams-hint-gravity="se"><i class="'+u.refreshClass+'"></i></a>'}else{p=""}var t=u.buttonsOrder.replace(/%refresh%/,p).replace(/%custom%/,r).replace(/%edit%/,j).replace(/%toggle%/,l).replace(/%fullscreen%/,f).replace(/%delete%/,o);if(p||r||j||l||f||o){s.prepend('<div class="ams-widget-ctrls">'+t+"</div>")}if(u.sortable&&(A.widgetSortable===undefined)){g.addClass("ams-widget-sortable")}var i=g.find(u.editPlaceholder);if(i.length>0){i.find("input").val(d.trim(s.children("h2").text()))}s.append('<span class="ams-widget-loader"><i class="fa fa-refresh fa-spin"></i></span>');g.attr("role","widget").children("div").attr("role","content").prev("header").attr("role","heading").children("div").attr("role","menu");MyAMS.plugins.enabled.hint(s)}g.data("widget-options",u);if(m.options.hiddenButtons){d(m.controls).hide()}g.find("[data-widget-load]").each(function(){var F=d(this),H=F.children(),G=F.data("widget-load"),E=F.data("widget-refresh")*1000,D=H;if(F.find(".ams-widget-ajax-placeholder").length<=0){F.children("widget-body").append('<div class="ams-widget-ajax-placeholder">'+m.options.loadingLabel+"</div>");if(E>0){m.loadAjaxFile(F,G,H);setInterval(function(){m._loadAjaxFile(F,G,H)},E)}else{m._loadAjaxFile(F,G,H)}}});if(m.options.hiddenButtons){m.widget.children("header").hover(function(){d(this).children(m.controls).stop(true,true).fadeTo(100,1)},function(){d(this).children(m.controls).stop(true,true).fadeTo(100,0)})}m._setClickEvents();d(m.options.deleteSettingsKey).on(m.clickEvent,this,function(E){if(m.storage){var D=confirm(m.options.settingsKeyLabel);if(D){m.storage.removeItem(m.settingsKey)}}E.preventDefault()});d(m.options.deletePositionKey).on(m.clickEvent,this,function(E){if(m.storage){var D=confirm(m.options.positionKeyLabel);if(D){m.storage.removeItem(m.positionKey)}}E.preventDefault()});if(m.storage){if(m.settingsKey===null||m.settingsKey.length<1){m._saveWidgetSettings()}if(m.positionKey===null||m.positionKey.length<1){m._saveWidgetPosition()}}m.grid.data("ams-widgets-loaded",true)},destroy:function(){var e=this;e.widgets.off("click",e._setClickEvents());e.element.removeData("AMSWidget")},_getSettings:function(){var f=this;if(!f.hasGrid||!f.gridId){f.storage=null}else{switch(f.options.storage){case"local":f.storage=localStorage;break;case"session":f.storage=sessionStorage;break;default:f.storage=null}}var e=(f.storage!=null)&&function(){var g,h=+new Date;try{f.storage.setItem(h,h);g=f.storage.getItem(h)==h;f.storage.removeItem(h);return g}catch(i){}}();if(e){f.settingsKey="AMS_settings_"+location.pathname+location.hash+"_"+f.gridId;f.settings=f.storage.getItem(f.settingsKey);f.positionKey="AMS_position_"+location.pathname+location.hash+"_"+f.gridId;f.position=f.storage.getItem(f.positionKey)}if(("ontouchstart" in window)||window.DocumentTouch&&document instanceof DocumentTouch){f.clickEvent="touchstart"}else{f.clickEvent="click"}},_runLoaderWidget:function(f){var e=this;if(e.options.indicator){f.find(".ams-widget-loader").stop(true,true).fadeIn(100).delay(e.options.indicatorTime).fadeOut(100)}},_loadAjaxFile:function(f,g,e){MyAMS.skin.loadURL(f,g.find(".widget-body"))},_saveWidgetSettings:function(){var f=this;f._getSettings();if(f.storage){var e=[];f.grid.find(f.options.widgets).each(function(){var i=d(this);var h={};h.id=i.attr("id");h.style=i.attr("data-widget-attstyle");h.title=i.children("header").children("h2").text();h.hidden=i.is(":hidden")?1:0;h.collapsed=i.hasClass("ams-widget-collapsed")?1:0;e.push(h)});var g=JSON.stringify({widget:e});if(f.settings!=g){f.storage.setItem(f.settingsKey,g)}if(typeof(f.options.onSave)=="function"){f.options.onSave.call(this,null,e)}}},_saveWidgetPosition:function(){var f=this;f._getSettings();if(f.storage){var g=[];f.grid.find(f.options.subgrid+".sortable-grid").each(function(){var h=[];d(this).children(f.options.widgets).each(function(){var j={};j.id=d(this).attr("id");h.push(j)});var i={section:h};g.push(i)});var e=JSON.stringify({grid:g});if(f.position!=e){f.storage.setItem(f.positionKey,e)}if(typeof(f.options.onSave)=="function"){f.options.onSave.call(this,null,g)}}},_setClickEvents:function(){function f(){if(d("#ams-widget-fullscreen-mode").length>0){var h=d("#ams-widget-fullscreen-mode").find(e.options.widgets);var i=d(window).height();var g=h.children("header").height();h.children("div").height(i-g-15)}}var e=this;e._getSettings();e.widget.on(e.clickEvent,".ams-widget-toggle-btn",function(k){k.preventDefault();var h=d(this);var i=h.parents(e.options.widgets);var l=i.data("widget-options");var g=l.toggleClass.split("|");e._runLoaderWidget(i);var j=true;if(i.hasClass("ams-widget-collapsed")){if(l.onToggle){j=l.onToggle.call(this,i,"expand")}if(j!==false){h.children().removeClass(g[1]).addClass(g[0]);i.removeClass("ams-widget-collapsed").children("[role=content]").slideDown(l.toggleSpeed,function(){e._saveWidgetSettings()})}}else{if(l.onToggle){j=l.onToggle.call(this,i,"collapse")}if(j!==false){h.children().removeClass(g[0]).addClass(g[1]);i.addClass("ams-widget-collapsed").children("[role=content]").slideUp(l.toggleSpeed,function(){e._saveWidgetSettings()})}}});e.widget.on("dblclick","header",function(g){d(".ams-widget-toggle-btn",this).click()});e.widget.on(e.clickEvent,".ams-widget-fullscreen-btn",function(k){k.preventDefault();var h=d(this);var j=h.parents(e.options.widgets);var l=j.data("widget-options");var g=l.fullscreenClass.split("|");var i=j.children("div");e._runLoaderWidget(j);if(d("#ams-widget-fullscreen-mode").length>0){d(".nooverflow").removeClass("nooverflow");j.unwrap("<div>").children("div").removeAttr("style").end().find(".ams-widget-fullscreen-btn").children().removeClass(g[1]).addClass(g[0]).parents(e.controls).children("a").show();if(i.hasClass("ams-widget-visible")){i.hide().removeClass("ams-widget-visible")}}else{d("body").addClass("nooverflow");j.wrap('<div id="ams-widget-fullscreen-mode"></div>').parent().find(".ams-widget-fullscreen-btn").children().removeClass(g[0]).addClass(g[1]).parents(e.controls).children("a:not(.ams-widget-fullscreen-btn)").hide();if(i.is(":hidden")){i.show().addClass("ams-widget-visible")}}f();if(typeof(l.onFullscreen)=="function"){l.onFullscreen.call(this,j)}});d(window).resize(function(){f()});e.widget.on(e.clickEvent,".ams-widget-edit-btn",function(j){j.preventDefault();var h=d(this);var i=h.parents(e.options.widgets);var l=i.data("widget-options");var g=l.editClass.split("|");e._runLoaderWidget(i);var k=i.find(l.editPlaceholder);if(k.is(":visible")){h.children().removeClass(g[1]).addClass(g[0]);k.slideUp(l.editSpeed,function(){e._saveWidgetSettings()})}else{h.children().removeClass(g[0]).addClass(g[1]);k.slideDown(l.editSpeed)}if(typeof(l.onEdit)=="function"){l.onEdit.call(this,i)}});d(e.options.editPlaceholder).find("input").keyup(function(){d(this).parents(e.options.widgets).children("header").children("h2").text(d(this).val())});e.widget.on(e.clickEvent,".ams-widget-custom-btn",function(j){j.preventDefault();var g=d(this);var i=g.parents(e.options.widgets);var k=i.data("widget-options");var h=k.customClass.split("|");e._runLoaderWidget(i);if(g.children("."+h[0]).length>0){g.children().removeClass(h[0]).addClass(h[1]);if(typeof(k.customStart)=="function"){k.customStart.call(this,i)}}else{g.children("."+h[1]).addClass(h[0]);if(typeof(k.customEnd)=="function"){k.customEnd.call(this,i)}}e._saveWidgetSettings()});e.widget.on(e.clickEvent,".ams-widget-delete-btn",function(i){i.preventDefault();var g=d(this);var h=g.parents(e.options.widgets);var l=h.data("widget-options");var k=h.attr("id");var j=h.children("header").children("h2").text();MyAMS.ajax.check(MyAMS.notify,MyAMS.baseURL+"myams-notify"+(MyAMS.devmode?".js":".min.js"),function(){MyAMS.notify.messageBox({title:'<i class="fa fa-times" style="color: #ed1c24;"></i> '+l.deleteLabel+' "'+j+'"',content:MyAMSWidget.i18n.DELETE_MSG,buttons:"["+MyAMS.i18n.BTN_OK+"]["+MyAMS.i18n.BTN_CANCEL+"]"},function(m){if(m==MyAMS.i18n.BTN_OK){e._runLoaderWidget(h);d("#"+k).fadeOut(l.deleteSpeed,function(){g.remove();if(typeof(l.onDelete)=="function"){l.onDelete.call(this,h)}})}})})});e.widget.on(e.clickEvent,".ams-widget-refresh-btn",function(k){k.preventDefault();var h=d(this);var i=h.parents(e.options.widgets);var j=i.data("widget-load");var g=i.children();h.button("loading");g.addClass("widget-body-ajax-loading");setTimeout(function(){h.button("reset");g.removeClass("widget-body-ajax-loading");e._loadAjaxFile(i,j,g)},1000)})}};MyAMSWidget={i18n:d.extend({SETTINGS_KEY_LABEL:"Reset settings?",POSITION_KEY_LABEL:"Reset position?",TIMESTAMP_FORMAT:"Last update: %d%/%m%/%y% %h%:%i%:%s",ERROR_LABEL:"An error occured: ",UPDATED_LABEL:"Last update: ",REFRESH_LABEL:"Refresh",EDIT_BTN:"Edit title",DELETE_BTN:"Delete",DELETE_LABEL:"Remove component: ",DELETE_MSG:"WARNING: this action can't be undone!",FULLSCREEN_BTN:"Fullscreen",COLLAPSE_BTN:"Collapse",REFRESH_BTN:"Reload content",LOADING_MSG:"Loading..."},MyAMS.plugins.i18n.widgets),initWidgetsGrid:function(f){if(!f.exists()){return}var e=d(".ams-widget:first",f).data("AMSWidget").options;if(e.sortable&&d.ui){var g=f.find(".sortable-grid").not("[data-widget-excludegrid]");g.sortable({items:g.find(".ams-widget-sortable"),connectWith:g,placeholder:e.placeholderClass,cursor:"move",revert:true,opacity:e.opacity,delay:200,cancel:".button-icon, #ams-widget-fullscreen-mode >div",zIndex:10000,handle:e.dragHandle,forcePlaceholderSize:true,forceHelperSize:true,update:function(h,j){var i=j.item.data("AMSWidget");i._runLoaderWidget(i.widget);i._saveWidgetPosition();if(typeof(e.onChange)=="function"){e.onChange.call(this,j.item)}}})}}};MyAMSWidget.defaults={grid:".ams-widget-grid",subgrid:"section",widgets:".ams-widget",controls:".ams-widget-ctrls",storage:"local",deleteSettingsKey:"",settingsKeyLabel:MyAMSWidget.i18n.SETTINGS_KEY_LABEL,deletePositionKey:"",positionKeyLabel:MyAMSWidget.i18n.POSITION_KEY_LABEL,sortable:true,hiddenButtons:false,toggleButton:true,toggleClass:"fa fa-minus|fa fa-plus",toggleSpeed:200,onToggle:null,deleteButton:false,deleteClass:"fa fa-times",deleteSpeed:200,onDelete:null,editButton:false,editPlaceholder:".ams-widget-editbox",editClass:"fa fa-cog|fa fa-save",editSpeed:200,onEdit:null,fullscreenButton:false,fullscreenClass:"fa fa-expand|fa fa-compress",fullscreenDiff:3,onFullscreen:null,customButton:false,customClass:"folder-10|next-10",customStart:null,customEnd:null,buttonsOrder:"%refresh% %custom% %edit% %toggle% %fullscreen% %delete%",opacity:1,dragHandle:"> header",placeholderClass:"ams-widget-placeholder",indicator:true,indicatorTime:600,ajax:true,timestampPlaceholder:".ams-widget-timestamp",timestampFormat:MyAMSWidget.i18n.TIMESTAMP_FORMAT,refreshButton:true,refreshButtonClass:"fa fa-refresh",errorLabel:MyAMSWidget.i18n.ERROR_LABEL,updatedLabel:MyAMSWidget.i18n.UPDATED_LABEL,refreshLabel:MyAMSWidget.i18n.REFRESH_LABEL,deleteLabel:MyAMSWidget.i18n.DELETE_LABEL,afterLoad:null,rtl:false,onChange:null,onSave:null,ajax_nav:MyAMS.ajax_nav};d.fn.extend({MyAMSWidget:function(e){return this.each(function(){var k=d(this);var j=k.data("AMSWidget");if(!j){var g=k.parents(e.grid||MyAMSWidget.defaults.grid);var i={};if(g.exists()){var f=g.data();i={grid:f.amsWidgetGrid,subgrid:f.amsWidgetSubgrid,controls:f.amsWidgetControls,storage:f.amsWidgetStorage,deleteSettingsKey:f.amsWidgetDeleteSettingsKey,deletePositionKey:f.amsWidgetDeletePositionKey,sortable:f.amsWidgetSortable,hiddenButtons:f.amsWidgetHiddenButtons,toggleButton:f.amsWidgetToggleButton,toggleClass:f.amsWidgetToggleClass,onToggle:MyAMS.getFunctionByName(f.amsWidgetToggleCallback),deleteButton:f.amsWidgetDeleteButton,deleteClass:f.amsWidgetDeleteClass,onDelete:MyAMS.getFunctionByName(f.amsWidgetDeleteCallback),editButton:f.amsWidgetEditButton,editPlaceholder:f.amsWidgetEditPlaceholder,editClass:f.amsWidgetEditClass,onEdit:MyAMS.getFunctionByName(f.amsWidgetEditCallback),fullscreenButton:f.amsWidgetFullscreenButton,fullscreenClass:f.amsWidgetFullscreenClass,fullscreenDiff:f.amsWidgetFullscreenDiff,onFullscreen:MyAMS.getFunctionByName(f.amsWidgetFullscreenCallback),customButton:f.amsWidgetCustomButton,customClass:f.amsWidgetCustomClass,customStart:MyAMS.getFunctionByName(f.amsWidgetCustomStartCallback),customEnd:MyAMS.getFunctionByName(f.amsWidgetCustomStartCallback),buttonsOrder:f.amsWidgetButtonsOrder,opacity:f.amsWidgetOpacity,dragHandle:f.amsWidgetDragHandle,placeholderClass:f.amsWidgetPlaceholderClass,indicator:f.amsWidgetIndicator,indicatorTime:f.amsWidgetIndicatorTime,ajax:f.amsWidgetAjax,timestampPlaceholder:f.amsWidgetTimestampPlaceholder,timestampFormat:f.amsWidgetTimestampFormat,refreshButton:f.amsWidgetRefreshButton,refreshClass:f.amsWidgetRefreshClass,errorLabel:f.amsWidgetErrorLabel,updatedLabel:f.amsWidgetUpdatedLabel,refreshLabel:f.amsWidgetRefreshLabel,deleteLabel:f.amsWidgetDeleteLabel,afterLoad:MyAMS.getFunctionByName(f.amsWidgetAfterLoadCallback),rtl:f.amsWidgetRtl,onChange:MyAMS.getFunctionByName(f.amsWidgetChangeCallback),onSave:MyAMS.getFunctionByName(f.amsWidgetSaveCallback),ajax_nav:MyAMS.ajax_nav}}var h=d.fn.extend({},i,k.data("ams-widget-options")||{},e);k.data("AMSWidget",new c(k,h))}})}})})(jQuery);
\ No newline at end of file
+(function(f,e){function c(h){if(h<10){h="0"+h}return h}function a(o,p){var h=new Date(o);var j=c(h.getMonth()+1);var l=c(h.getDate());var k=c(h.getFullYear());var m=c(h.getHours());var i=c(h.getMinutes());var n=c(h.getSeconds());return p.timestampFormat.replace(/%d%/g,l).replace(/%m%/g,j).replace(/%y%/g,k).replace(/%h%/g,m).replace(/%i%/g,i).replace(/%s%/g,n)}var g=e.MyAMS;function d(i,h){this.widget=i;this.options=f.extend({},b.defaults,h);this.grid=this.widget.parents(this.options.grid);this.hasGrid=this.grid.exists();this.gridId=this.grid.attr("id");this.controls=this.options.controls;this.toggleClass=this.options.toggleClass.split("|");this.editClass=this.options.editClass.split("|");this.fullscreenClass=this.options.fullscreenClass.split("|");this.customClass=this.options.customClass.split("|");this.init()}d.prototype={init:function(){var p=this;var j;if(p.options.rtl===true){f("body").addClass("rtl")}p.grid.each(function(){f(this).addClass("sortable-grid")});p._getSettings();if(p.hasGrid&&p.storage){var E;if(p.position){var C=JSON.parse(p.position);for(E in C.grid){if(!C.grid.hasOwnProperty(E)){continue}var A=p.grid.find(p.options.subgrid+".sortable-grid").eq(E);for(var B in C.grid[E].section){if(!C.grid[E].section.hasOwnProperty(B)){continue}A.append(f("#"+C.grid[E].section[B].id))}}}if(p.settings){var z=JSON.parse(p.settings);for(E in z.widget){if(!z.widget.hasOwnProperty(E)){continue}j=z.widget[E];var y=f("#"+j.id);if(j.style){y.removeClassPrefix("ams-widget-color-").addClass(j.style).attr("data-widget-attstyle",j.style)}if(j.hidden===1){y.hide(1)}else{y.show(1).removeAttr("data-widget-hidden")}if(j.collapsed===1){y.addClass("ams-widget-collapsed").children("div").hide(1)}var F=y.children("header").children("h2");if(F.text()!==j.title){F.text(j.title)}}}}j=p.widget;var D=j.data();var q={grid:D.amsWidgetGrid,subgrid:D.amsWudgetSubgrid,widgets:D.amsWidgetWidgets,controls:D.amsWidgetControls,storage:D.amsWidgetStorage,deleteSettingsKey:D.amsWidgetDeleteSettingsKey,deletePositionKey:D.amsWidgetDeletePositionKey,sortable:D.amsWidgetSortable,hiddenButtons:D.amsWidgetHiddenButtons,toggleButton:D.amsWidgetToggleButton,toggleClass:D.amsWidgetToggleClass,onToggle:g.getFunctionByName(D.amsWidgetToggleCallback),deleteButton:D.amsWidgetDeleteButton,deleteClass:D.amsWidgetDeleteClass,onDelete:g.getFunctionByName(D.amsWidgetDeleteCallback),editButton:D.amsWidgetEditButton,editPlaceholder:D.amsWidgetEditPlaceholder,editClass:D.amsWidgetEditClass,onEdit:g.getFunctionByName(D.amsWidgetEditCallback),fullscreenButton:D.amsWidgetFullscreenButton,fullscreenClass:D.amsWidgetFullscreenClass,fullscreenDiff:D.amsWidgetFullscreenDiff,onFullscreen:g.getFunctionByName(D.amsWidgetFullscreenCallback),customButton:D.amsWidgetCustomButton,customClass:D.amsWidgetCustomClass,customStart:g.getFunctionByName(D.amsWidgetCustomStartCallback),customEnd:g.getFunctionByName(D.amsWidgetCustomEndCallback),buttonsOrder:D.amsWidgetButtonsOrder,opacity:D.amsWidgetOpacity,dragHandle:D.amsWidgetDragHandle,placeholderClass:D.amsWidgetPlaceholderClass,indicator:D.amsWidgetIndicator,indicatorTime:D.amsWidgetIndicatorTime,ajax:D.amsWidgetAjax,timestampPlaceholder:D.amsWidgetTimestampPlaceholder,timestampFormat:D.amsWidgetTimestampFormat,refreshButton:D.amsWidgetRefreshButton,refreshClass:D.amsWidgetRefreshClass,errorLabel:D.amsWidgetErrorLabel,updatedLabel:D.amsWidgetUpdatedLabel,refreshLabel:D.amsWidgetRefreshLabel,deleteLabel:D.amsWidgetDeleteLabel,afterLoad:g.getFunctionByName(D.amsWidgetAfterLoadCallback),rtl:D.amsWidgetRtl,onChange:g.getFunctionByName(D.amsWidgetChangeCallback),onSave:g.getFunctionByName(D.amsWidgetSaveCallback),ajax_nav:g.ajax_nav};var x=f.extend({},p.options,q);var v=j.children("header");if(!v.parent().attr("role")){var u,r,m,i,o,t;if(D.widgetHidden===true){j.hide()}if(D.widgetCollapsed===true){j.addClass("ams-widget-collapsed").children("div").hide()}if(x.customButton&&(D.widgetCustombutton===undefined)&&(p.customClass[0].length!==0)){u='<a href="#" class="button-icon ams-widget-custom-btn"><i class="'+p.customClass[0]+'"></i></a>'}else{u=""}if(x.deleteButton&&(D.widgetDeleteButton===undefined)){r='<a href="#" class="button-icon ams-widget-delete-btn hint" title="'+b.i18n.DELETE_BTN+'" data-ams-hint-gravity="se"><i class="'+x.deleteClass+'"></i></a>'}else{r=""}if(x.editButton&&(D.widgetEditButton===undefined)){var k=x.editClass.split("|")[0];m='<a href="#" class="button-icon ams-widget-edit-btn hint" title="'+b.i18n.EDIT_BTN+'" data-ams-hint-gravity="se"><i class="'+k+'"></i></a>'}else{m=""}if(x.fullscreenButton&&(D.widgetFullscreenButton===undefined)){var n=x.fullscreenClass.split("|")[0];i='<a href="#" class="button-icon ams-widget-fullscreen-btn hint" title="'+b.i18n.FULLSCREEN_BTN+'" data-ams-hint-gravity="se"><i class="'+n+'"></i></a>'}else{i=""}if(x.toggleButton&&(D.widgetToggleButton===undefined)){var s=x.toggleClass.split("|");var h;if((j.dataWidgetCollapsed===true)||j.hasClass("ams-widget-collapsed")){h=s[1]}else{h=s[0]}o='<a href="#" class="button-icon ams-widget-toggle-btn hint" title="'+b.i18n.COLLAPSE_BTN+'" data-ams-hint-gravity="se"><i class="'+h+'"></i></a>'}else{o=""}if(x.refreshButton&&(D.widgetRefreshButton===undefined)&&D.widgetLoad){t='<a href="#" class="button-icon ams-widget-refresh-btn hint" title="'+b.i18n.REFRESH_BTN+'" data-loading-text="&nbsp;&nbsp;'+b.i18n.LOADING_MSG+'&nbsp;" data-ams-hint-gravity="se"><i class="'+x.refreshClass+'"></i></a>'}else{t=""}var w=x.buttonsOrder.replace(/%refresh%/,t).replace(/%custom%/,u).replace(/%edit%/,m).replace(/%toggle%/,o).replace(/%fullscreen%/,i).replace(/%delete%/,r);if(t||u||m||o||i||r){v.prepend('<div class="ams-widget-ctrls">'+w+"</div>")}if(x.sortable&&(D.widgetSortable===undefined)){j.addClass("ams-widget-sortable")}var l=j.find(x.editPlaceholder);if(l.length>0){l.find("input").val(f.trim(v.children("h2").text()))}v.append('<span class="ams-widget-loader"><i class="fa fa-refresh fa-spin"></i></span>');j.attr("role","widget").children("div").attr("role","content").prev("header").attr("role","heading").children("div").attr("role","menu");g.plugins.enabled.hint(v)}j.data("widget-options",x);if(p.options.hiddenButtons){f(p.controls).hide()}j.find("[data-widget-load]").each(function(){var I=f(this),K=I.children(),J=I.data("widget-load"),H=I.data("widget-refresh")*1000,G=K;if(I.find(".ams-widget-ajax-placeholder").length<=0){I.children("widget-body").append('<div class="ams-widget-ajax-placeholder">'+p.options.loadingLabel+"</div>");if(H>0){p.loadAjaxFile(I,J,K);setInterval(function(){p._loadAjaxFile(I,J,K)},H)}else{p._loadAjaxFile(I,J,K)}}});if(p.options.hiddenButtons){p.widget.children("header").hover(function(){f(this).children(p.controls).stop(true,true).fadeTo(100,1)},function(){f(this).children(p.controls).stop(true,true).fadeTo(100,0)})}p._setClickEvents();f(p.options.deleteSettingsKey).on(p.clickEvent,this,function(H){if(p.storage&&e.confirm){var G=e.confirm(p.options.settingsKeyLabel);if(G){p.storage.removeItem(p.settingsKey)}}H.preventDefault()});f(p.options.deletePositionKey).on(p.clickEvent,this,function(H){if(p.storage&&e.confirm){var G=e.confirm(p.options.positionKeyLabel);if(G){p.storage.removeItem(p.positionKey)}}H.preventDefault()});if(p.storage){if(p.settingsKey===null||p.settingsKey.length<1){p._saveWidgetSettings()}if(p.positionKey===null||p.positionKey.length<1){p._saveWidgetPosition()}}p.grid.data("ams-widgets-loaded",true)},destroy:function(){var h=this;h.widgets.off("click",h._setClickEvents());h.element.removeData("AMSWidget")},_getSettings:function(){var i=this;if(!i.hasGrid||!i.gridId){i.storage=null}else{switch(i.options.storage){case"local":i.storage=localStorage;break;case"session":i.storage=sessionStorage;break;default:i.storage=null}}var h=(i.storage!==null)&&function(){var j,k=+new Date();try{i.storage.setItem(k,k);j=i.storage.getItem(k)===k;i.storage.removeItem(k);return j}catch(l){}}();if(h){i.settingsKey="AMS_settings_"+location.pathname+location.hash+"_"+i.gridId;i.settings=i.storage.getItem(i.settingsKey);i.positionKey="AMS_position_"+location.pathname+location.hash+"_"+i.gridId;i.position=i.storage.getItem(i.positionKey)}if(("ontouchstart" in e)||e.DocumentTouch&&e.document instanceof e.DocumentTouch){i.clickEvent="touchstart"}else{i.clickEvent="click"}},_runLoaderWidget:function(i){var h=this;if(h.options.indicator){i.find(".ams-widget-loader").stop(true,true).fadeIn(100).delay(h.options.indicatorTime).fadeOut(100)}},_loadAjaxFile:function(i,j,h){g.skin.loadURL(i,j.find(".widget-body"))},_saveWidgetSettings:function(){var i=this;i._getSettings();if(i.storage){var h=[];i.grid.find(i.options.widgets).each(function(){var l=f(this);var k={};k.id=l.attr("id");k.style=l.attr("data-widget-attstyle");k.title=l.children("header").children("h2").text();k.hidden=l.is(":hidden")?1:0;k.collapsed=l.hasClass("ams-widget-collapsed")?1:0;h.push(k)});var j=JSON.stringify({widget:h});if(i.settings!==j){i.storage.setItem(i.settingsKey,j)}if(typeof(i.options.onSave)==="function"){i.options.onSave.call(this,null,h)}}},_saveWidgetPosition:function(){var i=this;i._getSettings();if(i.storage){var j=[];i.grid.find(i.options.subgrid+".sortable-grid").each(function(){var k=[];f(this).children(i.options.widgets).each(function(){var m={};m.id=f(this).attr("id");k.push(m)});var l={section:k};j.push(l)});var h=JSON.stringify({grid:j});if(i.position!==h){i.storage.setItem(i.positionKey,h)}if(typeof(i.options.onSave)==="function"){i.options.onSave.call(this,null,j)}}},_setClickEvents:function(){function i(){var l=f("#ams-widget-fullscreen-mode");if(l.length>0){var k=l.find(h.options.widgets);var m=f(window).height();var j=k.children("header").height();k.children("div").height(m-j-15)}}var h=this;h._getSettings();h.widget.on(h.clickEvent,".ams-widget-toggle-btn",function(n){n.preventDefault();var k=f(this);var l=k.parents(h.options.widgets).first();var o=l.data("widget-options");var j=o.toggleClass.split("|");h._runLoaderWidget(l);var m=true;if(l.hasClass("ams-widget-collapsed")){if(o.onToggle){m=o.onToggle.call(this,l,"expand")}if(m!==false){k.children().removeClass(j[1]).addClass(j[0]);l.removeClass("ams-widget-collapsed").children("[role=content]").slideDown(o.toggleSpeed,function(){h._saveWidgetSettings()})}}else{if(o.onToggle){m=o.onToggle.call(this,l,"collapse")}if(m!==false){k.children().removeClass(j[0]).addClass(j[1]);l.addClass("ams-widget-collapsed").children("[role=content]").slideUp(o.toggleSpeed,function(){h._saveWidgetSettings()})}}});h.widget.on("dblclick","header",function(j){f(".ams-widget-toggle-btn",this).click()});h.widget.on(h.clickEvent,".ams-widget-fullscreen-btn",function(n){n.preventDefault();var k=f(this);var m=k.parents(h.options.widgets);var o=m.data("widget-options");var j=o.fullscreenClass.split("|");var l=m.children("div");h._runLoaderWidget(m);if(f("#ams-widget-fullscreen-mode").length>0){f(".nooverflow").removeClass("nooverflow");m.unwrap("<div>").children("div").removeAttr("style").end().find(".ams-widget-fullscreen-btn").children().removeClass(j[1]).addClass(j[0]).parents(h.controls).children("a").show();if(l.hasClass("ams-widget-visible")){l.hide().removeClass("ams-widget-visible")}}else{f("body").addClass("nooverflow");m.wrap('<div id="ams-widget-fullscreen-mode"></div>').parent().find(".ams-widget-fullscreen-btn").children().removeClass(j[0]).addClass(j[1]).parents(h.controls).children("a:not(.ams-widget-fullscreen-btn)").hide();if(l.is(":hidden")){l.show().addClass("ams-widget-visible")}}i();if(typeof(o.onFullscreen)==="function"){o.onFullscreen.call(this,m)}});f(window).resize(function(){i()});h.widget.on(h.clickEvent,".ams-widget-edit-btn",function(m){m.preventDefault();var k=f(this);var l=k.parents(h.options.widgets);var o=l.data("widget-options");var j=o.editClass.split("|");h._runLoaderWidget(l);var n=l.find(o.editPlaceholder);if(n.is(":visible")){k.children().removeClass(j[1]).addClass(j[0]);n.slideUp(o.editSpeed,function(){h._saveWidgetSettings()})}else{k.children().removeClass(j[0]).addClass(j[1]);n.slideDown(o.editSpeed)}if(typeof(o.onEdit)==="function"){o.onEdit.call(this,l)}});f(h.options.editPlaceholder).find("input").keyup(function(){f(this).parents(h.options.widgets).children("header").children("h2").text(f(this).val())});h.widget.on(h.clickEvent,".ams-widget-custom-btn",function(m){m.preventDefault();var j=f(this);var l=j.parents(h.options.widgets);var n=l.data("widget-options");var k=n.customClass.split("|");h._runLoaderWidget(l);if(j.children("."+k[0]).length>0){j.children().removeClass(k[0]).addClass(k[1]);if(typeof(n.customStart)==="function"){n.customStart.call(this,l)}}else{j.children("."+k[1]).addClass(k[0]);if(typeof(n.customEnd)==="function"){n.customEnd.call(this,l)}}h._saveWidgetSettings()});h.widget.on(h.clickEvent,".ams-widget-delete-btn",function(l){l.preventDefault();var j=f(this);var k=j.parents(h.options.widgets);var o=k.data("widget-options");var n=k.attr("id");var m=k.children("header").children("h2").text();g.ajax.check(g.notify,g.baseURL+"myams-notify"+(g.devmode?".js":".min.js"),function(){g.notify.messageBox({title:'<i class="fa fa-times" style="color: #ed1c24;"></i> '+o.deleteLabel+' "'+m+'"',content:b.i18n.DELETE_MSG,buttons:"["+g.i18n.BTN_OK+"]["+g.i18n.BTN_CANCEL+"]"},function(p){if(p===g.i18n.BTN_OK){h._runLoaderWidget(k);f("#"+n).fadeOut(o.deleteSpeed,function(){j.remove();if(typeof(o.onDelete)==="function"){o.onDelete.call(this,k)}})}})})});h.widget.on(h.clickEvent,".ams-widget-refresh-btn",function(n){n.preventDefault();var k=f(this);var l=k.parents(h.options.widgets);var m=l.data("widget-load");var j=l.children();k.button("loading");j.addClass("widget-body-ajax-loading");setTimeout(function(){k.button("reset");j.removeClass("widget-body-ajax-loading");h._loadAjaxFile(l,m,j)},1000)})}};var b={i18n:f.extend({SETTINGS_KEY_LABEL:"Reset settings?",POSITION_KEY_LABEL:"Reset position?",TIMESTAMP_FORMAT:"Last update: %d%/%m%/%y% %h%:%i%:%s",ERROR_LABEL:"An error occured: ",UPDATED_LABEL:"Last update: ",REFRESH_LABEL:"Refresh",EDIT_BTN:"Edit title",DELETE_BTN:"Delete",DELETE_LABEL:"Remove component: ",DELETE_MSG:"WARNING: this action can't be undone!",FULLSCREEN_BTN:"Fullscreen",COLLAPSE_BTN:"Collapse",REFRESH_BTN:"Reload content",LOADING_MSG:"Loading..."},g.plugins.i18n.widgets),initWidgetsGrid:function(i){if(!i.exists()){return}var h=f(".ams-widget:first",i).data("AMSWidget").options;if(h.sortable&&f.ui){var j=i.find(".sortable-grid").not("[data-widget-excludegrid]");j.sortable({items:j.find(".ams-widget-sortable"),connectWith:j,placeholder:h.placeholderClass,cursor:"move",revert:true,opacity:h.opacity,delay:200,cancel:".button-icon, #ams-widget-fullscreen-mode >div",zIndex:10000,handle:h.dragHandle,forcePlaceholderSize:true,forceHelperSize:true,update:function(k,m){var l=m.item.data("AMSWidget");l._runLoaderWidget(l.widget);l._saveWidgetPosition();if(typeof(h.onChange)==="function"){h.onChange.call(this,m.item)}}})}}};b.defaults={grid:".ams-widget-grid",subgrid:"section",widgets:".ams-widget",controls:".ams-widget-ctrls",storage:"local",deleteSettingsKey:"",settingsKeyLabel:b.i18n.SETTINGS_KEY_LABEL,deletePositionKey:"",positionKeyLabel:b.i18n.POSITION_KEY_LABEL,sortable:true,hiddenButtons:false,toggleButton:true,toggleClass:"fa fa-minus|fa fa-plus",toggleSpeed:200,onToggle:null,deleteButton:false,deleteClass:"fa fa-times",deleteSpeed:200,onDelete:null,editButton:false,editPlaceholder:".ams-widget-editbox",editClass:"fa fa-cog|fa fa-save",editSpeed:200,onEdit:null,fullscreenButton:false,fullscreenClass:"fa fa-expand|fa fa-compress",fullscreenDiff:3,onFullscreen:null,customButton:false,customClass:"folder-10|next-10",customStart:null,customEnd:null,buttonsOrder:"%refresh% %custom% %edit% %toggle% %fullscreen% %delete%",opacity:1,dragHandle:"> header",placeholderClass:"ams-widget-placeholder",indicator:true,indicatorTime:600,ajax:true,timestampPlaceholder:".ams-widget-timestamp",timestampFormat:b.i18n.TIMESTAMP_FORMAT,refreshButton:true,refreshButtonClass:"fa fa-refresh",errorLabel:b.i18n.ERROR_LABEL,updatedLabel:b.i18n.UPDATED_LABEL,refreshLabel:b.i18n.REFRESH_LABEL,deleteLabel:b.i18n.DELETE_LABEL,afterLoad:null,rtl:false,onChange:null,onSave:null,ajax_nav:g.ajax_nav};e.MyAMSWidget=b;f.fn.extend({MyAMSWidget:function(h){return this.each(function(){var n=f(this);var m=n.data("AMSWidget");if(!m){var j=n.parents(h.grid||b.defaults.grid);var l={};if(j.exists()){var i=j.data();l={grid:i.amsWidgetGrid,subgrid:i.amsWidgetSubgrid,controls:i.amsWidgetControls,storage:i.amsWidgetStorage,deleteSettingsKey:i.amsWidgetDeleteSettingsKey,deletePositionKey:i.amsWidgetDeletePositionKey,sortable:i.amsWidgetSortable,hiddenButtons:i.amsWidgetHiddenButtons,toggleButton:i.amsWidgetToggleButton,toggleClass:i.amsWidgetToggleClass,onToggle:g.getFunctionByName(i.amsWidgetToggleCallback),deleteButton:i.amsWidgetDeleteButton,deleteClass:i.amsWidgetDeleteClass,onDelete:g.getFunctionByName(i.amsWidgetDeleteCallback),editButton:i.amsWidgetEditButton,editPlaceholder:i.amsWidgetEditPlaceholder,editClass:i.amsWidgetEditClass,onEdit:g.getFunctionByName(i.amsWidgetEditCallback),fullscreenButton:i.amsWidgetFullscreenButton,fullscreenClass:i.amsWidgetFullscreenClass,fullscreenDiff:i.amsWidgetFullscreenDiff,onFullscreen:g.getFunctionByName(i.amsWidgetFullscreenCallback),customButton:i.amsWidgetCustomButton,customClass:i.amsWidgetCustomClass,customStart:g.getFunctionByName(i.amsWidgetCustomStartCallback),customEnd:g.getFunctionByName(i.amsWidgetCustomStartCallback),buttonsOrder:i.amsWidgetButtonsOrder,opacity:i.amsWidgetOpacity,dragHandle:i.amsWidgetDragHandle,placeholderClass:i.amsWidgetPlaceholderClass,indicator:i.amsWidgetIndicator,indicatorTime:i.amsWidgetIndicatorTime,ajax:i.amsWidgetAjax,timestampPlaceholder:i.amsWidgetTimestampPlaceholder,timestampFormat:i.amsWidgetTimestampFormat,refreshButton:i.amsWidgetRefreshButton,refreshClass:i.amsWidgetRefreshClass,errorLabel:i.amsWidgetErrorLabel,updatedLabel:i.amsWidgetUpdatedLabel,refreshLabel:i.amsWidgetRefreshLabel,deleteLabel:i.amsWidgetDeleteLabel,afterLoad:g.getFunctionByName(i.amsWidgetAfterLoadCallback),rtl:i.amsWidgetRtl,onChange:g.getFunctionByName(i.amsWidgetChangeCallback),onSave:g.getFunctionByName(i.amsWidgetSaveCallback),ajax_nav:g.ajax_nav}}var k=f.fn.extend({},l,n.data("ams-widget-options")||{},h);n.data("AMSWidget",new d(n,k))}})}})})(jQuery,this);
\ No newline at end of file
--- a/src/ztfy/myams/resources/js/myams.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams.js	Tue Nov 17 12:05:38 2015 +0100
@@ -10,27 +10,29 @@
  * ©2014-2015 Thierry Florac <tflorac@ulthar.net>
  */
 
-(function($) {
+(function($, globals) {
+
+	"use strict";
 
 	/**
 	 * String prototype extensions
 	 */
 	String.prototype.startsWith = function(str) {
-		var slen = this.length;
-		var dlen = str.length;
+		var slen = this.length,
+			dlen = str.length;
 		if (slen < dlen) {
 			return false;
 		}
-		return (this.substr(0,dlen) == str);
+		return (this.substr(0,dlen) === str);
 	};
 
 	String.prototype.endsWith = function(str) {
-		var slen = this.length;
-		var dlen = str.length;
+		var slen = this.length,
+			dlen = str.length;
 		if (slen < dlen) {
 			return false;
 		}
-		return (this.substr(slen-dlen) == str);
+		return (this.substr(slen-dlen) === str);
 	};
 
 
@@ -38,18 +40,19 @@
 	 * Array prototype extensions
 	 */
 	if (!Array.prototype.indexOf) {
-		Array.prototype.indexOf = function(elt /*, from*/) {
+		Array.prototype.indexOf = function(elt, from) {
 			var len = this.length;
 
-			var from = Number(arguments[1]) || 0;
+			from = Number(from) || 0;
 			from = (from < 0) ? Math.ceil(from) : Math.floor(from);
-			if (from < 0)
+			if (from < 0) {
 				from += len;
+			}
 
 			for (; from < len; from++) {
-				if (from in this &&
-					this[from] === elt)
+				if (from in this && this[from] === elt) {
 					return from;
+				}
 			}
 			return -1;
 		};
@@ -61,7 +64,7 @@
 	 * Case insensitive contains expression
 	 */
 	$.expr[":"].econtains = function(obj, index, meta /*, stack*/) {
-		return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
+		return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() === meta[3].toLowerCase();
 	};
 
 
@@ -70,7 +73,7 @@
 	 * Case sensitive exact search expression
 	 */
 	$.expr[":"].withtext = function(obj, index, meta /*, stack*/) {
-		return (obj.textContent || obj.innerText || $(obj).text() || "") == meta[3];
+		return (obj.textContent || obj.innerText || $(obj).text() || "") === meta[3];
 	};
 
 
@@ -114,10 +117,11 @@
 		 * otherwise looks for parents
 		 */
 		objectOrParentWithClass: function(klass) {
-			if (this.hasClass(klass))
+			if (this.hasClass(klass)) {
 				return this;
-			else
+			} else {
 				return this.parents('.' + klass);
+			}
 		},
 
 		/*
@@ -139,16 +143,16 @@
 			// DOM node
 			var node = this.get(0);
 			// Ensure we have a DOM node
-			if (typeof node == 'undefined') {
+			if (typeof(node) === 'undefined') {
 				return;
 			}
 			// CSSStyleDeclaration
 			var style = this.get(0).style;
 			// Getter/Setter
-			if (typeof styleName != 'undefined') {
-				if (typeof value != 'undefined') {
+			if (typeof(styleName) !== 'undefined') {
+				if (typeof(value) !== 'undefined') {
 					// Set style property
-					priority = typeof priority != 'undefined' ? priority : '';
+					priority = typeof(priority) !== 'undefined' ? priority : '';
 					style.setProperty(styleName, value, priority);
 					return this;
 				} else {
@@ -167,9 +171,9 @@
 		removeClassPrefix: function (prefix) {
 			this.each(function (i, it) {
 				var classes = it.className.split(" ").map(function(item) {
-					return item.startsWith(prefix) ? "" : item
+					return item.startsWith(prefix) ? "" : item;
 				});
-				it.className = $.trim(classes.join(" "))
+				it.className = $.trim(classes.join(" "));
 			});
 			return this;
 		},
@@ -184,8 +188,9 @@
 					menu = $(settings.menuSelector)[direction](),
 					position = mouse;
 				// opening menu would pass the side of the page
-				if (mouse + menu > win && menu < mouse)
+				if (mouse + menu > win && menu < mouse) {
 					position -= menu;
+				}
 				return position;
 			}
 
@@ -197,8 +202,9 @@
 				});
 				$(this).on("contextmenu", function (e) {
 					// return native menu if pressing control
-					if (e.ctrlKey)
+					if (e.ctrlKey) {
 						return;
+					}
 					//open menu
 					$(settings.menuSelector).data("invokedOn", $(e.target))
 											.show()
@@ -252,7 +258,7 @@
 
 					// 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') == "#") {
+					if (first_link.attr('href') === "#") {
 						first_link.click(function() {
 							return false;
 						});
@@ -266,7 +272,7 @@
 				var active_item = active_parent.parent('LI');
 				active_parent.slideDown(settings.speed);
 				active_item.find("b:first").html(settings.openedSign);
-				active_item.addClass("open")
+				active_item.addClass("open");
 			});
 
 			menu.find("LI A").on('click', function() {
@@ -278,13 +284,13 @@
 					visible.each(function(visibleIndex) {
 						var close = true;
 						parents.each(function(parentIndex) {
-							if (parents[parentIndex] == visible[visibleIndex]) {
+							if (parents[parentIndex] === visible[visibleIndex]) {
 								close = false;
 								return false;
 							}
 						});
 						if (close) {
-							if (parent_ul != visible[visibleIndex]) {
+							if (parent_ul !== visible[visibleIndex]) {
 								$(visible[visibleIndex]).slideUp(settings.speed, function() {
 									link.parent("LI")
 										.find("b:first")
@@ -307,7 +313,7 @@
 							.delay(settings.speed)
 							.html(settings.closedSign);
 					});
-				} else /*if (link.attr('href') != location.hash)*/ {
+				} else /*if (link.attr('href') !== location.hash)*/ {
 					first_ul.slideDown(settings.speed, function() {
 						link.parent("LI")
 							.addClass("open")
@@ -388,8 +394,8 @@
 	/**
 	 * MyAMS extensions to JQuery
 	 */
-	if (window.MyAMS === undefined) {
-		window.MyAMS = {
+	if (globals.MyAMS === undefined) {
+		globals.MyAMS = {
 			devmode: true,
 			devext: '',
 			lang: 'en',
@@ -404,6 +410,7 @@
 			ismobile: (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))
 		};
 	}
+	var MyAMS = globals.MyAMS;
 	var ams = MyAMS;
 
 	/**
@@ -424,16 +431,18 @@
 	 */
 	MyAMS.getQueryVar = function(src, varName) {
 		// Check src
-		if (src.indexOf('?') < 0)
+		if (src.indexOf('?') < 0) {
 			return false;
-		if (!src.endsWith('&'))
+		}
+		if (!src.endsWith('&')) {
 			src += '&';
+		}
 		// Dynamic replacement RegExp
 		var regex = new RegExp('.*?[&\\?]' + varName + '=(.*?)&.*');
 		// Apply RegExp to the query string
 		var val = src.replace(regex, "$1");
 		// If the string is the same, we didn't find a match - return false
-		return val == src ? false : val;
+		return val === src ? false : val;
 	};
 
 
@@ -442,7 +451,7 @@
 	 */
 	MyAMS.rgb2hex = function(color) {
 		return "#" + $.map(color.match(/\b(\d+)\b/g), function(digit) {
-			return ('0' + parseInt(digit).toString(16)).slice(-2)
+			return ('0' + parseInt(digit).toString(16)).slice(-2);
 		}).join('');
 	};
 
@@ -465,10 +474,11 @@
 	 * Small piece of code by Jason Bunting
 	 */
 	MyAMS.getFunctionByName = function(functionName, context) {
-		if (functionName === undefined)
+		if (functionName === undefined) {
 			return undefined;
-		else if (typeof(functionName) == 'function')
+		} else if (typeof(functionName) === 'function') {
 			return functionName;
+		}
 		var namespaces = functionName.split(".");
 		var func = namespaces.pop();
 		context = (context === undefined || context === null) ? window : context;
@@ -488,7 +498,7 @@
 
 	MyAMS.executeFunctionByName = function(functionName, context /*, args */) {
 		var func = ams.getFunctionByName(functionName, window);
-		if (typeof(func) == 'function') {
+		if (typeof(func) === 'function') {
 			var args = Array.prototype.slice.call(arguments, 2);
 			return func.apply(context, args);
 		}
@@ -513,7 +523,7 @@
 			success: callback,
 			error: ams.error.show,
 			cache: !ams.devmode,
-			async: typeof(callback) == 'function'
+			async: typeof(callback) === 'function'
 		};
 		var settings = $.extend({}, defaults, options);
 		return $.ajax(settings);
@@ -522,10 +532,11 @@
 	MyAMS.getCSS = function(url, id) {
 		var head = $('HEAD');
 		var css = $('link[data-ams-id="' + id + '"]', head);
-		if (css.length == 0) {
+		if (css.length === 0) {
 			var source = ams.getSource(url);
-			if (ams.devmode)
+			if (ams.devmode) {
 				source += '?_=' + new Date().getTime();
+			}
 			$('<link />').attr({rel: 'stylesheet',
 								type: 'text/css',
 								href: source,
@@ -564,11 +575,12 @@
 
 		getInternetExplorerVersion: function() {
 			var rv = -1;
-			if (navigator.appName == "Microsoft Internet Explorer") {
+			if (navigator.appName === "Microsoft Internet Explorer") {
 				var ua = navigator.userAgent;
 				var re = new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");
-				if (re.exec(ua) != null)
+				if (re.exec(ua) !== null) {
 					rv = parseFloat(RegExp.$1);
+				}
 			}
 			return rv;
 		},
@@ -577,22 +589,26 @@
 			var msg = "You're not using Windows Internet Explorer.";
 			var ver = this.getInternetExplorerVersion();
 			if (ver > -1) {
-				if (ver >= 8)
+				if (ver >= 8) {
 					msg = "You're using a recent copy of Windows Internet Explorer.";
-				else
+				} else {
 					msg = "You should upgrade your copy of Windows Internet Explorer.";
+				}
 			}
-			alert(msg);
+			if (globals.alert) {
+				globals.alert(msg);
+			}
 		},
 
 		isIE8orlower: function() {
 			var msg = "0";
 			var ver = this.getInternetExplorerVersion();
 			if (ver > -1) {
-				if (ver >= 9)
+				if (ver >= 9) {
 					msg = 0;
-				else
+				} else {
 					msg = 1;
+				}
 			}
 			return msg;
 		},
@@ -601,8 +617,10 @@
 			return function() {
 				var source = $(this);
 				source.parents('.btn-group').removeClass('open');
-				window.prompt(MyAMS.i18n.CLIPBOARD_COPY, source.text());
-			}
+				if (globals.prompt) {
+					globals.prompt(MyAMS.i18n.CLIPBOARD_COPY, source.text());
+				}
+			};
 		}
 	};
 
@@ -616,10 +634,11 @@
 		 * Default JQuery AJAX error handler
 		 */
 		ajax: function(event, request /*, settings*/) {
-			if (request.statusText == 'OK')
+			if (request.statusText === 'OK') {
 				return;
+			}
 			var response = ams.ajax.getResponse(request);
-			if (response.content_type == 'json') {
+			if (response.content_type === 'json') {
 				ams.ajax.handleJSON(response.data);
 			} else {
 				var title = event.statusText || event.type;
@@ -631,9 +650,9 @@
 					timeout: 10000
 				});
 			}
-			if (window.console) {
-				console.error(event);
-				console.debug(request);
+			if (globals.console) {
+				globals.console.error(event);
+				globals.console.debug(request);
 			}
 		},
 
@@ -641,10 +660,11 @@
 		 * Show AJAX error
 		 */
 		show: function(request, status, error) {
-			if (!error)
+			if (!error) {
 				return;
+			}
 			var response = ams.ajax.getResponse(request);
-			if (response.content_type == 'json') {
+			if (response.content_type === 'json') {
 				ams.ajax.handleJSON(response.data);
 			} else {
 				ams.skin.messageBox('error', {
@@ -654,9 +674,9 @@
 					timeout: 10000
 				});
 			}
-			if (window.console) {
-				console.error(error);
-				console.debug(request);
+			if (globals.console) {
+				globals.console.error(error);
+				globals.console.debug(request);
 			}
 		}
 	};
@@ -678,22 +698,24 @@
 		 * @options: callback options
 		 */
 		check: function(checker, source, callback, options) {
-			if (typeof(callback) == 'object') {
+			if (typeof(callback) === 'object') {
 				options = callback;
 				callback = undefined;
 			}
 			var defaults = {
-				async: typeof(callback) == 'function'
+				async: typeof(callback) === 'function'
 			};
 			var settings = $.extend({}, defaults, options);
 			if (checker === undefined) {
 				ams.getScript(source, function() {
-					if (typeof(callback) == 'function')
+					if (typeof(callback) === 'function') {
 						callback(true, options);
+					}
 				}, settings);
 			} else {
-				if (typeof(callback) == 'function')
+				if (typeof(callback) === 'function') {
 					callback(false, options);
+				}
 			}
 		},
 
@@ -727,39 +749,47 @@
 		 * @param options: AJAX options
 		 */
 		progress: function(event) {
-			if (!event.lengthComputable)
+			if (!event.lengthComputable) {
+				return;
+			}
+			if (event.loaded >= event.total) {
 				return;
-			if (event.loaded >= event.total)
-				return;
-			console.log(parseInt((event.loaded / event.total * 100), 10) + "%");
+			}
+			if (globals.console) {
+				globals.console.log(parseInt((event.loaded / event.total * 100), 10) + "%");
+			}
 		},
 
 		/**
 		 * Post data to given URL
 		 */
 		post: function(url, data, options, callback) {
-			if (url.startsWith(window.location.protocol))
-				var addr = url;
-			else
+			var addr;
+			if (url.startsWith(window.location.protocol)) {
+				addr = url;
+			} else {
 				addr = this.getAddr() + url;
-			if (typeof(options) == 'function') {
+			}
+			if (typeof(options) === 'function') {
 				callback = options;
-				options = {}
+				options = {};
 			} else if (!options) {
 				options = {};
 			}
-			if (typeof(callback) == 'undefined')
+			if (typeof(callback) === 'undefined') {
 				callback = options.callback;
-			if (typeof(callback) == 'string')
+			}
+			if (typeof(callback) === 'string') {
 				callback = ams.getFunctionByName(callback);
+			}
 			delete options.callback;
 
-			var result = undefined;
+			var result;
 			var defaults = {
 				url: addr,
 				type: 'post',
 				cache: false,
-				async: typeof(callback) == 'function',
+				async: typeof(callback) === 'function',
 				data: $.param(data),
 				dataType: 'json',
 				success: callback || function(data /*, status*/) {
@@ -792,9 +822,9 @@
 					result = request.responseText;
 				} else {
 					result = request.responseJSON;
-					if (result)
+					if (result) {
 						data_type = 'json';
-					else {
+					} else {
 						try {
 							result = JSON.parse(request.responseText);
 							data_type = 'json';
@@ -844,15 +874,18 @@
 			var url;
 			switch (status) {
 				case 'alert':
-					alert(result.alert.title + '\n\n' + result.alert.content);
+					if (globals.alert) {
+						globals.alert(result.alert.title + '\n\n' + result.alert.content);
+					}
 					break;
 				case 'error':
 					ams.form.showErrors(form, result);
 					break;
 				case 'info':
 				case 'success':
-					if (result.close_form != false)
+					if (result.close_form !== false) {
 						ams.dialog.close(form);
+					}
 					break;
 				case 'message':
 				case 'messagebox':
@@ -860,28 +893,32 @@
 				case 'notify':
 				case 'callback':
 				case 'callbacks':
-					if (result.close_form != false)
+					if (result.close_form !== false) {
 						ams.dialog.close(form);
+					}
 					break;
 				case 'modal':
 					ams.dialog.open(result.location);
 					break;
 				case 'reload':
-					if (result.close_form != false)
+					if (result.close_form !== false) {
 						ams.dialog.close(form);
+					}
 					url = result.location || window.location.hash;
-					if (url.startsWith('#'))
+					if (url.startsWith('#')) {
 						url = url.substr(1);
+					}
 					ams.skin.loadURL(url, result.target || target || '#content');
 					break;
 				case 'redirect':
-					if (result.close_form == true)
+					if (result.close_form === true) {
 						ams.dialog.close(form);
+					}
 					url = result.location || window.location.href;
 					if (result.window) {
 						window.open(url, result.window, result.options);
 					} else {
-						if (window.location.href == url) {
+						if (window.location.href === url) {
 							window.location.reload(true);
 						} else {
 							window.location.href = url;
@@ -889,52 +926,65 @@
 					}
 					break;
 				default:
-					console.log("Unhandled status: " + status);
-					break;
+					if (globals.console) {
+						globals.console.log("Unhandled status: " + status);
+					}
 			}
+
+			var index;
+			var content;
+			var container;
 			if (result.content) {
-				var content = result.content;
-				var container = $(content.target || target || form || '#content');
-				if (content.raw == true) {
+				content = result.content;
+				container = $(content.target || target || form || '#content');
+				if (content.raw === true) {
 					container.text(content.text);
 				} else {
 					container.html(content.html);
 					ams.initContent(container);
 				}
-				if (!content.keep_hidden)
+				if (!content.keep_hidden) {
 					container.removeClass('hidden');
+				}
 			}
 			if (result.contents) {
 				var contents = result.contents;
-				for (var index in contents) {
+				for (index=0; index < contents.length; index++) {
 					content = contents[index];
 					container = $(content.target);
-					if (content.raw == true) {
+					if (content.raw === true) {
 						container.text(content.text);
 					} else {
 						container.html(content.html);
 						ams.initContent(container);
 					}
-					if (!content.keep_hidden)
+					if (!content.keep_hidden) {
 						container.removeClass('hidden');
+					}
 				}
 			}
+
+			var message;
 			if (result.message) {
-				var message = result.message;
-				if (typeof(message) == 'string') {
-					if ((status == 'info') || (status == 'success'))
+				message = result.message;
+				if (typeof(message) === 'string') {
+					if ((status === 'info') || (status === 'success')) {
 						ams.skin.smallBox(status,
-										  {title: message,
-										   icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
-										   timeout: 3000});
-					else
+										  {
+											  title: message,
+											  icon: 'fa fa-fw fa-info-circle font-xs align-top margin-top-10',
+											  timeout: 3000
+										  });
+					} else {
 						ams.skin.alert($(form || '#content'), status, message);
-				} else
+					}
+				} else {
 					ams.skin.alert($(message.target || target || form || '#content'),
 								   message.status || 'success',
 								   message.header,
 								   message.body,
 								   message.subtitle);
+				}
 			}
 			if (result.smallbox) {
 				ams.skin.smallBox(result.smallbox_status || status,
@@ -944,32 +994,36 @@
 			}
 			if (result.messagebox) {
 				message = result.messagebox;
-				if (typeof(message) == 'string')
+				if (typeof(message) === 'string') {
 					ams.skin.messageBox('info',
-										{title: ams.i18n.ERROR_OCCURED,
-										 content: message,
-										 timeout: 10000});
-				else {
+										{
+											title: ams.i18n.ERROR_OCCURED,
+											content: message,
+											timeout: 10000
+										});
+				} else {
 					var message_status = message.status || 'info';
-					if (message_status == 'error' && form && target)
+					if (message_status === 'error' && form && target) {
 						ams.executeFunctionByName(form.data('ams-form-submit-error') || 'MyAMS.form.finalizeSubmitOnError', form, target);
+					}
 					ams.skin.messageBox(message_status,
 										{title: message.title || ams.i18n.ERROR_OCCURED,
 										 content: message.content,
 										 icon: message.icon,
 										 number: message.number,
-										 timeout: message.timeout == null ? undefined : (message.timeout || 10000)});
+										 timeout: message.timeout === null ? undefined : (message.timeout || 10000)});
 				}
 			}
-			if (result.event)
+			if (result.event) {
 				form.trigger(result.event, result.event_options);
-			if (result.callback)
+			}
+			if (result.callback) {
 				ams.executeFunctionByName(result.callback, form, result.options);
+			}
 			if (result.callbacks) {
-				for (index in result.callbacks) {
-					if (!$.isNumeric(index))
-						continue;
-					var callback = result.callbacks[index];
+				var callback;
+				for (index=0; index < result.callbacks.length; index++) {
+					callback = result.callbacks[index];
 					ams.executeFunctionByName(callback, form, callback.options);
 				}
 			}
@@ -1005,33 +1059,37 @@
 			ams.ajax.check($.jsonRpc,
 						   ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
 						   function() {
-								var result;
-								if (typeof(options) == 'function') {
+								if (typeof(options) === 'function') {
 									callback = options;
 									options = {};
 								}
-								else if (!options)
+								else if (!options) {
 									options = {};
-								if (typeof(callback) == 'undefined')
+								}
+								if (callback === 'undefined') {
 									callback = options.callback;
-								if (typeof(callback) == 'string')
+								}
+								if (typeof(callback) === 'string') {
 									callback = ams.getFunctionByName(callback);
+								}
 								delete options.callback;
 
 								var params = {};
-								if (typeof(query) == 'string')
-									params['query'] = query;
-								else if (typeof(query) == 'object')
+								if (typeof(query) === 'string') {
+									params.query = query;
+								} else if (typeof(query) === 'object') {
 									$.extend(params, query);
+								}
 								$.extend(params, options);
 
+								var result;
 								var settings = {
 									url: ams.jsonrpc.getAddr(options.url),
 									type: 'post',
 									cache: false,
 									method: method,
 									params: params,
-									async: typeof(callback) == 'function',
+									async: typeof(callback) === 'function',
 									success: callback || function(data /*, status*/) {
 										result = data.result;
 									},
@@ -1054,17 +1112,19 @@
 			ams.ajax.check($.jsonRpc,
 						   ams.baseURL + 'ext/jquery-jsonrpc' + ams.devext + '.js',
 						   function() {
-								var result;
-								if (typeof(options) == 'function') {
+								if (typeof(options) === 'function') {
 									callback = options;
 									options = {};
 								}
-								else if (!options)
+								else if (!options) {
 									options = {};
-								if (typeof(callback) == 'undefined')
+								}
+								if (typeof(callback) === 'undefined') {
 									callback = options.callback;
-								if (typeof(callback) == 'string')
+								}
+								if (typeof(callback) === 'string') {
 									callback = ams.getFunctionByName(callback);
+								}
 								delete options.callback;
 
 								var result;
@@ -1074,7 +1134,7 @@
 									cache: false,
 									method: method,
 									params: data,
-									async: typeof(callback) == 'function',
+									async: typeof(callback) === 'function',
 									success: callback || function(data /*, status*/) {
 										result = data.result;
 									},
@@ -1115,19 +1175,22 @@
 			ams.ajax.check($.xmlrpc,
 						   ams.baseURL + 'ext/jquery-xmlrpc' + ams.devext + '.js',
 						   function() {
-								var result;
-								if (typeof(options) == 'function') {
+								if (typeof(options) === 'function') {
 									callback = options;
 									options = {};
 								}
-								else if (!options)
+								else if (!options) {
 									options = {};
-								if (typeof(callback) == 'undefined')
+								}
+								if (typeof(callback) === 'undefined') {
 									callback = options.callback;
-								if (typeof(callback) == 'string')
+								}
+								if (typeof(callback) === 'string') {
 									callback = ams.getFunctionByName(callback);
+								}
 								delete options.callback;
 
+								var result;
 								var defaults = {
 									url: ams.xmlrpc.getAddr(url),
 									methodName: method,
@@ -1157,10 +1220,12 @@
 		 */
 		init: function(element) {
 			// Activate form changes if required
-			if (ams.warn_on_form_change)
-				var forms = $('FORM[data-ams-warn-on-change!="false"]', element);
-			else
+			var forms;
+			if (ams.warn_on_form_change) {
+				forms = $('FORM[data-ams-warn-on-change!="false"]', element);
+			} else {
 				forms = $('FORM[data-ams-warn-on-change="true"]', element);
+			}
 			forms.each(function() {
 				var form = $(this);
 				$('INPUT[type="text"], ' +
@@ -1197,7 +1262,7 @@
 		 * Check for modified forms before loading new inner content
 		 */
 		confirmChangedForm: function(element, callback) {
-			if (typeof(element) == 'function') {
+			if (typeof(element) === 'function') {
 				callback = element;
 				element = undefined;
 			}
@@ -1208,8 +1273,9 @@
 					content: '<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; ' + ams.i18n.FORM_CHANGED_WARNING,
 					buttons: ams.i18n.BTN_OK_CANCEL
 				}, function(button) {
-					if (button == ams.i18n.BTN_OK)
+					if (button === ams.i18n.BTN_OK) {
 						callback.call(element);
+					}
 				});
 			} else {
 				callback.call(element);
@@ -1222,9 +1288,10 @@
 		submit: function(form, handler, submit_options) {
 			// Check params
 			form = $(form);
-			if (!form.exists())
+			if (!form.exists()) {
 				return false;
-			if (typeof(handler) == 'object') {
+			}
+			if (typeof(handler) === 'object') {
 				submit_options = handler;
 				handler = undefined;
 			}
@@ -1241,15 +1308,17 @@
 				return false;
 			}
 			// Check submit validators
-			if (!ams.form._checkSubmitValidators(form))
+			if (!ams.form._checkSubmitValidators(form)) {
 				return false;
+			}
 			// Remove remaining status messages
-			$('.alert, SPAN.state-error', form).remove();
+			$('.alert-danger, SPAN.state-error', form).remove();
 			$('.state-error', form).removeClassPrefix('state-');
 			// Check submit button
 			var button = $(form.data('ams-submit-button'));
-			if (button && !button.data('ams-form-hide-loading'))
+			if (button && !button.data('ams-form-hide-loading')) {
 				button.button('loading');
+			}
 			ams.ajax.check($.fn.ajaxSubmit,
 						   ams.baseURL + 'ext/jquery-form-3.49' + ams.devext + '.js',
 						   function() {
@@ -1259,23 +1328,29 @@
 									var button;
 									var data = form.data();
 									var form_options = data.amsFormOptions;
-
-									if (submit_options)
-										var form_data_callback = submit_options.formDataInitCallback;
-									if (form_data_callback)
+									var form_data;
+									var form_data_callback;
+
+									if (submit_options) {
+										form_data_callback = submit_options.formDataInitCallback;
+									}
+									if (form_data_callback) {
 										delete submit_options.formDataInitCallback;
-									else
+									} else {
 										form_data_callback = data.amsFormDataInitCallback;
+									}
 									if (form_data_callback) {
 										var veto = {};
-										if (typeof(form_data_callback) == 'function')
-											var form_data = form_data_callback.call(form, veto);
-										else
+										if (typeof(form_data_callback) === 'function') {
+											form_data = form_data_callback.call(form, veto);
+										} else {
 											form_data = ams.executeFunctionByName(form_data_callback, form, veto);
+										}
 										if (veto.veto) {
 											button = form.data('ams-submit-button');
-											if (button)
+											if (button) {
 												button.button('reset');
+											}
 											ams.form.finalizeSubmitFooter.call(form);
 											return false;
 										}
@@ -1291,32 +1366,43 @@
 										buttonTarget = button.data('ams-form-submit-target');
 									}
 
+									var url;
 									var form_handler = handler || buttonHandler || data.amsFormHandler || '';
 									if (form_handler.startsWith(window.location.protocol)) {
-										var url = form_handler;
+										url = form_handler;
 									} else {
 										var action = form.attr('action').replace(/#/, '');
-										if (action.startsWith(window.location.protocol))
+										if (action.startsWith(window.location.protocol)) {
 											url = action;
-										else
+										} else {
 											url = ams.ajax.getAddr() + action;
+										}
 										url += form_handler;
 									}
 
 									var target = null;
-									if (data.amsFormInitSubmitTarget) {
-										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);
-
-									var hasUpload = typeof(options.uuid) != 'undefined';
+									if (submit_options && submit_options.initSubmitTarget) {
+										ams.executeFunctionByName(submit_options.initSubmitTarget);
+									} else {
+										if (data.amsFormInitSubmitTarget) {
+											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);
+										}
+									}
+
+									var hasUpload = typeof(options.uuid) !== 'undefined';
 									if (hasUpload) {
-										if (url.indexOf('X-Progress-ID') < 0)
+										if (url.indexOf('X-Progress-ID') < 0) {
 											url += "?X-Progress-ID=" + options.uuid;
+										}
 										delete options.uuid;
 									}
 
+									if (submit_options) {
+										form_data = $.extend({}, form_data, submit_options.form_data);
+									}
 									var defaults = {
 										url: url,
 										type: 'post',
@@ -1324,33 +1410,37 @@
 										data: form_data,
 										dataType: data.amsFormDatatype,
 										beforeSerialize: function(/*form, options*/) {
-											if (typeof(tinyMCE) != 'undefined')
-												tinyMCE.triggerSave();
+											if (typeof(globals.tinyMCE) !== 'undefined') {
+												globals.tinyMCE.triggerSave();
+											}
 										},
 										beforeSubmit: function(data, form /*, options*/) {
 											form.data('submitted', true);
 										},
 										error: function(request, status, error, form) {
-											if (target)
+											if (target) {
 												ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
+											}
 											if (form.is(':visible')) {
 												var button = form.data('ams-submit-button');
-												if (button)
+												if (button) {
 													button.button('reset');
+												}
 												ams.form.finalizeSubmitFooter.call(form);
 											}
 											form.data('submitted', false);
 											form.removeData('ams-submit-button');
 										},
 										iframe: hasUpload
-									}
-									var download_target = data.amsFormDownloadTarget;
+									};
+									var download_target = (submit_options && submit_options.downloadTarget) || data.amsFormDownloadTarget;
 									if (download_target) {
 										var iframe = $('iframe[name="' + download_target + '"]');
-										if (!iframe.exists())
+										if (!iframe.exists()) {
 											iframe = $('<iframe></iframe>').hide()
 																		   .attr('name', download_target)
 																		   .appendTo(form);
+										}
 										defaults = $.extend({}, defaults, {
 											iframe: true,
 											iframeTarget: iframe,
@@ -1361,13 +1451,16 @@
 												} else {
 													var callback;
 													var button = form.data('ams-submit-button');
-													if (button)
+													if (button) {
 														callback = button.data('ams-form-submit-callback');
-													if (!callback)
+													}
+													if (!callback) {
 														callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
+													}
 													callback.call(form, result, status, request, form);
-													if (form.is(':visible') && button)
+													if (form.is(':visible') && button) {
 														button.button('reset');
+													}
 													form.data('submitted', false);
 													form.removeData('ams-submit-button');
 													form.removeAttr('data-ams-form-changed');
@@ -1377,12 +1470,14 @@
 									} else {
 										defaults = $.extend({}, defaults, {
 											error: function(request, status, error, form) {
-												if (target)
+												if (target) {
 													ams.executeFunctionByName(data.amsFormSubmitError || 'MyAMS.form.finalizeSubmitOnError', form, target);
+												}
 												if (form.is(':visible')) {
 													var button = form.data('ams-submit-button');
-													if (button)
+													if (button) {
 														button.button('reset');
+													}
 													ams.form.finalizeSubmitFooter.call(form);
 												}
 												form.data('submitted', false);
@@ -1391,13 +1486,16 @@
 											success: function(result, status, request, form) {
 												var callback;
 												var button = form.data('ams-submit-button');
-												if (button)
+												if (button) {
 													callback = button.data('ams-form-submit-callback');
-												if (!callback)
+												}
+												if (!callback) {
 													callback = ams.getFunctionByName(data.amsFormSubmitCallback) || ams.form._submitCallback;
+												}
 												callback.call(form, result, status, request, form);
-												if (form.is(':visible') && button)
+												if (form.is(':visible') && button) {
 													button.button('reset');
+												}
 												form.data('submitted', false);
 												form.removeData('ams-submit-button');
 												form.removeAttr('data-ams-form-changed');
@@ -1414,8 +1512,9 @@
 											ams.dialog.close(form);
 										} else {
 											ams.form.finalizeSubmitFooter.call(form);
-											if (button)
+											if (button) {
 												button.button('reset');
+											}
 											form.data('submitted', false);
 											form.removeData('ams-submit-button');
 											form.removeAttr('data-ams-form-changed');
@@ -1435,8 +1534,9 @@
 										uuid: $.progressBar.submit(form)
 									});
 									_submitAjaxForm(form, settings);
-								} else
+								} else {
 									_submitAjaxForm(form, {});
+								}
 						   });
 			return false;
 		},
@@ -1451,10 +1551,12 @@
 		initSubmit: function(target, message) {
 			var form = $(this);
 			var spin = '<i class="fa fa-3x fa-gear fa-spin"></i>';
-			if (!message)
+			if (!message) {
 				message = form.data('ams-form-submit-message');
-			if (message)
+			}
+			if (message) {
 				spin += '<strong>' + message + '</strong>';
+			}
 			$(target).html('<div class="row margin-20"><div class="text-center">' + spin + '</div></div>');
 			$(target).parents('.hidden').removeClass('hidden');
 		},
@@ -1479,10 +1581,12 @@
 		initSubmitFooter: function(message) {
 			var form = $(this);
 			var spin = '<i class="fa fa-3x fa-gear fa-spin"></i>';
-			if (!message)
+			if (!message) {
 				message = $(this).data('ams-form-submit-message');
-			if (message)
+			}
+			if (message) {
 				spin += '<strong class="submit-message align-top padding-left-10 margin-top-10">' + message + '</strong>';
+			}
 			var footer = $('footer', form);
 			$('button', footer).hide();
 			footer.append('<div class="row"><div class="text-center">' + spin + '</div></div>');
@@ -1522,25 +1626,31 @@
 		 */
 		_submitCallback: function(result, status, request, form) {
 
+			var button;
 			if (form.is(':visible')) {
 				ams.form.finalizeSubmitFooter.call(form);
-				var button = form.data('ams-submit-button');
-				if (button)
+				button = form.data('ams-submit-button');
+				if (button) {
 					button.button('reset');
+				}
 			}
+
 			var data = form.data();
-			if (data.amsFormDatatype)
-				var data_type = data.amsFormDatatype;
-			else {
+			var data_type;
+			if (data.amsFormDatatype) {
+				data_type = data.amsFormDatatype;
+			} else {
 				var request_data = ams.ajax.getResponse(request);
 				data_type = request_data.content_type;
 				result = request_data.data;
 			}
 
-			if (button)
-				var target = $(button.amsFormSubmitTarget || data.amsFormSubmitTarget || '#content');
-			else
+			var target;
+			if (button) {
+				target = $(button.amsFormSubmitTarget || data.amsFormSubmitTarget || '#content');
+			} else {
 				target = $(data.amsFormSubmitTarget || '#content');
+			}
 
 			switch (data_type) {
 				case 'json':
@@ -1551,12 +1661,16 @@
 				case 'xml':
 					break;
 				case 'html':
+					/* falls through */
 				case 'text':
+					/* falls through */
 				default:
-					if (button && (button.data('ams-keep-modal') !== true))
+					if (button && (button.data('ams-keep-modal') !== true)) {
 						ams.dialog.close(form);
-					if (!target.exists())
+					}
+					if (!target.exists()) {
 						target = $('body');
+					}
 					target.parents('.hidden').removeClass('hidden');
 					$('.alert', target.parents('.alerts-container')).remove();
 					target.css({opacity: '0.0'})
@@ -1576,10 +1690,11 @@
 		 * Get list of custom validators called before submit
 		 */
 		_getSubmitValidators: function(form) {
-			var validators = new Array();
+			var validators = [];
 			var form_validator = form.data('ams-form-validator');
-			if (form_validator)
+			if (form_validator) {
 				validators.push([form, form_validator]);
+			}
 			$('[data-ams-form-validator]', form).each(function() {
 				var source = $(this);
 				validators.push([source, source.data('ams-form-validator')]);
@@ -1598,30 +1713,31 @@
 		 */
 		_checkSubmitValidators: function(form) {
 			var validators = ams.form._getSubmitValidators(form);
-			if (!validators.length)
+			if (!validators.length) {
 				return true;
-			var output = new Array();
+			}
+			var output = [];
 			var result = true;
-			for (var index in validators) {
-				if (!$.isNumeric(index))  // IE check !
-					continue;
+			for (var index=0; index < validators.length; index++) {
 				var validator = validators[index];
 				var source = validator[0];
 				var handler = validator[1];
 				var validator_result = ams.executeFunctionByName(handler, form, source);
-				if (validator_result === false)
+				if (validator_result === false) {
 					result = false;
-				else if (typeof(validator_result) == 'string')
+				} else if (typeof(validator_result) === 'string') {
 					output.push(validator_result);
-				else if (result.length && (result.length > 0))
+				} else if (result.length && (result.length > 0)) {
 					output = output.concat(result);
+				}
 			}
 			if (output.length > 0) {
-				var header = output.length == 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
+				var header = output.length === 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
 				ams.skin.alert(form, 'danger', header, output);
 				return false;
-			} else
+			} else {
 				return result;
+			}
 		},
 
 		/**
@@ -1638,47 +1754,47 @@
 		 *             message: "Second error message"},...]}
 		 */
 		showErrors: function(form, errors) {
-			if (typeof(errors) == 'string') {
-				ams.skin.alert(form, 'error', ams.i18n.ERROR_OCCURED, errors)
+			var header;
+			if (typeof(errors) === 'string') {
+				ams.skin.alert(form, 'error', ams.i18n.ERROR_OCCURED, errors);
 			} else if (errors instanceof Array) {
-				var header = errors.length == 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
+				header = errors.length === 1 ? ams.i18n.ERROR_OCCURED : ams.i18n.ERRORS_OCCURED;
 				ams.skin.alert(form, 'error', header, errors);
 			} else {
 				$('.state-error', form).removeClass('state-error');
 				header = errors.error_header ||
 						 (errors.widgets && (errors.widgets.length > 1) ? ams.i18n.ERRORS_OCCURED : ams.i18n.ERROR_OCCURED);
-				var message = new Array();
+				var message = [];
 				var index;
-				for (index in errors.messages) {
-					if (!$.isNumeric(index))
-						continue;
-					if (errors.messages[index].header) {
-						message.push('<strong>' + errors.messages[index].header + '</strong><br />' + errors.messages[index].message);
+				for (index=0; index < errors.messages.length; index++) {
+					var msg = errors.messages[index];
+					if (msg.header) {
+						message.push('<strong>' + msg.header + '</strong><br />' + msg.message);
 					} else {
-						message.push(errors.messages[index].message || errors.messages[index]);
+						message.push(msg.message || msg);
 					}
 				}
-				for (index in errors.widgets) {
-					if (!$.isNumeric(index))
-						continue;
-					// set widget status message
-					var widget_data = errors.widgets[index];
-					var widget = $('[name="' + widget_data.name + '"]', form);
-					widget.parents('label:first')
-						  .removeClassPrefix('state-')
-						  .addClass('state-error')
-						  .after('<span for="name" class="state-error">' + widget_data.message + '</span>');
-					// complete form alert message
-					if (widget_data.label) {
-						message.push(widget_data.label + ' : ' + widget_data.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');
-						$('li.state-error:first a', form).click();
+				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);
+						widget.parents('label:first')
+								.removeClassPrefix('state-')
+								.addClass('state-error')
+								.after('<span for="name" class="state-error">' + widget_data.message + '</span>');
+						// complete form alert message
+						if (widget_data.label) {
+							message.push(widget_data.label + ' : ' + widget_data.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');
+							$('li.state-error:first a', form).click();
+						}
 					}
 				}
 				ams.skin.alert(form, errors.error_level || 'error', header, message, errors.error_message);
@@ -1705,8 +1821,10 @@
 			if (element) {
 				dialog = element.objectOrParentWithClass('modal-dialog');
 			}
+
+			var callbacks;
 			if (dialog && dialog.exists()) {
-				var callbacks = dialog.data('shown-callbacks');
+				callbacks = dialog.data('shown-callbacks');
 				if (callbacks === undefined) {
 					callbacks = [];
 					dialog.data('shown-callbacks', callbacks);
@@ -1714,8 +1832,9 @@
 			} else {
 				callbacks = ams.dialog._shown_callbacks;
 			}
-			if (callbacks.indexOf(callback) < 0)
+			if (callbacks.indexOf(callback) < 0) {
 				callbacks.push(callback);
+			}
 		},
 
 		/**
@@ -1731,8 +1850,10 @@
 			if (element) {
 				dialog = element.objectOrParentWithClass('modal-dialog');
 			}
+
+			var callbacks;
 			if (dialog && dialog.exists()) {
-				var callbacks = dialog.data('hide-callbacks');
+				callbacks = dialog.data('hide-callbacks');
 				if (callbacks === undefined) {
 					callbacks = [];
 					dialog.data('hide-callbacks', callbacks);
@@ -1740,8 +1861,9 @@
 			} else {
 				callbacks = ams.dialog._hide_callbacks;
 			}
-			if (callbacks.indexOf(callback) < 0)
+			if (callbacks.indexOf(callback) < 0) {
 				callbacks.push(callback);
+			}
 		},
 
 		/**
@@ -1763,21 +1885,25 @@
 												'</div>' +
 											'</div>';
 									}
-									if (typeof(source) == 'string') {
-										var source_data = {};
-										var url = source;
+
+									var source_data;
+									var url;
+									if (typeof(source) === 'string') {
+										source_data = {};
+										url = source;
 									} else {
 										source_data = source.data();
 										url = source.attr('href') || source_data.amsUrl;
 										var url_getter = ams.getFunctionByName(url);
-										if (typeof(url_getter) == 'function') {
+										if (typeof(url_getter) === 'function') {
 											url = url_getter.call(source);
 										}
 									}
-									if (!url)
+									if (!url) {
 										return;
+									}
 									$('body').modalmanager('loading');
-									if (url.indexOf('#') == 0) {
+									if (url.indexOf('#') === 0) {
 										// Inner hidden modal dialog
 										$(url).modal('show');
 									} else {
@@ -1801,15 +1927,17 @@
 													case 'xml':
 														break;
 													case 'html':
+														/* falls through */
 													case 'text':
+														/* falls through */
 													default:
 														var content = $(result);
 														var dialog = $('.modal-dialog', content.wrap('<div></div>').parent());
 														var dialog_data = dialog.data();
 														var data_options = {
 															overflow: dialog_data.amsModalOverflow || '.modal-viewport',
-															maxHeight: dialog_data.amsModalMaxHeight === undefined
-																	? function() {
+															maxHeight: dialog_data.amsModalMaxHeight === undefined ?
+																	function() {
 																		return $(window).height() -
 																					$('.modal-header', content).outerHeight(true) -
 																					$('footer', content).outerHeight(true) - 85;
@@ -1841,15 +1969,17 @@
 			function resetViewport(ev) {
 				var top = $('.scrollmarker.top', viewport);
 				var top_position = viewport.scrollTop();
-				if (top_position > 0)
+				if (top_position > 0) {
 					top.show();
-				else
+				} else {
 					top.hide();
+				}
 				var bottom = $('.scrollmarker.bottom', viewport);
-				if (maxHeight + top_position >= viewport.get(0).scrollHeight)
+				if (maxHeight + top_position >= viewport.get(0).scrollHeight) {
 					bottom.hide();
-				else
+				} else {
 					bottom.show();
+				}
 			}
 
 			var modal = e.target;
@@ -1857,7 +1987,7 @@
 			if (viewport.exists()) {
 				var maxHeight = parseInt(viewport.css('max-height'));
 				var barWidth = $.scrollbarWidth();
-				if (viewport.height() == maxHeight) {
+				if (viewport.height() === maxHeight) {
 					$('<div></div>').addClass('scrollmarker')
 						.addClass('top')
 						.css('top', 0)
@@ -1878,16 +2008,28 @@
 			}
 
 			// Call shown callbacks registered for this dialog
+			var index;
 			var callbacks = $('.modal-dialog', modal).data('shown-callbacks');
 			if (callbacks) {
-				for (var index in callbacks) {
+				for (index=0; index < callbacks.length; index++) {
 					callbacks[index].call(modal);
 				}
 			}
 			// Call globally registered shown callbacks
 			callbacks = ams.dialog._shown_callbacks;
-			for (index in callbacks) {
-				callbacks[index].call(modal);
+			if (callbacks) {
+				for (index=0; index < callbacks.length; index++) {
+					callbacks[index].call(modal);
+				}
+			}
+
+			// Set focus to first input
+			var focused = $('[data-ams-focus-target]', modal).first();
+			if (!focused.exists()) {
+				focused = $('input, select', modal).first();
+			}
+			if (focused.exists()) {
+				focused.focus();
 			}
 		},
 
@@ -1898,8 +2040,9 @@
 			var modal = context.parents('.modal').data('modal');
 			if (modal) {
 				var manager = $('body').data('modalmanager');
-				if (manager && (manager.getOpenModals().indexOf(modal) >= 0))
+				if (manager && (manager.getOpenModals().indexOf(modal) >= 0)) {
 					modal.hide();
+				}
 			}
 		},
 
@@ -1912,16 +2055,19 @@
 			// Call registered cleaning callbacks
 			ams.skin.cleanContainer(modal);
 			// Call hide callbacks registered for this dialog
+			var index;
 			var callbacks = $('.modal-dialog', modal).data('hide-callbacks');
 			if (callbacks) {
-				for (var index in callbacks) {
+				for (index=0; index < callbacks.length; index++) {
 					callbacks[index].call(modal);
 				}
 			}
 			// Call globally registered hide callbacks
 			callbacks = ams.dialog._hide_callbacks;
-			for (index in callbacks) {
-				callbacks[index].call(modal);
+			if (callbacks) {
+				for (index=0; index < callbacks.length; index++) {
+					callbacks[index].call(modal);
+				}
 			}
 		}
 	};
@@ -1948,16 +2094,18 @@
 		select2FormatSelection: function(object, container) {
 			if (object instanceof Array) {
 				$(object).each(function() {
-					if (typeof(this) == 'object')
+					if (typeof(this) === 'object') {
 						container.append(this.text);
-					else
+					} else {
 						container.append(this);
+					}
 				});
 			} else {
-				if (typeof(object) == 'object')
+				if (typeof(object) === 'object') {
 					container.append(object.text);
-				else
+				} else {
 					container.append(object);
+				}
 			}
 		},
 
@@ -1974,7 +2122,7 @@
 					break;
 				case 'modal':
 					$(this).data('select2').dropdown.hide();
-					ams.dialog.open(result.location);
+					ams.dialog.open(data.location);
 					break;
 				default:
 					return {
@@ -1988,7 +2136,7 @@
 		/** Select2 JSON-RPC success callback */
 		select2QueryMethodSuccessCallback: function(data, status, options) {
 			var result = data.result;
-			if (typeof(result) == 'string') {
+			if (typeof(result) === 'string') {
 				try {
 					result = JSON.parse(result);
 				} catch (e) {}
@@ -2018,25 +2166,26 @@
 		/** Context menu handler */
 		contextMenuHandler: function(target, menu) {
 			var menu_data = menu.data();
-			if (menu_data.toggle == 'modal') {
+			if (menu_data.toggle === 'modal') {
 				ams.dialog.open(menu);
 			} else {
 				var href = menu.attr('href') || menu_data.amsUrl;
-				if (!href || href.startsWith('javascript:') || menu.attr('target'))
+				if (!href || href.startsWith('javascript') || menu.attr('target')) {
 					return;
+				}
 				ams.event.stop();
 				var href_getter = ams.getFunctionByName(href);
-				if (typeof(href_getter) == 'function') {
+				if (typeof(href_getter) === 'function') {
 					href = href_getter.call(menu, target);
 				}
-				if (typeof(href) == 'function') {
+				if (typeof(href) === 'function') {
 					// Javascript function call
 					href.call(menu, target);
 				} else {
 					// Standard AJAX or browser URL call
 					// Convert %23 chars to #
 					href = href.replace(/\%23/, '#');
-					var target = menu.data('ams-target');
+					target = menu.data('ams-target');
 					if (target) {
 						ams.form.confirmChangedForm(target, function () {
 							ams.skin.loadURL(href, target, menu.data('ams-link-options'), menu.data('ams-link-callback'));
@@ -2044,17 +2193,19 @@
 					} else {
 						ams.form.confirmChangedForm(function () {
 							if (href.startsWith('#')) {
-								if (href != location.hash) {
+								if (href !== location.hash) {
 									if (ams.root.hasClass('mobile-view-activated')) {
 										ams.root.removeClass('hidden-menu');
 										window.setTimeout(function () {
 											window.location.hash = href;
 										}, 150);
-									} else
+									} else {
 										window.location.hash = href;
+									}
 								}
-							} else
+							} else {
 								window.location = href;
+							}
 						});
 					}
 				}
@@ -2092,53 +2243,58 @@
 			ams.plugins.initData(element);
 
 			// Check for disabled plug-ins
-			var disabled = new Array();
+			var disabled = [];
 			$('[data-ams-plugins-disabled]', element).each(function() {
 				var plugins = $(this).data('ams-plugins-disabled').split(/\s+/);
-				for (var name in plugins) {
-					disabled.push(plugins[name]);
+				for (var index=0; index < plugins.length; index++) {
+					disabled.push(plugins[index]);
 				}
 			});
 
 			// Load and register new plug-ins
-			var name;
+			var plugin;
 			$('[data-ams-plugins]', element).each(function() {
 				var source = $(this);
-				var plugins = {}
+				var plugins = {};
+				var name;
 				if (typeof(source.data('ams-plugins')) === 'string') {
 					var names = source.data('ams-plugins').split(/\s+/);
-					for (var index in names) {
+					for (var index=0; index < names.length; index++) {
 						name = names[index];
-						var plugin_options = {
+						plugins[name] = {
 							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')
-						}
-						plugins[name] = plugin_options;
+						};
 					}
 				} else {
 					plugins = source.data('ams-plugins');
 				}
+
+				function executePlugin() {
+					var callback = plugin.callback;
+					if (callback) {
+						var called = ams.getFunctionByName(callback);
+						if (plugin.register !== false) {
+							ams.plugins.enabled[name] = called;
+						}
+					} else {
+						if (plugin.register !== false) {
+							ams.plugins.enabled[name] = null;
+						}
+					}
+					var css = plugin.css;
+					if (css) {
+						ams.getCSS(css, name + '_css');
+					}
+				}
+
 				for (name in plugins) {
 					if (ams.plugins.enabled[name] === undefined) {
-						var plugin = plugins[name];
-						ams.getScript(plugin.src, function() {
-							var callback = plugin.callback;
-							if (callback) {
-								var called = ams.getFunctionByName(callback);
-								if (plugin.register !== false)
-									ams.plugins.enabled[name] = called;
-							} else {
-								if (plugin.register !== false)
-									ams.plugins.enabled[name] = null;
-							}
-							var css = plugin['css'];
-							if (css) {
-								ams.getCSS(css, name + '_css');
-							}
-						}, {
+						plugin = plugins[name];
+						ams.getScript(plugin.src, executePlugin, {
 							async: plugin.async === undefined ? true : plugin.async
 						});
 					}
@@ -2147,11 +2303,16 @@
 
 			// Run all enabled plug-ins
 			for (var index in ams.plugins.enabled) {
-				if (disabled.indexOf(index) >= 0)
+				if (!ams.plugins.enabled.hasOwnProperty(index)) {
+					continue;
+				}
+				if (disabled.indexOf(index) >= 0) {
 					continue;
-				var plugin = ams.plugins.enabled[index];
-				if (typeof(plugin) == 'function')
+				}
+				plugin = ams.plugins.enabled[index];
+				if (typeof(plugin) === 'function') {
 					plugin(element);
+				}
 			}
 		},
 
@@ -2165,8 +2326,10 @@
 			$('[data-ams-data]', element).each(function() {
 				var handler = $(this);
 				var data = handler.data('ams-data');
-				for (var index in data) {
-					handler.attr('data-' + index, data[index]);
+				if (data) {
+					for (var index=0; index < data.length; index++) {
+						handler.attr('data-' + index, data[index]);
+					}
 				}
 			});
 		},
@@ -2179,17 +2342,18 @@
 		 * @callback: a callback function which can be called after plug-in registry
 		 */
 		register: function(plugin, name, callback) {
-			if (typeof(name) == 'function') {
+			if (typeof(name) === 'function') {
 				callback = name;
 				name = null;
 			}
 			name = name || plugin.name;
 			if (ams.plugins.enabled.indexOf(name) >= 0) {
-				if (window.console)
-					console.warn("Plugin "+name+" is already registered!");
+				if (globals.console) {
+					globals.console.warn("Plugin " + name + " is already registered!");
+				}
 				return;
 			}
-			if (typeof(plugin) == 'object') {
+			if (typeof(plugin) === 'object') {
 				var src = plugin.src;
 				if (src) {
 					ams.ajax.check(plugin.callback, src, function(first_load) {
@@ -2202,7 +2366,7 @@
 								ams.executeFunctionByName(callback);
 							}
 						}
-					})
+					});
 				} else {
 					ams.plugins.enabled[name] = ams.getFunctionByName(plugin.callback);
 					if (plugin.css) {
@@ -2212,7 +2376,7 @@
 						ams.executeFunctionByName(callback);
 					}
 				}
-			} else if (typeof(plugin) == 'function') {
+			} else if (typeof(plugin) === 'function') {
 				ams.plugins.enabled[name] = plugin;
 				if (callback) {
 					ams.executeFunctionByName(callback);
@@ -2240,33 +2404,34 @@
 			 */
 			hint: function(element) {
 				var hints = $('.hint:not(:parents(.nohints))', element);
-				if (hints.length > 0)
+				if (hints.length > 0) {
 					ams.ajax.check($.fn.tipsy,
 								   ams.baseURL + 'ext/jquery-tipsy' + ams.devext + '.js',
-								   function() {
-										ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + ams.devext + '.css',
+								   function () {
+									   ams.getCSS(ams.baseURL + '../css/ext/jquery-tipsy' + ams.devext + '.css',
 												  'jquery-tipsy');
-										hints.each(function() {
-											var hint = $(this);
-											var data = hint.data();
-											var data_options = {
-												html: data.amsHintHtml,
-												title: ams.getFunctionByName(data.amsHintTitleGetter) || function() {
-													var hint = $(this);
-													return hint.attr('original-title') ||
+									   hints.each(function () {
+										   var hint = $(this);
+										   var data = hint.data();
+										   var data_options = {
+											   html: data.amsHintHtml,
+											   title: ams.getFunctionByName(data.amsHintTitleGetter) || function () {
+												   var hint = $(this);
+												   return hint.attr('original-title') ||
 														   hint.attr(data.amsHintTitleAttr || 'title') ||
 														   (data.amsHintHtml ? hint.html() : hint.text());
-												},
-												opacity: data.amsHintOpacity || 0.95,
-												gravity: data.amsHintGravity || 'sw',
-												offset: data.amsHintOffset || 0
-											};
-											var settings = $.extend({}, data_options, data.amsHintOptions);
-											settings = ams.executeFunctionByName(data.amsHintInitCallback, hint, settings) || settings;
-											var plugin = hint.tipsy(settings);
-											ams.executeFunctionByName(data.amsHintAfterInitCallback, hint, plugin, settings);
-										});
+											   },
+											   opacity: data.amsHintOpacity || 0.95,
+											   gravity: data.amsHintGravity || 'sw',
+											   offset: data.amsHintOffset || 0
+										   };
+										   var settings = $.extend({}, data_options, data.amsHintOptions);
+										   settings = ams.executeFunctionByName(data.amsHintInitCallback, hint, settings) || settings;
+										   var plugin = hint.tipsy(settings);
+										   ams.executeFunctionByName(data.amsHintAfterInitCallback, hint, plugin, settings);
+									   });
 								   });
+				}
 			},
 
 			/**
@@ -2301,15 +2466,16 @@
 					if (!data.amsSwitcher) {
 						$('<i class="fa fa-fw"></i>')
 							.prependTo($(this))
-							.addClass(data.amsSwitcherState == 'open' ?
+							.addClass(data.amsSwitcherState === 'open' ?
 									  (data.amsSwitcherMinusClass || 'fa-minus') :
 									  (data.amsSwitcherPlusClass || 'fa-plus'));
 						legend.on('click', function(e) {
 							e.preventDefault();
 							var veto = {};
 							legend.trigger('ams.switcher.before-switch', [legend, veto]);
-							if (veto.veto)
+							if (veto.veto) {
 								return;
+							}
 							if (fieldset.hasClass('switched')) {
 								fieldset.removeClass('switched');
 								$('.fa', legend).removeClass(data.amsSwitcherPlusClass || 'fa-plus')
@@ -2319,8 +2485,9 @@
 								if (id) {
 									$('legend.switcher[data-ams-switcher-sync="'+id+'"]', fieldset).each(function() {
 										var switcher = $(this);
-										if (switcher.parents('fieldset').hasClass('switched'))
+										if (switcher.parents('fieldset').hasClass('switched')) {
 											switcher.click();
+										}
 									});
 								}
 							} else {
@@ -2330,8 +2497,9 @@
 								legend.trigger('ams.switcher.closed', [legend]);
 							}
 						});
-						if (data.amsSwitcherState != 'open')
+						if (data.amsSwitcherState !== 'open') {
 							fieldset.addClass('switched');
+						}
 						legend.data('ams-switcher', 'on');
 					}
 				});
@@ -2356,7 +2524,7 @@
 						var marker = data.amsCheckerMarker || false;
 						if (prefix) {
 							hidden = $('<input type="hidden">').attr('name', prefix + fieldname)
-															   .val(data.amsCheckerState == 'on' ? checkedValue : uncheckedValue)
+															   .val(data.amsCheckerState === 'on' ? checkedValue : uncheckedValue)
 															   .prependTo(legend);
 						} else if (marker) {
 							$('<input type="hidden">').attr('name', marker)
@@ -2368,7 +2536,7 @@
 																.data('ams-checker-hidden-input', hidden)
 																.data('ams-checker-init', true)
 																.val(data.amsCheckerValue || true)
-																.attr('checked', data.amsCheckerState == 'on' ? 'checked' : null);
+																.attr('checked', data.amsCheckerState === 'on' ? 'checked' : null);
 						if (data.amsCheckerReadonly) {
 							input.attr('disabled', 'disabled');
 						} else {
@@ -2386,21 +2554,25 @@
 								if (!data.amsCheckerCancelDefault) {
 									var hidden = input.data('ams-checker-hidden-input');
 									if (isChecked) {
-										if (data.amsCheckerMode == 'disable')
+										if (data.amsCheckerMode === 'disable') {
 											fieldset.removeAttr('disabled');
-										else
+										} else {
 											fieldset.removeClass('switched');
-										if (hidden)
+										}
+										if (hidden) {
 											hidden.val(checkedValue);
+										}
 										$('[data-required]', fieldset).attr('required', 'required');
 										legend.trigger('ams.checker.opened', [legend]);
 									} else {
-										if (data.amsCheckerMode == 'disable')
+										if (data.amsCheckerMode === 'disable') {
 											fieldset.prop('disabled', 'disabled');
-										else
+										} else {
 											fieldset.addClass('switched');
-										if (hidden)
+										}
+										if (hidden) {
 											hidden.val(uncheckedValue);
+										}
 										$('[data-required]', fieldset).removeAttr('required');
 										legend.trigger('ams.checker.closed', [legend]);
 									}
@@ -2413,13 +2585,14 @@
 							   .prependTo(legend);
 						var required = $('[required]', fieldset);
 						required.attr('data-required', true);
-						if (data.amsCheckerState == 'on') {
+						if (data.amsCheckerState === 'on') {
 							input.attr('checked', true);
 						} else {
-							if (data.amsCheckerMode == 'disable')
+							if (data.amsCheckerMode === 'disable') {
 								fieldset.attr('disabled', 'disabled');
-							else
+							} else {
 								fieldset.addClass('switched');
+							}
 							required.removeAttr('required');
 						}
 						legend.data('ams-checker', 'on');
@@ -2570,53 +2743,54 @@
 												allowClear: data.amsSelect2AllowClear === undefined ? true : data.amsSelect2AllowClear,
 												width: data.amsSelect2Width || '100%',
 												initSelection: ams.getFunctionByName(data.amsSelect2InitSelection),
-												formatSelection: data.amsSelect2FormatSelection === undefined
-																	? ams.helpers.select2FormatSelection
+												formatSelection: data.amsSelect2FormatSelection === undefined ?
+																	ams.helpers.select2FormatSelection
 																	: ams.getFunctionByName(data.amsSelect2FormatSelection),
 												formatResult: ams.getFunctionByName(data.amsSelect2FormatResult),
-												formatMatches: data.amsSelect2FormatMatches === undefined
-																	? function(matches) {
-																		if (matches == 1)
+												formatMatches: data.amsSelect2FormatMatches === undefined ?
+																	function(matches) {
+																		if (matches === 1) {
 																			return ams.i18n.SELECT2_MATCH;
-																		else
+																		} else {
 																			return matches + ams.i18n.SELECT2_MATCHES;
+																		}
 																	}
 																	: ams.getFunctionByName(data.amsSelect2FormatMatches),
-												formatNoMatches: data.amsSelect2FormatResult === undefined
-																	? function(term) {
+												formatNoMatches: data.amsSelect2FormatResult === undefined ?
+																	function(term) {
 																		return ams.i18n.SELECT2_NOMATCHES;
 																	}
 																	: ams.getFunctionByName(data.amsSelect2FormatResult),
-												formatInputTooShort: data.amsSelect2FormatInputTooShort === undefined
-																	? function(input, min) {
+												formatInputTooShort: data.amsSelect2FormatInputTooShort === undefined ?
+																	function(input, min) {
 																		var n = min - input.length;
 																		return ams.i18n.SELECT2_INPUT_TOOSHORT
 																						.replace(/\{0\}/, n)
-																						.replace(/\{1\}/, n == 1 ? "" : ams.i18n.SELECT2_PLURAL);
+																						.replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
 																	}
 																	: ams.getFunctionByName(data.amsSelect2FormatInputTooShort),
-												formatInputTooLong: data.amsSelect2FormatInputTooLong === undefined
-																	? function(input, max) {
+												formatInputTooLong: data.amsSelect2FormatInputTooLong === undefined ?
+																	function(input, max) {
 																		var n = input.length - max;
 																		return ams.i18n.SELECT2_INPUT_TOOLONG
 																						.replace(/\{0\}/, n)
-																						.replace(/\{1\}/, n == 1 ? "" : ams.i18n.SELECT2_PLURAL);
+																						.replace(/\{1\}/, n === 1 ? "" : ams.i18n.SELECT2_PLURAL);
 																	}
 																	: ams.getFunctionByName(data.amsSelect2FormatInputTooLong),
-												formatSelectionTooBig: data.amsSelect2FormatSelectionTooBig === undefined
-																	? function(limit) {
+												formatSelectionTooBig: data.amsSelect2FormatSelectionTooBig === undefined ?
+																	function(limit) {
 																		return ams.i18n.SELECT2_SELECTION_TOOBIG
 																						.replace(/\{0\}/, limit)
-																						.replace(/\{1\}/, limit == 1 ? "" : ams.i18n.SELECT2_PLURAL);
+																						.replace(/\{1\}/, limit === 1 ? "" : ams.i18n.SELECT2_PLURAL);
 																	}
 																	: ams.getFunctionByName(data.amsSelect2FormatSelectionTooBig),
-												formatLoadMore: data.amsSelect2FormatLoadMore === undefined
-																	? function (pageNumber) {
+												formatLoadMore: data.amsSelect2FormatLoadMore === undefined ?
+																	function (pageNumber) {
 																		return ams.i18n.SELECT2_LOADMORE;
 																	}
 																	: ams.getFunctionByName(data.amsSelect2FormatLoadMore),
-												formatSearching: data.amsSelect2FormatSearching === undefined
-																	? function() {
+												formatSearching: data.amsSelect2FormatSearching === undefined ?
+																	function() {
 																		return ams.i18n.SELECT2_SEARCHING;
 																	}
 																	: ams.getFunctionByName(data.amsSelect2FormatSearching),
@@ -2638,7 +2812,7 @@
 																			   text: values_data[this] || this});
 																});
 																callback(data);
-															}
+															};
 														}
 													}
 													break;
@@ -2647,7 +2821,7 @@
 											}
 
 											if (select.attr('readonly')) {
-												if (select.attr('type') == 'hidden') {
+												if (select.attr('type') === 'hidden') {
 													data_options.query = function () {
 														return [];
 													};
@@ -2730,8 +2904,9 @@
 
 											select.on('change', function() {
 												var validator = $(select.get(0).form).data('validator');
-												if (validator !== undefined)
+												if (validator !== undefined) {
 													$(select).valid();
+												}
 											});
 										});
 								   });
@@ -2905,18 +3080,23 @@
 												errorClass: 'state-error',
 												errorPlacement: function(error, element) {
 													var label = element.parents('label:first');
-													if (label.length)
+													if (label.length) {
 														error.insertAfter(label);
-													else
+													} else {
 														error.insertAfter(element);
+													}
 												}
 											});
 											if (ams.plugins.i18n) {
 												for (var key in ams.plugins.i18n.validate) {
+													if (!ams.plugins.i18n.validate.hasOwnProperty(key)) {
+														continue;
+													}
 													var message = ams.plugins.i18n.validate[key];
-													if ((typeof(message) == 'string') &&
-														(message.indexOf('{0}') > -1))
+													if ((typeof(message) === 'string') &&
+														(message.indexOf('{0}') > -1)) {
 														ams.plugins.i18n.validate[key] = $.validator.format(message);
+													}
 												}
 												$.extend($.validator.messages, ams.plugins.i18n.validate);
 											}
@@ -2926,9 +3106,9 @@
 											var data = form.data();
 											var data_options = {
 												ignore: null,
-												submitHandler: form.attr('data-async') !== undefined
-															   ? data.amsFormSubmitHandler === undefined
-																	? function() {
+												submitHandler: form.attr('data-async') !== undefined ?
+															   data.amsFormSubmitHandler === undefined ?
+																	function() {
 																		// JQuery-form plug-in must be loaded synchronously!!
 																		// Otherwise, hidden input fields created by jquery-validate plug-in
 																		// and matching named buttons will be deleted (on first form submit)
@@ -2940,11 +3120,11 @@
 																	}
 																	: ams.getFunctionByName(data.amsFormSubmitHandler)
 															   : undefined,
-												invalidHandler: form.attr('data-async') !== undefined
-																? data.amsFormInvalidHandler === undefined
-																	? function(event, validator) {
+												invalidHandler: form.attr('data-async') !== undefined ?
+																data.amsFormInvalidHandler === undefined ?
+																	function(event, validator) {
 																		$('.state-error', form).removeClass('state-error');
-																		for (var index in validator.errorList) {
+																		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) {
@@ -2978,7 +3158,7 @@
 								   ams.baseURL + 'ext/jquery-dataTables-1.9.4' + ams.devext + '.js',
 								   function(first_load) {
 										$(tables).each(function() {
-											ams.ajax.check($.fn.dataTableExt.oPagination['bootstrap_full'],
+											ams.ajax.check($.fn.dataTableExt.oPagination.bootstrap_full,
 														   ams.baseURL + 'myams-dataTables' + ams.devext + '.js');
 											var table = $(this);
 											var data = table.data();
@@ -2998,13 +3178,14 @@
 												"><'dt-row dt-bottom-row'<'row'<'col-sm-6'" +
 												(data.amsDatatableInformation === false ? '': 'i') +
 												"><'col-sm-6 text-right'p>>";
+
 											var index;
 											// Check initial sorting
 											var sorting = data.amsDatatableSorting;
 											if (typeof(sorting) === 'string') {
 												var sortings = sorting.split(';');
 												sorting = [];
-												for (index in sortings) {
+												for (index=0; index < sortings.length; index++) {
 													var col_sorting = sortings[index].split(',');
 													col_sorting[0] = parseInt(col_sorting[0]);
 													sorting.push(col_sorting);
@@ -3013,7 +3194,7 @@
 											// Check columns types
 											var columns = [];
 											var sort_types = $('th', table).listattr('data-ams-datatable-stype');
-											for (index in sort_types) {
+											for (index=0; index < sort_types.length; index++) {
 												var sort_type = sort_types[index];
 												if (sort_type) {
 													var column = columns[index] || {};
@@ -3043,7 +3224,7 @@
 											};
 											var settings = $.extend({}, data_options, data.amsDatatableOptions);
 											if (extensions.length > 0) {
-												for (index in extensions) {
+												for (index=0; index < extensions.length; index++) {
 													switch (extensions[index]) {
 														case 'autofill':
 															ams.ajax.check($.fn.dataTable.AutoFill,
@@ -3110,13 +3291,13 @@
 												var plugin = table.dataTable(settings);
 												ams.executeFunctionByName(data.amsDatatableAfterInitCallback, table, plugin, settings);
 												if (extensions.length > 0) {
-													for (index in extensions) {
+													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;
-																table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined
-																							? new $.fn.dataTable.AutoFill(table, af_settings)
+																table.data('ams-autofill', data.amsDatatableAutofillConstructor === undefined ?
+																							new $.fn.dataTable.AutoFill(table, af_settings)
 																							: ams.executeFunctionByName(data.amsDatatableAutofillConstructor, table, plugin, af_settings));
 																break;
 															case 'columnfilter':
@@ -3125,29 +3306,29 @@
 																};
 																var cf_settings = $.extend({}, cf_default, data.amsDatatableColumnfilterOptions, settings.columnfilter);
 																cf_settings = ams.executeFunctionByName(data.amsDatatableColumnfilterInitCallback, table, cf_settings) || cf_settings;
-																table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined
-																							? plugin.columnFilter(cf_settings)
+																table.data('ams-columnfilter', data.amsDatatableColumnfilterConstructor === undefined ?
+																							plugin.columnFilter(cf_settings)
 																							: ams.executeFunctionByName(data.amsDatatableColumnfilterConstructor, table, plugin, cf_settings));
 																break;
 															case 'editable':
 																var ed_settings = $.extend({}, data.amsDatatableEditableOptions, settings.editable);
 																ed_settings = ams.executeFunctionByName(data.amsDatatableEditableInitCallback, table, ed_settings) || ed_settings;
-																table.data('ams-editable', data.amsDatatableEditableConstructor === undefined
-																							? table.makeEditable(ed_settings)
+																table.data('ams-editable', data.amsDatatableEditableConstructor === undefined ?
+																							table.makeEditable(ed_settings)
 																							: ams.executeFunctionByName(data.amsDatatableEditableConstructor, table, plugin, ed_settings));
 																break;
 															case 'fixedcolumns':
 																var fc_settings = $.extend({}, data.amsDatatableFixedcolumnsOptions, settings.fixedcolumns);
 																fc_settings = ams.executeFunctionByName(data.amsDatatableFixedcolumnsInitCallback, table, fc_settings) || fc_settings;
-																table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined
-																							? new $.fn.dataTable.FixedColumns(table, fc_settings)
+																table.data('ams-fixedcolumns', data.amsDatatableFixedcolumnsConstructor === undefined ?
+																							new $.fn.dataTable.FixedColumns(table, fc_settings)
 																							: ams.executeFunctionByName(data.amsDatatableFixedcolumnsConstructor, table, plugin, fc_settings));
 																break;
 															case 'fixedheader':
 																var fh_settings = $.extend({}, data.amsDatatableFixedheaderOptions, settings.fixedheader);
 																fh_settings = ams.executeFunctionByName(data.amsDatatableFixedheadeInitCallback, table, fh_settings) || fh_settings;
-																table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined
-																							? new $.fn.dataTable.FixedHeader(table, fh_settings)
+																table.data('ams-fixedheader', data.amsDatatableFixedheaderConstructor === undefined ?
+																							new $.fn.dataTable.FixedHeader(table, fh_settings)
 																							: ams.executeFunctionByName(data.amsDatatableFixedheaderConstructor, table, plugin, fh_settings));
 																break;
 															case 'keytable':
@@ -3157,22 +3338,22 @@
 																};
 																var kt_settings = $.extend({}, kt_default, data.amsDatatableKeytableOptions, settings.keytable);
 																kt_settings = ams.executeFunctionByName(data.amsDatatableKeytableInitCallback, table, kt_settings) || kt_settings;
-																table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined
-																							? new KeyTable(kt_settings)
+																table.data('ams-keytable', data.amsDatatableKeytableConstructor === undefined ?
+																							new KeyTable(kt_settings)
 																							: ams.executeFunctionByName(data.amsDatatableKeytableConstructor, table, plugin, kt_settings));
 																break;
 															case 'rowgrouping':
 																var rg_settings = $.extend({}, data.amsDatatableRowgroupingOptions, settings.rowgrouping);
 																rg_settings = ams.executeFunctionByName(data.amsDatatableRowgroupingInitCallback, table, rg_settings) || rg_settings;
-																table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined
-																							? table.rowGrouping(rg_settings)
+																table.data('ams-rowgrouping', data.amsDatatableRowgroupingConstructor === undefined ?
+																							table.rowGrouping(rg_settings)
 																							: ams.executeFunctionByName(data.amsDatatableRowgroupingConstructor, table, plugin, rg_settings));
 																break;
 															case 'rowreordering':
 																var rr_settings = $.extend({}, data.amsDatatableRowreorderingOptions, settings.rowreordering);
 																rr_settings = ams.executeFunctionByName(data.amsDatatableRowreorderingInitCallback, table, rr_settings) || rr_settings;
-																table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined
-																							? table.rowReordering(rr_settings)
+																table.data('ams-rowreordering', data.amsDatatableRowreorderingConstructor === undefined ?
+																							table.rowReordering(rr_settings)
 																							: ams.executeFunctionByName(data.amsDatatableRowreorderingConstructor, table, plugin, rr_settings));
 																break;
 															default:
@@ -3182,7 +3363,7 @@
 												}
 												var finalizers = (data.amsDatatableFinalizeCallback || '').split(/\s+/);
 												if (finalizers.length > 0) {
-													for (index in finalizers) {
+													for (index=0; index < finalizers.length; index++) {
 														ams.executeFunctionByName(finalizers[index], table, plugin, settings);
 													}
 												}
@@ -3222,11 +3403,12 @@
 														var rows = [];
 														$(dnd_table.rows).each(function() {
 															var row_id = $(this).data('ams-element-name');
-															if (row_id)
+															if (row_id) {
 																rows.push(row_id);
+															}
 														});
 														var local_target = ams.getFunctionByName(target);
-														if (typeof(local_target) == 'function') {
+														if (typeof(local_target) === 'function') {
 															local_target.call(table, dnd_table, rows);
 														} else {
 															ams.ajax.post(target, {names: JSON.stringify(rows)});
@@ -3253,8 +3435,9 @@
 					ams.ajax.check($.fn.imgAreaSelect,
 								   ams.baseURL + 'ext/jquery-imgareaselect-0.9.10' + ams.devext + '.js',
 								   function(first_load) {
-									   if (first_load)
+									   if (first_load) {
 										   ams.getCSS(ams.baseURL + '../css/ext/jquery-imgareaselect' + ams.devext + '.css');
+									   }
 									   images.each(function() {
 										   var image = $(this);
 										   var data = image.data();
@@ -3289,7 +3472,7 @@
 											   plugin.update();
 										   }, 250);
 									   });
-								   })
+								   });
 				}
 			},
 
@@ -3302,14 +3485,15 @@
 					ams.ajax.check($.fn.fancybox,
 								   ams.baseURL + 'ext/jquery-fancybox-2.1.5' + ams.devext + '.js',
 								   function(first_load) {
-										if (first_load)
+										if (first_load) {
 											ams.getCSS(ams.baseURL + '../css/ext/jquery-fancybox-2.1.5' + ams.devext + '.css');
+										}
 										fancyboxes.each(function() {
 											var fancybox = $(this);
 											var data = fancybox.data();
 											var helpers = (data.amsFancyboxHelpers || '').split(/\s+/);
 											if (helpers.length > 0) {
-												for (var index in helpers) {
+												for (var index=0; index < helpers.length; index++) {
 													var helper = helpers[index];
 													switch (helper) {
 														case 'buttons':
@@ -3377,9 +3561,10 @@
 										ams.ajax.check($.fn.mCustomScrollbar,
 													   ams.baseURL + 'ext/jquery-mCustomScrollbar' + ams.devext + '.js',
 													   function(first_load) {
-															if (first_load)
+															if (first_load) {
 																ams.getCSS(ams.baseURL + '../css/ext/jquery-mCustomScrollbar.css',
-																		  'jquery-mCustomScrollbar');
+																		   'jquery-mCustomScrollbar');
+															}
 															scrollbars.each(function() {
 																var scrollbar = $(this);
 																var data = scrollbar.data();
@@ -3427,13 +3612,13 @@
 									  function() {
 										ams.executeFunctionByName(data.amsCallback, self, data.amsCallbackOptions);
 									  });
-					} else if (window.console) {
-						console.warn("Undefined callback: " + data.amsCallback);
+					} else if (globals.console) {
+						globals.console.warn("Undefined callback: " + data.amsCallback);
 					}
 				} else {
 					callback.call(self, data.amsCallbackOptions);
 				}
-			})
+			});
 		},
 
 		/**
@@ -3537,8 +3722,12 @@
 			$('[data-ams-events-handlers]', element).each(function() {
 				var element = $(this);
 				var handlers = element.data('ams-events-handlers');
-				for (var event in handlers) {
-					element.on(event, ams.getFunctionByName(handlers[event]));
+				if (handlers) {
+					for (var event in handlers) {
+						if (handlers.hasOwnProperty(event)) {
+							element.on(event, ams.getFunctionByName(handlers[event]));
+						}
+					}
 				}
 			});
 		}
@@ -3577,14 +3766,14 @@
 					content: '<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; ' + ams.i18n.DELETE_WARNING,
 					buttons: ams.i18n.BTN_OK_CANCEL
 				}, function(button) {
-					if (button == ams.i18n.BTN_OK) {
+					if (button === ams.i18n.BTN_OK) {
 						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) {
-							if (result.status == 'success') {
+							if (result.status === 'success') {
 								if (table.hasClass('datatable')) {
 									table.dataTable().fnDeleteRow(tr[0]);
 								} else {
@@ -3594,7 +3783,7 @@
 						});
 					}
 				});
-			}
+			};
 		}
 	};
 
@@ -3624,10 +3813,11 @@
 		 * Check width for mobile devices
 		 */
 		_checkMobileWidth: function() {
-			if ($(window).width() < 979)
-				ams.root.addClass('mobile-view-activated')
-			else if (ams.root.hasClass('mobile-view-activated'))
+			if ($(window).width() < 979) {
+				ams.root.addClass('mobile-view-activated');
+			} else if (ams.root.hasClass('mobile-view-activated')) {
 				ams.root.removeClass('mobile-view-activated');
+			}
 		},
 
 		/**
@@ -3639,7 +3829,7 @@
 			}, 200, 'easeOutCirc');
 			ams.root.addClass('shortcut-on');
 		},
-		
+
 		_hideShortcutButtons: function() {
 			ams.shortcuts.animate({
 				height: 'hide'
@@ -3651,13 +3841,14 @@
 		 * Check notification badge
 		 */
 		checkNotification: function() {
-			$this = $('#activity > .badge');
-			if (parseInt($this.text()) > 0)
-				$this.removeClass("hidden")
+			var badge = $('#activity > .badge');
+			if (parseInt(badge.text()) > 0) {
+				badge.removeClass("hidden")
 					 .addClass("bg-color-red bounceIn animated");
-			else
-				$this.addClass("hidden")
+			} else {
+				badge.addClass("hidden")
 					 .removeClass("bg-color-red bounceIn animated");
+			}
 		},
 
 		/**
@@ -3666,29 +3857,31 @@
 		_initDesktopWidgets: function(element) {
 			if (ams.enable_widgets) {
 				var widgets = $('.ams-widget', element);
-				if (widgets.length > 0)
+				if (widgets.length > 0) {
 					ams.ajax.check($.fn.MyAMSWidget,
 								   ams.baseURL + 'myams-widgets' + ams.devext + '.js',
-								   function() {
-										widgets.each(function() {
-											var widget = $(this);
-											var data = widget.data();
-											var data_options = {
-												deleteSettingsKey: '#deletesettingskey-options',
-												deletePositionKey: '#deletepositionkey-options'
-											};
-											var settings = $.extend({}, data_options, data.amsWidgetOptions);
-											settings = ams.executeFunctionByName(data.amsWidgetInitcallback, widget, settings) || settings;
-											widget.MyAMSWidget(settings);
-										});
-										MyAMSWidget.initWidgetsGrid($('.ams-widget-grid', element));
-									});
+								   function () {
+									   widgets.each(function () {
+										   var widget = $(this);
+										   var data = widget.data();
+										   var data_options = {
+											   deleteSettingsKey: '#deletesettingskey-options',
+											   deletePositionKey: '#deletepositionkey-options'
+										   };
+										   var settings = $.extend({}, data_options, data.amsWidgetOptions);
+										   settings = ams.executeFunctionByName(data.amsWidgetInitcallback, widget, settings) || settings;
+										   widget.MyAMSWidget(settings);
+									   });
+									   globals.MyAMSWidget.initWidgetsGrid($('.ams-widget-grid', element));
+								   });
+				}
 			}
 		},
 
 		_initMobileWidgets: function(element) {
-			if (ams.enable_mobile && ams.enable_widgets)
+			if (ams.enable_mobile && ams.enable_widgets) {
 				ams.skin._initDesktopWidgets(element);
+			}
 		},
 
 		/**
@@ -3703,23 +3896,25 @@
 		 */
 		alert: function(parent, status, header, message, subtitle, margin) {
 			$('.alert', parent).remove();
-			if (status == 'error')
+			if (status === 'error') {
 				status = 'danger';
+			}
 			var content = '<div class="' + (margin ? 'margin-10' : '') + ' alert alert-block alert-' + status + ' 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> ' + header +
-							'</h4>' +
-							(subtitle ? ('<p>' + subtitle + '</p>') : '');
-			if (typeof(message) == 'string')
+				'<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> ' + header +
+				'</h4>' +
+				(subtitle ? ('<p>' + subtitle + '</p>') : '');
+			if (typeof(message) === 'string') {
 				content += '<ul><li>' + message + '</li></ul>';
-			else if (message) {
+			} else if (message) {
 				content += '<ul>';
 				for (var index in message) {
-					if (!$.isNumeric(index))  // IE check
+					if (!$.isNumeric(index)) {  // IE check
 						continue;
+					}
 					content += '<li>' + message[index] + '</li>';
-				};
+				}
 				content += '</ul>';
 			}
 			content += '</div>';
@@ -3728,7 +3923,7 @@
 				ams.ajax.check($.scrollTo,
 							   ams.baseURL + 'ext/jquery-scrollTo.min.js',
 							   function() {
-									$.scrollTo(parent, {offset: {top: -50}});
+								   $.scrollTo(parent, {offset: {top: -50}});
 							   });
 			}
 		},
@@ -3748,7 +3943,7 @@
 		 * Medium notification message box, displayed on page's bottom right
 		 */
 		messageBox: function(status, options, callback) {
-			if (typeof(status) == 'object') {
+			if (typeof(status) === 'object') {
 				callback = options;
 				options = status || {};
 				status = 'info';
@@ -3756,22 +3951,22 @@
 			ams.ajax.check(ams.notify,
 						   ams.baseURL + 'myams-notify' + ams.devext + '.js',
 						   function() {
-								switch (status) {
-									case 'error':
-									case 'danger':
-										options.color = '#C46A69';
-										break;
-									case 'warning':
-										options.color = '#C79121';
-										break;
-									case 'success':
-										options.color = '#739E73';
-										break;
-									default:
-										options.color = options.color || '#3276B1';
-								}
-								options.sound = false;
-								ams.notify.bigBox(options, callback);
+							   switch (status) {
+								   case 'error':
+								   case 'danger':
+									   options.color = '#C46A69';
+									   break;
+								   case 'warning':
+									   options.color = '#C79121';
+									   break;
+								   case 'success':
+									   options.color = '#739E73';
+									   break;
+								   default:
+									   options.color = options.color || '#3276B1';
+							   }
+							   options.sound = false;
+							   ams.notify.bigBox(options, callback);
 						   });
 		},
 
@@ -3779,30 +3974,30 @@
 		 * Small notification message box, displayed on page's top right
 		 */
 		smallBox: function(status, options, callback) {
-			if (typeof(status) == 'object') {
+			if (typeof(status) === 'object') {
 				callback = options;
 				options = status || {};
 				status = 'info';
 			}
 			ams.ajax.check(ams.notify,
 						   ams.baseURL + 'myams-notify' + ams.devext + '.js',
-						   function() {
-								switch (status) {
-									case 'error':
-									case 'danger':
-										options.color = '#C46A69';
-										break;
-									case 'warning':
-										options.color = '#C79121';
-										break;
-									case 'success':
-										options.color = '#739E73';
-										break;
-									default:
-										options.color = options.color || '#3276B1';
-								}
-								options.sound = false;
-								ams.notify.smallBox(options, callback);
+						   function () {
+							   switch (status) {
+								   case 'error':
+								   case 'danger':
+									   options.color = '#C46A69';
+									   break;
+								   case 'warning':
+									   options.color = '#C79121';
+									   break;
+								   case 'success':
+									   options.color = '#739E73';
+									   break;
+								   default:
+									   options.color = options.color || '#3276B1';
+							   }
+							   options.sound = false;
+							   ams.notify.smallBox(options, callback);
 						   });
 		},
 
@@ -3813,7 +4008,7 @@
 			var crumb = $('#ribbon OL.breadcrumb');
 			crumb.empty()
 				 .append($('<li></li>').append($('<a></a>').text(ams.i18n.HOME)
-				 										   .attr('href', $('nav a[href!="#"]:first').attr('href'))));
+														   .attr('href', $('nav a[href!="#"]:first').attr('href'))));
 			$('nav LI.active >A').each(function() {
 				var menu = $(this);
 				var body = $.trim(menu.clone()
@@ -3821,10 +4016,9 @@
 									  .remove()
 									  .end()
 									  .text());
-				var item = $("<li></li>").append(menu.attr('href').replace(/^#/, '')
-													? $("<a></a>").html(body)
-																  .attr('href', menu.attr('href'))
-													: body);
+				var item = $("<li></li>").append(menu.attr('href').replace(/^#/, '') ?
+												 $("<a></a>").html(body).attr('href', menu.attr('href'))
+												 : body);
 				crumb.append(item);
 			});
 		},
@@ -3839,22 +4033,25 @@
 				menu.addClass('open')
 					.addClass('active');
 				menu.parents('li').addClass('open active')
-								  .children('ul').addClass('active')
-												 .show();
+					.children('ul').addClass('active')
+					.show();
 				menu.parents('li:first').removeClass('open');
 				menu.parents('ul').addClass(menu.attr('href').replace(/^#/, '') ? 'active' : '')
-								  .show();
+					.show();
 			}
 
+			var menu;
 			var hash = location.hash;
 			var url = hash.replace(/^#/, '');
 			if (url) {
 				var container = $('#content');
-				if (!container.exists())
+				if (!container.exists()) {
 					container = $('body');
-				var menu = $('nav A[href="' + hash + '"]');
-				if (menu.exists())
+				}
+				menu = $('nav A[href="' + hash + '"]');
+				if (menu.exists()) {
 					updateActiveMenus(menu);
+				}
 				ams.skin.loadURL(url, container);
 				document.title = $('[data-ams-page-title]:first', container).data('ams-page-title') ||
 								 menu.attr('title') ||
@@ -3868,10 +4065,11 @@
 				}
 				if (menu.exists()) {
 					updateActiveMenus(menu);
-					if (active_url)
+					if (active_url) {
 						ams.skin._drawBreadCrumb();
-					else
+					} else {
 						window.location.hash = menu.attr('href');
+					}
 				}
 			}
 		},
@@ -3888,8 +4086,9 @@
 		 */
 		registerCleanCallback: function(callback) {
 			var callbacks = ams.skin._clean_callbacks;
-			if (callbacks.indexOf(callback) < 0)
+			if (callbacks.indexOf(callback) < 0) {
 				callbacks.push(callback);
+			}
 		},
 
 		/**
@@ -3897,7 +4096,7 @@
 		 */
 		cleanContainer: function(container) {
 			var callbacks = ams.skin._clean_callbacks;
-			for (var index in callbacks) {
+			for (var index=0; index < callbacks.length; index++) {
 				callbacks[index].call(container);
 			}
 		},
@@ -3909,7 +4108,7 @@
 			if (url.startsWith('#')) {
 				url = url.substr(1);
 			}
-			if (typeof(options) == 'function') {
+			if (typeof(options) === 'function') {
 				callback = options;
 				options = {};
 			}
@@ -3922,7 +4121,7 @@
 				beforeSend: function() {
 					ams.skin.cleanContainer(container);
 					container.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> Loading... </h1>');
-					if (container[0] == $('#content')[0]) {
+					if (container[0] === $('#content')[0]) {
 						ams.skin._drawBreadCrumb();
 						document.title = $('.breadcrumb LI:last-child').text();
 						$('html, body').animate({scrollTop: 0}, 'fast');
@@ -3931,9 +4130,9 @@
 					}
 				},
 				success: function(data, status, request) {
-					if (callback)
+					if (callback) {
 						ams.executeFunctionByName(callback, this, data, status, request, options);
-					else {
+					} else {
 						var request_data = ams.ajax.getResponse(request);
 						var data_type = request_data.content_type;
 						var result = request_data.data;
@@ -3947,8 +4146,11 @@
 							case 'xml':
 								break;
 							case 'html':
+								/* falls through */
 							case 'text':
+								/* falls through */
 							default:
+								// Show and init container
 								container.parents('.hidden').removeClass('hidden');
 								$('.alert', container.parents('.alerts-container')).remove();
 								container.css({opacity: '0.0'})
@@ -3957,6 +4159,14 @@
 										 .delay(50)
 										 .animate({opacity: '1.0'}, 300);
 								ams.initContent(container);
+								// Set focus to first input
+								var focused = $('[data-ams-focus-target]', container).first();
+								if (!focused.exists()) {
+									focused = $('input, select', container).first();
+								}
+								if (focused.exists()) {
+									focused.focus();
+								}
 						}
 						if (options && options.afterLoadCallback) {
 							ams.executeFunctionByName(options.afterLoadCallback, this);
@@ -4006,6 +4216,32 @@
 
 
 	/**
+	 * Statistics management
+	 */
+	MyAMS.stats = {
+
+		/**
+		 * Send event to Google Analytics platform
+		 *
+		 * @param category
+		 * @param action
+		 * @param label
+		 */
+		logEvent: function(category, action, label) {
+			if (typeof(globals._gaq) === 'undefined') {
+				return;
+			}
+			if (typeof(category) === 'object') {
+				action = category.action;
+				label = category.label;
+				category = category.category;
+			}
+			globals._gaq.push(['_trackEvent', category, action, label]);
+		}
+	};
+
+
+	/**
 	 * Main page initialization
 	 * This code is called only once to register global events and callbacks
 	 */
@@ -4026,7 +4262,7 @@
 			progressUpload: ams.ajax.progress,
 			xhr: function() {
 				var request = jquery_xhr();
-				if (request && (typeof(request.addEventListener) == "function")) {
+				if (request && (typeof(request.addEventListener) === "function")) {
 					var that = this;
 					request.addEventListener("progress", function(evt) {
 						that.progress(evt);
@@ -4076,8 +4312,8 @@
 		});
 
 		$(document).mouseup(function(e) {
-			if (!ams.shortcuts.is(e.target)
-				&& ams.shortcuts.has(e.target).length === 0) {
+			if (!ams.shortcuts.is(e.target) &&
+				ams.shortcuts.has(e.target).length === 0) {
 				ams.skin._hideShortcutButtons();
 			}
 		});
@@ -4101,7 +4337,7 @@
 				activity.addClass('active');
 			} else {
 				dropdown.fadeOut(150);
-				activity.removeClass('active')
+				activity.removeClass('active');
 			}
 			e.preventDefault();
 		});
@@ -4118,7 +4354,7 @@
 
 		$('input[name="activity"]').change(function() {
 			var url = $(this).data('ams-url');
-			container = $('.ajax-notifications');
+			var container = $('.ajax-notifications');
 			ams.skin.loadURL(url, container);
 		});
 
@@ -4135,9 +4371,9 @@
 				content : ams.i18n.LOGOUT_COMMENT,
 				buttons : '['+ams.i18n.BTN_NO+']['+ams.i18n.BTN_YES+']'
 			}, function(ButtonPressed) {
-				if (ButtonPressed == ams.i18n.BTN_YES) {
+				if (ButtonPressed === ams.i18n.BTN_YES) {
 					ams.root.addClass('animated fadeOutUp');
-					setTimeout(ams.skin.logout, 1000)
+					setTimeout(ams.skin.logout, 1000);
 				}
 			});
 		});
@@ -4162,7 +4398,7 @@
 				content: ams.i18n.CLEAR_STORAGE_CONTENT,
 				buttons: '['+ams.i18n.BTN_CANCEL+']['+ams.i18n.BTN_OK+']'
 			}, function(buttonPressed) {
-				if (buttonPressed == ams.i18n.BTN_OK && localStorage) {
+				if (buttonPressed === ams.i18n.BTN_OK && localStorage) {
 					localStorage.clear();
 					location.reload();
 				}
@@ -4175,8 +4411,9 @@
 			var element = $(this);
 			if (!element.is(e.target) &&
 				element.has(e.target).length === 0 &&
-				$('.popover').has(e.target).length === 0)
+				$('.popover').has(e.target).length === 0) {
 				element.popover('hide');
+			}
 		});
 
 		// Resize events
@@ -4200,15 +4437,16 @@
 			$(document).on('click', 'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])', function(e) {
 				var link = $(e.currentTarget);
 				var href = link.attr('href') || link.data('ams-url');
-				if (!href || href.startsWith('javascript:') || link.attr('target') || (link.data('ams-context-menu') === true))
+				if (!href || href.startsWith('javascript') || link.attr('target') || (link.data('ams-context-menu') === true)) {
 					return;
+				}
 				e.preventDefault();
 				e.stopPropagation();
 				var href_getter = ams.getFunctionByName(href);
-				if (typeof(href_getter) == 'function') {
+				if (typeof(href_getter) === 'function') {
 					href = href_getter.call(link);
 				}
-				if (typeof(href) == 'function') {
+				if (typeof(href) === 'function') {
 					// Javascript function call
 					href.call(link);
 				} else {
@@ -4223,17 +4461,19 @@
 					} else {
 						ams.form.confirmChangedForm(function () {
 							if (href.startsWith('#')) {
-								if (href != location.hash) {
+								if (href !== location.hash) {
 									if (ams.root.hasClass('mobile-view-activated')) {
 										ams.root.removeClass('hidden-menu');
 										window.setTimeout(function () {
 											window.location.hash = href;
 										}, 50);
-									} else
+									} else {
 										window.location.hash = href;
+									}
 								}
-							} else
+							} else {
 								window.location = href;
+							}
 						});
 					}
 				}
@@ -4257,14 +4497,17 @@
 		$(document).off('click.modal')
 				   .on('click', '[data-toggle="modal"]', function(e) {
 			var source = $(this);
-			if (source.data('ams-context-menu') === true)
+			if (source.data('ams-context-menu') === true) {
 				return;
-			if (source.data('ams-stop-propagation') === true)
+			}
+			if (source.data('ams-stop-propagation') === true) {
 				e.stopPropagation();
+			}
 			e.preventDefault();
 			ams.dialog.open(source);
-			if (source.parents('#shortcut').exists())
+			if (source.parents('#shortcut').exists()) {
 				setTimeout(ams.skin._hideShortcutButtons, 300);
+			}
 		});
 
 		// Initialize form buttons
@@ -4278,13 +4521,16 @@
 			var source = $(this);
 			var data = source.data();
 			if (data.amsClickHandler) {
-				if ((data.amsStopPropagation === true) || (data.amsClickStopPropagation === true))
+				if ((data.amsStopPropagation === true) || (data.amsClickStopPropagation === true)) {
 					e.stopPropagation();
-				if (data.amsClickKeepDefault !== true)
+				}
+				if (data.amsClickKeepDefault !== true) {
 					e.preventDefault();
+				}
 				var callback = ams.getFunctionByName(data.amsClickHandler);
-				if (callback !== undefined)
+				if (callback !== undefined) {
 					callback.call(source, data.amsClickHandlerOptions);
+				}
 			}
 		});
 
@@ -4293,11 +4539,13 @@
 			var source = $(this);
 			var data = source.data();
 			if (data.amsChangeHandler) {
-				if (data.amsChangeKeepDefault !== true)
+				if (data.amsChangeKeepDefault !== true) {
 					e.preventDefault();
+				}
 				var callback = ams.getFunctionByName(data.amsChangeHandler);
-				if (callback !== undefined)
+				if (callback !== undefined) {
 					callback.call(source, data.amsChangeHandlerOptions);
+				}
 			}
 		});
 
@@ -4307,6 +4555,14 @@
 			setTimeout(function() {
 				form.find('.select2').trigger('change');
 			}, 10);
+			// Set focus to first input
+			var focused = $('[data-ams-focus-target]', form).first();
+			if (!focused.exists()) {
+				focused = $('input, select', form).first();
+			}
+			if (focused.exists()) {
+				focused.focus();
+			}
 		});
 
 		// Initialize custom reset handlers
@@ -4314,11 +4570,13 @@
 			var form = $(this);
 			var data = form.data();
 			if (data.amsResetHandler) {
-				if (data.amsResetKeepDefault !== true)
+				if (data.amsResetKeepDefault !== true) {
 					e.preventDefault();
+				}
 				var callback = ams.getFunctionByName(data.amsResetHandler);
-				if (callback !== undefined)
+				if (callback !== undefined) {
 					callback.call(form, data.amsResetHandlerOptions);
+				}
 			}
 		});
 
@@ -4352,13 +4610,15 @@
 			var link = $(e.target);
 			var data = link.data();
 			if (data.amsUrl) {
-				if (data.amsTabLoaded)
+				if (data.amsTabLoaded) {
 					return;
+				}
 				try {
 					link.append('<i class="fa fa-spin fa-cog margin-left-5"></i>');
 					ams.skin.loadURL(data.amsUrl, link.attr('href'));
-					if (data.amsTabLoadOnce)
+					if (data.amsTabLoadOnce) {
 						link.data('ams-tab-loaded', true);
+					}
 				}
 				finally {
 					$('i', link).remove();
@@ -4368,8 +4628,9 @@
 
 		// Init page content
 		ams.initContent(document);
-		if (ams.ajax_nav && $('nav').exists())
+		if (ams.ajax_nav && $('nav').exists()) {
 			ams.skin.checkURL();
+		}
 
 		// Add unload event listener to check for modified forms
 		$(window).on('beforeunload', ams.form.checkBeforeUnload);
@@ -4403,10 +4664,11 @@
 		ams.form.init(element);
 
 		// Initialize widgets
-		if (ams.device === 'desktop')
+		if (ams.device === 'desktop') {
 			ams.skin._initDesktopWidgets(element);
-		else
+		} else {
 			ams.skin._initMobileWidgets(element);
+		}
 		ams.skin._setPageHeight();
 
 	};
@@ -4485,4 +4747,4 @@
 		}
 	});
 
-})(jQuery);
+})(jQuery, this);
--- a/src/ztfy/myams/resources/js/myams.min.js	Tue Nov 17 12:04:26 2015 +0100
+++ b/src/ztfy/myams/resources/js/myams.min.js	Tue Nov 17 12:05:38 2015 +0100
@@ -1,1 +1,1 @@
-(function(b){String.prototype.startsWith=function(e){var c=this.length;var d=e.length;if(c<d){return false}return(this.substr(0,d)==e)};String.prototype.endsWith=function(e){var c=this.length;var d=e.length;if(c<d){return false}return(this.substr(c-d)==e)};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(d){var c=this.length;var e=Number(arguments[1])||0;e=(e<0)?Math.ceil(e):Math.floor(e);if(e<0){e+=c}for(;e<c;e++){if(e in this&&this[e]===d){return e}}return -1}}b.expr[":"].econtains=function(e,c,d){return(e.textContent||e.innerText||b(e).text()||"").toLowerCase()==d[3].toLowerCase()};b.expr[":"].withtext=function(e,c,d){return(e.textContent||e.innerText||b(e).text()||"")==d[3]};b.expr[":"].parents=function(e,c,d){return b(e).parents(d[3]).length>0};if(b.scrollbarWidth===undefined){b.scrollbarWidth=function(){var d=b('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body");var e=d.children();var c=e.innerWidth()-e.height(99).innerWidth();d.remove();return c}}b.fn.extend({exists:function(){return b(this).length>0},objectOrParentWithClass:function(c){if(this.hasClass(c)){return this}else{return this.parents("."+c)}},listattr:function(d){var c=[];this.each(function(){c.push(b(this).attr(d))});return c},style:function(d,g,c){var f=this.get(0);if(typeof f=="undefined"){return}var e=this.get(0).style;if(typeof d!="undefined"){if(typeof g!="undefined"){c=typeof c!="undefined"?c:"";e.setProperty(d,g,c);return this}else{return e.getPropertyValue(d)}}else{return e}},removeClassPrefix:function(c){this.each(function(e,f){var d=f.className.split(" ").map(function(g){return g.startsWith(c)?"":g});f.className=b.trim(d.join(" "))});return this},contextMenu:function(d){function c(g,i,f){var h=b(window)[i](),j=b(d.menuSelector)[i](),e=g;if(g+j>h&&j<g){e-=j}return e}return this.each(function(){b("a",b(d.menuSelector)).each(function(){b(this).data("ams-context-menu",true)});b(this).on("contextmenu",function(f){if(f.ctrlKey){return}b(d.menuSelector).data("invokedOn",b(f.target)).show().css({position:"fixed",left:c(f.clientX,"width","scrollLeft")-10,top:c(f.clientY,"height","scrollTop")-10}).off("click").on("click",function(h){b(this).hide();var g=b(this).data("invokedOn");var i=b(h.target);d.menuSelected.call(this,g,i);a.event.stop(h)});return false});b(document).click(function(){b(d.menuSelector).hide()})})},myams_menu:function(c){var e={accordion:true,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'};var d=b.extend({},e,c);var f=b(this);f.find("LI").each(function(){var g=b(this);if(g.find("UL").size()>0){g.find("A:first").append("<b class='collapse-sign'>"+d.closedSign+"</b>");var h=g.find("A:first");if(h.attr("href")=="#"){h.click(function(){return false})}}});f.find("LI.active").each(function(){var g=b(this).parents("UL");var h=g.parent("LI");g.slideDown(d.speed);h.find("b:first").html(d.openedSign);h.addClass("open")});f.find("LI A").on("click",function(){var j=b(this);var g=j.parent().find("UL");if(d.accordion){var i=j.parent().parents("UL");var k=f.find("UL:visible");k.each(function(l){var m=true;i.each(function(n){if(i[n]==k[l]){m=false;return false}});if(m){if(g!=k[l]){b(k[l]).slideUp(d.speed,function(){j.parent("LI").find("b:first").html(d.closedSign);j.parent("LI").removeClass("open")})}}})}var h=j.parent().find("UL:first");if(!j.attr("href").replace(/^#/,"")&&h.is(":visible")&&!h.hasClass("active")){h.slideUp(d.speed,function(){j.parent("LI").removeClass("open").find("B:first").delay(d.speed).html(d.closedSign)})}else{h.slideDown(d.speed,function(){j.parent("LI").addClass("open").find("B:first").delay(d.speed).html(d.openedSign)})}})}});b.UTF8={encode:function(e){e=e.replace(/\r\n/g,"\n");var d="";for(var g=0;g<e.length;g++){var f=e.charCodeAt(g);if(f<128){d+=String.fromCharCode(f)}else{if((f>127)&&(f<2048)){d+=String.fromCharCode((f>>6)|192);d+=String.fromCharCode((f&63)|128)}else{d+=String.fromCharCode((f>>12)|224);d+=String.fromCharCode(((f>>6)&63)|128);d+=String.fromCharCode((f&63)|128)}}}return d},decode:function(d){var f="";var h=0,j=0,g=0,e=0;while(h<d.length){j=d.charCodeAt(h);if(j<128){f+=String.fromCharCode(j);h++}else{if((j>191)&&(j<224)){g=d.charCodeAt(h+1);f+=String.fromCharCode(((j&31)<<6)|(g&63));h+=2}else{g=d.charCodeAt(h+1);e=d.charCodeAt(h+2);f+=String.fromCharCode(((j&15)<<12)|((g&63)<<6)|(e&63));h+=3}}}return f}};if(window.MyAMS===undefined){window.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 a=MyAMS;MyAMS.baseURL=(function(){var c=b('script[src*="/myams.js"], script[src*="/myams.min.js"]');var d=c.attr("src");a.devmode=d.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return d.substring(0,d.lastIndexOf("/")+1)})();MyAMS.getQueryVar=function(e,f){if(e.indexOf("?")<0){return false}if(!e.endsWith("&")){e+="&"}var c=new RegExp(".*?[&\\?]"+f+"=(.*?)&.*");var d=e.replace(c,"$1");return d==e?false:d};MyAMS.rgb2hex=function(c){return"#"+b.map(c.match(/\b(\d+)\b/g),function(d){return("0"+parseInt(d).toString(16)).slice(-2)}).join("")};MyAMS.generateId=function(){function c(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return c()+c()+c()+c()};MyAMS.getFunctionByName=function(h,d){if(h===undefined){return undefined}else{if(typeof(h)=="function"){return h}}var g=h.split(".");var f=g.pop();d=(d===undefined||d===null)?window:d;for(var c=0;c<g.length;c++){try{d=d[g[c]]}catch(j){return undefined}}try{return d[f]}catch(j){return undefined}};MyAMS.executeFunctionByName=function(f,d){var e=a.getFunctionByName(f,window);if(typeof(e)=="function"){var c=Array.prototype.slice.call(arguments,2);return e.apply(d,c)}};MyAMS.getSource=function(c){return c.replace(/{[^{}]*}/g,function(d){return a.getFunctionByName(d.substr(1,d.length-2))})};MyAMS.getScript=function(d,g,c){var f={dataType:"script",url:a.getSource(d),success:g,error:a.error.show,cache:!a.devmode,async:typeof(g)=="function"};var e=b.extend({},f,c);return b.ajax(e)};MyAMS.getCSS=function(c,g){var e=b("HEAD");var d=b('link[data-ams-id="'+g+'"]',e);if(d.length==0){var f=a.getSource(c);if(a.devmode){f+="?_="+new Date().getTime()}b("<link />").attr({rel:"stylesheet",type:"text/css",href:f,"data-ams-id":g}).appendTo(e)}};MyAMS.event={stop:function(c){if(!c){c=window.event}if(c){if(c.stopPropagation){c.stopPropagation();c.preventDefault()}else{c.cancelBubble=true;c.returnValue=false}}}};MyAMS.browser={getInternetExplorerVersion:function(){var e=-1;if(navigator.appName=="Microsoft Internet Explorer"){var c=navigator.userAgent;var d=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(d.exec(c)!=null){e=parseFloat(RegExp.$1)}}return e},checkVersion:function(){var d="You're not using Windows Internet Explorer.";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=8){d="You're using a recent copy of Windows Internet Explorer."}else{d="You should upgrade your copy of Windows Internet Explorer."}}alert(d)},isIE8orlower:function(){var d="0";var c=this.getInternetExplorerVersion();if(c>-1){if(c>=9){d=0}else{d=1}}return d},copyToClipboard:function(){return function(){var c=b(this);c.parents(".btn-group").removeClass("open");window.prompt(MyAMS.i18n.CLIPBOARD_COPY,c.text())}}};MyAMS.error={ajax:function(f,e){if(e.statusText=="OK"){return}var c=a.ajax.getResponse(e);if(c.content_type=="json"){a.ajax.handleJSON(c.data)}else{var g=f.statusText||f.type;var d=e.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+g+"</h4><p>"+d+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(window.console){console.error(f);console.debug(e)}},show:function(f,c,e){if(!e){return}var d=a.ajax.getResponse(f);if(d.content_type=="json"){a.ajax.handleJSON(d.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"<h4>"+c+"</h4><p>"+e+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(window.console){console.error(e);console.debug(f)}}};MyAMS.ajax={check:function(d,f,h,c){if(typeof(h)=="object"){c=h;h=undefined}var g={async:typeof(h)=="function"};var e=b.extend({},g,c);if(d===undefined){a.getScript(f,function(){if(typeof(h)=="function"){h(true,c)}},e)}else{if(typeof(h)=="function"){h(false,c)}}},getAddr:function(d){var c=d||b("HTML HEAD BASE").attr("href")||window.location.href;return c.substr(0,c.lastIndexOf("/")+1)},start:function(){b("#ajax-gear").show()},stop:function(){b("#ajax-gear").hide()},progress:function(c){if(!c.lengthComputable){return}if(c.loaded>=c.total){return}console.log(parseInt((c.loaded/c.total*100),10)+"%")},post:function(e,g,d,j){if(e.startsWith(window.location.protocol)){var i=e}else{i=this.getAddr()+e}if(typeof(d)=="function"){j=d;d={}}else{if(!d){d={}}}if(typeof(j)=="undefined"){j=d.callback}if(typeof(j)=="string"){j=a.getFunctionByName(j)}delete d.callback;var c=undefined;var h={url:i,type:"post",cache:false,async:typeof(j)=="function",data:b.param(g),dataType:"json",success:j||function(k){c=k.result},error:a.error.show};var f=b.extend({},h,d);b.ajax(f);return c},getResponse:function(f){var d=f.getResponseHeader("content-type"),h,c;if(d){if(d.startsWith("application/javascript")){h="script";c=f.responseText}else{if(d.startsWith("text/html")){h="html";c=f.responseText}else{if(d.startsWith("text/xml")){h="xml";c=f.responseText}else{c=f.responseJSON;if(c){h="json"}else{try{c=JSON.parse(f.responseText);h="json"}catch(g){c=f.responseText;h="text"}}}}}}else{h="json";c={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:h,data:c}},handleJSON:function(n,e,j){var h=n.status;var c;switch(h){case"alert":alert(n.alert.title+"\n\n"+n.alert.content);break;case"error":a.form.showErrors(e,n);break;case"info":case"success":if(n.close_form!=false){a.dialog.close(e)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(n.close_form!=false){a.dialog.close(e)}break;case"modal":a.dialog.open(n.location);break;case"reload":if(n.close_form!=false){a.dialog.close(e)}c=n.location||window.location.hash;if(c.startsWith("#")){c=c.substr(1)}a.skin.loadURL(c,n.target||j||"#content");break;case"redirect":if(n.close_form==true){a.dialog.close(e)}c=n.location||window.location.href;if(n.window){window.open(c,n.window,n.options)}else{if(window.location.href==c){window.location.reload(true)}else{window.location.href=c}}break;default:console.log("Unhandled status: "+h);break}if(n.content){var k=n.content;var d=b(k.target||j||e||"#content");if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}if(n.contents){var g=n.contents;for(var i in g){k=g[i];d=b(k.target);if(k.raw==true){d.text(k.text)}else{d.html(k.html);a.initContent(d)}if(!k.keep_hidden){d.removeClass("hidden")}}}if(n.message){var m=n.message;if(typeof(m)=="string"){if((h=="info")||(h=="success")){a.skin.smallBox(h,{title:m,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(b(e||"#content"),h,m)}}else{a.skin.alert(b(m.target||j||e||"#content"),m.status||"success",m.header,m.body,m.subtitle)}}if(n.smallbox){a.skin.smallBox(n.smallbox_status||h,{title:n.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(n.messagebox){m=n.messagebox;if(typeof(m)=="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:m,timeout:10000})}else{var f=m.status||"info";if(f=="error"&&e&&j){a.executeFunctionByName(e.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",e,j)}a.skin.messageBox(f,{title:m.title||a.i18n.ERROR_OCCURED,content:m.content,icon:m.icon,number:m.number,timeout:m.timeout==null?undefined:(m.timeout||10000)})}}if(n.event){e.trigger(n.event,n.event_options)}if(n.callback){a.executeFunctionByName(n.callback,e,n.options)}if(n.callbacks){for(i in n.callbacks){if(!b.isNumeric(i)){continue}var l=n.callbacks[i];a.executeFunctionByName(l,e,l.options)}}}};MyAMS.jsonrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},query:function(d,f,c,e){a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var i={};if(typeof(d)=="string"){i.query=d}else{if(typeof(d)=="object"){b.extend(i,d)}}b.extend(i,c);var h={url:a.jsonrpc.getAddr(c.url),type:"post",cache:false,method:f,params:i,async:typeof(e)=="function",success:e||function(j){g=j.result},error:a.error.show};b.jsonRpc(h);return g})},post:function(f,d,c,e){a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){var g;if(typeof(c)=="function"){e=c;c={}}else{if(!c){c={}}}if(typeof(e)=="undefined"){e=c.callback}if(typeof(e)=="string"){e=a.getFunctionByName(e)}delete c.callback;var g;var i={url:a.jsonrpc.getAddr(c.url),type:"post",cache:false,method:f,params:d,async:typeof(e)=="function",success:e||function(j){g=j.result},error:a.error.show};var h=b.extend({},i,c);b.jsonRpc(h);return g})}};MyAMS.xmlrpc={getAddr:function(e){var c=e||b("HTML HEAD BASE").attr("href")||window.location.href;var d=c.replace(/\+\+skin\+\+\w+\//,"");return d.substr(0,d.lastIndexOf("/")+1)},post:function(d,g,e,c,f){a.ajax.check(b.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+a.devext+".js",function(){var h;if(typeof(c)=="function"){f=c;c={}}else{if(!c){c={}}}if(typeof(f)=="undefined"){f=c.callback}if(typeof(f)=="string"){f=a.getFunctionByName(f)}delete c.callback;var j={url:a.xmlrpc.getAddr(d),methodName:g,params:e,success:f||function(k){h=k},error:a.error.show};var i=b.extend({},j,c);b.xmlrpc(i);return h})}};MyAMS.form={init:function(d){if(a.warn_on_form_change){var c=b('FORM[data-ams-warn-on-change!="false"]',d)}else{c=b('FORM[data-ams-warn-on-change="true"]',d)}c.each(function(){var e=b(this);b('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',e).each(function(){var g=b(this);if(g.data("ams-ignore-change")!==true){var f=g.data("ams-changed-event")||"change";g.on(f,function(){b(this).parents("FORM").attr("data-ams-form-changed",true)})}});e.on("reset",function(){b(this).removeAttr("data-ams-form-changed")})})},checkBeforeUnload:function(){var c=b('FORM[data-ams-form-changed="true"]');if(c.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(d,e){if(typeof(d)=="function"){e=d;d=undefined}var c=b('FORM[data-ams-form-changed="true"]',d);if(c.exists()){a.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(f){if(f==a.i18n.BTN_OK){e.call(d)}})}else{e.call(d)}},submit:function(e,d,f){e=b(e);if(!e.exists()){return false}if(typeof(d)=="object"){f=d;d=undefined}if(e.data("submitted")){if(!e.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:e.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(e)){return false}b(".alert, SPAN.state-error",e).remove();b(".state-error",e).removeClassPrefix("state-");var c=b(e.data("ams-submit-button"));if(c&&!c.data("ams-form-hide-loading")){c.button("loading")}a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function i(k,m){var j;var C=k.data();var t=C.amsFormOptions;if(f){var o=f.formDataInitCallback}if(o){delete f.formDataInitCallback}else{o=C.amsFormDataInitCallback}if(o){var u={};if(typeof(o)=="function"){var l=o.call(k,u)}else{l=a.executeFunctionByName(o,k,u)}if(u.veto){j=k.data("ams-submit-button");if(j){j.button("reset")}a.form.finalizeSubmitFooter.call(k);return false}}else{l=C.amsFormData||{}}j=b(k.data("ams-submit-button"));var v,y;if(j){v=j.data("ams-form-handler");y=j.data("ams-form-submit-target")}var r=d||v||C.amsFormHandler||"";if(r.startsWith(window.location.protocol)){var n=r}else{var x=k.attr("action").replace(/#/,"");if(x.startsWith(window.location.protocol)){n=x}else{n=a.ajax.getAddr()+x}n+=r}var B=null;if(C.amsFormInitSubmitTarget){B=b(y||C.amsFormSubmitTarget||"#content");a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmit",k,B)}else{if(!C.amsFormHideSubmitFooter){a.executeFunctionByName(C.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",k)}}var p=typeof(m.uuid)!="undefined";if(p){if(n.indexOf("X-Progress-ID")<0){n+="?X-Progress-ID="+m.uuid}delete m.uuid}var s={url:n,type:"post",cache:false,data:l,dataType:C.amsFormDatatype,beforeSerialize:function(){if(typeof(tinyMCE)!="undefined"){tinyMCE.triggerSave()}},beforeSubmit:function(E,D){D.data("submitted",true)},error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},iframe:p};var w=C.amsFormDownloadTarget;if(w){var q=b('iframe[name="'+w+'"]');if(!q.exists()){q=b("<iframe></iframe>").hide().attr("name",w).appendTo(k)}s=b.extend({},s,{iframe:true,iframeTarget:q,success:function(D,E,I,H){var G=b(H).parents(".modal-dialog");if(G.exists()){a.dialog.close(H)}else{var J;var F=H.data("ams-submit-button");if(F){J=F.data("ams-form-submit-callback")}if(!J){J=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}J.call(H,D,E,I,H);if(H.is(":visible")&&F){F.button("reset")}H.data("submitted",false);H.removeData("ams-submit-button");H.removeAttr("data-ams-form-changed")}}})}else{s=b.extend({},s,{error:function(H,D,E,G){if(B){a.executeFunctionByName(C.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",G,B)}if(G.is(":visible")){var F=G.data("ams-submit-button");if(F){F.button("reset")}a.form.finalizeSubmitFooter.call(G)}G.data("submitted",false);G.removeData("ams-submit-button")},success:function(D,E,H,G){var I;var F=G.data("ams-submit-button");if(F){I=F.data("ams-form-submit-callback")}if(!I){I=a.getFunctionByName(C.amsFormSubmitCallback)||a.form._submitCallback}I.call(G,D,E,H,G);if(G.is(":visible")&&F){F.button("reset")}G.data("submitted",false);G.removeData("ams-submit-button");G.removeAttr("data-ams-form-changed")},iframe:p})}var A=b.extend({},s,m,t,f);b(k).ajaxSubmit(A);if(w){var z=b(k).parents(".modal-dialog");if(z.exists()){a.dialog.close(k)}else{a.form.finalizeSubmitFooter.call(k);if(j){j.button("reset")}k.data("submitted",false);k.removeData("ams-submit-button");k.removeAttr("data-ams-form-changed")}}}var h=b('INPUT[type="file"]',e).length>0;if(h){a.ajax.check(b.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var g=b.extend({},{uuid:b.progressBar.submit(e)});i(e,g)}else{i(e,{})}});return false},initSubmit:function(e,d){var c=b(this);var f='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!d){d=c.data("ams-form-submit-message")}if(d){f+="<strong>"+d+"</strong>"}b(e).html('<div class="row margin-20"><div class="text-center">'+f+"</div></div>");b(e).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(c){b("i",c).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(d){var c=b(this);var f='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!d){d=b(this).data("ams-form-submit-message")}if(d){f+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+d+"</strong>"}var e=b("footer",c);b("button",e).hide();e.append('<div class="row"><div class="text-center">'+f+"</div></div>")},finalizeSubmitFooter:function(){var c=b(this);var d=b("footer",c);if(d){b(".row",d).remove();b("button",d).show()}},_submitCallback:function(m,e,d,c){if(c.is(":visible")){a.form.finalizeSubmitFooter.call(c);var g=c.data("ams-submit-button");if(g){g.button("reset")}}var f=c.data();if(f.amsFormDatatype){var j=f.amsFormDatatype}else{var h=a.ajax.getResponse(d);j=h.content_type;m=h.data}if(g){var i=b(g.amsFormSubmitTarget||f.amsFormSubmitTarget||"#content")}else{i=b(f.amsFormSubmitTarget||"#content")}switch(j){case"json":a.ajax.handleJSON(m,c,i);break;case"script":break;case"xml":break;case"html":case"text":default:if(g&&(g.data("ams-keep-modal")!==true)){a.dialog.close(c)}if(!i.exists()){i=b("body")}i.parents(".hidden").removeClass("hidden");b(".alert",i.parents(".alerts-container")).remove();i.css({opacity:"0.0"}).html(m).delay(50).animate({opacity:"1.0"},300);a.initContent(i)}var k=d.getResponseHeader("X-AMS-Callback");if(k){var l=d.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(k,c,l===undefined?{}:JSON.parse(l),d)}},_getSubmitValidators:function(d){var c=new Array();var e=d.data("ams-form-validator");if(e){c.push([d,e])}b("[data-ams-form-validator]",d).each(function(){var f=b(this);c.push([f,f.data("ams-form-validator")])});return c},_checkSubmitValidators:function(e){var g=a.form._getSubmitValidators(e);if(!g.length){return true}var f=new Array();var l=true;for(var i in g){if(!b.isNumeric(i)){continue}var d=g[i];var c=d[0];var j=d[1];var k=a.executeFunctionByName(j,e,c);if(k===false){l=false}else{if(typeof(k)=="string"){f.push(k)}else{if(l.length&&(l.length>0)){f=f.concat(l)}}}}if(f.length>0){var h=f.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"danger",h,f);return false}else{return l}},showErrors:function(c,j){if(typeof(j)=="string"){a.skin.alert(c,"error",a.i18n.ERROR_OCCURED,j)}else{if(j instanceof Array){var f=j.length==1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(c,"error",f,j)}else{b(".state-error",c).removeClass("state-error");f=j.error_header||(j.widgets&&(j.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var k=new Array();var i;for(i in j.messages){if(!b.isNumeric(i)){continue}if(j.messages[i].header){k.push("<strong>"+j.messages[i].header+"</strong><br />"+j.messages[i].message)}else{k.push(j.messages[i].message||j.messages[i])}}for(i in j.widgets){if(!b.isNumeric(i)){continue}var d=j.widgets[i];var g=b('[name="'+d.name+'"]',c);g.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+d.message+"</span>");if(d.label){k.push(d.label+" : "+d.message)}var h=g.parents(".tab-pane").index()+1;if(h>0){var e=b(".nav-tabs",b(g).parents(".tabforms"));b("li:nth-child("+h+")",e).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",c).click()}}a.skin.alert(c,j.error_level||"error",f,k,j.error_message)}}}};MyAMS.dialog={_shown_callbacks:[],registerShownCallback:function(f,d){var c;if(d){c=d.objectOrParentWithClass("modal-dialog")}if(c&&c.exists()){var e=c.data("shown-callbacks");if(e===undefined){e=[];c.data("shown-callbacks",e)}}else{e=a.dialog._shown_callbacks}if(e.indexOf(f)<0){e.push(f)}},_hide_callbacks:[],registerHideCallback:function(f,d){var c;if(d){c=d.objectOrParentWithClass("modal-dialog")}if(c&&c.exists()){var e=c.data("hide-callbacks");if(e===undefined){e=[];c.data("hide-callbacks",e)}}else{e=a.dialog._hide_callbacks}if(e.indexOf(f)<0){e.push(f)}},open:function(d,c){a.ajax.check(b.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(b.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(h){if(h){b(document).off("click.modal");b.fn.modal.defaults.spinner=b.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>'}if(typeof(d)=="string"){var g={};var f=d}else{g=d.data();f=d.attr("href")||g.amsUrl;var e=a.getFunctionByName(f);if(typeof(e)=="function"){f=e.call(d)}}if(!f){return}b("body").modalmanager("loading");if(f.indexOf("#")==0){b(f).modal("show")}else{b.ajax({url:f,type:"get",cache:g.amsAllowCache===undefined?false:g.amsAllowCache,data:c,success:function(l,k,j){b("body").modalmanager("removeLoading");var m=a.ajax.getResponse(j);var r=m.content_type;var s=m.data;switch(r){case"json":a.ajax.handleJSON(s,b(b(d).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var n=b(s);var p=b(".modal-dialog",n.wrap("<div></div>").parent());var o=p.data();var q={overflow:o.amsModalOverflow||".modal-viewport",maxHeight:o.amsModalMaxHeight===undefined?function(){return b(window).height()-b(".modal-header",n).outerHeight(true)-b("footer",n).outerHeight(true)-85}:a.getFunctionByName(o.amsModalMaxHeight)};var i=b.extend({},q,o.amsModalOptions);i=a.executeFunctionByName(o.amsModalInitCallback,p,i)||i;b("<div>").addClass("modal fade").append(n).modal(i).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(n)}}})}})})},shown:function(k){function j(m){var n=b(".scrollmarker.top",c);var l=c.scrollTop();if(l>0){n.show()}else{n.hide()}var e=b(".scrollmarker.bottom",c);if(h+l>=c.get(0).scrollHeight){e.hide()}else{e.show()}}var i=k.target;var c=b(".modal-viewport",i);if(c.exists()){var h=parseInt(c.css("max-height"));var f=b.scrollbarWidth();if(c.height()==h){b("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",c.width()-f).hide().appendTo(c);b("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",h-20).css("width",c.width()-f).appendTo(c);c.scroll(j);c.off("resize").on("resize",j)}else{b(".scrollmarker",c).remove()}}var g=b(".modal-dialog",i).data("shown-callbacks");if(g){for(var d in g){g[d].call(i)}}g=a.dialog._shown_callbacks;for(d in g){g[d].call(i)}},close:function(d){var e=d.parents(".modal").data("modal");if(e){var c=b("body").data("modalmanager");if(c&&(c.getOpenModals().indexOf(e)>=0)){e.hide()}}},hidden:function(g){var f=g.target;a.skin.cleanContainer(f);var d=b(".modal-dialog",f).data("hide-callbacks");if(d){for(var c in d){d[c].call(f)}}d=a.dialog._hide_callbacks;for(c in d){d[c].call(f)}}};MyAMS.helpers={select2ClearSelection:function(){var d=b(this);var c=d.parents("label");var e=d.data("ams-select2-target");b('[name="'+e+'"]',c).data("select2").val("")},select2FormatSelection:function(d,c){if(d instanceof Array){b(d).each(function(){if(typeof(this)=="object"){c.append(this.text)}else{c.append(this)}})}else{if(typeof(d)=="object"){c.append(d.text)}else{c.append(d)}}},select2QueryUrlResultsCallback:function(e,d,c){switch(e.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+e.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(result.location);break;default:return{results:e.results||e,more:e.has_more||false,context:e.context}}},select2QueryMethodSuccessCallback:function(g,d,f){var c=g.result;if(typeof(c)=="string"){try{c=JSON.parse(c)}catch(h){}}switch(c.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+c.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":b(this).data("select2").dropdown.hide();a.dialog.open(c.location);break;default:f.callback({results:c.results||c,more:c.has_more||false,context:c.context})}},contextMenuHandler:function(f,g){var c=g.data();if(c.toggle=="modal"){a.dialog.open(g)}else{var d=g.attr("href")||c.amsUrl;if(!d||d.startsWith("javascript:")||g.attr("target")){return}a.event.stop();var e=a.getFunctionByName(d);if(typeof(e)=="function"){d=e.call(g,f)}if(typeof(d)=="function"){d.call(g,f)}else{d=d.replace(/\%23/,"#");var f=g.data("ams-target");if(f){a.form.confirmChangedForm(f,function(){a.skin.loadURL(d,f,g.data("ams-link-options"),g.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(d.startsWith("#")){if(d!=location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=d},150)}else{window.location.hash=d}}}else{window.location=d}})}}}},datetimepickerDialogHiddenCallback:function(){b(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};MyAMS.plugins={init:function(e){a.plugins.initData(e);var f=new Array();b("[data-ams-plugins-disabled]",e).each(function(){var h=b(this).data("ams-plugins-disabled").split(/\s+/);for(var i in h){f.push(h[i])}});var d;b("[data-ams-plugins]",e).each(function(){var l=b(this);var h={};if(typeof(l.data("ams-plugins"))==="string"){var m=l.data("ams-plugins").split(/\s+/);for(var j in m){d=m[j];var i={src:l.data("ams-plugin-"+d+"-src"),css:l.data("ams-plugin-"+d+"-css"),callback:l.data("ams-plugin-"+d+"-callback"),register:l.data("ams-plugin-"+d+"-register"),async:l.data("ams-plugin-"+d+"-async")};h[d]=i}}else{h=l.data("ams-plugins")}for(d in h){if(a.plugins.enabled[d]===undefined){var k=h[d];a.getScript(k.src,function(){var p=k.callback;if(p){var o=a.getFunctionByName(p);if(k.register!==false){a.plugins.enabled[d]=o}}else{if(k.register!==false){a.plugins.enabled[d]=null}}var n=k.css;if(n){a.getCSS(n,d+"_css")}},{async:k.async===undefined?true:k.async})}}});for(var c in a.plugins.enabled){if(f.indexOf(c)>=0){continue}var g=a.plugins.enabled[c];if(typeof(g)=="function"){g(e)}}},initData:function(c){b("[data-ams-data]",c).each(function(){var e=b(this);var f=e.data("ams-data");for(var d in f){e.attr("data-"+d,f[d])}})},register:function(d,c,f){if(typeof(c)=="function"){f=c;c=null}c=c||d.name;if(a.plugins.enabled.indexOf(c)>=0){if(window.console){console.warn("Plugin "+c+" is already registered!")}return}if(typeof(d)=="object"){var e=d.src;if(e){a.ajax.check(d.callback,e,function(g){if(g){a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}})}else{a.plugins.enabled[c]=a.getFunctionByName(d.callback);if(d.css){a.getCSS(d.css,c+"_css")}if(f){a.executeFunctionByName(f)}}}else{if(typeof(d)=="function"){a.plugins.enabled[c]=d;if(f){a.executeFunctionByName(f)}}}},enabled:{hint:function(c){var d=b(".hint:not(:parents(.nohints))",c);if(d.length>0){a.ajax.check(b.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");d.each(function(){var i=b(this);var h=i.data();var f={html:h.amsHintHtml,title:a.getFunctionByName(h.amsHintTitleGetter)||function(){var j=b(this);return j.attr("original-title")||j.attr(h.amsHintTitleAttr||"title")||(h.amsHintHtml?j.html():j.text())},opacity:h.amsHintOpacity||0.95,gravity:h.amsHintGravity||"sw",offset:h.amsHintOffset||0};var e=b.extend({},f,h.amsHintOptions);e=a.executeFunctionByName(h.amsHintInitCallback,i,e)||e;var g=i.tipsy(e);a.executeFunctionByName(h.amsHintAfterInitCallback,i,g,e)})})}},contextMenu:function(c){var d=b(".context-menu",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={menuSelector:h.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var e=b.extend({},f,h.amsContextmenuOptions);e=a.executeFunctionByName(h.amsContextmenuInitCallback,i,e)||e;var g=i.contextMenu(e);a.executeFunctionByName(h.amsContextmenuAfterInitCallback,i,g,e)})}},switcher:function(c){b("LEGEND.switcher",c).each(function(){var e=b(this);var d=e.parent("fieldset");var f=e.data();if(!f.amsSwitcher){b('<i class="fa fa-fw"></i>').prependTo(b(this)).addClass(f.amsSwitcherState=="open"?(f.amsSwitcherMinusClass||"fa-minus"):(f.amsSwitcherPlusClass||"fa-plus"));e.on("click",function(h){h.preventDefault();var g={};e.trigger("ams.switcher.before-switch",[e,g]);if(g.veto){return}if(d.hasClass("switched")){d.removeClass("switched");b(".fa",e).removeClass(f.amsSwitcherPlusClass||"fa-plus").addClass(f.amsSwitcherMinusClass||"fa-minus");e.trigger("ams.switcher.opened",[e]);var i=e.attr("id");if(i){b('legend.switcher[data-ams-switcher-sync="'+i+'"]',d).each(function(){var j=b(this);if(j.parents("fieldset").hasClass("switched")){j.click()}})}}else{d.addClass("switched");b(".fa",e).removeClass(f.amsSwitcherMinusClass||"fa-minus").addClass(f.amsSwitcherPlusClass||"fa-plus");e.trigger("ams.switcher.closed",[e])}});if(f.amsSwitcherState!="open"){d.addClass("switched")}e.data("ams-switcher","on")}})},checker:function(c){b("LEGEND.checker",c).each(function(){var o=b(this);var p=o.parent("fieldset");var f=o.data();if(!f.amsChecker){var d=b('<label class="checkbox"></label>');var i=f.amsCheckerFieldname||("checker_"+a.generateId());var m=i.replace(/\./,"_");var g=f.amsCheckerHiddenPrefix;var h=null;var l=f.amsCheckerHiddenValueOn||"true";var j=f.amsCheckerHiddenValueOff||"false";var e=f.amsCheckerMarker||false;if(g){h=b('<input type="hidden">').attr("name",g+i).val(f.amsCheckerState=="on"?l:j).prependTo(o)}else{if(e){b('<input type="hidden">').attr("name",e).attr("value",1).prependTo(o)}}var n=b('<input type="checkbox">').attr("name",i).attr("id",m).data("ams-checker-hidden-input",h).data("ams-checker-init",true).val(f.amsCheckerValue||true).attr("checked",f.amsCheckerState=="on"?"checked":null);if(f.amsCheckerReadonly){n.attr("disabled","disabled")}else{n.on("change",function(s){s.preventDefault();var q={};var t=b(this).is(":checked");o.trigger("ams.checker.before-switch",[o,q]);if(q.veto){b(this).prop("checked",!t);return}a.executeFunctionByName(f.amsCheckerChangeHandler,o,t);if(!f.amsCheckerCancelDefault){var r=n.data("ams-checker-hidden-input");if(t){if(f.amsCheckerMode=="disable"){p.removeAttr("disabled")}else{p.removeClass("switched")}if(r){r.val(l)}b("[data-required]",p).attr("required","required");o.trigger("ams.checker.opened",[o])}else{if(f.amsCheckerMode=="disable"){p.prop("disabled","disabled")}else{p.addClass("switched")}if(r){r.val(j)}b("[data-required]",p).removeAttr("required");o.trigger("ams.checker.closed",[o])}}})}n.appendTo(d);b(">label",o).attr("for",n.attr("id"));d.append("<i></i>").prependTo(o);var k=b("[required]",p);k.attr("data-required",true);if(f.amsCheckerState=="on"){n.attr("checked",true)}else{if(f.amsCheckerMode=="disable"){p.attr("disabled","disabled")}else{p.addClass("switched")}k.removeAttr("required")}o.data("ams-checker","on")}})},slider:function(c){var d=b(".slider",c);if(d.length>0){a.ajax.check(b.fn.slider,a.baseURL+"ext/bootstrap-slider.min.js",function(){d.each(function(){var h=b(this);var i=h.data();var f={};var e=b.extend({},f,h.data.amsSliderOptions);e=a.executeFunctionByName(i.amsSliderInitCallback,h,e)||e;var g=h.slider(e);a.executeFunctionByName(i.amsSliderAfterInitCallback,h,g,e)})})}},draggable:function(d){var c=b(".draggable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={containment:i.amsDraggableContainment,helper:a.getFunctionByName(i.amsDraggableHelper)||i.amsDraggableHelper,start:a.getFunctionByName(i.amsDraggableStart),stop:a.getFunctionByName(i.amsDraggableStop)};var f=b.extend({},g,i.amsDraggableOptions);f=a.executeFunctionByName(i.amsDraggableInitCallback,e,f)||f;var h=e.draggable(f);e.disableSelection();a.executeFunctionByName(i.amsDraggableAfterInitCallback,e,h,f)})}},sortable:function(c){var d=b(".sortable",c);if(d.length>0){d.each(function(){var i=b(this);var h=i.data();var f={items:h.amsSortableItems,handle:h.amsSortableHandle,connectWith:h.amsSortableConnectwith,start:a.getFunctionByName(h.amsSortableStart),over:a.getFunctionByName(h.amsSortableOver),containment:h.amsSortableContainment,placeholder:h.amsSortablePlaceholder,stop:a.getFunctionByName(h.amsSortableStop)};var e=b.extend({},f,h.amsSortableOptions);e=a.executeFunctionByName(h.amsSortableInitCallback,i,e)||e;var g=i.sortable(e);i.disableSelection();a.executeFunctionByName(h.amsSortableAfterInitCallback,i,g,e)})}},resizable:function(d){var c=b(".resizable",d);if(c.length>0){c.each(function(){var e=b(this);var i=e.data();var g={autoHide:i.amsResizableAutohide===false?true:i.amsResizableAutohide,containment:i.amsResizableContainment,grid:i.amsResizableGrid,handles:i.amsResizableHandles,start:a.getFunctionByName(i.amsResizableStart),stop:a.getFunctionByName(i.amsResizableStop)};var f=b.extend({},g,i.amsResizableOptions);f=a.executeFunctionByName(i.amsResizableInitCallback,e,f)||f;var h=e.resizable(f);e.disableSelection();a.executeFunctionByName(i.amsResizableAfterInitCallback,e,h,f)})}},typeahead:function(d){var c=b(".typeahead",d);if(c.length>0){a.ajax.check(b.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){c.each(function(){var e=b(this);var i=e.data();var g={};var f=b.extend({},g,i.amsTypeaheadOptions);f=a.executeFunctionByName(i.amsTypeaheadInitCallback,e,f)||f;var h=e.typeahead(f);a.executeFunctionByName(i.amsTypeaheadAfterInitCallback,e,h,f)})})}},select2:function(d){var c=b(".select2",d);if(c.length>0){a.ajax.check(b.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){c.each(function(){var e=b(this);var j=e.data();var h={placeholder:j.amsSelect2Placeholder,multiple:j.amsSelect2Multiple,minimumInputLength:j.amsSelect2MinimumInputLength||0,maximumSelectionSize:j.amsSelect2MaximumSelectionSize,openOnEnter:j.amsSelect2EnterOpen===undefined?true:j.amsSelect2EnterOpen,allowClear:j.amsSelect2AllowClear===undefined?true:j.amsSelect2AllowClear,width:j.amsSelect2Width||"100%",initSelection:a.getFunctionByName(j.amsSelect2InitSelection),formatSelection:j.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(j.amsSelect2FormatSelection),formatResult:a.getFunctionByName(j.amsSelect2FormatResult),formatMatches:j.amsSelect2FormatMatches===undefined?function(k){if(k==1){return a.i18n.SELECT2_MATCH}else{return k+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(j.amsSelect2FormatMatches),formatNoMatches:j.amsSelect2FormatResult===undefined?function(k){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(j.amsSelect2FormatResult),formatInputTooShort:j.amsSelect2FormatInputTooShort===undefined?function(k,l){var m=l-k.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooShort),formatInputTooLong:j.amsSelect2FormatInputTooLong===undefined?function(l,k){var m=l.length-k;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,m).replace(/\{1\}/,m==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatInputTooLong),formatSelectionTooBig:j.amsSelect2FormatSelectionTooBig===undefined?function(k){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,k).replace(/\{1\}/,k==1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(j.amsSelect2FormatSelectionTooBig),formatLoadMore:j.amsSelect2FormatLoadMore===undefined?function(k){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(j.amsSelect2FormatLoadMore),formatSearching:j.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(j.amsSelect2FormatSearching),separator:j.amsSelect2Separator||",",tokenSeparators:j.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(j.amsSelect2Tokenizer)};switch(e.context.type){case"text":case"hidden":if(!h.initSelection){var f=e.data("ams-select2-values");if(f){h.initSelection=function(k,m){var l=[];b(k.val().split(h.separator)).each(function(){l.push({id:this,text:f[this]||this})});m(l)}}}break;default:break}if(e.attr("readonly")){if(e.attr("type")=="hidden"){h.query=function(){return[]}}}else{if(j.amsSelect2Query){h.query=a.getFunctionByName(j.amsSelect2Query);h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryUrl){h.ajax={url:j.amsSelect2QueryUrl,quietMillis:j.amsSelect2QuietMillis||200,type:j.amsSelect2QueryType||"POST",dataType:j.amsSelect2QueryDatatype||"json",data:function(m,n,l){var k={};k[j.amsSelect2QueryParamName||"query"]=m;k[j.amsSelect2PageParamName||"page"]=n;k[j.amsSelect2ContextParamName||"context"]=l;return b.extend({},k,j.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2QueryMethod){h.query=function(k){var l={url:j.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:j.amsSelect2MethodType||"POST",cache:false,method:j.amsSelect2QueryMethod,params:j.amsSelect2QueryParams||{},success:function(n,m){return a.helpers.select2QueryMethodSuccessCallback.call(e,n,m,k)},error:a.error.show};l.params[j.amsSelect2QueryParamName||"query"]=k.term;l.params[j.amsSelect2PageParamName||"page"]=k.page;l.params[j.amsSelect2ContextParamName||"context"]=k.context;l=b.extend({},l,j.amsSelect2QueryOptions);l=a.executeFunctionByName(j.amsSelect2QueryInitCallback,e,l)||l;a.ajax.check(b.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){b.jsonRpc(l)})};h.minimumInputLength=j.amsSelect2MinimumInputLength||1}else{if(j.amsSelect2Tags){h.tags=j.amsSelect2Tags}else{if(j.amsSelect2Data){h.data=j.amsSelect2Data}}}}}}if(j.amsSelect2EnableFreeTags){h.createSearchChoice=function(k){return{id:k,text:(j.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+k}}}var g=b.extend({},h,j.amsSelect2Options);g=a.executeFunctionByName(j.amsSelect2InitCallback,e,g)||g;var i=e.select2(g);a.executeFunctionByName(j.amsSelect2AfterInitCallback,e,i,g);if(e.hasClass("ordered")){a.ajax.check(b.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){e.select2Sortable({bindOrder:"sortableStop"})})}e.on("change",function(){var k=b(e.get(0).form).data("validator");if(k!==undefined){b(e).valid()}})})})}},maskedit:function(d){var c=b("[data-mask]",d);if(c.length>0){a.ajax.check(b.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.3.1.min.js",function(){c.each(function(){var e=b(this);var i=e.data();var g={placeholder:i.amsMaskeditPlaceholder||"X"};var f=b.extend({},g,i.amsMaskeditOptions);f=a.executeFunctionByName(i.amsMaskeditInitCallback,e,f)||f;var h=e.mask(e.attr("data-mask"),f);a.executeFunctionByName(i.amsMaskeditAfterInitCallback,e,h,f)})})}},datepicker:function(c){var d=b(".datepicker",c);if(d.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}d.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},datetimepicker:function(d){var c=b(".datetimepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},timepicker:function(d){var c=b(".timepicker",d);if(c.length>0){a.ajax.check(b.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}c.each(function(){var f=b(this);var j=f.data();var h={lang:j.amsDatetimepickerLang||a.lang,format:j.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var g=b.extend({},h,j.amsDatetimepickerOptions);g=a.executeFunctionByName(j.amsDatetimepickerInitCallback,f,g)||g;var i=f.datetimepicker(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},colorpicker:function(c){var d=b(".colorpicker",c);if(d.length>0){a.ajax.check(b.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}d.each(function(){var f=b(this);var j=f.data();var h={position:j.amsColorpickerPosition||f.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var g=b.extend({},h,j.amsColorpickerOptions);g=a.executeFunctionByName(j.amsColorpickerInitCallback,f,g)||g;var i=f.minicolors(g);a.executeFunctionByName(j.amsDatetimepickerAfterInitCallback,f,i,g)})})}},validate:function(d){var c=b("FORM:not([novalidate])",d);if(c.length>0){a.ajax.check(b.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(g){if(g){b.validator.setDefaults({highlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(h){b(h).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(i,j){var h=j.parents("label:first");if(h.length){i.insertAfter(h)}else{i.insertAfter(j)}}});if(a.plugins.i18n){for(var e in a.plugins.i18n.validate){var f=a.plugins.i18n.validate[e];if((typeof(f)=="string")&&(f.indexOf("{0}")>-1)){a.plugins.i18n.validate[e]=b.validator.format(f)}}b.extend(b.validator.messages,a.plugins.i18n.validate)}}c.each(function(){var k=b(this);var l=k.data();var i={ignore:null,submitHandler:k.attr("data-async")!==undefined?l.amsFormSubmitHandler===undefined?function(){b(".state-error",k).removeClass("state-error");a.ajax.check(b.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(k)}:a.getFunctionByName(l.amsFormSubmitHandler):undefined,invalidHandler:k.attr("data-async")!==undefined?l.amsFormInvalidHandler===undefined?function(q,p){b(".state-error",k).removeClass("state-error");for(var n in p.errorList){var m=p.errorList[n];var o=b(m.element).parents(".tab-pane").index()+1;if(o>0){var r=b(".nav-tabs",b(m.element).parents(".tabforms"));b("li:nth-child("+o+")",r).removeClassPrefix("state-").addClass("state-error");b("li.state-error:first a",r).click()}}}:a.getFunctionByName(l.amsFormInvalidHandler):undefined};var h=b.extend({},i,l.amsValidateOptions);h=a.executeFunctionByName(l.amsValidateInitCallback,k,h)||h;var j=k.validate(h);a.executeFunctionByName(l.amsValidateAfterInitCallback,k,j,h)})})}},datatable:function(d){var c=b(".datatable",d);if(c.length>0){a.ajax.check(b.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(e){b(c).each(function(){a.ajax.check(b.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var B=b(this);var F=B.data();var D=(F.amsDatatableExtensions||"").split(/\s+/);var k=F.amsDatatableSdom||"W"+((D.indexOf("colreorder")>=0||D.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(D.indexOf("colvis")>=0?"C":"")+((F.amsDatatablePagination===false||F.amsDatatablePaginationSize===false)?"":"L")+(F.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(D.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(F.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var n;var g=F.amsDatatableSorting;if(typeof(g)==="string"){var E=g.split(";");g=[];for(n in E){var v=E[n].split(",");v[0]=parseInt(v[0]);g.push(v)}}var f=[];var r=b("th",B).listattr("data-ams-datatable-stype");for(n in r){var q=r[n];if(q){var h=f[n]||{};h.sType=q;f[n]=h}}var x={bJQueryUI:false,bFilter:F.amsDatatableGlobalFilter!==false,bPaginate:F.amsDatatablePagination!==false,bInfo:F.amsDatatableInfo!==false,bSort:F.amsDatatableSort!==false,aaSorting:g,aoColumns:f.length>0?f:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:F.amsDatatableDisplayLength||25,sPaginationType:F.amsDatatablePaginationType||"bootstrap_full",sDom:k,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(I,H){b(".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 C=b.extend({},x,F.amsDatatableOptions);if(D.length>0){for(n in D){switch(D[n]){case"autofill":a.ajax.check(b.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+a.devext+".js");break;case"columnfilter":a.ajax.check(b.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+a.devext+".js");break;case"colreorder":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+a.devext+".js");break;case"colreorderwithresize":a.ajax.check(b.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+a.devext+".js");break;case"colvis":a.ajax.check(b.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+a.devext+".js");var s={activate:"click",sAlign:"right"};C.oColVis=b.extend({},s,F.amsDatatableColvisOptions);break;case"editable":a.ajax.check(b.fn.editable,a.baseURL+"ext/jquery-jeditable"+a.devext+".js");a.ajax.check(b.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+a.devext+".js");break;case"fixedcolumns":a.ajax.check(b.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+a.devext+".js");break;case"fixedheader":a.ajax.check(b.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(b.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+a.devext+".js");break;case"rowreordering":a.ajax.check(b.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+a.devext+".js");break;case"scroller":a.ajax.check(b.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+a.devext+".js");break;default:break}}}C=a.executeFunctionByName(F.amsDatatableInitCallback,B,C)||C;try{var j=B.dataTable(C);a.executeFunctionByName(F.amsDatatableAfterInitCallback,B,j,C);if(D.length>0){for(n in D){switch(D[n]){case"autofill":var G=b.extend({},F.amsDatatableAutofillOptions,C.autofill);G=a.executeFunctionByName(F.amsDatatableAutofillInitCallback,B,G)||G;B.data("ams-autofill",F.amsDatatableAutofillConstructor===undefined?new b.fn.dataTable.AutoFill(B,G):a.executeFunctionByName(F.amsDatatableAutofillConstructor,B,j,G));break;case"columnfilter":var m={sPlaceHolder:"head:after"};var o=b.extend({},m,F.amsDatatableColumnfilterOptions,C.columnfilter);o=a.executeFunctionByName(F.amsDatatableColumnfilterInitCallback,B,o)||o;B.data("ams-columnfilter",F.amsDatatableColumnfilterConstructor===undefined?j.columnFilter(o):a.executeFunctionByName(F.amsDatatableColumnfilterConstructor,B,j,o));break;case"editable":var p=b.extend({},F.amsDatatableEditableOptions,C.editable);p=a.executeFunctionByName(F.amsDatatableEditableInitCallback,B,p)||p;B.data("ams-editable",F.amsDatatableEditableConstructor===undefined?B.makeEditable(p):a.executeFunctionByName(F.amsDatatableEditableConstructor,B,j,p));break;case"fixedcolumns":var i=b.extend({},F.amsDatatableFixedcolumnsOptions,C.fixedcolumns);i=a.executeFunctionByName(F.amsDatatableFixedcolumnsInitCallback,B,i)||i;B.data("ams-fixedcolumns",F.amsDatatableFixedcolumnsConstructor===undefined?new b.fn.dataTable.FixedColumns(B,i):a.executeFunctionByName(F.amsDatatableFixedcolumnsConstructor,B,j,i));break;case"fixedheader":var y=b.extend({},F.amsDatatableFixedheaderOptions,C.fixedheader);y=a.executeFunctionByName(F.amsDatatableFixedheadeInitCallback,B,y)||y;B.data("ams-fixedheader",F.amsDatatableFixedheaderConstructor===undefined?new b.fn.dataTable.FixedHeader(B,y):a.executeFunctionByName(F.amsDatatableFixedheaderConstructor,B,j,y));break;case"keytable":var l={table:B.get(0),datatable:j};var w=b.extend({},l,F.amsDatatableKeytableOptions,C.keytable);w=a.executeFunctionByName(F.amsDatatableKeytableInitCallback,B,w)||w;B.data("ams-keytable",F.amsDatatableKeytableConstructor===undefined?new KeyTable(w):a.executeFunctionByName(F.amsDatatableKeytableConstructor,B,j,w));break;case"rowgrouping":var u=b.extend({},F.amsDatatableRowgroupingOptions,C.rowgrouping);u=a.executeFunctionByName(F.amsDatatableRowgroupingInitCallback,B,u)||u;B.data("ams-rowgrouping",F.amsDatatableRowgroupingConstructor===undefined?B.rowGrouping(u):a.executeFunctionByName(F.amsDatatableRowgroupingConstructor,B,j,u));break;case"rowreordering":var t=b.extend({},F.amsDatatableRowreorderingOptions,C.rowreordering);t=a.executeFunctionByName(F.amsDatatableRowreorderingInitCallback,B,t)||t;B.data("ams-rowreordering",F.amsDatatableRowreorderingConstructor===undefined?B.rowReordering(t):a.executeFunctionByName(F.amsDatatableRowreorderingConstructor,B,j,t));break;default:break}}}var z=(F.amsDatatableFinalizeCallback||"").split(/\s+/);if(z.length>0){for(n in z){a.executeFunctionByName(z[n],B,j,C)}}}catch(A){}})})}},tablednd:function(d){var c=b(".table-dnd",d);if(c.length>0){a.ajax.check(b.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(e){c.each(function(){var i=b(this);b(i).on("mouseover","tr",function(){b(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){b(this.cells[0]).removeClass("drag-handle")});var j=i.data();var g={onDragClass:j.amsTabledndDragClass||"dragging-row",onDragStart:j.amsTabledndDragStart,dragHandle:j.amsTabledndDragHandle,scrollAmount:j.amsTabledndScrollAmount,onAllowDrop:j.amsTabledndAllowDrop,onDrop:j.amsTabledndDrop||function(m,o){var l=j.amsTabledndDropTarget;if(l){var k=[];b(m.rows).each(function(){var p=b(this).data("ams-element-name");if(p){k.push(p)}});var n=a.getFunctionByName(l);if(typeof(n)=="function"){n.call(i,m,k)}else{a.ajax.post(l,{names:JSON.stringify(k)})}}return false}};var f=b.extend({},g,j.amsTabledndOptions);f=a.executeFunctionByName(j.amsTabledndInitCallback,i,f)||f;var h=i.tableDnD(f);a.executeFunctionByName(j.amsTabledndAfterInitCallback,i,h,f)})})}},imgareaselect:function(d){var c=b(".imgareaselect",d);if(c.length>0){a.ajax.check(b.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.10"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}c.each(function(){var k=b(this);var j=k.data();var h=j.amsImgareaselectParent?k.parents(j.amsImgareaselectParent):"body";var g={instance:true,handles:true,parent:h,x1:j.amsImgareaselectX1||0,y1:j.amsImgareaselectY1||0,x2:j.amsImgareaselectX2||j.amsImgareaselectImageWidth,y2:j.amsImgareaselectY2||j.amsImgareaselectImageHeight,imageWidth:j.amsImgareaselectImageWidth,imageHeight:j.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:j.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(j.amsImgareaselectSelectEnd)||function(l,m){var n=j.amsImgareaselectTargetField||"image_";b('input[name="'+n+'x1"]',h).val(m.x1);b('input[name="'+n+'y1"]',h).val(m.y1);b('input[name="'+n+'x2"]',h).val(m.x2);b('input[name="'+n+'y2"]',h).val(m.y2)}};var f=b.extend({},g,j.amsImgareaselectOptions);f=a.executeFunctionByName(j.amsImgareaselectInitCallback,k,f)||f;var i=k.imgAreaSelect(f);a.executeFunctionByName(j.amsImgareaselectAfterInitCallback,k,i,f);setTimeout(function(){i.update()},250)})})}},fancybox:function(c){var d=b(".fancybox",c);if(d.length>0){a.ajax.check(b.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}d.each(function(){var f=b(this);var m=f.data();var l=(m.amsFancyboxHelpers||"").split(/\s+/);if(l.length>0){for(var g in l){var k=l[g];switch(k){case"buttons":a.ajax.check(b.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons"+a.devext+".js");break;case"thumbs":a.ajax.check(b.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+a.devext+".js");break;case"media":a.ajax.check(b.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media"+a.devext+".js");break;default:break}}}var i={type:m.amsFancyboxType,padding:m.amsFancyboxPadding||10,margin:m.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(m.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(m.amsFancyboxTitleGetter,this)||b(this.element).attr("original-title")||b(this.element).attr("title")},helpers:{title:{type:"inside"}}};var h=b.extend({},i,m.amsFancyboxOptions);h=a.executeFunctionByName(m.amsFancyboxInitCallback,f,h)||h;var j=f.fancybox(h);a.executeFunctionByName(m.amsFancyboxAfterInitCallback,f,j,h)})})}},graphs:function(d){var c=b(".sparkline",d);if(c.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(c)})}},scrollbars:function(c){var d=b(".scrollbar",c);if(d.length>0){a.ajax.check(b.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(b.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(e){if(e){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}d.each(function(){var j=b(this);var i=j.data();var g={theme:i.amsScrollbarTheme||"light"};var f=b.extend({},g,i.amsScrollbarOptions);f=a.executeFunctionByName(i.amsScrollbarInitCallback,j,f)||f;var h=j.mCustomScrollbar(f);a.executeFunctionByName(i.amsScrollbarAfterInitCallback,j,h,f)})})})}}}};MyAMS.callbacks={init:function(c){b("[data-ams-callback]",c).each(function(){var d=this;var e=b(d).data();var f=a.getFunctionByName(e.amsCallback);if(f===undefined){if(e.amsCallbackSource){a.getScript(e.amsCallbackSource,function(){a.executeFunctionByName(e.amsCallback,d,e.amsCallbackOptions)})}else{if(window.console){console.warn("Undefined callback: "+e.amsCallback)}}}else{f.call(d,e.amsCallbackOptions)}})},alert:function(k){var f=b(this).data();var c=b.extend({},k,f.amsAlertOptions);var i=b(f.amsAlertParent||c.parent||this);var e=f.amsAlertStatus||c.status||"info";var g=f.amsAlertHeader||c.header;var j=f.amsAlertMessage||c.message;var h=f.amsAlertSubtitle||c.subtitle;var d=f.amsAlertMargin===undefined?(c.margin===undefined?false:c.margin):f.amsAlertMargin;a.skin.alert(i,e,g,j,h,d)},messageBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsMessageboxOptions);var e=b.extend({},f,{title:g.amsMessageboxTitle||f.title||"",content:g.amsMessageboxContent||f.content||"",icon:g.amsMessageboxIcon||f.icon,number:g.amsMessageboxNumber||f.number,timeout:g.amsMessageboxTimeout||f.timeout});var c=g.amsMessageboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsMessageboxCallback||f.callback);a.skin.messageBox(c,e,h)},smallBox:function(d){var g=b(this).data();var f=b.extend({},d,g.amsSmallboxOptions);var e=b.extend({},f,{title:g.amsSmallboxTitle||f.title||"",content:g.amsSmallboxContent||f.content||"",icon:g.amsSmallboxIcon||f.icon,iconSmall:g.amsSmallboxIconSmall||f.iconSmall,timeout:g.amsSmallboxTimeout||f.timeout});var c=g.amsSmallboxStatus||f.status||"info";var h=a.getFunctionByName(g.amsSmallboxCallback||f.callback);a.skin.smallBox(c,e,h)}};MyAMS.events={init:function(c){b("[data-ams-events-handlers]",c).each(function(){var e=b(this);var d=e.data("ams-events-handlers");for(var f in d){e.on(f,a.getFunctionByName(d[f]))}})}};MyAMS.container={changeOrder:function(d,e){var c=b('input[name="'+b(this).data("ams-input-name")+'"]',b(this));c.val(e.join(";"))},deleteElement:function(c){return function(){var d=b(this);MyAMS.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(g){if(g==a.i18n.BTN_OK){var i=d.parents("table");var f=i.data("ams-location")||"";var j=d.parents("tr");var h=j.data("ams-delete-target")||i.data("ams-delete-target")||"delete-element.json";var e=j.data("ams-element-name");MyAMS.ajax.post(f+"/"+h,{object_name:e},function(k,l){if(k.status=="success"){if(i.hasClass("datatable")){i.dataTable().fnDeleteRow(j[0])}else{j.remove()}}})}})}}};MyAMS.skin={_setPageHeight:function(){var e=b("#main").height();var c=a.left_panel.height();var d=b(window).height()-a.navbar_height;if(e>d){a.left_panel.css("min-height",e);a.root.css("min-height",e+a.navbar_height)}else{a.left_panel.css("min-height",d);a.root.css("min-height",d)}},_checkMobileWidth:function(){if(b(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(){$this=b("#activity > .badge");if(parseInt($this.text())>0){$this.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{$this.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(c){if(a.enable_widgets){var d=b(".ams-widget",c);if(d.length>0){a.ajax.check(b.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){d.each(function(){var h=b(this);var g=h.data();var f={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var e=b.extend({},f,g.amsWidgetOptions);e=a.executeFunctionByName(g.amsWidgetInitcallback,h,e)||e;h.MyAMSWidget(e)});MyAMSWidget.initWidgetsGrid(b(".ams-widget-grid",c))})}}},_initMobileWidgets:function(c){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(c)}},alert:function(j,d,e,k,i,c){b(".alert",j).remove();if(d=="error"){d="danger"}var g='<div class="'+(c?"margin-10":"")+" alert alert-block alert-"+d+' 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> '+e+"</h4>"+(i?("<p>"+i+"</p>"):"");if(typeof(k)=="string"){g+="<ul><li>"+k+"</li></ul>"}else{if(k){g+="<ul>";for(var f in k){if(!b.isNumeric(f)){continue}g+="<li>"+k[f]+"</li>"}g+="</ul>"}}g+="</div>";var h=b(g).prependTo(j);if(j.exists){a.ajax.check(b.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){b.scrollTo(j,{offset:{top:-50}})})}},bigBox:function(c,d){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(c,d)})},messageBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.bigBox(d,e)})},smallBox:function(c,d,e){if(typeof(c)=="object"){e=d;d=c||{};c="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(c){case"error":case"danger":d.color="#C46A69";break;case"warning":d.color="#C79121";break;case"success":d.color="#739E73";break;default:d.color=d.color||"#3276B1"}d.sound=false;a.notify.smallBox(d,e)})},_drawBreadCrumb:function(){var c=b("#ribbon OL.breadcrumb");c.empty().append(b("<li></li>").append(b("<a></a>").text(a.i18n.HOME).attr("href",b('nav a[href!="#"]:first').attr("href"))));b("nav LI.active >A").each(function(){var f=b(this);var d=b.trim(f.clone().children(".badge").remove().end().text());var e=b("<li></li>").append(f.attr("href").replace(/^#/,"")?b("<a></a>").html(d).attr("href",f.attr("href")):d);c.append(e)})},checkURL:function(){function c(i){b("nav .active").removeClass("active");i.addClass("open").addClass("active");i.parents("li").addClass("open active").children("ul").addClass("active").show();i.parents("li:first").removeClass("open");i.parents("ul").addClass(i.attr("href").replace(/^#/,"")?"active":"").show()}var f=location.hash;var e=f.replace(/^#/,"");if(e){var d=b("#content");if(!d.exists()){d=b("body")}var g=b('nav A[href="'+f+'"]');if(g.exists()){c(g)}a.skin.loadURL(e,d);document.title=b("[data-ams-page-title]:first",d).data("ams-page-title")||g.attr("title")||document.title}else{var h=b("[data-ams-active-menu]").data("ams-active-menu");if(h){g=b('nav A[href="'+h+'"]')}else{g=b('nav >UL >LI >A[href!="#"]').first()}if(g.exists()){c(g);if(h){a.skin._drawBreadCrumb()}else{window.location.hash=g.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(d){var c=a.skin._clean_callbacks;if(c.indexOf(d)<0){c.push(d)}},cleanContainer:function(c){var e=a.skin._clean_callbacks;for(var d in e){e[d].call(c)}},loadURL:function(e,c,d,h){if(e.startsWith("#")){e=e.substr(1)}if(typeof(d)=="function"){h=d;d={}}c=b(c);var g={type:"GET",url:e,dataType:"html",cache:false,beforeSend:function(){a.skin.cleanContainer(c);c.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> Loading... </h1>');if(c[0]==b("#content")[0]){a.skin._drawBreadCrumb();document.title=b(".breadcrumb LI:last-child").text();b("html, body").animate({scrollTop:0},"fast")}else{c.animate({scrollTop:0},"fast")}},success:function(m,j,l){if(h){a.executeFunctionByName(h,this,m,j,l,d)}else{var k=a.ajax.getResponse(l);var n=k.content_type;var i=k.data;b(".loading",c).remove();switch(n){case"json":a.ajax.handleJSON(i,c);break;case"script":break;case"xml":break;case"html":case"text":default:c.parents(".hidden").removeClass("hidden");b(".alert",c.parents(".alerts-container")).remove();c.css({opacity:"0.0"}).html(m).removeClass("hidden").delay(50).animate({opacity:"1.0"},300);a.initContent(c)}if(d&&d.afterLoadCallback){a.executeFunctionByName(d.afterLoadCallback,this)}}},error:function(k,j,i){c.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+a.i18n.ERROR+i+"</h3>"+k.responseText)},async:false};var f=b.extend({},g,d);b.ajax(f)},setLanguage:function(d){var f=d.lang;var e=d.handler_type||"json";switch(e){case"json":var g=d.method||"setUserLanguage";a.jsonrpc.post(g,{lang:f},function(){window.location.reload(true)});break;case"ajax":var c=d.href||"setUserLanguage";a.ajax.post(c,{lang:f},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};MyAMS.initPage=function(){var c=b("body");a.root=c;a.left_panel=b("#left-panel");a.shortcuts=b("#shortcut");a.plugins.initData(c);var d=b.ajaxSettings.xhr;b.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var f=d();if(f&&(typeof(f.addEventListener)=="function")){var e=this;f.addEventListener("progress",function(g){e.progress(g)},false)}return f}});b(document).ajaxStart(a.ajax.start);b(document).ajaxStop(a.ajax.stop);b(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(b.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){b("NAV UL A").noClickDelay();b("#hide-menu A").noClickDelay()})}}b("#hide-menu >:first-child > A").click(function(f){c.toggleClass("hidden-menu");f.preventDefault()});b("#show-shortcut").click(function(f){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}f.preventDefault()});a.shortcuts.click(function(f){a.skin._hideShortcutButtons()});b(document).mouseup(function(f){if(!a.shortcuts.is(f.target)&&a.shortcuts.has(f.target).length===0){a.skin._hideShortcutButtons()}});b("#search-mobile").click(function(){a.root.addClass("search-mobile")});b("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});b("#activity").click(function(g){var f=b(this);var h=f.next(".ajax-dropdown");if(!h.is(":visible")){h.css("left",f.position().left-h.innerWidth()/2+f.innerWidth()/2).fadeIn(150);f.addClass("active")}else{h.fadeOut(150);f.removeClass("active")}g.preventDefault()});a.skin.checkNotification();b(document).mouseup(function(f){var g=b(".ajax-dropdown");if(!g.is(f.target)&&g.has(f.target).length===0){g.fadeOut(150).prev().removeClass("active")}});b('input[name="activity"]').change(function(){var e=b(this).data("ams-url");container=b(".ajax-notifications");a.skin.loadURL(e,container)});b("#logout a").click(function(f){f.preventDefault();f.stopPropagation();a.loginURL=b(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>"+b("#show-shortcut").text()+"</strong></span> ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(e){if(e==a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});b("NAV UL").myams_menu({accordion:true,speed:a.menu_speed});b(".minifyme").click(function(f){b("BODY").toggleClass("minified");b(this).effect("highlight",{},500);f.preventDefault()});b("#refresh").click(function(f){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(e){if(e==a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});f.preventDefault()});c.on("click",function(g){var f=b(this);if(!f.is(g.target)&&f.has(g.target).length===0&&b(".popover").has(g.target).length===0){f.popover("hide")}});a.ajax.check(b.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){b("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});b("nav").resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){b(document).on("click",'a[href="#"]',function(f){f.preventDefault()});b(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(j){var h=b(j.currentTarget);var f=h.attr("href")||h.data("ams-url");if(!f||f.startsWith("javascript:")||h.attr("target")||(h.data("ams-context-menu")===true)){return}j.preventDefault();j.stopPropagation();var g=a.getFunctionByName(f);if(typeof(g)=="function"){f=g.call(h)}if(typeof(f)=="function"){f.call(h)}else{f=f.replace(/\%23/,"#");var i=h.data("ams-target");if(i){a.form.confirmChangedForm(i,function(){a.skin.loadURL(f,i,h.data("ams-link-options"),h.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},50)}else{window.location.hash=f}}}else{window.location=f}})}}});b(document).on("click",'a[target="_blank"]',function(f){f.preventDefault();window.open(b(f.currentTarget).attr("href"))});b(document).on("click",'a[target="_top"]',function(f){f.preventDefault();a.form.confirmChangedForm(function(){window.location=b(f.currentTarget).attr("href")})});b(window).on("hashchange",a.skin.checkURL)}b(document).off("click.modal").on("click",'[data-toggle="modal"]',function(g){var f=b(this);if(f.data("ams-context-menu")===true){return}if(f.data("ams-stop-propagation")===true){g.stopPropagation()}g.preventDefault();a.dialog.open(f);if(f.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});b(document).on("click",'button[type="submit"], button.submit',function(){var e=b(this);b(e.get(0).form).data("ams-submit-button",e)});b(document).on("click","[data-ams-click-handler]",function(h){var g=b(this);var f=g.data();if(f.amsClickHandler){if((f.amsStopPropagation===true)||(f.amsClickStopPropagation===true)){h.stopPropagation()}if(f.amsClickKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(f.amsClickHandler);if(i!==undefined){i.call(g,f.amsClickHandlerOptions)}}});b(document).on("change","[data-ams-change-handler]",function(h){var g=b(this);var f=g.data();if(f.amsChangeHandler){if(f.amsChangeKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(f.amsChangeHandler);if(i!==undefined){i.call(g,f.amsChangeHandlerOptions)}}});b(document).on("reset","form",function(g){var f=b(this);setTimeout(function(){f.find(".select2").trigger("change")},10)});b(document).on("reset","[data-ams-reset-handler]",function(h){var f=b(this);var g=f.data();if(g.amsResetHandler){if(g.amsResetKeepDefault!==true){h.preventDefault()}var i=a.getFunctionByName(g.amsResetHandler);if(i!==undefined){i.call(f,g.amsResetHandlerOptions)}}});b(document).on("change",'input[type="file"]',function(h){h.preventDefault();var f=b(this);var g=f.parent(".button");if(g.exists()&&g.parent().hasClass("input-file")){g.next('input[type="text"]').val(f.val())}});b(document).on("focusin",function(f){if(b(f.target).closest(".mce-window").length){f.stopImmediatePropagation()}});b("a[data-toggle=tab]",".nav-tabs").on("click",function(f){if(b(this).parent("li").hasClass("disabled")){f.preventDefault();return false}});b(document).on("show.bs.tab",function(h){var f=b(h.target);var g=f.data();if(g.amsUrl){if(g.amsTabLoaded){return}try{f.append('<i class="fa fa-spin fa-cog margin-left-5"></i>');a.skin.loadURL(g.amsUrl,f.attr("href"));if(g.amsTabLoadOnce){f.data("ams-tab-loaded",true)}}finally{b("i",f).remove()}}});a.initContent(document);if(a.ajax_nav&&b("nav").exists()){a.skin.checkURL()}b(window).on("beforeunload",a.form.checkBeforeUnload)};MyAMS.initContent=function(c){b(".tipsy").remove();b("[rel=tooltip]",c).tooltip();b("[rel=popover]",c).popover();b("[rel=popover-hover]",c).popover({trigger:"hover"});a.plugins.init(c);a.callbacks.init(c);a.events.init(c);a.form.init(c);if(a.device==="desktop"){a.skin._initDesktopWidgets(c)}else{a.skin._initMobileWidgets(c)}a.skin._setPageHeight()};MyAMS.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"};b(document).ready(function(){b=jQuery.noConflict();var c=b("HTML");var d=c.attr("lang")||c.attr("xml:lang");if(d&&!d.startsWith("en")){MyAMS.lang=d;MyAMS.getScript(MyAMS.baseURL+"i18n/myams_"+d.substr(0,2)+".js",function(){MyAMS.initPage()})}else{MyAMS.initPage()}})})(jQuery);
\ No newline at end of file
+(function(c,b){String.prototype.startsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(0,f)===g)};String.prototype.endsWith=function(g){var e=this.length,f=g.length;if(e<f){return false}return(this.substr(e-f)===g)};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(f,g){var e=this.length;g=Number(g)||0;g=(g<0)?Math.ceil(g):Math.floor(g);if(g<0){g+=e}for(;g<e;g++){if(g in this&&this[g]===f){return g}}return -1}}c.expr[":"].econtains=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"").toLowerCase()===f[3].toLowerCase()};c.expr[":"].withtext=function(g,e,f){return(g.textContent||g.innerText||c(g).text()||"")===f[3]};c.expr[":"].parents=function(g,e,f){return c(g).parents(f[3]).length>0};if(c.scrollbarWidth===undefined){c.scrollbarWidth=function(){var f=c('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body");var g=f.children();var e=g.innerWidth()-g.height(99).innerWidth();f.remove();return e}}c.fn.extend({exists:function(){return c(this).length>0},objectOrParentWithClass:function(e){if(this.hasClass(e)){return this}else{return this.parents("."+e)}},listattr:function(f){var e=[];this.each(function(){e.push(c(this).attr(f))});return e},style:function(f,i,e){var h=this.get(0);if(typeof(h)==="undefined"){return}var g=this.get(0).style;if(typeof(f)!=="undefined"){if(typeof(i)!=="undefined"){e=typeof(e)!=="undefined"?e:"";g.setProperty(f,i,e);return this}else{return g.getPropertyValue(f)}}else{return g}},removeClassPrefix:function(e){this.each(function(g,h){var f=h.className.split(" ").map(function(i){return i.startsWith(e)?"":i});h.className=c.trim(f.join(" "))});return this},contextMenu:function(f){function e(i,k,h){var j=c(window)[k](),l=c(f.menuSelector)[k](),g=i;if(i+l>j&&l<i){g-=l}return g}return this.each(function(){c("a",c(f.menuSelector)).each(function(){c(this).data("ams-context-menu",true)});c(this).on("contextmenu",function(g){if(g.ctrlKey){return}c(f.menuSelector).data("invokedOn",c(g.target)).show().css({position:"fixed",left:e(g.clientX,"width","scrollLeft")-10,top:e(g.clientY,"height","scrollTop")-10}).off("click").on("click",function(i){c(this).hide();var h=c(this).data("invokedOn");var j=c(i.target);f.menuSelected.call(this,h,j);a.event.stop(i)});return false});c(document).click(function(){c(f.menuSelector).hide()})})},myams_menu:function(e){var g={accordion:true,speed:200,closedSign:'<em class="fa fa-angle-down"></em>',openedSign:'<em class="fa fa-angle-up"></em>'};var f=c.extend({},g,e);var h=c(this);h.find("LI").each(function(){var i=c(this);if(i.find("UL").size()>0){i.find("A:first").append("<b class='collapse-sign'>"+f.closedSign+"</b>");var j=i.find("A:first");if(j.attr("href")==="#"){j.click(function(){return false})}}});h.find("LI.active").each(function(){var i=c(this).parents("UL");var j=i.parent("LI");i.slideDown(f.speed);j.find("b:first").html(f.openedSign);j.addClass("open")});h.find("LI A").on("click",function(){var l=c(this);var i=l.parent().find("UL");if(f.accordion){var k=l.parent().parents("UL");var m=h.find("UL:visible");m.each(function(n){var o=true;k.each(function(p){if(k[p]===m[n]){o=false;return false}});if(o){if(i!==m[n]){c(m[n]).slideUp(f.speed,function(){l.parent("LI").find("b:first").html(f.closedSign);l.parent("LI").removeClass("open")})}}})}var j=l.parent().find("UL:first");if(!l.attr("href").replace(/^#/,"")&&j.is(":visible")&&!j.hasClass("active")){j.slideUp(f.speed,function(){l.parent("LI").removeClass("open").find("B:first").delay(f.speed).html(f.closedSign)})}else{j.slideDown(f.speed,function(){l.parent("LI").addClass("open").find("B:first").delay(f.speed).html(f.openedSign)})}})}});c.UTF8={encode:function(f){f=f.replace(/\r\n/g,"\n");var e="";for(var h=0;h<f.length;h++){var g=f.charCodeAt(h);if(g<128){e+=String.fromCharCode(g)}else{if((g>127)&&(g<2048)){e+=String.fromCharCode((g>>6)|192);e+=String.fromCharCode((g&63)|128)}else{e+=String.fromCharCode((g>>12)|224);e+=String.fromCharCode(((g>>6)&63)|128);e+=String.fromCharCode((g&63)|128)}}}return e},decode:function(e){var g="";var j=0,k=0,h=0,f=0;while(j<e.length){k=e.charCodeAt(j);if(k<128){g+=String.fromCharCode(k);j++}else{if((k>191)&&(k<224)){h=e.charCodeAt(j+1);g+=String.fromCharCode(((k&31)<<6)|(h&63));j+=2}else{h=e.charCodeAt(j+1);f=e.charCodeAt(j+2);g+=String.fromCharCode(((k&15)<<12)|((h&63)<<6)|(f&63));j+=3}}}return g}};if(b.MyAMS===undefined){b.MyAMS={devmode:true,devext:"",lang:"en",throttle_delay:350,menu_speed:235,navbar_height:49,ajax_nav:true,enable_widgets:true,enable_mobile:false,enable_fastclick:false,warn_on_form_change:false,ismobile:(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()))}}var d=b.MyAMS;var a=d;d.baseURL=(function(){var e=c('script[src*="/myams.js"], script[src*="/myams.min.js"]');var f=e.attr("src");a.devmode=f.indexOf(".min.js")<0;a.devext=a.devmode?"":".min";return f.substring(0,f.lastIndexOf("/")+1)})();d.getQueryVar=function(g,h){if(g.indexOf("?")<0){return false}if(!g.endsWith("&")){g+="&"}var e=new RegExp(".*?[&\\?]"+h+"=(.*?)&.*");var f=g.replace(e,"$1");return f===g?false:f};d.rgb2hex=function(e){return"#"+c.map(e.match(/\b(\d+)\b/g),function(f){return("0"+parseInt(f).toString(16)).slice(-2)}).join("")};d.generateId=function(){function e(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return e()+e()+e()+e()};d.getFunctionByName=function(k,g){if(k===undefined){return undefined}else{if(typeof(k)==="function"){return k}}var j=k.split(".");var h=j.pop();g=(g===undefined||g===null)?window:g;for(var f=0;f<j.length;f++){try{g=g[j[f]]}catch(l){return undefined}}try{return g[h]}catch(l){return undefined}};d.executeFunctionByName=function(h,f){var g=a.getFunctionByName(h,window);if(typeof(g)==="function"){var e=Array.prototype.slice.call(arguments,2);return g.apply(f,e)}};d.getSource=function(e){return e.replace(/{[^{}]*}/g,function(f){return a.getFunctionByName(f.substr(1,f.length-2))})};d.getScript=function(f,i,e){var h={dataType:"script",url:a.getSource(f),success:i,error:a.error.show,cache:!a.devmode,async:typeof(i)==="function"};var g=c.extend({},h,e);return c.ajax(g)};d.getCSS=function(e,i){var g=c("HEAD");var f=c('link[data-ams-id="'+i+'"]',g);if(f.length===0){var h=a.getSource(e);if(a.devmode){h+="?_="+new Date().getTime()}c("<link />").attr({rel:"stylesheet",type:"text/css",href:h,"data-ams-id":i}).appendTo(g)}};d.event={stop:function(e){if(!e){e=window.event}if(e){if(e.stopPropagation){e.stopPropagation();e.preventDefault()}else{e.cancelBubble=true;e.returnValue=false}}}};d.browser={getInternetExplorerVersion:function(){var g=-1;if(navigator.appName==="Microsoft Internet Explorer"){var e=navigator.userAgent;var f=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(f.exec(e)!==null){g=parseFloat(RegExp.$1)}}return g},checkVersion:function(){var f="You're not using Windows Internet Explorer.";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=8){f="You're using a recent copy of Windows Internet Explorer."}else{f="You should upgrade your copy of Windows Internet Explorer."}}if(b.alert){b.alert(f)}},isIE8orlower:function(){var f="0";var e=this.getInternetExplorerVersion();if(e>-1){if(e>=9){f=0}else{f=1}}return f},copyToClipboard:function(){return function(){var e=c(this);e.parents(".btn-group").removeClass("open");if(b.prompt){b.prompt(d.i18n.CLIPBOARD_COPY,e.text())}}}};d.error={ajax:function(h,g){if(g.statusText==="OK"){return}var e=a.ajax.getResponse(g);if(e.content_type==="json"){a.ajax.handleJSON(e.data)}else{var i=h.statusText||h.type;var f=g.responseText;a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+i+"</h4><p>"+f+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(h);b.console.debug(g)}},show:function(h,e,g){if(!g){return}var f=a.ajax.getResponse(h);if(f.content_type==="json"){a.ajax.handleJSON(f.data)}else{a.skin.messageBox("error",{title:a.i18n.ERRORS_OCCURED,content:"<h4>"+e+"</h4><p>"+g+"</p>",icon:"fa fa-warning animated shake",timeout:10000})}if(b.console){b.console.error(g);b.console.debug(h)}}};d.ajax={check:function(f,h,j,e){if(typeof(j)==="object"){e=j;j=undefined}var i={async:typeof(j)==="function"};var g=c.extend({},i,e);if(f===undefined){a.getScript(h,function(){if(typeof(j)==="function"){j(true,e)}},g)}else{if(typeof(j)==="function"){j(false,e)}}},getAddr:function(f){var e=f||c("HTML HEAD BASE").attr("href")||window.location.href;return e.substr(0,e.lastIndexOf("/")+1)},start:function(){c("#ajax-gear").show()},stop:function(){c("#ajax-gear").hide()},progress:function(e){if(!e.lengthComputable){return}if(e.loaded>=e.total){return}if(b.console){b.console.log(parseInt((e.loaded/e.total*100),10)+"%")}},post:function(g,i,f,l){var k;if(g.startsWith(window.location.protocol)){k=g}else{k=this.getAddr()+g}if(typeof(f)==="function"){l=f;f={}}else{if(!f){f={}}}if(typeof(l)==="undefined"){l=f.callback}if(typeof(l)==="string"){l=a.getFunctionByName(l)}delete f.callback;var e;var j={url:k,type:"post",cache:false,async:typeof(l)==="function",data:c.param(i),dataType:"json",success:l||function(m){e=m.result},error:a.error.show};var h=c.extend({},j,f);c.ajax(h);return e},getResponse:function(h){var g=h.getResponseHeader("content-type"),j,f;if(g){if(g.startsWith("application/javascript")){j="script";f=h.responseText}else{if(g.startsWith("text/html")){j="html";f=h.responseText}else{if(g.startsWith("text/xml")){j="xml";f=h.responseText}else{f=h.responseJSON;if(f){j="json"}else{try{f=JSON.parse(h.responseText);j="json"}catch(i){f=h.responseText;j="text"}}}}}}else{j="json";f={status:"alert",alert:{title:a.i18n.ERROR_OCCURED,content:a.i18n.NO_SERVER_RESPONSE}}}return{content_type:j,data:f}},handleJSON:function(p,g,l){var j=p.status;var e;switch(j){case"alert":if(b.alert){b.alert(p.alert.title+"\n\n"+p.alert.content)}break;case"error":a.form.showErrors(g,p);break;case"info":case"success":if(p.close_form!==false){a.dialog.close(g)}break;case"message":case"messagebox":break;case"notify":case"callback":case"callbacks":if(p.close_form!==false){a.dialog.close(g)}break;case"modal":a.dialog.open(p.location);break;case"reload":if(p.close_form!==false){a.dialog.close(g)}e=p.location||window.location.hash;if(e.startsWith("#")){e=e.substr(1)}a.skin.loadURL(e,p.target||l||"#content");break;case"redirect":if(p.close_form===true){a.dialog.close(g)}e=p.location||window.location.href;if(p.window){window.open(e,p.window,p.options)}else{if(window.location.href===e){window.location.reload(true)}else{window.location.href=e}}break;default:if(b.console){b.console.log("Unhandled status: "+j)}}var k;var m;var f;if(p.content){m=p.content;f=c(m.target||l||g||"#content");if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}if(p.contents){var i=p.contents;for(k=0;k<i.length;k++){m=i[k];f=c(m.target);if(m.raw===true){f.text(m.text)}else{f.html(m.html);a.initContent(f)}if(!m.keep_hidden){f.removeClass("hidden")}}}var o;if(p.message){o=p.message;if(typeof(o)==="string"){if((j==="info")||(j==="success")){a.skin.smallBox(j,{title:o,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}else{a.skin.alert(c(g||"#content"),j,o)}}else{a.skin.alert(c(o.target||l||g||"#content"),o.status||"success",o.header,o.body,o.subtitle)}}if(p.smallbox){a.skin.smallBox(p.smallbox_status||j,{title:p.smallbox,icon:"fa fa-fw fa-info-circle font-xs align-top margin-top-10",timeout:3000})}if(p.messagebox){o=p.messagebox;if(typeof(o)==="string"){a.skin.messageBox("info",{title:a.i18n.ERROR_OCCURED,content:o,timeout:10000})}else{var h=o.status||"info";if(h==="error"&&g&&l){a.executeFunctionByName(g.data("ams-form-submit-error")||"MyAMS.form.finalizeSubmitOnError",g,l)}a.skin.messageBox(h,{title:o.title||a.i18n.ERROR_OCCURED,content:o.content,icon:o.icon,number:o.number,timeout:o.timeout===null?undefined:(o.timeout||10000)})}}if(p.event){g.trigger(p.event,p.event_options)}if(p.callback){a.executeFunctionByName(p.callback,g,p.options)}if(p.callbacks){var n;for(k=0;k<p.callbacks.length;k++){n=p.callbacks[k];a.executeFunctionByName(n,g,n.options)}}}};d.jsonrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},query:function(f,h,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(g==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var k={};if(typeof(f)==="string"){k.query=f}else{if(typeof(f)==="object"){c.extend(k,f)}}c.extend(k,e);var i;var j={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:k,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};c.jsonRpc(j);return i})},post:function(h,f,e,g){a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+a.devext+".js",function(){if(typeof(e)==="function"){g=e;e={}}else{if(!e){e={}}}if(typeof(g)==="undefined"){g=e.callback}if(typeof(g)==="string"){g=a.getFunctionByName(g)}delete e.callback;var i;var k={url:a.jsonrpc.getAddr(e.url),type:"post",cache:false,method:h,params:f,async:typeof(g)==="function",success:g||function(l){i=l.result},error:a.error.show};var j=c.extend({},k,e);c.jsonRpc(j);return i})}};d.xmlrpc={getAddr:function(g){var e=g||c("HTML HEAD BASE").attr("href")||window.location.href;var f=e.replace(/\+\+skin\+\+\w+\//,"");return f.substr(0,f.lastIndexOf("/")+1)},post:function(f,i,g,e,h){a.ajax.check(c.xmlrpc,a.baseURL+"ext/jquery-xmlrpc"+a.devext+".js",function(){if(typeof(e)==="function"){h=e;e={}}else{if(!e){e={}}}if(typeof(h)==="undefined"){h=e.callback}if(typeof(h)==="string"){h=a.getFunctionByName(h)}delete e.callback;var j;var l={url:a.xmlrpc.getAddr(f),methodName:i,params:g,success:h||function(m){j=m},error:a.error.show};var k=c.extend({},l,e);c.xmlrpc(k);return j})}};d.form={init:function(f){var e;if(a.warn_on_form_change){e=c('FORM[data-ams-warn-on-change!="false"]',f)}else{e=c('FORM[data-ams-warn-on-change="true"]',f)}e.each(function(){var g=c(this);c('INPUT[type="text"], INPUT[type="checkbox"], INPUT[type="radio"], SELECT, TEXTAREA, [data-ams-changed-event]',g).each(function(){var i=c(this);if(i.data("ams-ignore-change")!==true){var h=i.data("ams-changed-event")||"change";i.on(h,function(){c(this).parents("FORM").attr("data-ams-form-changed",true)})}});g.on("reset",function(){c(this).removeAttr("data-ams-form-changed")})})},checkBeforeUnload:function(){var e=c('FORM[data-ams-form-changed="true"]');if(e.exists()){return a.i18n.FORM_CHANGED_WARNING}},confirmChangedForm:function(f,g){if(typeof(f)==="function"){g=f;f=undefined}var e=c('FORM[data-ams-form-changed="true"]',f);if(e.exists()){a.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+a.i18n.FORM_CHANGED_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(h){if(h===a.i18n.BTN_OK){g.call(f)}})}else{g.call(f)}},submit:function(g,f,h){g=c(g);if(!g.exists()){return false}if(typeof(f)==="object"){h=f;f=undefined}if(g.data("submitted")){if(!g.data("ams-form-hide-submitted")){a.skin.messageBox("warning",{title:a.i18n.WAIT,content:a.i18n.FORM_SUBMITTED,icon:"fa fa-save shake animated",timeout:g.data("ams-form-alert-timeout")||5000})}return false}if(!a.form._checkSubmitValidators(g)){return false}c(".alert-danger, SPAN.state-error",g).remove();c(".state-error",g).removeClassPrefix("state-");var e=c(g.data("ams-submit-button"));if(e&&!e.data("ams-form-hide-loading")){e.button("loading")}a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js",function(){function k(m,o){var l;var E=m.data();var v=E.amsFormOptions;var n;var q;if(h){q=h.formDataInitCallback}if(q){delete h.formDataInitCallback}else{q=E.amsFormDataInitCallback}if(q){var w={};if(typeof(q)==="function"){n=q.call(m,w)}else{n=a.executeFunctionByName(q,m,w)}if(w.veto){l=m.data("ams-submit-button");if(l){l.button("reset")}a.form.finalizeSubmitFooter.call(m);return false}}else{n=E.amsFormData||{}}l=c(m.data("ams-submit-button"));var x,A;if(l){x=l.data("ams-form-handler");A=l.data("ams-form-submit-target")}var p;var t=f||x||E.amsFormHandler||"";if(t.startsWith(window.location.protocol)){p=t}else{var z=m.attr("action").replace(/#/,"");if(z.startsWith(window.location.protocol)){p=z}else{p=a.ajax.getAddr()+z}p+=t}var D=null;if(h&&h.initSubmitTarget){a.executeFunctionByName(h.initSubmitTarget)}else{if(E.amsFormInitSubmitTarget){D=c(A||E.amsFormSubmitTarget||"#content");a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmit",m,D)}else{if(!E.amsFormHideSubmitFooter){a.executeFunctionByName(E.amsFormInitSubmit||"MyAMS.form.initSubmitFooter",m)}}}var r=typeof(o.uuid)!=="undefined";if(r){if(p.indexOf("X-Progress-ID")<0){p+="?X-Progress-ID="+o.uuid}delete o.uuid}if(h){n=c.extend({},n,h.form_data)}var u={url:p,type:"post",cache:false,data:n,dataType:E.amsFormDatatype,beforeSerialize:function(){if(typeof(b.tinyMCE)!=="undefined"){b.tinyMCE.triggerSave()}},beforeSubmit:function(G,F){F.data("submitted",true)},error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},iframe:r};var y=(h&&h.downloadTarget)||E.amsFormDownloadTarget;if(y){var s=c('iframe[name="'+y+'"]');if(!s.exists()){s=c("<iframe></iframe>").hide().attr("name",y).appendTo(m)}u=c.extend({},u,{iframe:true,iframeTarget:s,success:function(F,G,K,J){var I=c(J).parents(".modal-dialog");if(I.exists()){a.dialog.close(J)}else{var L;var H=J.data("ams-submit-button");if(H){L=H.data("ams-form-submit-callback")}if(!L){L=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}L.call(J,F,G,K,J);if(J.is(":visible")&&H){H.button("reset")}J.data("submitted",false);J.removeData("ams-submit-button");J.removeAttr("data-ams-form-changed")}}})}else{u=c.extend({},u,{error:function(J,F,G,I){if(D){a.executeFunctionByName(E.amsFormSubmitError||"MyAMS.form.finalizeSubmitOnError",I,D)}if(I.is(":visible")){var H=I.data("ams-submit-button");if(H){H.button("reset")}a.form.finalizeSubmitFooter.call(I)}I.data("submitted",false);I.removeData("ams-submit-button")},success:function(F,G,J,I){var K;var H=I.data("ams-submit-button");if(H){K=H.data("ams-form-submit-callback")}if(!K){K=a.getFunctionByName(E.amsFormSubmitCallback)||a.form._submitCallback}K.call(I,F,G,J,I);if(I.is(":visible")&&H){H.button("reset")}I.data("submitted",false);I.removeData("ams-submit-button");I.removeAttr("data-ams-form-changed")},iframe:r})}var C=c.extend({},u,o,v,h);c(m).ajaxSubmit(C);if(y){var B=c(m).parents(".modal-dialog");if(B.exists()){a.dialog.close(m)}else{a.form.finalizeSubmitFooter.call(m);if(l){l.button("reset")}m.data("submitted",false);m.removeData("ams-submit-button");m.removeAttr("data-ams-form-changed")}}}var j=c('INPUT[type="file"]',g).length>0;if(j){a.ajax.check(c.progressBar,a.baseURL+"ext/jquery-progressbar"+a.devext+".js");var i=c.extend({},{uuid:c.progressBar.submit(g)});k(g,i)}else{k(g,{})}});return false},initSubmit:function(g,f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=e.data("ams-form-submit-message")}if(f){h+="<strong>"+f+"</strong>"}c(g).html('<div class="row margin-20"><div class="text-center">'+h+"</div></div>");c(g).parents(".hidden").removeClass("hidden")},finalizeSubmitOnError:function(e){c("i",e).removeClass("fa-spin").removeClass("fa-gear").addClass("fa-ambulance")},initSubmitFooter:function(f){var e=c(this);var h='<i class="fa fa-3x fa-gear fa-spin"></i>';if(!f){f=c(this).data("ams-form-submit-message")}if(f){h+='<strong class="submit-message align-top padding-left-10 margin-top-10">'+f+"</strong>"}var g=c("footer",e);c("button",g).hide();g.append('<div class="row"><div class="text-center">'+h+"</div></div>")},finalizeSubmitFooter:function(){var e=c(this);var f=c("footer",e);if(f){c(".row",f).remove();c("button",f).show()}},_submitCallback:function(o,g,f,e){var i;if(e.is(":visible")){a.form.finalizeSubmitFooter.call(e);i=e.data("ams-submit-button");if(i){i.button("reset")}}var h=e.data();var l;if(h.amsFormDatatype){l=h.amsFormDatatype}else{var j=a.ajax.getResponse(f);l=j.content_type;o=j.data}var k;if(i){k=c(i.amsFormSubmitTarget||h.amsFormSubmitTarget||"#content")}else{k=c(h.amsFormSubmitTarget||"#content")}switch(l){case"json":a.ajax.handleJSON(o,e,k);break;case"script":break;case"xml":break;case"html":case"text":default:if(i&&(i.data("ams-keep-modal")!==true)){a.dialog.close(e)}if(!k.exists()){k=c("body")}k.parents(".hidden").removeClass("hidden");c(".alert",k.parents(".alerts-container")).remove();k.css({opacity:"0.0"}).html(o).delay(50).animate({opacity:"1.0"},300);a.initContent(k)}var m=f.getResponseHeader("X-AMS-Callback");if(m){var n=f.getResponseHeader("X-AMS-Callback-Options");a.executeFunctionByName(m,e,n===undefined?{}:JSON.parse(n),f)}},_getSubmitValidators:function(f){var e=[];var g=f.data("ams-form-validator");if(g){e.push([f,g])}c("[data-ams-form-validator]",f).each(function(){var h=c(this);e.push([h,h.data("ams-form-validator")])});return e},_checkSubmitValidators:function(g){var i=a.form._getSubmitValidators(g);if(!i.length){return true}var h=[];var n=true;for(var k=0;k<i.length;k++){var f=i[k];var e=f[0];var l=f[1];var m=a.executeFunctionByName(l,g,e);if(m===false){n=false}else{if(typeof(m)==="string"){h.push(m)}else{if(n.length&&(n.length>0)){h=h.concat(n)}}}}if(h.length>0){var j=h.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(g,"danger",j,h);return false}else{return n}},showErrors:function(e,m){var i;if(typeof(m)==="string"){a.skin.alert(e,"error",a.i18n.ERROR_OCCURED,m)}else{if(m instanceof Array){i=m.length===1?a.i18n.ERROR_OCCURED:a.i18n.ERRORS_OCCURED;a.skin.alert(e,"error",i,m)}else{c(".state-error",e).removeClass("state-error");i=m.error_header||(m.widgets&&(m.widgets.length>1)?a.i18n.ERRORS_OCCURED:a.i18n.ERROR_OCCURED);var n=[];var l;for(l=0;l<m.messages.length;l++){var f=m.messages[l];if(f.header){n.push("<strong>"+f.header+"</strong><br />"+f.message)}else{n.push(f.message||f)}}if(m.widgets){for(l=0;l<m.widgets.length;l++){var g=m.widgets[l];var j=c('[name="'+g.name+'"]',e);j.parents("label:first").removeClassPrefix("state-").addClass("state-error").after('<span for="name" class="state-error">'+g.message+"</span>");if(g.label){n.push(g.label+" : "+g.message)}var k=j.parents(".tab-pane").index()+1;if(k>0){var h=c(".nav-tabs",c(j).parents(".tabforms"));c("li:nth-child("+k+")",h).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",e).click()}}}a.skin.alert(e,m.error_level||"error",i,n,m.error_message)}}}};d.dialog={_shown_callbacks:[],registerShownCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("shown-callbacks");if(g===undefined){g=[];e.data("shown-callbacks",g)}}else{g=a.dialog._shown_callbacks}if(g.indexOf(h)<0){g.push(h)}},_hide_callbacks:[],registerHideCallback:function(h,f){var e;if(f){e=f.objectOrParentWithClass("modal-dialog")}var g;if(e&&e.exists()){g=e.data("hide-callbacks");if(g===undefined){g=[];e.data("hide-callbacks",g)}}else{g=a.dialog._hide_callbacks}if(g.indexOf(h)<0){g.push(h)}},open:function(f,e){a.ajax.check(c.fn.modalmanager,a.baseURL+"ext/bootstrap-modalmanager"+a.devext+".js",function(){a.ajax.check(c.fn.modal.defaults,a.baseURL+"ext/bootstrap-modal"+a.devext+".js",function(j){if(j){c(document).off("click.modal");c.fn.modal.defaults.spinner=c.fn.modalmanager.defaults.spinner='<div class="loading-spinner" style="width: 200px; margin-left: -100px;"><div class="progress progress-striped active"><div class="progress-bar" style="width: 100%;"></div></div></div>'}var i;var h;if(typeof(f)==="string"){i={};h=f}else{i=f.data();h=f.attr("href")||i.amsUrl;var g=a.getFunctionByName(h);if(typeof(g)==="function"){h=g.call(f)}}if(!h){return}c("body").modalmanager("loading");if(h.indexOf("#")===0){c(h).modal("show")}else{c.ajax({url:h,type:"get",cache:i.amsAllowCache===undefined?false:i.amsAllowCache,data:e,success:function(n,m,l){c("body").modalmanager("removeLoading");var o=a.ajax.getResponse(l);var t=o.content_type;var u=o.data;switch(t){case"json":a.ajax.handleJSON(u,c(c(f).data("ams-json-target")||"#content"));break;case"script":break;case"xml":break;case"html":case"text":default:var p=c(u);var r=c(".modal-dialog",p.wrap("<div></div>").parent());var q=r.data();var s={overflow:q.amsModalOverflow||".modal-viewport",maxHeight:q.amsModalMaxHeight===undefined?function(){return c(window).height()-c(".modal-header",p).outerHeight(true)-c("footer",p).outerHeight(true)-85}:a.getFunctionByName(q.amsModalMaxHeight)};var k=c.extend({},s,q.amsModalOptions);k=a.executeFunctionByName(q.amsModalInitCallback,r,k)||k;c("<div>").addClass("modal fade").append(p).modal(k).on("shown",a.dialog.shown).on("hidden",a.dialog.hidden);a.initContent(p)}}})}})})},shown:function(g){function j(p){var q=c(".scrollmarker.top",i);var o=i.scrollTop();if(o>0){q.show()}else{q.hide()}var e=c(".scrollmarker.bottom",i);if(m+o>=i.get(0).scrollHeight){e.hide()}else{e.show()}}var l=g.target;var i=c(".modal-viewport",l);if(i.exists()){var m=parseInt(i.css("max-height"));var n=c.scrollbarWidth();if(i.height()===m){c("<div></div>").addClass("scrollmarker").addClass("top").css("top",0).css("width",i.width()-n).hide().appendTo(i);c("<div></div>").addClass("scrollmarker").addClass("bottom").css("top",m-20).css("width",i.width()-n).appendTo(i);i.scroll(j);i.off("resize").on("resize",j)}else{c(".scrollmarker",i).remove()}}var f;var h=c(".modal-dialog",l).data("shown-callbacks");if(h){for(f=0;f<h.length;f++){h[f].call(l)}}h=a.dialog._shown_callbacks;if(h){for(f=0;f<h.length;f++){h[f].call(l)}}var k=c("[data-ams-focus-target]",l).first();if(!k.exists()){k=c("input, select",l).first()}if(k.exists()){k.focus()}},close:function(f){var g=f.parents(".modal").data("modal");if(g){var e=c("body").data("modalmanager");if(e&&(e.getOpenModals().indexOf(g)>=0)){g.hide()}}},hidden:function(i){var h=i.target;a.skin.cleanContainer(h);var f;var g=c(".modal-dialog",h).data("hide-callbacks");if(g){for(f=0;f<g.length;f++){g[f].call(h)}}g=a.dialog._hide_callbacks;if(g){for(f=0;f<g.length;f++){g[f].call(h)}}}};d.helpers={select2ClearSelection:function(){var f=c(this);var e=f.parents("label");var g=f.data("ams-select2-target");c('[name="'+g+'"]',e).data("select2").val("")},select2FormatSelection:function(f,e){if(f instanceof Array){c(f).each(function(){if(typeof(this)==="object"){e.append(this.text)}else{e.append(this)}})}else{if(typeof(f)==="object"){e.append(f.text)}else{e.append(f)}}},select2QueryUrlResultsCallback:function(g,f,e){switch(g.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+g.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(g.location);break;default:return{results:g.results||g,more:g.has_more||false,context:g.context}}},select2QueryMethodSuccessCallback:function(i,g,h){var f=i.result;if(typeof(f)==="string"){try{f=JSON.parse(f)}catch(j){}}switch(f.status){case"error":a.skin.messageBox("error",{title:a.i18n.ERROR_OCCURED,content:"<h4>"+f.error_message+"</h4>",icon:"fa fa-warning animated shake",timeout:10000});break;case"modal":c(this).data("select2").dropdown.hide();a.dialog.open(f.location);break;default:h.callback({results:f.results||f,more:f.has_more||false,context:f.context})}},contextMenuHandler:function(h,i){var e=i.data();if(e.toggle==="modal"){a.dialog.open(i)}else{var f=i.attr("href")||e.amsUrl;if(!f||f.startsWith("javascript")||i.attr("target")){return}a.event.stop();var g=a.getFunctionByName(f);if(typeof(g)==="function"){f=g.call(i,h)}if(typeof(f)==="function"){f.call(i,h)}else{f=f.replace(/\%23/,"#");h=i.data("ams-target");if(h){a.form.confirmChangedForm(h,function(){a.skin.loadURL(f,h,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(f.startsWith("#")){if(f!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=f},150)}else{window.location.hash=f}}}else{window.location=f}})}}}},datetimepickerDialogHiddenCallback:function(){c(".datepicker, .timepicker, .datetimepicker",this).datetimepicker("destroy")}};d.plugins={init:function(f){a.plugins.initData(f);var g=[];c("[data-ams-plugins-disabled]",f).each(function(){var i=c(this).data("ams-plugins-disabled").split(/\s+/);for(var j=0;j<i.length;j++){g.push(i[j])}});var h;c("[data-ams-plugins]",f).each(function(){var l=c(this);var i={};var k;if(typeof(l.data("ams-plugins"))==="string"){var n=l.data("ams-plugins").split(/\s+/);for(var j=0;j<n.length;j++){k=n[j];i[k]={src:l.data("ams-plugin-"+k+"-src"),css:l.data("ams-plugin-"+k+"-css"),callback:l.data("ams-plugin-"+k+"-callback"),register:l.data("ams-plugin-"+k+"-register"),async:l.data("ams-plugin-"+k+"-async")}}}else{i=l.data("ams-plugins")}function m(){var q=h.callback;if(q){var p=a.getFunctionByName(q);if(h.register!==false){a.plugins.enabled[k]=p}}else{if(h.register!==false){a.plugins.enabled[k]=null}}var o=h.css;if(o){a.getCSS(o,k+"_css")}}for(k in i){if(a.plugins.enabled[k]===undefined){h=i[k];a.getScript(h.src,m,{async:h.async===undefined?true:h.async})}}});for(var e in a.plugins.enabled){if(!a.plugins.enabled.hasOwnProperty(e)){continue}if(g.indexOf(e)>=0){continue}h=a.plugins.enabled[e];if(typeof(h)==="function"){h(f)}}},initData:function(e){c("[data-ams-data]",e).each(function(){var g=c(this);var h=g.data("ams-data");if(h){for(var f=0;f<h.length;f++){g.attr("data-"+f,h[f])}}})},register:function(f,e,h){if(typeof(e)==="function"){h=e;e=null}e=e||f.name;if(a.plugins.enabled.indexOf(e)>=0){if(b.console){b.console.warn("Plugin "+e+" is already registered!")}return}if(typeof(f)==="object"){var g=f.src;if(g){a.ajax.check(f.callback,g,function(i){if(i){a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}})}else{a.plugins.enabled[e]=a.getFunctionByName(f.callback);if(f.css){a.getCSS(f.css,e+"_css")}if(h){a.executeFunctionByName(h)}}}else{if(typeof(f)==="function"){a.plugins.enabled[e]=f;if(h){a.executeFunctionByName(h)}}}},enabled:{hint:function(e){var f=c(".hint:not(:parents(.nohints))",e);if(f.length>0){a.ajax.check(c.fn.tipsy,a.baseURL+"ext/jquery-tipsy"+a.devext+".js",function(){a.getCSS(a.baseURL+"../css/ext/jquery-tipsy"+a.devext+".css","jquery-tipsy");f.each(function(){var k=c(this);var j=k.data();var h={html:j.amsHintHtml,title:a.getFunctionByName(j.amsHintTitleGetter)||function(){var l=c(this);return l.attr("original-title")||l.attr(j.amsHintTitleAttr||"title")||(j.amsHintHtml?l.html():l.text())},opacity:j.amsHintOpacity||0.95,gravity:j.amsHintGravity||"sw",offset:j.amsHintOffset||0};var g=c.extend({},h,j.amsHintOptions);g=a.executeFunctionByName(j.amsHintInitCallback,k,g)||g;var i=k.tipsy(g);a.executeFunctionByName(j.amsHintAfterInitCallback,k,i,g)})})}},contextMenu:function(e){var f=c(".context-menu",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={menuSelector:j.amsContextmenuSelector,menuSelected:a.helpers.contextMenuHandler};var g=c.extend({},h,j.amsContextmenuOptions);g=a.executeFunctionByName(j.amsContextmenuInitCallback,k,g)||g;var i=k.contextMenu(g);a.executeFunctionByName(j.amsContextmenuAfterInitCallback,k,i,g)})}},switcher:function(e){c("LEGEND.switcher",e).each(function(){var g=c(this);var f=g.parent("fieldset");var h=g.data();if(!h.amsSwitcher){c('<i class="fa fa-fw"></i>').prependTo(c(this)).addClass(h.amsSwitcherState==="open"?(h.amsSwitcherMinusClass||"fa-minus"):(h.amsSwitcherPlusClass||"fa-plus"));g.on("click",function(j){j.preventDefault();var i={};g.trigger("ams.switcher.before-switch",[g,i]);if(i.veto){return}if(f.hasClass("switched")){f.removeClass("switched");c(".fa",g).removeClass(h.amsSwitcherPlusClass||"fa-plus").addClass(h.amsSwitcherMinusClass||"fa-minus");g.trigger("ams.switcher.opened",[g]);var k=g.attr("id");if(k){c('legend.switcher[data-ams-switcher-sync="'+k+'"]',f).each(function(){var l=c(this);if(l.parents("fieldset").hasClass("switched")){l.click()}})}}else{f.addClass("switched");c(".fa",g).removeClass(h.amsSwitcherMinusClass||"fa-minus").addClass(h.amsSwitcherPlusClass||"fa-plus");g.trigger("ams.switcher.closed",[g])}});if(h.amsSwitcherState!=="open"){f.addClass("switched")}g.data("ams-switcher","on")}})},checker:function(e){c("LEGEND.checker",e).each(function(){var q=c(this);var r=q.parent("fieldset");var h=q.data();if(!h.amsChecker){var f=c('<label class="checkbox"></label>');var k=h.amsCheckerFieldname||("checker_"+a.generateId());var o=k.replace(/\./,"_");var i=h.amsCheckerHiddenPrefix;var j=null;var n=h.amsCheckerHiddenValueOn||"true";var l=h.amsCheckerHiddenValueOff||"false";var g=h.amsCheckerMarker||false;if(i){j=c('<input type="hidden">').attr("name",i+k).val(h.amsCheckerState==="on"?n:l).prependTo(q)}else{if(g){c('<input type="hidden">').attr("name",g).attr("value",1).prependTo(q)}}var p=c('<input type="checkbox">').attr("name",k).attr("id",o).data("ams-checker-hidden-input",j).data("ams-checker-init",true).val(h.amsCheckerValue||true).attr("checked",h.amsCheckerState==="on"?"checked":null);if(h.amsCheckerReadonly){p.attr("disabled","disabled")}else{p.on("change",function(u){u.preventDefault();var s={};var v=c(this).is(":checked");q.trigger("ams.checker.before-switch",[q,s]);if(s.veto){c(this).prop("checked",!v);return}a.executeFunctionByName(h.amsCheckerChangeHandler,q,v);if(!h.amsCheckerCancelDefault){var t=p.data("ams-checker-hidden-input");if(v){if(h.amsCheckerMode==="disable"){r.removeAttr("disabled")}else{r.removeClass("switched")}if(t){t.val(n)}c("[data-required]",r).attr("required","required");q.trigger("ams.checker.opened",[q])}else{if(h.amsCheckerMode==="disable"){r.prop("disabled","disabled")}else{r.addClass("switched")}if(t){t.val(l)}c("[data-required]",r).removeAttr("required");q.trigger("ams.checker.closed",[q])}}})}p.appendTo(f);c(">label",q).attr("for",p.attr("id"));f.append("<i></i>").prependTo(q);var m=c("[required]",r);m.attr("data-required",true);if(h.amsCheckerState==="on"){p.attr("checked",true)}else{if(h.amsCheckerMode==="disable"){r.attr("disabled","disabled")}else{r.addClass("switched")}m.removeAttr("required")}q.data("ams-checker","on")}})},slider:function(e){var f=c(".slider",e);if(f.length>0){a.ajax.check(c.fn.slider,a.baseURL+"ext/bootstrap-slider.min.js",function(){f.each(function(){var j=c(this);var k=j.data();var h={};var g=c.extend({},h,j.data.amsSliderOptions);g=a.executeFunctionByName(k.amsSliderInitCallback,j,g)||g;var i=j.slider(g);a.executeFunctionByName(k.amsSliderAfterInitCallback,j,i,g)})})}},draggable:function(f){var e=c(".draggable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={containment:k.amsDraggableContainment,helper:a.getFunctionByName(k.amsDraggableHelper)||k.amsDraggableHelper,start:a.getFunctionByName(k.amsDraggableStart),stop:a.getFunctionByName(k.amsDraggableStop)};var h=c.extend({},i,k.amsDraggableOptions);h=a.executeFunctionByName(k.amsDraggableInitCallback,g,h)||h;var j=g.draggable(h);g.disableSelection();a.executeFunctionByName(k.amsDraggableAfterInitCallback,g,j,h)})}},sortable:function(e){var f=c(".sortable",e);if(f.length>0){f.each(function(){var k=c(this);var j=k.data();var h={items:j.amsSortableItems,handle:j.amsSortableHandle,connectWith:j.amsSortableConnectwith,start:a.getFunctionByName(j.amsSortableStart),over:a.getFunctionByName(j.amsSortableOver),containment:j.amsSortableContainment,placeholder:j.amsSortablePlaceholder,stop:a.getFunctionByName(j.amsSortableStop)};var g=c.extend({},h,j.amsSortableOptions);g=a.executeFunctionByName(j.amsSortableInitCallback,k,g)||g;var i=k.sortable(g);k.disableSelection();a.executeFunctionByName(j.amsSortableAfterInitCallback,k,i,g)})}},resizable:function(f){var e=c(".resizable",f);if(e.length>0){e.each(function(){var g=c(this);var k=g.data();var i={autoHide:k.amsResizableAutohide===false?true:k.amsResizableAutohide,containment:k.amsResizableContainment,grid:k.amsResizableGrid,handles:k.amsResizableHandles,start:a.getFunctionByName(k.amsResizableStart),stop:a.getFunctionByName(k.amsResizableStop)};var h=c.extend({},i,k.amsResizableOptions);h=a.executeFunctionByName(k.amsResizableInitCallback,g,h)||h;var j=g.resizable(h);g.disableSelection();a.executeFunctionByName(k.amsResizableAfterInitCallback,g,j,h)})}},typeahead:function(f){var e=c(".typeahead",f);if(e.length>0){a.ajax.check(c.fn.typeahead,a.baseURL+"ext/jquery-typeahead"+a.devext+".js",function(){e.each(function(){var g=c(this);var k=g.data();var i={};var h=c.extend({},i,k.amsTypeaheadOptions);h=a.executeFunctionByName(k.amsTypeaheadInitCallback,g,h)||h;var j=g.typeahead(h);a.executeFunctionByName(k.amsTypeaheadAfterInitCallback,g,j,h)})})}},select2:function(f){var e=c(".select2",f);if(e.length>0){a.ajax.check(c.fn.select2,a.baseURL+"ext/jquery-select2-3.5.2"+a.devext+".js",function(){e.each(function(){var g=c(this);var l=g.data();var j={placeholder:l.amsSelect2Placeholder,multiple:l.amsSelect2Multiple,minimumInputLength:l.amsSelect2MinimumInputLength||0,maximumSelectionSize:l.amsSelect2MaximumSelectionSize,openOnEnter:l.amsSelect2EnterOpen===undefined?true:l.amsSelect2EnterOpen,allowClear:l.amsSelect2AllowClear===undefined?true:l.amsSelect2AllowClear,width:l.amsSelect2Width||"100%",initSelection:a.getFunctionByName(l.amsSelect2InitSelection),formatSelection:l.amsSelect2FormatSelection===undefined?a.helpers.select2FormatSelection:a.getFunctionByName(l.amsSelect2FormatSelection),formatResult:a.getFunctionByName(l.amsSelect2FormatResult),formatMatches:l.amsSelect2FormatMatches===undefined?function(m){if(m===1){return a.i18n.SELECT2_MATCH}else{return m+a.i18n.SELECT2_MATCHES}}:a.getFunctionByName(l.amsSelect2FormatMatches),formatNoMatches:l.amsSelect2FormatResult===undefined?function(m){return a.i18n.SELECT2_NOMATCHES}:a.getFunctionByName(l.amsSelect2FormatResult),formatInputTooShort:l.amsSelect2FormatInputTooShort===undefined?function(m,o){var p=o-m.length;return a.i18n.SELECT2_INPUT_TOOSHORT.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooShort),formatInputTooLong:l.amsSelect2FormatInputTooLong===undefined?function(o,m){var p=o.length-m;return a.i18n.SELECT2_INPUT_TOOLONG.replace(/\{0\}/,p).replace(/\{1\}/,p===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatInputTooLong),formatSelectionTooBig:l.amsSelect2FormatSelectionTooBig===undefined?function(m){return a.i18n.SELECT2_SELECTION_TOOBIG.replace(/\{0\}/,m).replace(/\{1\}/,m===1?"":a.i18n.SELECT2_PLURAL)}:a.getFunctionByName(l.amsSelect2FormatSelectionTooBig),formatLoadMore:l.amsSelect2FormatLoadMore===undefined?function(m){return a.i18n.SELECT2_LOADMORE}:a.getFunctionByName(l.amsSelect2FormatLoadMore),formatSearching:l.amsSelect2FormatSearching===undefined?function(){return a.i18n.SELECT2_SEARCHING}:a.getFunctionByName(l.amsSelect2FormatSearching),separator:l.amsSelect2Separator||",",tokenSeparators:l.amsSelect2TokensSeparators||[","],tokenizer:a.getFunctionByName(l.amsSelect2Tokenizer)};switch(g.context.type){case"text":case"hidden":if(!j.initSelection){var h=g.data("ams-select2-values");if(h){j.initSelection=function(m,o){var n=[];c(m.val().split(j.separator)).each(function(){n.push({id:this,text:h[this]||this})});o(n)}}}break;default:break}if(g.attr("readonly")){if(g.attr("type")==="hidden"){j.query=function(){return[]}}}else{if(l.amsSelect2Query){j.query=a.getFunctionByName(l.amsSelect2Query);j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryUrl){j.ajax={url:l.amsSelect2QueryUrl,quietMillis:l.amsSelect2QuietMillis||200,type:l.amsSelect2QueryType||"POST",dataType:l.amsSelect2QueryDatatype||"json",data:function(o,p,n){var m={};m[l.amsSelect2QueryParamName||"query"]=o;m[l.amsSelect2PageParamName||"page"]=p;m[l.amsSelect2ContextParamName||"context"]=n;return c.extend({},m,l.amsSelect2QueryOptions)},results:a.helpers.select2QueryUrlResultsCallback};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2QueryMethod){j.query=function(m){var n={url:l.amsSelect2MethodTarget||a.jsonrpc.getAddr(),type:l.amsSelect2MethodType||"POST",cache:false,method:l.amsSelect2QueryMethod,params:l.amsSelect2QueryParams||{},success:function(p,o){return a.helpers.select2QueryMethodSuccessCallback.call(g,p,o,m)},error:a.error.show};n.params[l.amsSelect2QueryParamName||"query"]=m.term;n.params[l.amsSelect2PageParamName||"page"]=m.page;n.params[l.amsSelect2ContextParamName||"context"]=m.context;n=c.extend({},n,l.amsSelect2QueryOptions);n=a.executeFunctionByName(l.amsSelect2QueryInitCallback,g,n)||n;a.ajax.check(c.jsonRpc,a.baseURL+"ext/jquery-jsonrpc"+(a.devmode?".js":".min.js"),function(){c.jsonRpc(n)})};j.minimumInputLength=l.amsSelect2MinimumInputLength||1}else{if(l.amsSelect2Tags){j.tags=l.amsSelect2Tags}else{if(l.amsSelect2Data){j.data=l.amsSelect2Data}}}}}}if(l.amsSelect2EnableFreeTags){j.createSearchChoice=function(m){return{id:m,text:(l.amsSelect2FreeTagsPrefix||a.i18n.SELECT2_FREETAG_PREFIX)+m}}}var i=c.extend({},j,l.amsSelect2Options);i=a.executeFunctionByName(l.amsSelect2InitCallback,g,i)||i;var k=g.select2(i);a.executeFunctionByName(l.amsSelect2AfterInitCallback,g,k,i);if(g.hasClass("ordered")){a.ajax.check(c.fn.select2Sortable,a.baseURL+"ext/jquery-select2-sortable"+a.devext+".js",function(){g.select2Sortable({bindOrder:"sortableStop"})})}g.on("change",function(){var m=c(g.get(0).form).data("validator");if(m!==undefined){c(g).valid()}})})})}},maskedit:function(f){var e=c("[data-mask]",f);if(e.length>0){a.ajax.check(c.fn.mask,a.baseURL+"ext/jquery-maskedinput-1.3.1.min.js",function(){e.each(function(){var g=c(this);var k=g.data();var i={placeholder:k.amsMaskeditPlaceholder||"X"};var h=c.extend({},i,k.amsMaskeditOptions);h=a.executeFunctionByName(k.amsMaskeditInitCallback,g,h)||h;var j=g.mask(g.attr("data-mask"),h);a.executeFunctionByName(k.amsMaskeditAfterInitCallback,g,j,h)})})}},datepicker:function(e){var f=c(".datepicker",e);if(f.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}f.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y",datepicker:true,dayOfWeekStart:1,timepicker:false};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},datetimepicker:function(f){var e=c(".datetimepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"d/m/y H:i",datepicker:true,dayOfWeekStart:1,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},timepicker:function(f){var e=c(".timepicker",f);if(e.length>0){a.ajax.check(c.fn.datetimepicker,a.baseURL+"ext/jquery-datetimepicker"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-datetimepicker"+a.devext+".css","jquery-datetimepicker");a.dialog.registerHideCallback(a.helpers.datetimepickerDialogHiddenCallback)}e.each(function(){var h=c(this);var l=h.data();var j={lang:l.amsDatetimepickerLang||a.lang,format:l.amsDatetimepickerFormat||"H:i",datepicker:false,timepicker:true};var i=c.extend({},j,l.amsDatetimepickerOptions);i=a.executeFunctionByName(l.amsDatetimepickerInitCallback,h,i)||i;var k=h.datetimepicker(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},colorpicker:function(e){var f=c(".colorpicker",e);if(f.length>0){a.ajax.check(c.fn.minicolors,a.baseURL+"ext/jquery-minicolors"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-minicolors"+a.devext+".css","jquery-minicolors")}f.each(function(){var h=c(this);var l=h.data();var j={position:l.amsColorpickerPosition||h.closest("label.input").data("ams-colorpicker-position")||"bottom left"};var i=c.extend({},j,l.amsColorpickerOptions);i=a.executeFunctionByName(l.amsColorpickerInitCallback,h,i)||i;var k=h.minicolors(i);a.executeFunctionByName(l.amsDatetimepickerAfterInitCallback,h,k,i)})})}},validate:function(f){var e=c("FORM:not([novalidate])",f);if(e.length>0){a.ajax.check(c.fn.validate,a.baseURL+"ext/jquery-validate-1.11.1"+a.devext+".js",function(i){if(i){c.validator.setDefaults({highlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").addClass("state-error")},unhighlight:function(j){c(j).closest(".form-group, label:not(:parents(.form-group))").removeClass("state-error")},errorElement:"span",errorClass:"state-error",errorPlacement:function(k,l){var j=l.parents("label:first");if(j.length){k.insertAfter(j)}else{k.insertAfter(l)}}});if(a.plugins.i18n){for(var g in a.plugins.i18n.validate){if(!a.plugins.i18n.validate.hasOwnProperty(g)){continue}var h=a.plugins.i18n.validate[g];if((typeof(h)==="string")&&(h.indexOf("{0}")>-1)){a.plugins.i18n.validate[g]=c.validator.format(h)}}c.extend(c.validator.messages,a.plugins.i18n.validate)}}e.each(function(){var m=c(this);var n=m.data();var k={ignore:null,submitHandler:m.attr("data-async")!==undefined?n.amsFormSubmitHandler===undefined?function(){c(".state-error",m).removeClass("state-error");a.ajax.check(c.fn.ajaxSubmit,a.baseURL+"ext/jquery-form-3.49"+a.devext+".js");return a.form.submit(m)}:a.getFunctionByName(n.amsFormSubmitHandler):undefined,invalidHandler:m.attr("data-async")!==undefined?n.amsFormInvalidHandler===undefined?function(s,r){c(".state-error",m).removeClass("state-error");for(var p=0;p<r.errorList.length;p++){var o=r.errorList[p];var q=c(o.element).parents(".tab-pane").index()+1;if(q>0){var t=c(".nav-tabs",c(o.element).parents(".tabforms"));c("li:nth-child("+q+")",t).removeClassPrefix("state-").addClass("state-error");c("li.state-error:first a",t).click()}}}:a.getFunctionByName(n.amsFormInvalidHandler):undefined};var j=c.extend({},k,n.amsValidateOptions);j=a.executeFunctionByName(n.amsValidateInitCallback,m,j)||j;var l=m.validate(j);a.executeFunctionByName(n.amsValidateAfterInitCallback,m,l,j)})})}},datatable:function(f){var e=c(".datatable",f);if(e.length>0){a.ajax.check(c.fn.dataTable,a.baseURL+"ext/jquery-dataTables-1.9.4"+a.devext+".js",function(g){c(e).each(function(){a.ajax.check(c.fn.dataTableExt.oPagination.bootstrap_full,a.baseURL+"myams-dataTables"+a.devext+".js");var D=c(this);var H=D.data();var F=(H.amsDatatableExtensions||"").split(/\s+/);var m=H.amsDatatableSdom||"W"+((F.indexOf("colreorder")>=0||F.indexOf("colreorderwithresize")>=0)?"R":"")+"<'dt-top-row'"+(F.indexOf("colvis")>=0?"C":"")+((H.amsDatatablePagination===false||H.amsDatatablePaginationSize===false)?"":"L")+(H.amsDatatableGlobalFilter===false?"":"F")+">r<'dt-wrapper't"+(F.indexOf("scroller")>=0?"S":"")+"><'dt-row dt-bottom-row'<'row'<'col-sm-6'"+(H.amsDatatableInformation===false?"":"i")+"><'col-sm-6 text-right'p>>";var p;var i=H.amsDatatableSorting;if(typeof(i)==="string"){var G=i.split(";");i=[];for(p=0;p<G.length;p++){var x=G[p].split(",");x[0]=parseInt(x[0]);i.push(x)}}var h=[];var t=c("th",D).listattr("data-ams-datatable-stype");for(p=0;p<t.length;p++){var s=t[p];if(s){var j=h[p]||{};j.sType=s;h[p]=j}}var z={bJQueryUI:false,bFilter:H.amsDatatableGlobalFilter!==false,bPaginate:H.amsDatatablePagination!==false,bInfo:H.amsDatatableInfo!==false,bSort:H.amsDatatableSort!==false,aaSorting:i,aoColumns:h.length>0?h:undefined,bDeferRender:true,bAutoWidth:false,iDisplayLength:H.amsDatatableDisplayLength||25,sPaginationType:H.amsDatatablePaginationType||"bootstrap_full",sDom:m,oLanguage:a.plugins.i18n.datatables,fnInitComplete:function(K,J){c(".ColVis_Button").addClass("btn btn-default btn-sm").html((a.plugins.i18n.datatables.sColumns||"Columns")+' <i class="fa fa-fw fa-caret-down"></i>')}};var E=c.extend({},z,H.amsDatatableOptions);if(F.length>0){for(p=0;p<F.length;p++){switch(F[p]){case"autofill":a.ajax.check(c.fn.dataTable.AutoFill,a.baseURL+"ext/jquery-dataTables-autoFill"+a.devext+".js");break;case"columnfilter":a.ajax.check(c.fn.columnFilter,a.baseURL+"ext/jquery-dataTables-columnFilter"+a.devext+".js");break;case"colreorder":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorder"+a.devext+".js");break;case"colreorderwithresize":a.ajax.check(c.fn.dataTable.ColReorder,a.baseURL+"ext/jquery-dataTables-colReorderWithResize"+a.devext+".js");break;case"colvis":a.ajax.check(c.fn.dataTable.ColVis,a.baseURL+"ext/jquery-dataTables-colVis"+a.devext+".js");var u={activate:"click",sAlign:"right"};E.oColVis=c.extend({},u,H.amsDatatableColvisOptions);break;case"editable":a.ajax.check(c.fn.editable,a.baseURL+"ext/jquery-jeditable"+a.devext+".js");a.ajax.check(c.fn.makeEditable,a.baseURL+"ext/jquery-dataTables-editable"+a.devext+".js");break;case"fixedcolumns":a.ajax.check(c.fn.dataTable.FixedColumns,a.baseURL+"ext/jquery-dataTables-fixedColumns"+a.devext+".js");break;case"fixedheader":a.ajax.check(c.fn.dataTable.FixedHeader,a.baseURL+"ext/jquery-dataTables-fixedHeader"+a.devext+".js");break;case"keytable":a.ajax.check(window.KeyTable,a.baseURL+"ext/jquery-dataTables-keyTable"+a.devext+".js");break;case"rowgrouping":a.ajax.check(c.fn.rowGrouping,a.baseURL+"ext/jquery-dataTables-rowGrouping"+a.devext+".js");break;case"rowreordering":a.ajax.check(c.fn.rowReordering,a.baseURL+"ext/jquery-dataTables-rowReordering"+a.devext+".js");break;case"scroller":a.ajax.check(c.fn.dataTable.Scroller,a.baseURL+"ext/jquery-dataTables-scroller"+a.devext+".js");break;default:break}}}E=a.executeFunctionByName(H.amsDatatableInitCallback,D,E)||E;try{var l=D.dataTable(E);a.executeFunctionByName(H.amsDatatableAfterInitCallback,D,l,E);if(F.length>0){for(p=0;p<F.length;p++){switch(F[p]){case"autofill":var I=c.extend({},H.amsDatatableAutofillOptions,E.autofill);I=a.executeFunctionByName(H.amsDatatableAutofillInitCallback,D,I)||I;D.data("ams-autofill",H.amsDatatableAutofillConstructor===undefined?new c.fn.dataTable.AutoFill(D,I):a.executeFunctionByName(H.amsDatatableAutofillConstructor,D,l,I));break;case"columnfilter":var o={sPlaceHolder:"head:after"};var q=c.extend({},o,H.amsDatatableColumnfilterOptions,E.columnfilter);q=a.executeFunctionByName(H.amsDatatableColumnfilterInitCallback,D,q)||q;D.data("ams-columnfilter",H.amsDatatableColumnfilterConstructor===undefined?l.columnFilter(q):a.executeFunctionByName(H.amsDatatableColumnfilterConstructor,D,l,q));break;case"editable":var r=c.extend({},H.amsDatatableEditableOptions,E.editable);r=a.executeFunctionByName(H.amsDatatableEditableInitCallback,D,r)||r;D.data("ams-editable",H.amsDatatableEditableConstructor===undefined?D.makeEditable(r):a.executeFunctionByName(H.amsDatatableEditableConstructor,D,l,r));break;case"fixedcolumns":var k=c.extend({},H.amsDatatableFixedcolumnsOptions,E.fixedcolumns);k=a.executeFunctionByName(H.amsDatatableFixedcolumnsInitCallback,D,k)||k;D.data("ams-fixedcolumns",H.amsDatatableFixedcolumnsConstructor===undefined?new c.fn.dataTable.FixedColumns(D,k):a.executeFunctionByName(H.amsDatatableFixedcolumnsConstructor,D,l,k));break;case"fixedheader":var A=c.extend({},H.amsDatatableFixedheaderOptions,E.fixedheader);A=a.executeFunctionByName(H.amsDatatableFixedheadeInitCallback,D,A)||A;D.data("ams-fixedheader",H.amsDatatableFixedheaderConstructor===undefined?new c.fn.dataTable.FixedHeader(D,A):a.executeFunctionByName(H.amsDatatableFixedheaderConstructor,D,l,A));break;case"keytable":var n={table:D.get(0),datatable:l};var y=c.extend({},n,H.amsDatatableKeytableOptions,E.keytable);y=a.executeFunctionByName(H.amsDatatableKeytableInitCallback,D,y)||y;D.data("ams-keytable",H.amsDatatableKeytableConstructor===undefined?new KeyTable(y):a.executeFunctionByName(H.amsDatatableKeytableConstructor,D,l,y));break;case"rowgrouping":var w=c.extend({},H.amsDatatableRowgroupingOptions,E.rowgrouping);w=a.executeFunctionByName(H.amsDatatableRowgroupingInitCallback,D,w)||w;D.data("ams-rowgrouping",H.amsDatatableRowgroupingConstructor===undefined?D.rowGrouping(w):a.executeFunctionByName(H.amsDatatableRowgroupingConstructor,D,l,w));break;case"rowreordering":var v=c.extend({},H.amsDatatableRowreorderingOptions,E.rowreordering);v=a.executeFunctionByName(H.amsDatatableRowreorderingInitCallback,D,v)||v;D.data("ams-rowreordering",H.amsDatatableRowreorderingConstructor===undefined?D.rowReordering(v):a.executeFunctionByName(H.amsDatatableRowreorderingConstructor,D,l,v));break;default:break}}}var B=(H.amsDatatableFinalizeCallback||"").split(/\s+/);if(B.length>0){for(p=0;p<B.length;p++){a.executeFunctionByName(B[p],D,l,E)}}}catch(C){}})})}},tablednd:function(f){var e=c(".table-dnd",f);if(e.length>0){a.ajax.check(c.fn.tableDnD,a.baseURL+"ext/jquery-tablednd"+a.devext+".js",function(g){e.each(function(){var k=c(this);c(k).on("mouseover","tr",function(){c(this.cells[0]).addClass("drag-handle")}).on("mouseout","tr",function(){c(this.cells[0]).removeClass("drag-handle")});var l=k.data();var i={onDragClass:l.amsTabledndDragClass||"dragging-row",onDragStart:l.amsTabledndDragStart,dragHandle:l.amsTabledndDragHandle,scrollAmount:l.amsTabledndScrollAmount,onAllowDrop:l.amsTabledndAllowDrop,onDrop:l.amsTabledndDrop||function(o,q){var n=l.amsTabledndDropTarget;if(n){var m=[];c(o.rows).each(function(){var r=c(this).data("ams-element-name");if(r){m.push(r)}});var p=a.getFunctionByName(n);if(typeof(p)==="function"){p.call(k,o,m)}else{a.ajax.post(n,{names:JSON.stringify(m)})}}return false}};var h=c.extend({},i,l.amsTabledndOptions);h=a.executeFunctionByName(l.amsTabledndInitCallback,k,h)||h;var j=k.tableDnD(h);a.executeFunctionByName(l.amsTabledndAfterInitCallback,k,j,h)})})}},imgareaselect:function(f){var e=c(".imgareaselect",f);if(e.length>0){a.ajax.check(c.fn.imgAreaSelect,a.baseURL+"ext/jquery-imgareaselect-0.9.10"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-imgareaselect"+a.devext+".css")}e.each(function(){var m=c(this);var l=m.data();var j=l.amsImgareaselectParent?m.parents(l.amsImgareaselectParent):"body";var i={instance:true,handles:true,parent:j,x1:l.amsImgareaselectX1||0,y1:l.amsImgareaselectY1||0,x2:l.amsImgareaselectX2||l.amsImgareaselectImageWidth,y2:l.amsImgareaselectY2||l.amsImgareaselectImageHeight,imageWidth:l.amsImgareaselectImageWidth,imageHeight:l.amsImgareaselectImageHeight,minWidth:128,minHeight:128,aspectRatio:l.amsImgareaselectRatio,onSelectEnd:a.getFunctionByName(l.amsImgareaselectSelectEnd)||function(n,o){var p=l.amsImgareaselectTargetField||"image_";c('input[name="'+p+'x1"]',j).val(o.x1);c('input[name="'+p+'y1"]',j).val(o.y1);c('input[name="'+p+'x2"]',j).val(o.x2);c('input[name="'+p+'y2"]',j).val(o.y2)}};var h=c.extend({},i,l.amsImgareaselectOptions);h=a.executeFunctionByName(l.amsImgareaselectInitCallback,m,h)||h;var k=m.imgAreaSelect(h);a.executeFunctionByName(l.amsImgareaselectAfterInitCallback,m,k,h);setTimeout(function(){k.update()},250)})})}},fancybox:function(e){var f=c(".fancybox",e);if(f.length>0){a.ajax.check(c.fn.fancybox,a.baseURL+"ext/jquery-fancybox-2.1.5"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-fancybox-2.1.5"+a.devext+".css")}f.each(function(){var h=c(this);var o=h.data();var n=(o.amsFancyboxHelpers||"").split(/\s+/);if(n.length>0){for(var i=0;i<n.length;i++){var m=n[i];switch(m){case"buttons":a.ajax.check(c.fancybox.helpers.buttons,a.baseURL+"ext/fancybox-helpers/fancybox-buttons"+a.devext+".js");break;case"thumbs":a.ajax.check(c.fancybox.helpers.thumbs,a.baseURL+"ext/fancybox-helpers/fancybox-thumbs"+a.devext+".js");break;case"media":a.ajax.check(c.fancybox.helpers.media,a.baseURL+"ext/fancybox-helpers/fancybox-media"+a.devext+".js");break;default:break}}}var k={type:o.amsFancyboxType,padding:o.amsFancyboxPadding||10,margin:o.amsFancyboxMargin||10,beforeLoad:a.getFunctionByName(o.amsFancyboxBeforeLoad)||function(){this.title=a.executeFunctionByName(o.amsFancyboxTitleGetter,this)||c(this.element).attr("original-title")||c(this.element).attr("title")},helpers:{title:{type:"inside"}}};var j=c.extend({},k,o.amsFancyboxOptions);j=a.executeFunctionByName(o.amsFancyboxInitCallback,h,j)||j;var l=h.fancybox(j);a.executeFunctionByName(o.amsFancyboxAfterInitCallback,h,l,j)})})}},graphs:function(f){var e=c(".sparkline",f);if(e.length>0){a.ajax.check(a.graphs,a.baseURL+"myams-graphs"+a.devext+".js",function(){a.graphs.init(e)})}},scrollbars:function(e){var f=c(".scrollbar",e);if(f.length>0){a.ajax.check(c.event.special.mousewheel,a.baseURL+"ext/jquery-mousewheel.min.js",function(){a.ajax.check(c.fn.mCustomScrollbar,a.baseURL+"ext/jquery-mCustomScrollbar"+a.devext+".js",function(g){if(g){a.getCSS(a.baseURL+"../css/ext/jquery-mCustomScrollbar.css","jquery-mCustomScrollbar")}f.each(function(){var l=c(this);var k=l.data();var i={theme:k.amsScrollbarTheme||"light"};var h=c.extend({},i,k.amsScrollbarOptions);h=a.executeFunctionByName(k.amsScrollbarInitCallback,l,h)||h;var j=l.mCustomScrollbar(h);a.executeFunctionByName(k.amsScrollbarAfterInitCallback,l,j,h)})})})}}}};d.callbacks={init:function(e){c("[data-ams-callback]",e).each(function(){var f=this;var g=c(f).data();var h=a.getFunctionByName(g.amsCallback);if(h===undefined){if(g.amsCallbackSource){a.getScript(g.amsCallbackSource,function(){a.executeFunctionByName(g.amsCallback,f,g.amsCallbackOptions)})}else{if(b.console){b.console.warn("Undefined callback: "+g.amsCallback)}}}else{h.call(f,g.amsCallbackOptions)}})},alert:function(m){var h=c(this).data();var e=c.extend({},m,h.amsAlertOptions);var k=c(h.amsAlertParent||e.parent||this);var g=h.amsAlertStatus||e.status||"info";var i=h.amsAlertHeader||e.header;var l=h.amsAlertMessage||e.message;var j=h.amsAlertSubtitle||e.subtitle;var f=h.amsAlertMargin===undefined?(e.margin===undefined?false:e.margin):h.amsAlertMargin;a.skin.alert(k,g,i,l,j,f)},messageBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsMessageboxOptions);var g=c.extend({},h,{title:i.amsMessageboxTitle||h.title||"",content:i.amsMessageboxContent||h.content||"",icon:i.amsMessageboxIcon||h.icon,number:i.amsMessageboxNumber||h.number,timeout:i.amsMessageboxTimeout||h.timeout});var e=i.amsMessageboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsMessageboxCallback||h.callback);a.skin.messageBox(e,g,j)},smallBox:function(f){var i=c(this).data();var h=c.extend({},f,i.amsSmallboxOptions);var g=c.extend({},h,{title:i.amsSmallboxTitle||h.title||"",content:i.amsSmallboxContent||h.content||"",icon:i.amsSmallboxIcon||h.icon,iconSmall:i.amsSmallboxIconSmall||h.iconSmall,timeout:i.amsSmallboxTimeout||h.timeout});var e=i.amsSmallboxStatus||h.status||"info";var j=a.getFunctionByName(i.amsSmallboxCallback||h.callback);a.skin.smallBox(e,g,j)}};d.events={init:function(e){c("[data-ams-events-handlers]",e).each(function(){var g=c(this);var f=g.data("ams-events-handlers");if(f){for(var h in f){if(f.hasOwnProperty(h)){g.on(h,a.getFunctionByName(f[h]))}}}})}};d.container={changeOrder:function(f,g){var e=c('input[name="'+c(this).data("ams-input-name")+'"]',c(this));e.val(g.join(";"))},deleteElement:function(e){return function(){var f=c(this);d.skin.bigBox({title:a.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i>&nbsp; '+a.i18n.DELETE_WARNING,buttons:a.i18n.BTN_OK_CANCEL},function(i){if(i===a.i18n.BTN_OK){var k=f.parents("table");var h=k.data("ams-location")||"";var l=f.parents("tr");var j=l.data("ams-delete-target")||k.data("ams-delete-target")||"delete-element.json";var g=l.data("ams-element-name");d.ajax.post(h+"/"+j,{object_name:g},function(m,n){if(m.status==="success"){if(k.hasClass("datatable")){k.dataTable().fnDeleteRow(l[0])}else{l.remove()}}})}})}}};d.skin={_setPageHeight:function(){var g=c("#main").height();var e=a.left_panel.height();var f=c(window).height()-a.navbar_height;if(g>f){a.left_panel.css("min-height",g);a.root.css("min-height",g+a.navbar_height)}else{a.left_panel.css("min-height",f);a.root.css("min-height",f)}},_checkMobileWidth:function(){if(c(window).width()<979){a.root.addClass("mobile-view-activated")}else{if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("mobile-view-activated")}}},_showShortcutButtons:function(){a.shortcuts.animate({height:"show"},200,"easeOutCirc");a.root.addClass("shortcut-on")},_hideShortcutButtons:function(){a.shortcuts.animate({height:"hide"},300,"easeOutCirc");a.root.removeClass("shortcut-on")},checkNotification:function(){var e=c("#activity > .badge");if(parseInt(e.text())>0){e.removeClass("hidden").addClass("bg-color-red bounceIn animated")}else{e.addClass("hidden").removeClass("bg-color-red bounceIn animated")}},_initDesktopWidgets:function(e){if(a.enable_widgets){var f=c(".ams-widget",e);if(f.length>0){a.ajax.check(c.fn.MyAMSWidget,a.baseURL+"myams-widgets"+a.devext+".js",function(){f.each(function(){var j=c(this);var i=j.data();var h={deleteSettingsKey:"#deletesettingskey-options",deletePositionKey:"#deletepositionkey-options"};var g=c.extend({},h,i.amsWidgetOptions);g=a.executeFunctionByName(i.amsWidgetInitcallback,j,g)||g;j.MyAMSWidget(g)});b.MyAMSWidget.initWidgetsGrid(c(".ams-widget-grid",e))})}}},_initMobileWidgets:function(e){if(a.enable_mobile&&a.enable_widgets){a.skin._initDesktopWidgets(e)}},alert:function(l,f,g,m,k,e){c(".alert",l).remove();if(f==="error"){f="danger"}var i='<div class="'+(e?"margin-10":"")+" alert alert-block alert-"+f+' fade in"><a class="close" data-dismiss="alert"><i class="fa fa-check"></i></a><h4 class="alert-heading"><i class="fa fa-fw fa-warning"></i> '+g+"</h4>"+(k?("<p>"+k+"</p>"):"");if(typeof(m)==="string"){i+="<ul><li>"+m+"</li></ul>"}else{if(m){i+="<ul>";for(var h in m){if(!c.isNumeric(h)){continue}i+="<li>"+m[h]+"</li>"}i+="</ul>"}}i+="</div>";var j=c(i).prependTo(l);if(l.exists){a.ajax.check(c.scrollTo,a.baseURL+"ext/jquery-scrollTo.min.js",function(){c.scrollTo(l,{offset:{top:-50}})})}},bigBox:function(e,f){a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){a.notify.messageBox(e,f)})},messageBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.bigBox(f,g)})},smallBox:function(e,f,g){if(typeof(e)==="object"){g=f;f=e||{};e="info"}a.ajax.check(a.notify,a.baseURL+"myams-notify"+a.devext+".js",function(){switch(e){case"error":case"danger":f.color="#C46A69";break;case"warning":f.color="#C79121";break;case"success":f.color="#739E73";break;default:f.color=f.color||"#3276B1"}f.sound=false;a.notify.smallBox(f,g)})},_drawBreadCrumb:function(){var e=c("#ribbon OL.breadcrumb");e.empty().append(c("<li></li>").append(c("<a></a>").text(a.i18n.HOME).attr("href",c('nav a[href!="#"]:first').attr("href"))));c("nav LI.active >A").each(function(){var h=c(this);var f=c.trim(h.clone().children(".badge").remove().end().text());var g=c("<li></li>").append(h.attr("href").replace(/^#/,"")?c("<a></a>").html(f).attr("href",h.attr("href")):f);e.append(g)})},checkURL:function(){function e(k){c("nav .active").removeClass("active");k.addClass("open").addClass("active");k.parents("li").addClass("open active").children("ul").addClass("active").show();k.parents("li:first").removeClass("open");k.parents("ul").addClass(k.attr("href").replace(/^#/,"")?"active":"").show()}var i;var h=location.hash;var g=h.replace(/^#/,"");if(g){var f=c("#content");if(!f.exists()){f=c("body")}i=c('nav A[href="'+h+'"]');if(i.exists()){e(i)}a.skin.loadURL(g,f);document.title=c("[data-ams-page-title]:first",f).data("ams-page-title")||i.attr("title")||document.title}else{var j=c("[data-ams-active-menu]").data("ams-active-menu");if(j){i=c('nav A[href="'+j+'"]')}else{i=c('nav >UL >LI >A[href!="#"]').first()}if(i.exists()){e(i);if(j){a.skin._drawBreadCrumb()}else{window.location.hash=i.attr("href")}}}},_clean_callbacks:[],registerCleanCallback:function(f){var e=a.skin._clean_callbacks;if(e.indexOf(f)<0){e.push(f)}},cleanContainer:function(e){var g=a.skin._clean_callbacks;for(var f=0;f<g.length;f++){g[f].call(e)}},loadURL:function(g,e,f,j){if(g.startsWith("#")){g=g.substr(1)}if(typeof(f)==="function"){j=f;f={}}e=c(e);var i={type:"GET",url:g,dataType:"html",cache:false,beforeSend:function(){a.skin.cleanContainer(e);e.html('<h1 class="loading"><i class="fa fa-cog fa-spin"></i> Loading... </h1>');if(e[0]===c("#content")[0]){a.skin._drawBreadCrumb();document.title=c(".breadcrumb LI:last-child").text();c("html, body").animate({scrollTop:0},"fast")}else{e.animate({scrollTop:0},"fast")}},success:function(o,l,n){if(j){a.executeFunctionByName(j,this,o,l,n,f)}else{var m=a.ajax.getResponse(n);var q=m.content_type;var k=m.data;c(".loading",e).remove();switch(q){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);var p=c("[data-ams-focus-target]",e).first();if(!p.exists()){p=c("input, select",e).first()}if(p.exists()){p.focus()}}if(f&&f.afterLoadCallback){a.executeFunctionByName(f.afterLoadCallback,this)}}},error:function(m,l,k){e.html('<h3 class="error"><i class="fa fa-warning txt-color-orangeDark"></i> '+a.i18n.ERROR+k+"</h3>"+m.responseText)},async:false};var h=c.extend({},i,f);c.ajax(h)},setLanguage:function(f){var h=f.lang;var g=f.handler_type||"json";switch(g){case"json":var i=f.method||"setUserLanguage";a.jsonrpc.post(i,{lang:h},function(){window.location.reload(true)});break;case"ajax":var e=f.href||"setUserLanguage";a.ajax.post(e,{lang:h},function(){window.location.reload(true)});break}},logout:function(){window.location=a.loginURL}};d.stats={logEvent:function(f,g,e){if(typeof(b._gaq)==="undefined"){return}if(typeof(f)==="object"){g=f.action;e=f.label;f=f.category}b._gaq.push(["_trackEvent",f,g,e])}};d.initPage=function(){var e=c("body");a.root=e;a.left_panel=c("#left-panel");a.shortcuts=c("#shortcut");a.plugins.initData(e);var f=c.ajaxSettings.xhr;c.ajaxSetup({progress:a.ajax.progress,progressUpload:a.ajax.progress,xhr:function(){var h=f();if(h&&(typeof(h.addEventListener)==="function")){var g=this;h.addEventListener("progress",function(i){g.progress(i)},false)}return h}});c(document).ajaxStart(a.ajax.start);c(document).ajaxStop(a.ajax.stop);c(document).ajaxError(a.error.ajax);if(!a.isMobile){a.root.addClass("desktop-detected");a.device="desktop"}else{a.root.addClass("mobile-detected");a.device="mobile";if(a.enable_fastclick){a.ajax.check(c.fn.noClickDelay,a.baseURL+"/ext/jquery-smartclick"+a.devext+".js",function(){c("NAV UL A").noClickDelay();c("#hide-menu A").noClickDelay()})}}c("#hide-menu >:first-child > A").click(function(g){e.toggleClass("hidden-menu");g.preventDefault()});c("#show-shortcut").click(function(g){if(a.shortcuts.is(":visible")){a.skin._hideShortcutButtons()}else{a.skin._showShortcutButtons()}g.preventDefault()});a.shortcuts.click(function(g){a.skin._hideShortcutButtons()});c(document).mouseup(function(g){if(!a.shortcuts.is(g.target)&&a.shortcuts.has(g.target).length===0){a.skin._hideShortcutButtons()}});c("#search-mobile").click(function(){a.root.addClass("search-mobile")});c("#cancel-search-js").click(function(){a.root.removeClass("search-mobile")});c("#activity").click(function(h){var g=c(this);var i=g.next(".ajax-dropdown");if(!i.is(":visible")){i.css("left",g.position().left-i.innerWidth()/2+g.innerWidth()/2).fadeIn(150);g.addClass("active")}else{i.fadeOut(150);g.removeClass("active")}h.preventDefault()});a.skin.checkNotification();c(document).mouseup(function(g){var h=c(".ajax-dropdown");if(!h.is(g.target)&&h.has(g.target).length===0){h.fadeOut(150).prev().removeClass("active")}});c('input[name="activity"]').change(function(){var h=c(this).data("ams-url");var g=c(".ajax-notifications");a.skin.loadURL(h,g)});c("#logout a").click(function(g){g.preventDefault();g.stopPropagation();a.loginURL=c(this).attr("href");a.skin.bigBox({title:"<i class='fa fa-sign-out txt-color-orangeDark'></i> "+a.i18n.LOGOUT+" <span class='txt-color-orangeDark'><strong>"+c("#show-shortcut").text()+"</strong></span> ?",content:a.i18n.LOGOUT_COMMENT,buttons:"["+a.i18n.BTN_NO+"]["+a.i18n.BTN_YES+"]"},function(h){if(h===a.i18n.BTN_YES){a.root.addClass("animated fadeOutUp");setTimeout(a.skin.logout,1000)}})});c("NAV UL").myams_menu({accordion:true,speed:a.menu_speed});c(".minifyme").click(function(g){c("BODY").toggleClass("minified");c(this).effect("highlight",{},500);g.preventDefault()});c("#refresh").click(function(g){a.skin.bigBox({title:"<i class='fa fa-refresh' style='color: green'></i> "+a.i18n.CLEAR_STORAGE_TITLE,content:a.i18n.CLEAR_STORAGE_CONTENT,buttons:"["+a.i18n.BTN_CANCEL+"]["+a.i18n.BTN_OK+"]"},function(h){if(h===a.i18n.BTN_OK&&localStorage){localStorage.clear();location.reload()}});g.preventDefault()});e.on("click",function(h){var g=c(this);if(!g.is(h.target)&&g.has(h.target).length===0&&c(".popover").has(h.target).length===0){g.popover("hide")}});a.ajax.check(c.resize,a.baseURL+"ext/jquery-resize"+a.devext+".js",function(){c("#main").resize(function(){a.skin._setPageHeight();a.skin._checkMobileWidth()});c("nav").resize(function(){a.skin._setPageHeight()})});if(a.ajax_nav){c(document).on("click",'a[href="#"]',function(g){g.preventDefault()});c(document).on("click",'a[href!="#"]:not([data-toggle]), [data-ams-url]:not([data-toggle])',function(k){var i=c(k.currentTarget);var g=i.attr("href")||i.data("ams-url");if(!g||g.startsWith("javascript")||i.attr("target")||(i.data("ams-context-menu")===true)){return}k.preventDefault();k.stopPropagation();var h=a.getFunctionByName(g);if(typeof(h)==="function"){g=h.call(i)}if(typeof(g)==="function"){g.call(i)}else{g=g.replace(/\%23/,"#");var j=i.data("ams-target");if(j){a.form.confirmChangedForm(j,function(){a.skin.loadURL(g,j,i.data("ams-link-options"),i.data("ams-link-callback"))})}else{a.form.confirmChangedForm(function(){if(g.startsWith("#")){if(g!==location.hash){if(a.root.hasClass("mobile-view-activated")){a.root.removeClass("hidden-menu");window.setTimeout(function(){window.location.hash=g},50)}else{window.location.hash=g}}}else{window.location=g}})}}});c(document).on("click",'a[target="_blank"]',function(g){g.preventDefault();window.open(c(g.currentTarget).attr("href"))});c(document).on("click",'a[target="_top"]',function(g){g.preventDefault();a.form.confirmChangedForm(function(){window.location=c(g.currentTarget).attr("href")})});c(window).on("hashchange",a.skin.checkURL)}c(document).off("click.modal").on("click",'[data-toggle="modal"]',function(h){var g=c(this);if(g.data("ams-context-menu")===true){return}if(g.data("ams-stop-propagation")===true){h.stopPropagation()}h.preventDefault();a.dialog.open(g);if(g.parents("#shortcut").exists()){setTimeout(a.skin._hideShortcutButtons,300)}});c(document).on("click",'button[type="submit"], button.submit',function(){var g=c(this);c(g.get(0).form).data("ams-submit-button",g)});c(document).on("click","[data-ams-click-handler]",function(i){var h=c(this);var g=h.data();if(g.amsClickHandler){if((g.amsStopPropagation===true)||(g.amsClickStopPropagation===true)){i.stopPropagation()}if(g.amsClickKeepDefault!==true){i.preventDefault()}var j=a.getFunctionByName(g.amsClickHandler);if(j!==undefined){j.call(h,g.amsClickHandlerOptions)}}});c(document).on("change","[data-ams-change-handler]",function(i){var h=c(this);var g=h.data();if(g.amsChangeHandler){if(g.amsChangeKeepDefault!==true){i.preventDefault()}var j=a.getFunctionByName(g.amsChangeHandler);if(j!==undefined){j.call(h,g.amsChangeHandlerOptions)}}});c(document).on("reset","form",function(i){var g=c(this);setTimeout(function(){g.find(".select2").trigger("change")},10);var h=c("[data-ams-focus-target]",g).first();if(!h.exists()){h=c("input, select",g).first()}if(h.exists()){h.focus()}});c(document).on("reset","[data-ams-reset-handler]",function(i){var g=c(this);var h=g.data();if(h.amsResetHandler){if(h.amsResetKeepDefault!==true){i.preventDefault()}var j=a.getFunctionByName(h.amsResetHandler);if(j!==undefined){j.call(g,h.amsResetHandlerOptions)}}});c(document).on("change",'input[type="file"]',function(i){i.preventDefault();var g=c(this);var h=g.parent(".button");if(h.exists()&&h.parent().hasClass("input-file")){h.next('input[type="text"]').val(g.val())}});c(document).on("focusin",function(g){if(c(g.target).closest(".mce-window").length){g.stopImmediatePropagation()}});c("a[data-toggle=tab]",".nav-tabs").on("click",function(g){if(c(this).parent("li").hasClass("disabled")){g.preventDefault();return false}});c(document).on("show.bs.tab",function(i){var g=c(i.target);var h=g.data();if(h.amsUrl){if(h.amsTabLoaded){return}try{g.append('<i class="fa fa-spin fa-cog margin-left-5"></i>');a.skin.loadURL(h.amsUrl,g.attr("href"));if(h.amsTabLoadOnce){g.data("ams-tab-loaded",true)}}finally{c("i",g).remove()}}});a.initContent(document);if(a.ajax_nav&&c("nav").exists()){a.skin.checkURL()}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