/*************************************************
jquery.animate-enhanced plugin v0.76
Author: www.benbarnett.net || @benpbarnett
 
Copyright (c) 2011 Ben Barnett
Licensed under the MIT license
http://www.opensource.org/licenses/mit-license.php
**************************************************/
(function (a, b, c) { function z(a, b, c) { var e = jQuery.inArray(a, d) > -1; (a == "width" || a == "height") && b === parseFloat(c.css(a)) && (e = !1); return e } function y(a) { return parseFloat(a.replace(/px/i, "")) } function x(a) { for (var b in a) return !1; return !0 } function w(a) { for (var b in a) if ((b == "width" || b == "height") && (a[b] == "show" || a[b] == "hide" || a[b] == "toggle")) return !0; return !1 } function v(a, b, c, d, e, g, h, i) { a = typeof a == "undefined" ? {} : a, a.secondary = typeof a.secondary == "undefined" ? {} : a.secondary; for (var j = f.length - 1; j >= 0; j--) typeof a[f[j] + "transition-property"] == "undefined" && (a[f[j] + "transition-property"] = ""), a[f[j] + "transition-property"] += ", " + (g === !0 && h === !0 ? f[j] + "transform" : b), a[f[j] + "transition-duration"] = c + "ms", a[f[j] + "transition-timing-function"] = d, a.secondary[g === !0 && h === !0 ? f[j] + "transform" : b] = g === !0 && h === !0 ? t(a.meta.left, a.meta.top, i) : e; return a } function u(a, b, c, d, f, g, h, i) { var l = a.data(k) ? x(a.data(k)) ? jQuery.extend(!0, {}, j) : a.data(k) : jQuery.extend(!0, {}, j), m = f, n = jQuery.inArray(b, e) > -1; if (n) { var o = l.meta, p = y(a.css(b)) || 0, q = b + "_o"; m = n ? f - p : f, o[b] = m, o[q] = a.css(b) == "auto" ? 0 + m : p + m || 0, l.meta = o, h && m === 0 && (m = 0 - o[q], o[b] = m, o[q] = 0) } return a.data(k, v(l, b, c, d, m, g, h, i)) } function t(a, b, c) { return c === !0 && r ? "translate3d(" + a + "px," + b + "px,0)" : "translate(" + a + "px," + b + "px)" } function s(a, b, c, d) { var e = h.exec(b), f = a.css(c) === "auto" ? 0 : a.css(c), g = typeof f == "string" ? y(f) : f, i = typeof b == "string" ? y(b) : b, j = d === !0 ? 0 : g, k = a.is(":hidden"), l = a.translation(); c == "left" && (j = parseInt(g, 10) + l.x), c == "top" && (j = parseInt(g, 10) + l.y), !e && b == "show" ? (j = 1, k && a.css({ display: "block", opacity: 0 })) : !e && b == "hide" && (j = 0); if (e) { var m = parseFloat(e[2]); e[1] && (m = (e[1] === "-=" ? -1 : 1) * m + parseInt(j, 10)); return m } return j } var d = ["top", "right", "bottom", "left", "opacity", "height", "width"], e = ["top", "right", "bottom", "left"], f = ["", "-webkit-", "-moz-", "-o-"], g = ["avoidTransforms", "useTranslate3d", "leaveTransforms"], h = /^([+-]=)?([\d+-.]+)(.*)$/, i = /([A-Z])/g, j = { secondary: {}, meta: { top: 0, right: 0, bottom: 0, left: 0} }, k = "jQe", l = "cubic-bezier(", m = ")", n = document.body || document.documentElement, o = n.style, p = o.WebkitTransition !== undefined ? "webkitTransitionEnd" : o.OTransition !== undefined ? "oTransitionEnd" : "transitionend", q = o.WebkitTransition !== undefined || o.MozTransition !== undefined || o.OTransition !== undefined || o.transition !== undefined, r = "WebKitCSSMatrix" in window && "m11" in new WebKitCSSMatrix; jQuery.fn.translation = function () { if (!this[0]) return null; var a = this[0], b = window.getComputedStyle(a, null), c = { x: 0, y: 0 }; for (var d = f.length - 1; d >= 0; d--) { var e = b.getPropertyValue(f[d] + "transform"); if (e && /matrix/i.test(e)) { var g = e.replace(/^matrix\(/i, "").split(/, |\)$/g); c = { x: parseInt(g[4], 10), y: parseInt(g[5], 10) }; break } } return c }, jQuery.fn.animate = function (a, c, d, h) { a = a || {}; var i = typeof a.bottom == "undefined" && typeof a.right == "undefined", j = jQuery.speed(c, d, h), n = this, o = 0, r = function () { o--, o === 0 && typeof j.complete == "function" && j.complete.apply(n[0], arguments) }; if (!q || x(a) || w(a) || j.duration <= 0 || jQuery.fn.animate.defaults.avoidTransforms === !0 && a.avoidTransforms !== !1) return b.apply(this, arguments); return this[j.queue === !0 ? "queue" : "each"](function () { var c = jQuery(this), d = jQuery.extend({}, j), h = function () { var b = {}; for (var d = f.length - 1; d >= 0; d--) b[f[d] + "transition-property"] = "none", b[f[d] + "transition-duration"] = "", b[f[d] + "transition-timing-function"] = ""; c.unbind(p); if (!a.leaveTransforms == !0) { var g = c.data(k) || {}, h = {}; for (d = f.length - 1; d >= 0; d--) h[f[d] + "transform"] = ""; if (i && typeof g.meta != "undefined") for (var j = 0, l; l = e[j]; ++j) h[l] = g.meta[l + "_o"] + "px"; c.css(b).css(h) } a.opacity === "hide" && c.css("display", "none"), c.data(k, null), r.call(c) }, n = { bounce: l + "0.0, 0.35, .5, 1.3" + m, linear: "linear", swing: "ease-in-out", easeInQuad: l + "0.550, 0.085, 0.680, 0.530" + m, easeInCubic: l + "0.550, 0.055, 0.675, 0.190" + m, easeInQuart: l + "0.895, 0.030, 0.685, 0.220" + m, easeInQuint: l + "0.755, 0.050, 0.855, 0.060" + m, easeInSine: l + "0.470, 0.000, 0.745, 0.715" + m, easeInExpo: l + "0.950, 0.050, 0.795, 0.035" + m, easeInCirc: l + "0.600, 0.040, 0.980, 0.335" + m, easeOutQuad: l + "0.250, 0.460, 0.450, 0.940" + m, easeOutCubic: l + "0.215, 0.610, 0.355, 1.000" + m, easeOutQuart: l + "0.165, 0.840, 0.440, 1.000" + m, easeOutQuint: l + "0.230, 1.000, 0.320, 1.000" + m, easeOutSine: l + "0.390, 0.575, 0.565, 1.000" + m, easeOutExpo: l + "0.190, 1.000, 0.220, 1.000" + m, easeOutCirc: l + "0.075, 0.820, 0.165, 1.000" + m, easeInOutQuad: l + "0.455, 0.030, 0.515, 0.955" + m, easeInOutCubic: l + "0.645, 0.045, 0.355, 1.000" + m, easeInOutQuart: l + "0.770, 0.000, 0.175, 1.000" + m, easeInOutQuint: l + "0.860, 0.000, 0.070, 1.000" + m, easeInOutSine: l + "0.445, 0.050, 0.550, 0.950" + m, easeInOutExpo: l + "1.000, 0.000, 0.000, 1.000" + m, easeInOutCirc: l + "0.785, 0.135, 0.150, 0.860" + m }, q = {}, t = n[d.easing || "swing"] ? n[d.easing || "swing"] : d.easing || "swing"; for (var v in a) if (jQuery.inArray(v, g) === -1) { var w = jQuery.inArray(v, e) > -1, y = s(c, a[v], v, w && a.avoidTransforms !== !0); a.avoidTransforms !== !0 && z(v, y, c) ? u(c, v, d.duration, t, w && a.avoidTransforms === !0 ? y + "px" : y, w && a.avoidTransforms !== !0, i, a.useTranslate3d === !0) : q[v] = a[v] } var A = c.data(k) || {}; for (var B = f.length - 1; B >= 0; B--) typeof A[f[B] + "transition-property"] != "undefined" && (A[f[B] + "transition-property"] = A[f[B] + "transition-property"].substr(2)); c.data(k, A).unbind(p); if (!x(c.data(k)) && !x(c.data(k).secondary)) { o++, c.css(c.data(k)); var C = c.data(k).secondary; setTimeout(function () { c.bind(p, h).css(C) }) } else d.queue = !1; x(q) || (o++, b.apply(c, [q, { duration: d.duration, easing: jQuery.easing[d.easing] ? d.easing : jQuery.easing.swing ? "swing" : "linear", complete: r, queue: d.queue}])); return !0 }) }, jQuery.fn.animate.defaults = {}, jQuery.fn.stop = function (a, b, d) { if (!q) return c.apply(this, [a, b]); a && this.queue([]); var e = {}; for (var g = f.length - 1; g >= 0; g--) e[f[g] + "transition-property"] = "none", e[f[g] + "transition-duration"] = "", e[f[g] + "transition-timing-function"] = ""; this.each(function () { var g = jQuery(this), h = window.getComputedStyle(this, null), j = {}, l; if (!x(g.data(k)) && !x(g.data(k).secondary)) { var m = g.data(k); if (b) { j = m.secondary; if (!d && typeof m.meta.left_o !== undefined || typeof m.meta.top_o !== undefined) { j.left = typeof m.meta.left_o !== undefined ? m.meta.left_o : "auto", j.top = typeof m.meta.top_o !== undefined ? m.meta.top_o : "auto"; for (l = f.length - 1; l >= 0; l--) j[f[l] + "transform"] = "" } } else for (var n in g.data(k).secondary) { n = n.replace(i, "-$1").toLowerCase(), j[n] = h.getPropertyValue(n); if (!d && /matrix/i.test(j[n])) { var o = j[n].replace(/^matrix\(/i, "").split(/, |\)$/g); j.left = parseFloat(o[4]) + parseFloat(g.css("left")) + "px" || "auto", j.top = parseFloat(o[5]) + parseFloat(g.css("top")) + "px" || "auto"; for (l = f.length - 1; l >= 0; l--) j[f[l] + "transform"] = "" } } g.unbind(p).css(e).css(j).data(k, null) } else c.apply(g, [a, b]) }); return this } })(jQuery, jQuery.fn.animate, jQuery.fn.stop)
