﻿(function(a){a.effects.bounce=function(b){return this.queue(function(){var c=a(this),k=["position","top","left"],f=a.effects.setMode(c,b.options.mode||"effect"),m=b.options.direction||"up",d=b.options.distance||20,i=b.options.times||5,h=b.duration||250;if(/show|hide/.test(f))k.push("opacity");a.effects.save(c,k);c.show();a.effects.createWrapper(c);var e=m=="up"||m=="down"?"top":"left",g=m=="up"||m=="left"?"pos":"neg",d=b.options.distance||(e=="top"?c.outerHeight({margin:true})/3:c.outerWidth({margin:true})/3);if(f=="show")c.css("opacity",0).css(e,g=="pos"?-d:d);if(f=="hide")d=d/(i*2);if(f!="hide")i--;if(f=="show"){var j={opacity:1};j[e]=(g=="pos"?"+=":"-=")+d;c.animate(j,h/2,b.options.easing);d=d/2;i--}for(var o=0;o<i;o++){var n={},l={};n[e]=(g=="pos"?"-=":"+=")+d;l[e]=(g=="pos"?"+=":"-=")+d;c.animate(n,h/2,b.options.easing).animate(l,h/2,b.options.easing);d=f=="hide"?d*2:d/2}if(f=="hide"){var j={opacity:0};j[e]=(g=="pos"?"-=":"+=")+d;c.animate(j,h/2,b.options.easing,function(){c.hide();a.effects.restore(c,k);a.effects.removeWrapper(c);if(b.callback)b.callback.apply(this,arguments)})}else{var n={},l={};n[e]=(g=="pos"?"-=":"+=")+d;l[e]=(g=="pos"?"+=":"-=")+d;c.animate(n,h/2,b.options.easing).animate(l,h/2,b.options.easing,function(){a.effects.restore(c,k);a.effects.removeWrapper(c);if(b.callback)b.callback.apply(this,arguments)})}c.queue("fx",function(){c.dequeue()});c.dequeue()})}})(jQuery)
