q?0:q,i[k]=255p?0:p;f.putImageData(e,0,0);f.restore();c.css("opacity", 0).insertAfter(b);b=b.parent();"inline"===b.css("display")&&b.css("display","inline-block");b.css("position","relative").data("fx",c).on("mouseover.cj",T)},blinds:function(b){var a=b.data(),c=a.height,e=a.width,f=v(b,{width:e,height:c}),d=f[2],i=f[1],h=f[0][0],g=a.settings,a=g.cols,l=g.rows,n=g.color,g=a*l,m=Math.ceil(e/a),l=Math.ceil(c/l),q,p,u,c=k("
").css({top:0,left:0,width:e,height:c,overflow:"hidden",position:"absolute"}),e={width:m,height:l,display:"block",overflow:"hidden",position:"absolute"}, n={opacity:0,width:m,height:l,display:"block",position:"absolute",backgroundColor:n};x(d.data);for(i.putImageData(d,0,0);g--;)d=g%a,i=g/a|0,d*=m,u=l*i,e.top=u,e.left=d,i=k("").css(e).appendTo(c),p=k("").css(n).appendTo(i),q=k("").appendTo(i),f[g]=[i,q,p],q[0].getContext("2d").drawImage(h,d,u,m,l,0,0,m,l);h=b.parent();c.insertAfter(b);"inline"===h.css("display")&&h.css("display","inline-block");h.css("position","relative").data("fx",f).on("mouseenter.cj",H).on("mouseleave.cj", H)},scramble:function(b){var a=b.data(),c=a.height,e=a.width,f=v(b,{width:e,height:c}),d=f[2],i=f[1],h=f[0][0],g,l=a.settings,n=l.reversed,a=l.cols,l=l.rows,m=a*l;g=m;var q=e/a|0,p=c/l|0,u={},s,t=k("").css({top:0,left:0,width:e,height:c,overflow:"hidden",position:"absolute"}),r={width:q,height:p,display:"block",overflow:"hidden",position:"absolute"};for(i.putImageData(d,0,0);m--;)i=m%a,d=m/a|0,i*=q,d*=p,u.origLeft=i,u.origTop=d,s=f[m]=k("").data(u).appendTo(t),s=k("").appendTo(s), s[0].getContext("2d").drawImage(h,i,d,q,p,0,0,q,p);n?(f=z(f,g),h=F,n=G):(h=G,n=F);for(;g--;)i=g%a,d=g/a|0,r.left=q*i,r.top=p*d,f[g].css(r);g=b.parent();"inline"===g.css("display")&&g.css("display","inline-block");g.css({position:"relative",height:c,width:e}).data({fx:f,cols:a,rows:l,newW:q,newH:p}).on("mouseenter.cj",h).on("mouseleave.cj",n);t.insertAfter(b);b.remove()},rubix:function(b){var a=b.data(),c=a.height,e=a.width,f=v(b,{width:e,height:c}),d=f[2],i=f[1],h=f[0][0],g=a.settings,a=g.cols,l= g.rows,n=g.color,m=a*l,q=Math.ceil(e/a),l=Math.ceil(c/l),g=!A?g.rubixBorder:g.rubixBorderIE,c=k("").css({top:0,left:0,width:e,height:c,overflow:"hidden",position:"absolute"}),p,r,e={width:q,height:l,display:"block",overflow:"hidden",position:"absolute"},n={opacity:0,width:q,height:l,border:g,display:"block",position:"absolute",backgroundColor:n,boxSizing:"border-box"};x(d.data);for(i.putImageData(d,0,0);m--;)d=m%a,i=m/a|0,d*=q,r=l*i,e.left=d,e.top=r,g=k("").css(e).appendTo(c),i=k("").css(n).appendTo(g), p=k("").appendTo(g),f[m]=[g,i],p[0].getContext("2d").drawImage(h,d,r,q,l,0,0,q,l);h=b.parent();c.insertAfter(b);"inline"===h.css("display")&&h.css("display","inline-block");h.css("position","relative").data("fx",f).on("mouseenter.cj",E).on("mouseleave.cj",E)},rotate:function(b){var a=b.data(),c=a.height,e=a.width,f={width:e,height:c},d=v(b,f),i=d[0][0],h=d[2],g=d[1],d=a.settings,a=d.cols,d=d.rows,l=a*d,n=Math.ceil(e/a),m=Math.ceil(c/d),q,p,u,s,c=k("").css({top:0,left:0,width:e,height:c, overflow:"hidden"}),e={position:"absolute",overflow:"hidden",display:"block",height:m,width:n},t={position:"absolute",overflow:"hidden",display:"block",height:m,width:n};c[0].style[y]="preserve-3d";t[r]="rotateZ(-180deg)";g.putImageData(h,0,0);g.restore();d=v(b,f);h=d[2];g=d[1];f=d[0][0];x(h.data);for(g.putImageData(h,0,0);l--;)h=l%a,g=l/a|0,h*=n,s=m*g,e.left=t.left=h,e.top=t.top=s,p=k("").css(t).appendTo(c),g=k("").css(e).appendTo(c),u=k("").appendTo(p),q=k("").appendTo(g), p[0].cjFx=g[0],d[l]=[p[0],q[0]],u[0].getContext("2d").drawImage(i,h,s,n,m,0,0,n,m),q[0].getContext("2d").drawImage(f,h,s,n,m,0,0,n,m);i=b.parent();"inline"===i.css("display")&&i.css("display","inline-block");i.css("position","relative").data("fx",d).on("mouseenter.cj",I).on("mouseleave.cj",I);c.insertAfter(b);b.remove()},flip:function(b){var a=b.data(),c=a.height,e=a.width,f={width:e,height:c},d=v(b,f),i=d[0][0],h=d[2],g=d[1],d=a.settings,a=d.cols,d=d.rows,l=a*d,n=Math.ceil(e/a),m=Math.ceil(c/d), q,p,u,s,c=k("").css({top:0,left:0,width:e,height:c,overflow:"hidden"}),e={position:"absolute",overflow:"hidden",display:"block",height:m,width:n},t={position:"absolute",overflow:"hidden",display:"block",height:m,width:n},d=c[0].style;d[B]="100px";d[y]="preserve-3d";t[r]="rotateX(-180deg)";g.putImageData(h,0,0);d=v(b,f);h=d[2];g=d[1];f=d[0][0];x(h.data);for(g.putImageData(h,0,0);l--;)h=l%a,g=l/a|0,h*=n,s=m*g,e.left=t.left=h,e.top=t.top=s,p=k("").css(t).appendTo(c),g=k("").css(e).appendTo(c), u=k("").appendTo(p),q=k("").appendTo(g),p[0].cjFx=g[0],d[l]=[p[0],q[0]],u[0].getContext("2d").drawImage(i,h,s,n,m,0,0,n,m),q[0].getContext("2d").drawImage(f,h,s,n,m,0,0,n,m);i=b.parent();c.insertAfter(b);"inline"===i.css("display")&&i.css("display","inline-block");i.css("position","relative").data("fx",d).on("mouseenter.cj",J).on("mouseleave.cj",J);b.remove()},scale:function(b){var a=b.data(),c=a.height,e=a.width,f={width:e,height:c},d=v(b,f),i=d[0][0],h=d[2],g=d[1],d=a.settings, a=d.cols,d=d.rows,l=a*d,n=Math.ceil(e/a),m=Math.ceil(c/d),q,p,u,s,c=k("").css({top:0,left:0,width:e,height:c,overflow:"hidden"}),e={position:"absolute",overflow:"hidden",display:"block",height:m,width:n},t={position:"absolute",overflow:"hidden",display:"block",height:m,width:n},d=c[0].style;d[B]="75px";d[y]="preserve-3d";t[r]="scale(0, 0)";g.putImageData(h,0,0);d=v(b,f);h=d[2];g=d[1];f=d[0][0];x(h.data);g.putImageData(h,0,0);for(g.restore();l--;)h=l%a,g=l/a|0,h*=n,s=m*g,e.left=t.left=h,e.top= t.top=s,r?(p=k("").css(t).appendTo(c),g=k("").css(e).appendTo(c)):(g=k("").css(e).appendTo(c),p=k("").css(t).appendTo(c)),u=k("").appendTo(p),q=k("").appendTo(g),p[0].cjFx=g[0],d[l]=p[0],u[0].getContext("2d").drawImage(i,h,s,n,m,0,0,n,m),q[0].getContext("2d").drawImage(f,h,s,n,m,0,0,n,m);i=b.parent();c.insertAfter(b);"inline"===i.css("display")&&i.css("display","inline-block");i.css("position","relative").data("fx",d).on("mouseenter.cj",K).on("mouseleave.cj", K);b.remove()},zoom:function(b){var a=b.data(),c=a.thumb,e=parseInt(c.attr("width"),10)||c.width(),f=parseInt(c.attr("height"),10)||c.height(),d=b.parent(),i=f>>1,h=i>>1,g=e>>1,l=g>>1,a=k("").css({top:0,left:0,opacity:0,width:g,height:i,overflow:"hidden",position:"absolute",border:!A?a.settings.zoomBorder:a.settings.zoomBorderIE}).insertAfter(c).append(b);k("").insertAfter(c).data({ww:l,hh:h,width:e,image:b[0],height:f,zoom:a[0],bufR:e-l-2,bufB:f-h-2,snapR:e-g-2,snapB:f-i-2}).append(c, a).on("mouseenter.cj",Q).on("mouseleave.cj",S);"inline"===d.css("display")&&d.css("display","inline-block")}},M="undefined"!==typeof Jacked,A,r,O="getContext"in document.createElement("canvas"),P={position:"absolute",left:0,top:0},y,B,w;M&&(A=Jacked.getIE(),r=Jacked.getTransform());k.fn.jackboxFX=function(b,a){var c;a?(c={},k.extend(c,L),k.extend(c,a)):c=L;if(M)return w||(w=document.body.style,B="WebkitPerspective"in w?"WebkitPerspective":"MozPerspective"in w?"MozPerspective":"msPerspective"in w? "msPerspective":"perspective"in w?"perspective":null,y="WebkitTransformStyle"in w?"WebkitTransformStyle":"MozTransformStyle"in w?"MozTransformStyle":"msTransformStyle"in w?"msTransformStyle":"transformStyle"in w?"transformStyle":null),this.each(N,[b,c])}})(jQuery);