window.addEvent("load",function(){var d,q,v,p,F,D,C,j,e;var s,A,h,G,r;var f=1.3,u=1,x=5;var b,z;var w=false;var k=function(I){I=new Event(I);if(I.key=="esc"||I.key=="x"){l()}};var a=function(J,I){if(I===undefined){I=n()}H(J);o(I,n())};var B=function(I){o(z,b);I.stop().preventDefault()};var c=function(K){K=new Event(K);var I=E(b);H(K.wheel>0?1:-1);var J={x:I.x/A.x,y:I.y/A.y};o(b,J);K.stop().preventDefault()};var l=function(){d.hide();i(1);q.hide();v.set("src","");u=1;[fImage,C,F,D].invoke("removeEvents");document.removeEvent("keypress",k);if($("loadingImg")){j.dispose()}};var H=function(I){u=Math.pow(f,I)*u;u=Math.max(1,Math.min(u,x));A={x:s.x*u,y:s.y*u};v.setStyles({width:A.x,height:A.y})};var o=function(J,I){J=E(J);I=E(I);h={x:Math.max(Math.min(0,h.x+I.x-J.x),Math.ceil(G.x-A.x)),y:Math.max(Math.min(0,h.y+I.y-J.y),Math.ceil(G.y-A.y))};v.setStyles({left:h.x,top:h.y})};var y=function(J,I){if(J.x>I.x){J={x:I.x,y:J.y*(I.x/J.x)}}if(J.y>I.y){J={x:J.x*(I.y/J.y),y:I.y}}return J};var g=function(I){var J={x:I.page.x,y:I.page.y};J.x=(J.x-r.x-h.x)/A.x;J.y=(J.y-r.y-h.y)/A.y;return J};var E=function(I){return{x:I.x*A.x,y:I.y*A.y}};var t=function(I){return Math.round(I)+"px"};var n=function(){return{x:(G.x/2-h.x)/A.x,y:(G.y/2-h.y)/A.y}};var m=function(){var I=E(b);return{x:(I.x-h.x)/s.x,y:(I.y-h.y)/s.y}};var i=function(I){if(Browser.Engine.trident4||(Browser.Engine.gecko&&Browser.Platform.mac)){$$("select").each(function(J){J.setStyle("opacity",I)})}};d=new Element("div",{id:"zoomField",styles:{"z-index":2,opacity:0.85},events:{click:l}}).makeInvisible().inject(document.body);q=new Element("div",{id:"zoomAperture",styles:{"z-index":2,display:"none"}});v=new Element("img",{styles:{position:"absolute","z-index":2}}).inject(q);fImage=new Element("img",{styles:{position:"absolute","z-index":3}}).inject(q);p=new Element("div",{id:"zoomControls",styles:{"z-index":3}}).adopt(D=new Element("a",{id:"zoomOut"}).adopt(new Element("img",{alt:"Zoom Out",src:"http://s2.cart-site.ifixit.com/cart-site/images/buttons/zoom-out.gif"})),F=new Element("a",{id:"zoomIn"}).adopt(new Element("img",{alt:"Zoom In",src:"http://s1.cart-site.ifixit.com/cart-site/images/buttons/zoom-in.gif"}))).inject(q);new Element("div",{id:"zoomHide",styles:{"z-index":3}}).adopt(C=new Element("a").adopt(new Element("img",{alt:"Hide",src:"http://s2.cart-site.ifixit.com/cart-site/images/buttons/zoom-hide.gif"}))).inject(q);q.inject(document.body);$$(".zoomable").each(function(I){I.addEvent("click",function(){if(!this.hasClass("hasLarge")){return}b={x:0,y:0};i(0);d.setStyles({height:window.getScrollSize().y}).makeVisible();j=new Element("div",{id:"loadingImg",styles:{position:"absolute",width:100,height:100,"background-repeat":"no-repeat","background-image":"url(http://s2.cart-site.ifixit.com/cart-site/images/site/loading.gif)","z-index":2}}).inject(document.body).center();var L=new Element("img").addEvent("load",function(){v.set("src",this.src);fImage.set("src","http://s2.cart-site.ifixit.com/cart-site/images/site/blank.gif");d.setStyle("height",window.getScrollSize().y);var O=window.getSize();G=y({x:J,y:N},{x:O.x*0.8,y:O.y*0.8});q.setStyles({width:G.x,height:G.y});j.dispose();q.center();r={x:parseInt(q.getStyle("left"))+3,y:parseInt(q.getStyle("top"))+3};q.show().pin();A={x:G.x,y:G.y};s={x:G.x,y:G.y};h={x:0,y:0};v.setStyles({width:A.x,height:A.y,top:h.x,left:h.y});fImage.setStyles({width:A.x,height:A.y,top:h.x,left:h.y});document.addEvent("keypress",k);fImage.addEvent("mousemove",function(P){P=new Event(P);b=g(P);if(w){B(P)}});fImage.addEvent("mousewheel",c);fImage.addEvent("mousedown",function(Q){Q=new Event(Q);z={x:b.x,y:b.y};w=true;var P=function(){w=false;document.removeEvent("mouseup",P);fImage.removeEvent("mouseout",P)};document.addEvent("mouseup",P);fImage.addEvent("mouseout",P);Q.stop().preventDefault()});fImage.addEvent("dblclick",function(T){T=new Event(T);var Q={x:b.x,y:b.y};var S,R,P;do{H(1);o(Q,n());S=n();R=Math.abs(Q.x-S.x);P=Math.abs(Q.y-S.y)}while(u<5&&(R>0||P>0))});C.addEvent("click",l);F.addEvent("click",a.pass(1));D.addEvent("click",a.pass(-1))});var K=$("large_size").get("html").split(",");var J=parseInt(K[0]);var N=parseInt(K[1]);var M=this.getStyle("background-image");M=M.replace(/url\("?(.*?)standard\.jpg"?\)$/,"$1large.jpg");L.set("src",M)})})});