(function(){function a(a,b,d,m){var n=m;d&&(n=e(m));var o=!1,d=!1;if("up"==n||"down"==n)o=!0;if("right"==n||"down"==n)d=!0;"rtl"==document.documentElement.dir?"start"==n&&(d=!0):"end"==n&&(d=!0);var q=$.Deferred(),n=a.width(),m=d?-1*n:n,s=-1*m;o?(n=a.height(),m=d?-1*n:n,s=-1*m,a.height(n),b.height(n),b.css("top",m+"px")):(a.width(n),b.width(n),"rtl"==document.documentElement.dir&&(b.css("width",n+"px"),b.css("right",-m+"px")),b.css("left",m+"px"));b.removeClass("new").addClass("showing");setTimeout(function(){var d=
$.Deferred(),e=$.Deferred();b.addClass("transitioning");a.addClass("transitioning");o?a.css("-webkit-transform","translate(0,"+s+"px)"):a.css("-webkit-transform","translate("+s+"px,0)");a.one("webkitTransitionEnd",function(){a.removeClass("current").addClass("old");a.removeClass("transitioning");a.remove();d.resolve()});b.addClass("transitioning");o?b.css("-webkit-transform","translate(0,"+s+"px)"):b.css("-webkit-transform","translate("+s+"px,0)");b.one("webkitTransitionEnd",function(){b.removeClass("showing").addClass("current");
b.removeClass("transitioning");b.attr("style","");e.resolve()});$.when(d,e).done(function(){setTimeout(function(){q.resolve()},1)})},1);return q.promise()}function b(a,b,d,m){var n=m;d&&(n=e(m));var o=!1,q=!1;if("up"==n||"down"==n)o=!0;if("right"==n||"up"==n)q=!0;"rtl"==document.documentElement.dir?"start"==n&&(q=!0):"end"==n&&(q=!0);var s=$.Deferred(),d=a.width(),m=q?"rotateY(-180deg)":"rotateY(180deg)";o?(d=a.height(),a.height(d),b.height(d),m=q?"rotateX(-180deg)":"rotateX(180deg)",a.addClass("face").css("-webkit-transform",
"rotateX(0deg)")):(a.width(d),b.width(d),a.addClass("face").css("-webkit-transform","rotateY(0deg)"));b.addClass("face").css("-webkit-transform",m);b.removeClass("new").addClass("showing");setTimeout(function(){var d=$.Deferred(),e=$.Deferred();$("#bodyPage").addClass("transitioning");a.addClass("transitioning-slow");var k=q?"rotateY(+180deg)":"rotateY(-180deg)";o&&(k=q?"rotateX(+180deg)":"rotateX(-180deg)");a.css("-webkit-transform",k);a.one("webkitTransitionEnd",function(){a.removeClass("current").addClass("old");
a.removeClass("transitioning-slow face");a.remove();d.resolve()});b.addClass("transitioning-slow");o?b.css("-webkit-transform","rotateX(0deg)"):b.css("-webkit-transform","rotateY(0deg)");b.one("webkitTransitionEnd",function(){b.removeClass("showing").addClass("current");b.removeClass("transitioning-slow face");$("#bodyPage").removeClass("transitioning");b.attr("style","");e.resolve()});$.when(d,e).done(function(){setTimeout(function(){s.resolve()},1)})},1);return s.promise()}function d(a,b){var d=
$.Deferred();a.addClass("face").css("opacity","1");b.addClass("face").css("opacity","0");b.addClass("transitioning-slow");b.removeClass("new").addClass("showing");setTimeout(function(){var e=$.Deferred(),n=$.Deferred();a.addClass("transitioning-slow");a.css("opacity","0");a.one("webkitTransitionEnd",function(){a.removeClass("current").addClass("old");a.removeClass("transitioning-slow face");a.remove();e.resolve()});b.addClass("transitioning-slow");b.css("opacity","1");b.one("webkitTransitionEnd",
function(){b.removeClass("showing").addClass("current");b.removeClass("transitioning-slow face");b.attr("style","");n.resolve()});$.when(e,n).done(function(){setTimeout(function(){d.resolve()},1)})},1);return d.promise()}function e(a){"start"==a?a="end":"end"==a?a="start":"left"==a?a="right":"right"==a?a="left":"up"==a?a="down":"down"==a&&(a="up");return a}amx.registerTransitionHandler("slide",function(b,d,e){return a(b,d,e,"start").promise()});amx.registerTransitionHandler("slideStart",function(b,
d,e){return a(b,d,e,"start").promise()});amx.registerTransitionHandler("slideEnd",function(b,d,e){return a(b,d,e,"end").promise()});amx.registerTransitionHandler("slideLeft",function(b,d,e){return a(b,d,e,"left").promise()});amx.registerTransitionHandler("slideRight",function(b,d,e){return a(b,d,e,"right").promise()});amx.registerTransitionHandler("slideUp",function(b,d,e){return a(b,d,e,"up").promise()});amx.registerTransitionHandler("slideDown",function(b,d,e){return a(b,d,e,"down").promise()});
amx.registerTransitionHandler("flip",function(a,d,e){return b(a,d,e,"start").promise()});amx.registerTransitionHandler("flipStart",function(a,d,e){return b(a,d,e,"start").promise()});amx.registerTransitionHandler("flipEnd",function(a,d,e){return b(a,d,e,"end").promise()});amx.registerTransitionHandler("flipLeft",function(a,d,e){return b(a,d,e,"left").promise()});amx.registerTransitionHandler("flipRight",function(a,d,e){return b(a,d,e,"right").promise()});amx.registerTransitionHandler("flipUp",function(a,
d,e){return b(a,d,e,"up").promise()});amx.registerTransitionHandler("flipDown",function(a,d,e){return b(a,d,e,"down").promise()});amx.registerTransitionHandler("fade",function(a,b,e){return d(a,b,e,"in").promise()});amx.registerTransitionHandler("fadeIn",function(a,b,e){return d(a,b,e,"in").promise()});amx.registerTransitionHandler("fadeOut",function(a,b,e){return d(a,b,e,"out").promise()})})();