/*
 jQuery Transit - CSS3 transitions and transformations
 (c) 2011-2012 Rico Sta. Cruz <rico@ricostacruz.com>
 MIT Licensed.

 http://ricostacruz.com/jquery.transit
 http://github.com/rstacruz/jquery.transit
*/
(function(c){function n(a){if(a in k.style)return a;var b=["Moz","Webkit","O","ms"],e=a.charAt(0).toUpperCase()+a.substr(1);if(a in k.style)return a;for(a=0;a<b.length;++a){var c=b[a]+e;if(c in k.style)return c}}function m(a){"string"===typeof a&&this.parse(a);return this}function t(a,b,e){!0===b?a.queue(e):b?a.queue(b,e):e()}function v(a){var b=[];c.each(a,function(a){a=c.camelCase(a);a=c.transit.propertyMap[a]||c.cssProps[a]||a;a=w(a);-1===c.inArray(a,b)&&b.push(a)});return b}function u(a,b,e,d){a=
v(a);c.cssEase[e]&&(e=c.cssEase[e]);var h=""+q(b)+" "+e;0<parseInt(d,10)&&(h+=" "+q(d));var p=[];c.each(a,function(a,b){p.push(b+" "+h)});return p.join(", ")}function f(a,b){b||(c.cssNumber[a]=!0);c.transit.propertyMap[a]=d.transform;c.cssHooks[a]={get:function(b){return c(b).css("transit:transform").get(a)},set:function(b,d){var e=c(b).css("transit:transform");e.setFromString(a,d);c(b).css({"transit:transform":e})}}}function w(a){return a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})}
function g(a,b){return"string"!==typeof a||a.match(/^[\-0-9\.]+$/)?""+a+b:a}function q(a){c.fx.speeds[a]&&(a=c.fx.speeds[a]);return g(a,"ms")}c.transit={version:"0.9.9",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:!0,useTransitionEnd:!1};var k=document.createElement("div"),d={},x=-1<navigator.userAgent.toLowerCase().indexOf("chrome");d.transition=n("transition");
d.transitionDelay=n("transitionDelay");d.transform=n("transform");d.transformOrigin=n("transformOrigin");k.style[d.transform]="";k.style[d.transform]="rotateY(90deg)";d.transform3d=""!==k.style[d.transform];var r=d.transitionEnd={transition:"transitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"}[d.transition]||null,l;for(l in d)d.hasOwnProperty(l)&&"undefined"===typeof c.support[l]&&(c.support[l]=d[l]);k=null;
c.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",
easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",
easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};c.cssHooks["transit:transform"]={get:function(a){return c(a).data("transform")||new m},set:function(a,b){b instanceof m||(b=new m(b));a.style[d.transform]="WebkitTransform"!==d.transform||x?b.toString():b.toString(!0);c(a).data("transform",b)}};c.cssHooks.transform={set:c.cssHooks["transit:transform"].set};"1.8">c.fn.jquery&&(c.cssHooks.transformOrigin={get:function(a){return a.style[d.transformOrigin]},
set:function(a,b){a.style[d.transformOrigin]=b}},c.cssHooks.transition={get:function(a){return a.style[d.transition]},set:function(a,b){a.style[d.transition]=b}});f("scale");f("translate");f("rotate");f("rotateX");f("rotateY");f("rotate3d");f("perspective");f("skewX");f("skewY");f("x",!0);f("y",!0);m.prototype={setFromString:function(a,b){b="string"===typeof b?b.split(","):b.constructor===Array?b:[b];b.unshift(a);m.prototype.set.apply(this,b)},set:function(a){var b=Array.prototype.slice.apply(arguments,
[1]);this.setter[a]?this.setter[a].apply(this,b):this[a]=b.join(",")},get:function(a){return this.getter[a]?this.getter[a].apply(this):this[a]||0},setter:{rotate:function(a){this.rotate=g(a,"deg")},rotateX:function(a){this.rotateX=g(a,"deg")},rotateY:function(a){this.rotateY=g(a,"deg")},scale:function(a,b){void 0===b&&(b=a);this.scale=a+","+b},skewX:function(a){this.skewX=g(a,"deg")},skewY:function(a){this.skewY=g(a,"deg")},perspective:function(a){this.perspective=g(a,"px")},x:function(a){this.set("translate",
a,null)},y:function(a){this.set("translate",null,a)},translate:function(a,b){void 0===this._translateX&&(this._translateX=0);void 0===this._translateY&&(this._translateY=0);null!==a&&void 0!==a&&(this._translateX=g(a,"px"));null!==b&&void 0!==b&&(this._translateY=g(b,"px"));this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var a=(this.scale||"1,1").split(",");a[0]&&(a[0]=parseFloat(a[0]));
a[1]&&(a[1]=parseFloat(a[1]));return a[0]===a[1]?a[0]:a},rotate3d:function(){for(var a=(this.rotate3d||"0,0,0,0deg").split(","),b=0;3>=b;++b)a[b]&&(a[b]=parseFloat(a[b]));a[3]&&(a[3]=g(a[3],"deg"));return a}},parse:function(a){var b=this;a.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(a,c,d){b.setFromString(c,d)})},toString:function(a){var b=[],c;for(c in this)this.hasOwnProperty(c)&&(d.transform3d||"rotateX"!==c&&"rotateY"!==c&&"perspective"!==c&&"transformOrigin"!==c)&&"_"!==c[0]&&(a&&"scale"===c?
b.push(c+"3d("+this[c]+",1)"):a&&"translate"===c?b.push(c+"3d("+this[c]+",0)"):b.push(c+"("+this[c]+")"));return b.join(" ")}};c.fn.transition=c.fn.transit=function(a,b,e,f){var h=this,g=0,k=!0;"function"===typeof b&&(f=b,b=void 0);"function"===typeof e&&(f=e,e=void 0);"undefined"!==typeof a.easing&&(e=a.easing,delete a.easing);"undefined"!==typeof a.duration&&(b=a.duration,delete a.duration);"undefined"!==typeof a.complete&&(f=a.complete,delete a.complete);"undefined"!==typeof a.queue&&(k=a.queue,
delete a.queue);"undefined"!==typeof a.delay&&(g=a.delay,delete a.delay);"undefined"===typeof b&&(b=c.fx.speeds._default);"undefined"===typeof e&&(e=c.cssEase._default);b=q(b);var m=u(a,b,e,g),l=c.transit.enabled&&d.transition?parseInt(b,10)+parseInt(g,10):0;if(0===l)return t(h,k,function(b){h.css(a);f&&f.apply(h);b&&b()}),h;var n={},p=function(b){var e=!1,g=function(){e&&h.unbind(r,g);0<l&&h.each(function(){this.style[d.transition]=n[this]||null});"function"===typeof f&&f.apply(h);"function"===typeof b&&
b()};0<l&&r&&c.transit.useTransitionEnd?(e=!0,h.bind(r,g)):window.setTimeout(g,l);h.each(function(){0<l&&(this.style[d.transition]=m);c(this).css(a)})};t(h,k,function(a){this.offsetWidth;p(a)});return this};c.transit.getTransitionValue=u})(jq);
