(function(a){a.fn.extend({reflect:function(b){b=a.extend({height:1/3,opacity:.5},b);return this.unreflect().each(function(){var c=this;if(/^img$/i.test(c.tagName)){function d(){var h=c.width,e=c.height,g,f,j,d,i;f=Math.floor(b.height>1?Math.min(e,b.height):e*b.height);if(a.browser.msie)g=a("<img />").attr("src",c.src).css({width:h,height:e,marginBottom:f-e,filter:"flipv progid:DXImageTransform.Microsoft.Alpha(opacity="+b.opacity*100+", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy="+f/e*100+")"})[0];else{g=a("<canvas />")[0];if(!g.getContext)return;d=g.getContext("2d");try{a(g).attr({width:h,height:f});d.save();d.translate(0,e-1);d.scale(1,-1);d.drawImage(c,0,0,h,e);d.restore();d.globalCompositeOperation="destination-out";i=d.createLinearGradient(0,0,0,f);i.addColorStop(0,"rgba(255, 255, 255, "+(1-b.opacity)+")");i.addColorStop(1,"rgba(255, 255, 255, 1.0)");d.fillStyle=i;d.rect(0,0,h,f);d.fill()}catch(k){return}}a(g).css({display:"block",border:0});j=a(/^a$/i.test(c.parentNode.tagName)?"<span />":"<div />").insertAfter(c).append([c,g])[0];j.className=c.className;a.data(c,"reflected",j.style.cssText=c.style.cssText);a(j).css({width:h,height:e+f,overflow:"hidden"});c.style.cssText="display: block; border: 0px";c.className="reflected"}if(c.complete)d();else a(c).load(d)}})},unreflect:function(){return this.unbind("load").each(function(){var b=this,d=a.data(this,"reflected"),c;if(d!==undefined){c=b.parentNode;b.className=c.className;b.style.cssText=d;a.removeData(b,"reflected");c.parentNode.replaceChild(b,c)}})}})})(jQuery);jQuery(function(a){a("img.reflect").reflect({})});
